@jerryan/just-bash 3.11.0 → 3.11.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.
@@ -2,16 +2,16 @@ var Jb=Object.create;var Yc=Object.defineProperty;var e8=Object.getOwnPropertyDe
2
2
 
3
3
  If this access is required by trusted host-runtime code, add "${t}" to defenseInDepth.excludeViolationTypes.`:"";return e+c8+r}var Uh,c8,jh=F(()=>{"use strict";Uh=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);c8=`
4
4
 
5
- This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`});function Hh(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function f8(e,t,...n){return lt.run(e,()=>t(...n))}function Vh(){return!Br&&typeof co?.registerHooks=="function"}function qh(e){let t=typeof e=="boolean"?{enabled:e}:e??{};if(zh(t.excludeViolationTypes),t.enabled!==void 0&&t.enabled!==!0&&t.enabled!==!1&&t.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let n={...d8,...t},r=n.enabled==="auto"?"auto":n.enabled?"enabled":"disabled",s={...n,enabled:r!=="disabled",requested:r};return s.excludeViolationTypes&&(s.excludeViolationTypes=[...new Set(s.excludeViolationTypes)].sort()),s}function p8(e,t){if(e.enabled!==t.enabled||e.auditMode!==t.auditMode||e.processLifetimeIntrinsicHardening!==t.processLifetimeIntrinsicHardening||e.onViolation!==t.onViolation)return!1;let n=e.excludeViolationTypes??[],r=t.excludeViolationTypes??[];return n.length===r.length&&n.every((s,i)=>s===r[i])}var Br,ru,co,Gh,Ce,lt,u8,d8,Ct,mn=F(()=>{"use strict";eu();eu();Mh();Bh();jh();Br=!0;ru=null,co=null,Gh=null;if(!Br)try{ru=void 0,co=Ea,Gh=co.Module??co.default??null}catch{}Ce=class extends Error{violation;constructor(t,n){super(Wh(t,n.type,n.type==="error_prepare_stack_trace"||Fh().has(n.type))),this.violation=n,this.name="SecurityViolationError"}},lt=!Br&&ru?new ru:null,u8=1e3;d8={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};Ct=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=qh(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(!p8(n,r))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return lt?lt?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(lt)return lt?.getStore()?.executionId}static enterTrustedScope(t){let n=e.trustedExecutionDepth.get(t)??0;e.trustedExecutionDepth.set(t,n+1)}static leaveTrustedScope(t){let n=e.trustedExecutionDepth.get(t);if(n){if(n===1){e.trustedExecutionDepth.delete(t);return}e.trustedExecutionDepth.set(t,n-1)}}static isTrustedScopeActive(t){return t?(e.trustedExecutionDepth.get(t)??0)>0:!1}static isTrustedContext(t){return!t||t.forceUntrusted?!1:t.trusted===!0||e.isTrustedScopeActive(t.executionId)}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let n=this.contextCache.get(t);return n||(n={sandboxActive:!0,executionId:t},this.contextCache.set(t,n)),n}static bindCurrentContext(t){if(!lt)return t;let n=lt.getStore(),r=n?.sandboxActive===!0?n.executionId:void 0;if(!r)return t;let i=e.instance?.getCachedContext(r)??{sandboxActive:!0,executionId:r},o=n?.forceUntrusted?{...i,forceUntrusted:!0}:i;return((...a)=>{let l=e.instance;if(!(l&&!l.isExecutionIdActive(r)&&(l.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!l.config.auditMode)))return f8(o,t,...a)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let t=Vh();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!lt||Br?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":t?"full":"best-effort",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":t?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(t){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=qh({...this.config,...t})}activate(){if(!Br&&this.config.enabled&&!lt)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(Br||!this.config.enabled){let r=Hh(),s=!1;return{run:i=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):i(),deactivate:()=>{s=!0},executionId:r}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(r){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,r}this.activationTime=Date.now()}let t=Hh(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),lt.run({sandboxActive:!0,executionId:t},r)),deactivate:()=>{n||(n=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),e.trustedExecutionDepth.delete(t),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(t,n){return t===globalThis?`globalThis.${n}`:t===process?`process.${n}`:t===Error?`Error.${n}`:t===Function.prototype?`Function.prototype.${n}`:t===Object.prototype?`Object.prototype.${n}`:`<object>.${n}`}static runTrusted(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return lt.run({...n,trusted:!0,forceUntrusted:!1},()=>{e.enterTrustedScope(r);try{let s=t();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{e.leaveTrustedScope(r)}):(e.leaveTrustedScope(r),s)}catch(s){throw e.leaveTrustedScope(r),s}})}static async runTrustedAsync(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return await lt.run({...n,trusted:!0,forceUntrusted:!1},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}static async runUntrustedAsync(t){if(!lt)return t();let n=lt.getStore();return n?lt.run({...n,trusted:!1,forceUntrusted:!0},t):t()}shouldBlock(){if(Br||this.config.auditMode||!lt)return!1;let t=lt?.getStore();return!(t?.sandboxActive!==!0||e.isTrustedContext(t))}shouldAudit(){if(!this.config.auditMode||!lt)return!1;let t=lt.getStore();return t?.sandboxActive===!0&&!e.isTrustedContext(t)}recordViolation(t,n,r){let s={timestamp:_h(),type:t,message:r,path:n,stack:new Error().stack,executionId:lt?.getStore()?.executionId};if(this.violations.length<u8&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return s}createBlockingProxy(t,n,r){let s=this;return new Proxy(t,{apply(i,o,a){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,n,r,s){let i=this;return new Proxy(t,{get(o,a,l){if(i.shouldBlock()){if(s&&typeof a=="string"&&s.has(a))return Reflect.get(o,a,l);let c=`${n}.${String(a)}`,u=`${c} is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ce(u,f)}if(i.shouldAudit()){let c=`${n}.${String(a)}`;i.recordViolation(r,c,`${c} accessed (audit mode)`)}return Reflect.get(o,a,l)},set(o,a,l,c){if(i.shouldBlock()){let u=`${n}.${String(a)}`,f=`${u} modification is blocked during script execution`,d=i.recordViolation(r,u,f);throw new Ce(f,d)}return n==="process.env"&&a==="DEBUG"?Reflect.set(o,a,l):Reflect.set(o,a,l,c)},ownKeys(o){if(i.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,l=i.recordViolation(r,n,a);throw new Ce(a,l)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} descriptor access is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.getOwnPropertyDescriptor(o,a)},has(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} existence check is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.has(o,a)},deleteProperty(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} deletion is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){if(i.shouldBlock()){let l=`${n} setPrototypeOf is blocked during script execution`,c=i.recordViolation(r,n,l);throw new Ce(l,c)}return Reflect.setPrototypeOf(o,a)},defineProperty(o,a,l){if(i.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} defineProperty is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ce(u,f)}return Reflect.defineProperty(o,a,l)}})}createReadonlyObjectProxy(t,n,r){let s=this,i=o=>{let a=`${n} ${o} is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ce(a,l)};return new Proxy(t,{set(o,a,l,c){return s.shouldBlock()&&i("modification"),Reflect.set(o,a,l,c)},defineProperty(o,a,l){return s.shouldBlock()&&i("defineProperty"),Reflect.defineProperty(o,a,l)},deleteProperty(o,a){return s.shouldBlock()&&i("deletion"),Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){return s.shouldBlock()&&i("setPrototypeOf"),Reflect.setPrototypeOf(o,a)},preventExtensions(o){return s.shouldBlock()&&i("preventExtensions"),Reflect.preventExtensions(o)}})}applyPatches(){this.patchFailures=[];let t=nu(),n=new Set(this.config.excludeViolationTypes??[]),r=new Set(["process_send","process_channel","process_stdout","process_stderr"]),s=[];for(let a of t)if(!n.has(a.violationType)&&!r.has(a.violationType)){if(a.strategy==="freeze"){s.push(a);continue}this.applyPatch(a)}this.protectConstructorChain(),n.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),Vh()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let i=["Function.prototype.constructor","Module._load","Module._resolveFilename"],o=this.patchFailures.filter(a=>i.includes(a));if(o.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${o.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(s);for(let a of s)this.applyPatch(a,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(t){let n=new Set,r=(o,a)=>{let l=Object.getOwnPropertyDescriptor(o,a);!l||!("value"in l)||l.writable!==!0||l.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:l}),Object.defineProperty(o,a,{...l,writable:!1}))};for(let{target:o,prop:a}of t){let l=o[a];if(!(typeof l!="object"||l===null)){n.add(l);for(let c of Reflect.ownKeys(l))r(l,c)}}let s=[];for(let o of[Array,Map,Set,RegExp,Promise])s.push([o,Symbol.species]);for(let o of[Array.prototype,String.prototype,Map.prototype,Set.prototype])s.push([o,Symbol.iterator]);s.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let o of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])s.push([RegExp.prototype,o]);for(let o of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])s.push([o,Symbol.toStringTag]);for(let[o,a]of s)n.add(o),r(o,a);let i=(o,a,l)=>{let c=Object.getOwnPropertyDescriptor(o,a);if(!c||!("value"in c)||typeof c.value!="function"||c.configurable!==!0)return;let u=c.value,f=this,d=function(...p){let h=p[0];if(f.shouldBlock()&&typeof h=="object"&&h!==null&&n.has(h)){let m=`${l}.${a}`,g=`${m} is blocked for protected intrinsics during script execution`,b=f.recordViolation("prototype_mutation",m,g);throw new Ce(g,b)}return Reflect.apply(u,this,p)};this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:c}),Object.defineProperty(o,a,{...c,value:d,writable:!1})};for(let o of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])i(Object,o,"Object");for(let o of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])i(Reflect,o,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,n=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==n&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let n=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:n});let r=n?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new Ce(i,o)}t.shouldAudit()&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}protectPromiseThen(){let t=this;try{let i=function(...o){return lt.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var n=i;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(a,l){if(!lt)return Reflect.apply(s,this,[a,l]);let c=lt.getStore(),u=c?.sandboxActive===!0&&c.trusted!==!0?c.executionId:void 0;if(!u)return Reflect.apply(s,this,[a,l]);let f=t.getCachedContext(u),d=c?.forceUntrusted?{...f,forceUntrusted:!0}:f,p=(h,m)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:d,cb:h,kind:m});return Reflect.apply(s,this,[p(a,"fulfilled"),p(l,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let a=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ce(a,l)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} accessed (audit mode)`),o},set(a){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){this.patchFailures.push(n),console.debug(`[DefenseInDepthBox] Could not patch ${n}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:n});let r=n?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let s="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",s);throw new Ce(s,i)}return t.shouldAudit()&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",o=t.recordViolation("process_main_module","process.mainModule",i);throw new Ce(i,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",n instanceof Error?n.message:n)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:n});let r=n?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let s="process.execPath access is blocked during script execution",i=t.recordViolation("process_exec_path","process.execPath",s);throw new Ce(s,i)}return t.shouldAudit()&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.execPath modification is blocked during script execution",o=t.recordViolation("process_exec_path","process.execPath",i);throw new Ce(i,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}lockWellKnownSymbols(){let t=(n,r)=>{try{let s=Object.getOwnPropertyDescriptor(n,r);if(s?.configurable){if("value"in s){Object.defineProperty(n,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(n,r,{...s,configurable:!1})}}catch{}};for(let n of[Array,Map,Set,RegExp,Promise])t(n,Symbol.species);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(n,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,n);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(n,Symbol.toStringTag)}protectProxyRevocable(){let t=this;try{let n=Proxy.revocable;if(typeof n!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(i,o){if(t.shouldBlock()){let a="Proxy.revocable is blocked during script execution",l=t.recordViolation("proxy","Proxy.revocable",a);throw new Ce(a,l)}return t.shouldAudit()&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),n(i,o)},writable:!1,configurable:!0})}catch(n){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",n instanceof Error?n.message:n)}}protectDynamicImport(){if(!(Br||e.importHooksRegistered))try{let t=co;if(!t)throw new Error("node:module is unavailable");let n=new Set;for(let i of t.builtinModules??[]){let o=i.startsWith("node:")?i.slice(5):i;n.add(o);let a=o.indexOf("/");a>0&&n.add(o.slice(0,a))}let r=i=>{if(i.startsWith("./")||i.startsWith("../")||i.startsWith("/")||i.startsWith("file:")||i.startsWith("data:")||i.startsWith("blob:")||i.startsWith("http:")||i.startsWith("https:"))return!1;let o=i.startsWith("node:")?i.slice(5):i;if(!o)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(o)||n.has(o))return!0;let a=o.indexOf("/");return a>0&&n.has(o.slice(0,a))},s=i=>{let o=lt?.getStore();return i.config.auditMode===!0&&o?.sandboxActive===!0&&!e.isTrustedContext(o)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(i,o,a){let l=e.instance;if(!l)return a(i,o);if((i.startsWith("data:")||i.startsWith("blob:"))&&l.shouldBlock()){let c=`import(${i.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${i.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ce(u,f)}if(r(i)){let c=`import(${i})`,u=`dynamic import of Node.js builtin '${i}' is blocked during script execution`;if(l.shouldBlock()){let f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ce(u,f)}s(l)&&l.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${i}' called (audit mode)`)}return a(i,o)}}),e.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(t){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(t,n){if(Br)return;let r=`Module.${t}`;try{let s=Gh,i=s?.[t];if(!s||typeof i!="function")throw new Error("node:module Module class or method is unavailable");let o=Object.getOwnPropertyDescriptor(s,t);if(!o)throw new Error("method has no own property descriptor");if(o.configurable===!1&&o.writable===!1)throw new Error("method is non-configurable and non-writable");let a=this.createBlockingProxy(i,r,n);this.originalDescriptors.push({target:s,prop:t,descriptor:o}),Object.defineProperty(s,t,{...o,value:a});let l=Object.getOwnPropertyDescriptor(s,t);if(s[t]!==a||l?.value!==a)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(r)}}applyPatch(t,n=!1){let{target:r,prop:s,violationType:i,strategy:o}=t;try{let a=r[s];if(a===void 0)return;let l=Object.getOwnPropertyDescriptor(r,s);if(this.originalDescriptors.push({target:r,prop:s,descriptor:l}),o==="freeze"){if(typeof a=="object"&&a!==null){n&&Object.freeze(a);let c=this.getPathForTarget(r,s),u=this.createReadonlyObjectProxy(a,c,i);Object.defineProperty(r,s,{...l,value:u})}}else{let c=this.getPathForTarget(r,s),u=typeof a=="function"?this.createBlockingProxy(a,c,i):this.createBlockingObjectProxy(a,c,i,t.allowedKeys);Object.defineProperty(r,s,{value:u,writable:!0,configurable:!0})}}catch(a){let l=this.getPathForTarget(r,s);this.patchFailures.push(l),console.debug(`[DefenseInDepthBox] Could not patch ${l}:`,a instanceof Error?a.message:a)}}restorePatches(){for(let t=this.temporaryIntrinsicDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.temporaryIntrinsicDescriptors[t];try{Object.defineProperty(n,r,s)}catch(i){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(r)}:`,i instanceof Error?i.message:i)}}this.temporaryIntrinsicDescriptors=[];for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.originalDescriptors[t];try{s?Object.defineProperty(n,r,s):delete n[r]}catch(i){let o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}}});function Xh(e){return typeof e!="function"?e:Ct.bindCurrentContext(e)}function uo(e,t){if(t===Number.POSITIVE_INFINITY)return;let n=Xh(e),r={cleared:!1,remainingMs:Math.max(0,t),timer:void 0},s=()=>{if(r.cleared)return;let i=Math.min(r.remainingMs,h8);r.timer=Zh(()=>{r.cleared||(r.remainingMs-=i,r.remainingMs>0?s():n())},i)};return s(),r}function fo(e){e&&(e.cleared=!0,e.timer!==void 0&&Kh(e.timer))}var Zh,Kh,lR,cR,Is,di,h8,Os=F(()=>{"use strict";mn();Zh=globalThis.setTimeout.bind(globalThis),Kh=globalThis.clearTimeout.bind(globalThis),lR=globalThis.setInterval.bind(globalThis),cR=globalThis.clearInterval.bind(globalThis);Is=((e,t,...n)=>Zh(Xh(e),t,...n)),di=Kh,h8=2147483647});function iu(e,t,n){if(!Number.isSafeInteger(e)||e<0||!Number.isSafeInteger(t)||t<0||e>t)throw new RangeError(`${n}: byte conversion limit exceeded (${t} bytes)`)}function M(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<=127)t++;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let s=e.charCodeAt(n+1);s>=56320&&s<=57343?(t+=4,n++):t+=3}else t+=3}return t}function fe(e,t=su){let n=e;if(!n)return n;iu(n.length,t,"UTF-8 decode");let r=!1;for(let i=0;i<n.length;i++){let o=n.charCodeAt(i);if(o>255)return n;o>127&&(r=!0)}if(!r)return n;let s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);try{return m8.decode(s)}catch{return n}}function Mn(e,t=su){if(!e)return e;iu(M(e),t,"UTF-8 encode");let n=g8.encode(e),r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return r}function y8(e,t=su){iu(e.byteLength,t,"byte-string conversion");let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return n}async function Ht(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):y8(await e.readFileBuffer(t))}function Qh(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function es(e){return Qh(e)==="bytes"?e.stdout:Mn(e.stdout)}function ou(e){return Qh(e)==="bytes"?fe(e.stdout):e.stdout}var m8,g8,su,Ts,ue=F(()=>{"use strict";m8=new TextDecoder("utf-8",{fatal:!0}),g8=new TextEncoder,su=512*1024*1024;Ts=""});function Sa(e){return e instanceof Yt||e instanceof Jt||e instanceof zt}var ft,Yt,Jt,zt,en,tn,we,qe,sn,xr,pi,C,_e,Tt,Er,gn,G=F(()=>{"use strict";ue();ft=class extends Error{stdout;stderr;internalOutputAccounting={stdout:0,stderr:0};constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr,this.internalOutputAccounting.stdout+=M(t),this.internalOutputAccounting.stderr+=M(n)}},Yt=class extends ft{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},Jt=class extends ft{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},zt=class extends ft{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},en=class extends ft{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},tn=class extends ft{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
6
- `),this.varName=t}},we=class extends ft{exitCode;name="ExitError";constructor(t,n="",r=""){super("exit",n,r),this.exitCode=t}},qe=class extends ft{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
5
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`});function Hh(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function f8(e,t,...n){return lt.run(e,()=>t(...n))}function Vh(){return!Br&&typeof co?.registerHooks=="function"}function qh(e){let t=typeof e=="boolean"?{enabled:e}:e??{};if(zh(t.excludeViolationTypes),t.enabled!==void 0&&t.enabled!==!0&&t.enabled!==!1&&t.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let n={...d8,...t},r=n.enabled==="auto"?"auto":n.enabled?"enabled":"disabled",s={...n,enabled:r!=="disabled",requested:r};return s.excludeViolationTypes&&(s.excludeViolationTypes=[...new Set(s.excludeViolationTypes)].sort()),s}function p8(e,t){if(e.enabled!==t.enabled||e.auditMode!==t.auditMode||e.processLifetimeIntrinsicHardening!==t.processLifetimeIntrinsicHardening||e.onViolation!==t.onViolation)return!1;let n=e.excludeViolationTypes??[],r=t.excludeViolationTypes??[];return n.length===r.length&&n.every((s,i)=>s===r[i])}var Br,ru,co,Gh,Ce,lt,u8,d8,Ct,mn=F(()=>{"use strict";eu();eu();Mh();Bh();jh();Br=!0;ru=null,co=null,Gh=null;if(!Br)try{ru=void 0,co=Ea,Gh=co.Module??co.default??null}catch{}Ce=class extends Error{violation;constructor(t,n){super(Wh(t,n.type,n.type==="error_prepare_stack_trace"||Fh().has(n.type))),this.violation=n,this.name="SecurityViolationError"}},lt=!Br&&ru?new ru:null,u8=1e3;d8={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};Ct=class e{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(t){this.config=t}static getInstance(t){let n=qh(t);if(!e.instance)e.instance=new e(n);else{let r=e.instance.config;if(!p8(n,r))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return e.instance}static resetInstance(){e.instance&&(e.instance.forceDeactivate(),e.instance=null),e.trustedExecutionDepth.clear()}static isInSandboxedContext(){return lt?lt?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(lt)return lt?.getStore()?.executionId}static enterTrustedScope(t){let n=e.trustedExecutionDepth.get(t)??0;e.trustedExecutionDepth.set(t,n+1)}static leaveTrustedScope(t){let n=e.trustedExecutionDepth.get(t);if(n){if(n===1){e.trustedExecutionDepth.delete(t);return}e.trustedExecutionDepth.set(t,n-1)}}static isTrustedScopeActive(t){return t?(e.trustedExecutionDepth.get(t)??0)>0:!1}static isTrustedContext(t){return!t||t.forceUntrusted?!1:t.trusted===!0||e.isTrustedScopeActive(t.executionId)}isExecutionIdActive(t){return this.activeExecutionIds.has(t)}getCachedContext(t){let n=this.contextCache.get(t);return n||(n={sandboxActive:!0,executionId:t},this.contextCache.set(t,n)),n}static bindCurrentContext(t){if(!lt)return t;let n=lt.getStore(),r=n?.sandboxActive===!0?n.executionId:void 0;if(!r)return t;let i=e.instance?.getCachedContext(r)??{sandboxActive:!0,executionId:r},o=n?.forceUntrusted?{...i,forceUntrusted:!0}:i;return((...a)=>{let l=e.instance;if(!(l&&!l.isExecutionIdActive(r)&&(l.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!l.config.auditMode)))return f8(o,t,...a)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let t=Vh();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!lt||Br?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":t?"full":"best-effort",contextualDynamicImportProtection:t,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":t?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(t){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=qh({...this.config,...t})}activate(){if(!Br&&this.config.enabled&&!lt)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(Br||!this.config.enabled){let r=Hh(),s=!1;return{run:i=>s?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):i(),deactivate:()=>{s=!0},executionId:r}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(r){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,r}this.activationTime=Date.now()}let t=Hh(),n=!1;return{run:r=>n?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(t),lt.run({sandboxActive:!0,executionId:t},r)),deactivate:()=>{n||(n=!0,this.activeExecutionIds.delete(t),this.contextCache.delete(t),e.trustedExecutionDepth.delete(t),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:t}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(t,n){return t===globalThis?`globalThis.${n}`:t===process?`process.${n}`:t===Error?`Error.${n}`:t===Function.prototype?`Function.prototype.${n}`:t===Object.prototype?`Object.prototype.${n}`:`<object>.${n}`}static runTrusted(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return lt.run({...n,trusted:!0,forceUntrusted:!1},()=>{e.enterTrustedScope(r);try{let s=t();return typeof s=="object"&&s!==null&&"finally"in s&&typeof s.finally=="function"?s.finally(()=>{e.leaveTrustedScope(r)}):(e.leaveTrustedScope(r),s)}catch(s){throw e.leaveTrustedScope(r),s}})}static async runTrustedAsync(t){if(!lt)return t();let n=lt.getStore();if(!n)return t();let{executionId:r}=n;return await lt.run({...n,trusted:!0,forceUntrusted:!1},async()=>{e.enterTrustedScope(r);try{return await t()}finally{e.leaveTrustedScope(r)}})}static async runUntrustedAsync(t){if(!lt)return t();let n=lt.getStore();return n?lt.run({...n,trusted:!1,forceUntrusted:!0},t):t()}shouldBlock(){if(Br||this.config.auditMode||!lt)return!1;let t=lt?.getStore();return!(t?.sandboxActive!==!0||e.isTrustedContext(t))}shouldAudit(){if(!this.config.auditMode||!lt)return!1;let t=lt.getStore();return t?.sandboxActive===!0&&!e.isTrustedContext(t)}recordViolation(t,n,r){let s={timestamp:_h(),type:t,message:r,path:n,stack:new Error().stack,executionId:lt?.getStore()?.executionId};if(this.violations.length<u8&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(i){console.debug("[DefenseInDepthBox] onViolation callback threw:",i instanceof Error?i.message:i)}return s}createBlockingProxy(t,n,r){let s=this;return new Proxy(t,{apply(i,o,a){if(s.shouldBlock()){let l=`${n} is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} called (audit mode)`),Reflect.apply(i,o,a)},construct(i,o,a){if(s.shouldBlock()){let l=`${n} constructor is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} constructor called (audit mode)`),Reflect.construct(i,o,a)}})}createBlockingObjectProxy(t,n,r,s){let i=this;return new Proxy(t,{get(o,a,l){if(i.shouldBlock()){if(s&&typeof a=="string"&&s.has(a))return Reflect.get(o,a,l);let c=`${n}.${String(a)}`,u=`${c} is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ce(u,f)}if(i.shouldAudit()){let c=`${n}.${String(a)}`;i.recordViolation(r,c,`${c} accessed (audit mode)`)}return Reflect.get(o,a,l)},set(o,a,l,c){if(i.shouldBlock()){let u=`${n}.${String(a)}`,f=`${u} modification is blocked during script execution`,d=i.recordViolation(r,u,f);throw new Ce(f,d)}return n==="process.env"&&a==="DEBUG"?Reflect.set(o,a,l):Reflect.set(o,a,l,c)},ownKeys(o){if(i.shouldBlock()){let a=`${n} enumeration is blocked during script execution`,l=i.recordViolation(r,n,a);throw new Ce(a,l)}return Reflect.ownKeys(o)},getOwnPropertyDescriptor(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} descriptor access is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.getOwnPropertyDescriptor(o,a)},has(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} existence check is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.has(o,a)},deleteProperty(o,a){if(i.shouldBlock()){let l=`${n}.${String(a)}`,c=`${l} deletion is blocked during script execution`,u=i.recordViolation(r,l,c);throw new Ce(c,u)}return Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){if(i.shouldBlock()){let l=`${n} setPrototypeOf is blocked during script execution`,c=i.recordViolation(r,n,l);throw new Ce(l,c)}return Reflect.setPrototypeOf(o,a)},defineProperty(o,a,l){if(i.shouldBlock()){let c=`${n}.${String(a)}`,u=`${c} defineProperty is blocked during script execution`,f=i.recordViolation(r,c,u);throw new Ce(u,f)}return Reflect.defineProperty(o,a,l)}})}createReadonlyObjectProxy(t,n,r){let s=this,i=o=>{let a=`${n} ${o} is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ce(a,l)};return new Proxy(t,{set(o,a,l,c){return s.shouldBlock()&&i("modification"),Reflect.set(o,a,l,c)},defineProperty(o,a,l){return s.shouldBlock()&&i("defineProperty"),Reflect.defineProperty(o,a,l)},deleteProperty(o,a){return s.shouldBlock()&&i("deletion"),Reflect.deleteProperty(o,a)},setPrototypeOf(o,a){return s.shouldBlock()&&i("setPrototypeOf"),Reflect.setPrototypeOf(o,a)},preventExtensions(o){return s.shouldBlock()&&i("preventExtensions"),Reflect.preventExtensions(o)}})}applyPatches(){this.patchFailures=[];let t=nu(),n=new Set(this.config.excludeViolationTypes??[]),r=new Set(["process_send","process_channel","process_stdout","process_stderr"]),s=[];for(let a of t)if(!n.has(a.violationType)&&!r.has(a.violationType)){if(a.strategy==="freeze"){s.push(a);continue}this.applyPatch(a)}this.protectConstructorChain(),n.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),Vh()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let i=["Function.prototype.constructor","Module._load","Module._resolveFilename"],o=this.patchFailures.filter(a=>i.includes(a));if(o.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${o.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(s);for(let a of s)this.applyPatch(a,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(t){let n=new Set,r=(o,a)=>{let l=Object.getOwnPropertyDescriptor(o,a);!l||!("value"in l)||l.writable!==!0||l.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:l}),Object.defineProperty(o,a,{...l,writable:!1}))};for(let{target:o,prop:a}of t){let l=o[a];if(!(typeof l!="object"||l===null)){n.add(l);for(let c of Reflect.ownKeys(l))r(l,c)}}let s=[];for(let o of[Array,Map,Set,RegExp,Promise])s.push([o,Symbol.species]);for(let o of[Array.prototype,String.prototype,Map.prototype,Set.prototype])s.push([o,Symbol.iterator]);s.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let o of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])s.push([RegExp.prototype,o]);for(let o of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])s.push([o,Symbol.toStringTag]);for(let[o,a]of s)n.add(o),r(o,a);let i=(o,a,l)=>{let c=Object.getOwnPropertyDescriptor(o,a);if(!c||!("value"in c)||typeof c.value!="function"||c.configurable!==!0)return;let u=c.value,f=this,d=function(...p){let h=p[0];if(f.shouldBlock()&&typeof h=="object"&&h!==null&&n.has(h)){let m=`${l}.${a}`,g=`${m} is blocked for protected intrinsics during script execution`,b=f.recordViolation("prototype_mutation",m,g);throw new Ce(g,b)}return Reflect.apply(u,this,p)};this.temporaryIntrinsicDescriptors.push({target:o,prop:a,descriptor:c}),Object.defineProperty(o,a,{...c,value:d,writable:!1})};for(let o of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])i(Object,o,"Object");for(let o of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])i(Reflect,o,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(t){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&this.patchPrototypeConstructor(t.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(t){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}try{let t=Object.getPrototypeOf(async function*(){}).constructor,n=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&t!==n&&this.patchPrototypeConstructor(t.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(t){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",t instanceof Error?t.message:t)}}protectErrorPrepareStackTrace(){let t=this;try{let n=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:n});let r=n?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(t.shouldBlock()){let i="Error.prepareStackTrace modification is blocked during script execution",o=t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",i);throw new Ce(i,o)}t.shouldAudit()&&t.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(n){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",n instanceof Error?n.message:n)}}protectPromiseThen(){let t=this;try{let i=function(...o){return lt.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,o);if(this.kind==="fulfilled")return o[0];throw o[0]}return Reflect.apply(this.cb,void 0,o)})};var n=i;let r=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:r});let s=r?.value;if(typeof s!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(a,l){if(!lt)return Reflect.apply(s,this,[a,l]);let c=lt.getStore(),u=c?.sandboxActive===!0&&c.trusted!==!0?c.executionId:void 0;if(!u)return Reflect.apply(s,this,[a,l]);let f=t.getCachedContext(u),d=c?.forceUntrusted?{...f,forceUntrusted:!0}:f,p=(h,m)=>typeof h!="function"?h:i.bind({box:t,executionId:u,captured:d,cb:h,kind:m});return Reflect.apply(s,this,[p(a,"fulfilled"),p(l,"rejected")])},writable:!0,configurable:!0})}catch(r){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",r instanceof Error?r.message:r)}}patchPrototypeConstructor(t,n,r){let s=this;try{let i=Object.getOwnPropertyDescriptor(t,"constructor");this.originalDescriptors.push({target:t,prop:"constructor",descriptor:i});let o=i?.value;Object.defineProperty(t,"constructor",{get(){if(s.shouldBlock()){let a=`${n} access is blocked during script execution`,l=s.recordViolation(r,n,a);throw new Ce(a,l)}return s.shouldAudit()&&s.recordViolation(r,n,`${n} accessed (audit mode)`),o},set(a){if(s.shouldBlock()){let l=`${n} modification is blocked during script execution`,c=s.recordViolation(r,n,l);throw new Ce(l,c)}Object.defineProperty(this,"constructor",{value:a,writable:!0,configurable:!0})},configurable:!0})}catch(i){this.patchFailures.push(n),console.debug(`[DefenseInDepthBox] Could not patch ${n}:`,i instanceof Error?i.message:i)}}protectProcessMainModule(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:n});let r=n?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(t.shouldBlock()){let s="process.mainModule access is blocked during script execution",i=t.recordViolation("process_main_module","process.mainModule",s);throw new Ce(s,i)}return t.shouldAudit()&&t.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.mainModule modification is blocked during script execution",o=t.recordViolation("process_main_module","process.mainModule",i);throw new Ce(i,o)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",n instanceof Error?n.message:n)}}protectProcessExecPath(){if(typeof process>"u")return;let t=this;try{let n=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:n});let r=n?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(t.shouldBlock()){let s="process.execPath access is blocked during script execution",i=t.recordViolation("process_exec_path","process.execPath",s);throw new Ce(s,i)}return t.shouldAudit()&&t.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(t.shouldBlock()){let i="process.execPath modification is blocked during script execution",o=t.recordViolation("process_exec_path","process.execPath",i);throw new Ce(i,o)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(n){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",n instanceof Error?n.message:n)}}lockWellKnownSymbols(){let t=(n,r)=>{try{let s=Object.getOwnPropertyDescriptor(n,r);if(s?.configurable){if("value"in s){Object.defineProperty(n,r,{...s,configurable:!1,writable:!1});return}Object.defineProperty(n,r,{...s,configurable:!1})}}catch{}};for(let n of[Array,Map,Set,RegExp,Promise])t(n,Symbol.species);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])t(n,Symbol.iterator);t(Symbol.prototype,Symbol.toPrimitive),t(Date.prototype,Symbol.toPrimitive);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])t(RegExp.prototype,n);t(Function.prototype,Symbol.hasInstance),t(Array.prototype,Symbol.unscopables);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])t(n,Symbol.toStringTag)}protectProxyRevocable(){let t=this;try{let n=Proxy.revocable;if(typeof n!="function")return;let r=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:r}),Object.defineProperty(Proxy,"revocable",{value:function(i,o){if(t.shouldBlock()){let a="Proxy.revocable is blocked during script execution",l=t.recordViolation("proxy","Proxy.revocable",a);throw new Ce(a,l)}return t.shouldAudit()&&t.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),n(i,o)},writable:!1,configurable:!0})}catch(n){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",n instanceof Error?n.message:n)}}protectDynamicImport(){if(!(Br||e.importHooksRegistered))try{let t=co;if(!t)throw new Error("node:module is unavailable");let n=new Set;for(let i of t.builtinModules??[]){let o=i.startsWith("node:")?i.slice(5):i;n.add(o);let a=o.indexOf("/");a>0&&n.add(o.slice(0,a))}let r=i=>{if(i.startsWith("./")||i.startsWith("../")||i.startsWith("/")||i.startsWith("file:")||i.startsWith("data:")||i.startsWith("blob:")||i.startsWith("http:")||i.startsWith("https:"))return!1;let o=i.startsWith("node:")?i.slice(5):i;if(!o)return!1;if(typeof t.isBuiltin=="function"&&t.isBuiltin(o)||n.has(o))return!0;let a=o.indexOf("/");return a>0&&n.has(o.slice(0,a))},s=i=>{let o=lt?.getStore();return i.config.auditMode===!0&&o?.sandboxActive===!0&&!e.isTrustedContext(o)};if(typeof t.registerHooks=="function"){t.registerHooks({resolve(i,o,a){let l=e.instance;if(!l)return a(i,o);if((i.startsWith("data:")||i.startsWith("blob:"))&&l.shouldBlock()){let c=`import(${i.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${i.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ce(u,f)}if(r(i)){let c=`import(${i})`,u=`dynamic import of Node.js builtin '${i}' is blocked during script execution`;if(l.shouldBlock()){let f=l.recordViolation("dynamic_import_builtin",c,u);throw new Ce(u,f)}s(l)&&l.recordViolation("dynamic_import_builtin",c,`dynamic import of Node.js builtin '${i}' called (audit mode)`)}return a(i,o)}}),e.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(t){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(t,n){if(Br)return;let r=`Module.${t}`;try{let s=Gh,i=s?.[t];if(!s||typeof i!="function")throw new Error("node:module Module class or method is unavailable");let o=Object.getOwnPropertyDescriptor(s,t);if(!o)throw new Error("method has no own property descriptor");if(o.configurable===!1&&o.writable===!1)throw new Error("method is non-configurable and non-writable");let a=this.createBlockingProxy(i,r,n);this.originalDescriptors.push({target:s,prop:t,descriptor:o}),Object.defineProperty(s,t,{...o,value:a});let l=Object.getOwnPropertyDescriptor(s,t);if(s[t]!==a||l?.value!==a)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(r)}}applyPatch(t,n=!1){let{target:r,prop:s,violationType:i,strategy:o}=t;try{let a=r[s];if(a===void 0)return;let l=Object.getOwnPropertyDescriptor(r,s);if(this.originalDescriptors.push({target:r,prop:s,descriptor:l}),o==="freeze"){if(typeof a=="object"&&a!==null){n&&Object.freeze(a);let c=this.getPathForTarget(r,s),u=this.createReadonlyObjectProxy(a,c,i);Object.defineProperty(r,s,{...l,value:u})}}else{let c=this.getPathForTarget(r,s),u=typeof a=="function"?this.createBlockingProxy(a,c,i):this.createBlockingObjectProxy(a,c,i,t.allowedKeys);Object.defineProperty(r,s,{value:u,writable:!0,configurable:!0})}}catch(a){let l=this.getPathForTarget(r,s);this.patchFailures.push(l),console.debug(`[DefenseInDepthBox] Could not patch ${l}:`,a instanceof Error?a.message:a)}}restorePatches(){for(let t=this.temporaryIntrinsicDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.temporaryIntrinsicDescriptors[t];try{Object.defineProperty(n,r,s)}catch(i){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(r)}:`,i instanceof Error?i.message:i)}}this.temporaryIntrinsicDescriptors=[];for(let t=this.originalDescriptors.length-1;t>=0;t--){let{target:n,prop:r,descriptor:s}=this.originalDescriptors[t];try{s?Object.defineProperty(n,r,s):delete n[r]}catch(i){let o=this.getPathForTarget(n,r);console.debug(`[DefenseInDepthBox] Could not restore ${o}:`,i instanceof Error?i.message:i)}}this.originalDescriptors=[]}}});function Xh(e){return typeof e!="function"?e:Ct.bindCurrentContext(e)}function uo(e,t){if(t===Number.POSITIVE_INFINITY)return;let n=Xh(e),r={cleared:!1,remainingMs:Math.max(0,t),timer:void 0},s=()=>{if(r.cleared)return;let i=Math.min(r.remainingMs,h8);r.timer=Zh(()=>{r.cleared||(r.remainingMs-=i,r.remainingMs>0?s():n())},i)};return s(),r}function fo(e){e&&(e.cleared=!0,e.timer!==void 0&&Kh(e.timer))}var Zh,Kh,lR,cR,Is,di,h8,Os=F(()=>{"use strict";mn();Zh=globalThis.setTimeout.bind(globalThis),Kh=globalThis.clearTimeout.bind(globalThis),lR=globalThis.setInterval.bind(globalThis),cR=globalThis.clearInterval.bind(globalThis);Is=((e,t,...n)=>Zh(Xh(e),t,...n)),di=Kh,h8=2147483647});function iu(e,t,n){if(!Number.isSafeInteger(e)||e<0||!Number.isSafeInteger(t)||t<0||e>t)throw new RangeError(`${n}: byte conversion limit exceeded (${t} bytes)`)}function M(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<=127)t++;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let s=e.charCodeAt(n+1);s>=56320&&s<=57343?(t+=4,n++):t+=3}else t+=3}return t}function fe(e,t=su){let n=e;if(!n)return n;iu(n.length,t,"UTF-8 decode");let r=!1;for(let i=0;i<n.length;i++){let o=n.charCodeAt(i);if(o>255)return n;o>127&&(r=!0)}if(!r)return n;let s=new Uint8Array(n.length);for(let i=0;i<n.length;i++)s[i]=n.charCodeAt(i);try{return m8.decode(s)}catch{return n}}function Mn(e,t=su){if(!e)return e;iu(M(e),t,"UTF-8 encode");let n=g8.encode(e),r="";for(let s=0;s<n.length;s++)r+=String.fromCharCode(n[s]);return r}function y8(e,t=su){iu(e.byteLength,t,"byte-string conversion");let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return n}async function Ht(e,t){return typeof e.readFileBytes=="function"?e.readFileBytes(t):y8(await e.readFileBuffer(t))}function Qh(e){return e.stdoutKind?e.stdoutKind:e.stdoutEncoding==="binary"?"bytes":"text"}function es(e){return Qh(e)==="bytes"?e.stdout:Mn(e.stdout)}function ou(e){return Qh(e)==="bytes"?fe(e.stdout):e.stdout}var m8,g8,su,Ts,ue=F(()=>{"use strict";m8=new TextDecoder("utf-8",{fatal:!0}),g8=new TextEncoder,su=512*1024*1024;Ts=""});function Sa(e){return e instanceof Yt||e instanceof Jt||e instanceof zt}var ft,Yt,Jt,zt,en,tn,we,Ge,sn,xr,pi,C,Fe,Tt,Er,gn,G=F(()=>{"use strict";ue();ft=class extends Error{stdout;stderr;internalOutputAccounting={stdout:0,stderr:0};constructor(t,n="",r=""){super(t),this.stdout=n,this.stderr=r}prependOutput(t,n){this.stdout=t+this.stdout,this.stderr=n+this.stderr,this.internalOutputAccounting.stdout+=M(t),this.internalOutputAccounting.stderr+=M(n)}},Yt=class extends ft{levels;name="BreakError";constructor(t=1,n="",r=""){super("break",n,r),this.levels=t}},Jt=class extends ft{levels;name="ContinueError";constructor(t=1,n="",r=""){super("continue",n,r),this.levels=t}},zt=class extends ft{exitCode;name="ReturnError";constructor(t=0,n="",r=""){super("return",n,r),this.exitCode=t}},en=class extends ft{exitCode;name="ErrexitError";constructor(t,n="",r=""){super(`errexit: command exited with status ${t}`,n,r),this.exitCode=t}},tn=class extends ft{varName;name="NounsetError";constructor(t,n=""){super(`${t}: unbound variable`,n,`bash: ${t}: unbound variable
6
+ `),this.varName=t}},we=class extends ft{exitCode;name="ExitError";constructor(t,n="",r=""){super("exit",n,r),this.exitCode=t}},Ge=class extends ft{name="ArithmeticError";fatal;constructor(t,n="",r="",s=!1){super(t,n,r),this.stderr=r||`bash: ${t}
7
7
  `,this.fatal=s}},sn=class extends ft{name="BadSubstitutionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}: bad substitution
8
8
  `}},xr=class extends ft{name="GlobError";constructor(t,n="",r=""){super(`no match: ${t}`,n,r),this.stderr=r||`bash: no match: ${t}
9
9
  `}},pi=class extends ft{name="BraceExpansionError";constructor(t,n="",r=""){super(t,n,r),this.stderr=r||`bash: ${t}
10
10
  `}},C=class extends ft{limitType;name="ExecutionLimitError";static EXIT_CODE=126;constructor(t,n,r="",s=""){super(t,r,s),this.limitType=n,this.stderr=s||`bash: ${t}
11
- `}},_e=class extends ft{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Tt=class extends ft{commandName;name="UnresolvedCommandError";exitCode=127;constructor(t,n="",r=""){super(`unresolved command: ${t}`,n,r),this.commandName=t}},Er=class extends ft{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};gn=class extends ft{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function hi(...e){let t=[...new Set(e.filter(s=>s!==void 0))];if(t.length===0)return{signal:void 0,cleanup(){}};if(t.length===1)return{signal:t[0],cleanup(){}};let n=new AbortController,r=[];for(let s of t){if(s.aborted){n.abort(s.reason);break}let i=()=>n.abort(s.reason);s.addEventListener("abort",i,{once:!0}),r.push([s,i])}return{signal:n.signal,cleanup(){for(let[s,i]of r)s.removeEventListener("abort",i)}}}async function Aa(e,t,n){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),new _e("",n);let r;try{return await Promise.race([e,new Promise((s,i)=>{r=()=>i(new _e("",n)),t.addEventListener("abort",r,{once:!0})})])}finally{r&&t.removeEventListener("abort",r)}}var mi=F(()=>{"use strict";G()});function _n(e,t,n){let r=n==="width"?Math.abs(e):e;if(!Number.isFinite(e)||!Number.isSafeInteger(e)||r<0||r>t)throw new C(`format ${n} limit exceeded (${t} bytes)`,"string_length")}function gi(e,t,n,r=au){_n(t,r,"width"),n!==-1&&_n(n,r,"precision");let s=e;n>=0&&s.length>n&&(s=s.slice(0,n));let i=Math.abs(t);if(i>s.length){if(M(s)+i-s.length>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");t<0?s=s.padEnd(i," "):s=s.padStart(i," ")}if(M(s)>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");return s}function Yh(e,t,n=au){let r=t,s=0,i=-1,o=!1;for(r<e.length&&e[r]==="-"&&(o=!0,r++);r<e.length&&/\d/.test(e[r]);)s=s*10+parseInt(e[r],10),r++;if(r<e.length&&e[r]===".")for(r++,i=0;r<e.length&&/\d/.test(e[r]);)i=i*10+parseInt(e[r],10),r++;return o&&s>0&&(s=-s),_n(s,n,"width"),i!==-1&&_n(i,n,"precision"),[s,i,r-t]}function Ca(e,t=au){if(M(e)>t)throw new C(`escaped string size limit exceeded (${t} bytes)`,"string_length");let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length)switch(e[r+1]){case"n":n+=`
11
+ `}},Fe=class extends ft{name="ExecutionAbortedError";constructor(t="",n=""){super("execution aborted",t,n)}},Tt=class extends ft{commandName;name="UnresolvedCommandError";exitCode=127;constructor(t,n="",r=""){super(`unresolved command: ${t}`,n,r),this.commandName=t}},Er=class extends ft{name="SubshellExitError";constructor(t="",n=""){super("subshell exit",t,n)}};gn=class extends ft{exitCode;name="PosixFatalError";constructor(t,n="",r=""){super("posix fatal error",n,r),this.exitCode=t}}});function hi(...e){let t=[...new Set(e.filter(s=>s!==void 0))];if(t.length===0)return{signal:void 0,cleanup(){}};if(t.length===1)return{signal:t[0],cleanup(){}};let n=new AbortController,r=[];for(let s of t){if(s.aborted){n.abort(s.reason);break}let i=()=>n.abort(s.reason);s.addEventListener("abort",i,{once:!0}),r.push([s,i])}return{signal:n.signal,cleanup(){for(let[s,i]of r)s.removeEventListener("abort",i)}}}async function Aa(e,t,n){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),new Fe("",n);let r;try{return await Promise.race([e,new Promise((s,i)=>{r=()=>i(new Fe("",n)),t.addEventListener("abort",r,{once:!0})})])}finally{r&&t.removeEventListener("abort",r)}}var mi=F(()=>{"use strict";G()});function _n(e,t,n){let r=n==="width"?Math.abs(e):e;if(!Number.isFinite(e)||!Number.isSafeInteger(e)||r<0||r>t)throw new C(`format ${n} limit exceeded (${t} bytes)`,"string_length")}function gi(e,t,n,r=au){_n(t,r,"width"),n!==-1&&_n(n,r,"precision");let s=e;n>=0&&s.length>n&&(s=s.slice(0,n));let i=Math.abs(t);if(i>s.length){if(M(s)+i-s.length>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");t<0?s=s.padEnd(i," "):s=s.padStart(i," ")}if(M(s)>r)throw new C(`formatted value size limit exceeded (${r} bytes)`,"string_length");return s}function Yh(e,t,n=au){let r=t,s=0,i=-1,o=!1;for(r<e.length&&e[r]==="-"&&(o=!0,r++);r<e.length&&/\d/.test(e[r]);)s=s*10+parseInt(e[r],10),r++;if(r<e.length&&e[r]===".")for(r++,i=0;r<e.length&&/\d/.test(e[r]);)i=i*10+parseInt(e[r],10),r++;return o&&s>0&&(s=-s),_n(s,n,"width"),i!==-1&&_n(i,n,"precision"),[s,i,r-t]}function Ca(e,t=au){if(M(e)>t)throw new C(`escaped string size limit exceeded (${t} bytes)`,"string_length");let n="",r=0;for(;r<e.length;)if(e[r]==="\\"&&r+1<e.length)switch(e[r+1]){case"n":n+=`
12
12
  `,r+=2;break;case"t":n+=" ",r+=2;break;case"r":n+="\r",r+=2;break;case"\\":n+="\\",r+=2;break;case"a":n+="\x07",r+=2;break;case"b":n+="\b",r+=2;break;case"f":n+="\f",r+=2;break;case"v":n+="\v",r+=2;break;case"e":case"E":n+="\x1B",r+=2;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let i="",o=r+1;for(;o<e.length&&o<r+4&&/[0-7]/.test(e[o]);)i+=e[o],o++;n+=String.fromCharCode(parseInt(i,8)),r=o;break}case"x":{let i=[],o=r;for(;o+3<e.length&&e[o]==="\\"&&e[o+1]==="x"&&/[0-9a-fA-F]{2}/.test(e.slice(o+2,o+4));)i.push(parseInt(e.slice(o+2,o+4),16)),o+=4;if(i.length>0){try{let a=new TextDecoder("utf-8",{fatal:!0});n+=a.decode(new Uint8Array(i))}catch{for(let a of i)n+=String.fromCharCode(a)}r=o}else n+=e[r],r++;break}case"u":{let i="",o=r+2;for(;o<e.length&&o<r+6&&/[0-9a-fA-F]/.test(e[o]);)i+=e[o],o++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=o):(n+="\\u",r+=2);break}case"U":{let i="",o=r+2;for(;o<e.length&&o<r+10&&/[0-9a-fA-F]/.test(e[o]);)i+=e[o],o++;i?(n+=String.fromCodePoint(parseInt(i,16)),r=o):(n+="\\U",r+=2);break}default:n+=e[r],r++}else n+=e[r],r++;return n}var au,kt=F(()=>{"use strict";ue();G();ue();au=10*1024*1024});var Jh={};ae(Jh,{echoCommand:()=>b8,flagsForFuzzing:()=>x8});function w8(e){let t="",n=0;for(;n<e.length;)if(e[n]==="\\"){if(n+1>=e.length){t+="\\";break}let r=e[n+1];switch(r){case"\\":t+="\\",n+=2;break;case"n":t+=`
13
13
  `,n+=2;break;case"t":t+=" ",n+=2;break;case"r":t+="\r",n+=2;break;case"a":t+="\x07",n+=2;break;case"b":t+="\b",n+=2;break;case"f":t+="\f",n+=2;break;case"v":t+="\v",n+=2;break;case"e":case"E":t+="\x1B",n+=2;break;case"c":return{output:t,stop:!0};case"0":{let s="",i=n+2;for(;i<e.length&&i<n+5&&/[0-7]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\0";else{let o=parseInt(s,8)%256;t+=String.fromCharCode(o)}n=i;break}case"x":{let s="",i=n+2;for(;i<e.length&&i<n+4&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\x",n+=2;else{let o=parseInt(s,16);t+=String.fromCharCode(o),n=i}break}case"u":{let s="",i=n+2;for(;i<e.length&&i<n+6&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\u",n+=2;else{let o=parseInt(s,16);t+=String.fromCodePoint(o),n=i}break}case"U":{let s="",i=n+2;for(;i<e.length&&i<n+10&&/[0-9a-fA-F]/.test(e[i]);)s+=e[i],i++;if(s.length===0)t+="\\U",n+=2;else{let o=parseInt(s,16);try{t+=String.fromCodePoint(o)}catch{t+=`\\U${s}`}n=i}break}default:t+=`\\${r}`,n+=2}}else t+=e[n],n++;return{output:t,stop:!1}}var b8,x8,e1=F(()=>{"use strict";b8={name:"echo",async execute(e,t){let n=!1,r=t.xpgEcho??!1,s=0;for(;s<e.length;){let o=e[s];if(o==="-n")n=!0,s++;else if(o==="-e")r=!0,s++;else if(o==="-E")r=!1,s++;else if(o==="-ne"||o==="-en")n=!0,r=!0,s++;else break}let i=e.slice(s).join(" ");if(r){let o=w8(i);if(i=o.output,o.stop)return{stdout:i,stderr:"",exitCode:0,internalStdinConsumed:0}}return n||(i+=`
14
- `),{stdout:i,stderr:"",exitCode:0,internalStdinConsumed:0}}},x8={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function po(e){return e instanceof C||e instanceof _e||e instanceof Ce||e instanceof Tt}function ge(e){if(po(e))throw e}var vt=F(()=>{"use strict";G();mn()});function q(e){let t=`${e.name} - ${e.summary}
14
+ `),{stdout:i,stderr:"",exitCode:0,internalStdinConsumed:0}}},x8={name:"echo",flags:[{flag:"-n",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-E",type:"boolean"}],stdinType:"none",needsArgs:!0}});function po(e){return e instanceof C||e instanceof Fe||e instanceof Ce||e instanceof Tt}function ge(e){if(po(e))throw e}var vt=F(()=>{"use strict";G();mn()});function q(e){let t=`${e.name} - ${e.summary}
15
15
 
16
16
  `;if(t+=`Usage: ${e.usage}
17
17
  `,e.description){if(t+=`
@@ -53,7 +53,7 @@ Notes:
53
53
  `,exitCode:1,internalStdinConsumed:0};if(n=e[r+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(?:\[[^\]\n]+\])?$/.test(n)||/[;\r\\]/.test(n)||n.includes(".."))return{stdout:"",stderr:`printf: \`${n}': not a valid identifier
54
54
  `,exitCode:2,internalStdinConsumed:0};r+=2}else{if(o.startsWith("-")&&o!=="-")break;break}}if(r>=e.length)return{stdout:"",stderr:`printf: usage: printf format [arguments]
55
55
  `,exitCode:1,internalStdinConsumed:0};let s=e[r],i=e.slice(r+1);try{let o=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),a=Ca(s,o),l="",c=0,u=0,f=!1,d="",p=t.env.get("TZ");do{let{result:h,argsConsumed:m,error:g,errMsg:b,stopped:y}=F8(a,i,u,p,o-c),w=M(h);if(w>o-c)throw new C(`printf: output size limit exceeded (${o} bytes)`,"string_length");if(l+=h,c+=w,u+=m,g&&(f=!0,b&&(d=b)),y)break}while(u<i.length&&u>0);if(u===0&&i.length>0,n){let h=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(['"]?)(.+?)\2\]$/);if(h){let m=h[1],g=h[3];if(g=g.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(b,y)=>t.env.get(y)??""),t.assignShellVariable)await t.assignShellVariable(m,l,g);else throw new Error("printf -v array assignment requires an interpreter assignment gateway")}else if(t.assignShellVariable)await t.assignShellVariable(n,l);else{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n))throw new Error(`${n}: not a valid identifier`);t.env.set(n,l)}return{stdout:"",stderr:d,exitCode:f?1:0,internalStdinConsumed:0}}return{stdout:l,stderr:d,exitCode:f?1:0,internalStdinConsumed:0}}catch(o){if(o instanceof C||typeof o=="object"&&o!==null&&"name"in o&&o.name==="ExitError")throw o;return{stdout:"",stderr:`printf: ${dt(o)}
56
- `,exitCode:1,internalStdinConsumed:0}}}};sr=!1;q8={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});function ns(e,t){if(!Number.isSafeInteger(e)||e<0)throw new C(`${t}: invalid bounded allocation count`,"array_elements")}function c1(e){return new C(`${e}: invalid bounded allocation count`,"array_elements")}function Rs(e,t,n){ns(e,n),ns(t,n);let r=e+t;if(!Number.isSafeInteger(r))throw c1(n);return r}function u1(e,t,n){if(ns(e,n),ns(t,n),e!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/e))throw c1(n);return e*t}function f1(e,t,n,r){let s=new $e(n,r);return s.repeat(e,t),s.build()}function Bn(e,t,n,r){let s=new $e(n,r);for(let i=0;i<e.length;i++)i>0&&s.append(t),s.append(e[i]);return s.build()}var $e,St=F(()=>{"use strict";ue();G();$e=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,n,r=void 0,s=0){this.maxBytes=t,this.label=n,this.createLimitError=r,this.reservedBytes=s,ns(t,n),ns(s,n),s>t&&this.fail()}fail(){throw this.createLimitError?.()??new C(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(t){ns(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let n=M(t);return this.reserve(n),t&&this.chunks.push(t),this.usedBytes+=n,this}repeat(t,n){ns(n,this.label);let r=M(t);return r!==0&&n>Math.floor(this.remainingBytes/r)&&this.fail(),this.append(t.repeat(n))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}}});function G8(e){if(typeof e=="object"&&e!==null&&"code"in e){let t=e.code;if(typeof t=="string"&&t.length>0)return t}}function ht(e,t){return G8(e)===t}var me,Un=F(()=>{"use strict";me=class extends Error{code;bareMessage;constructor(t,n){if(t.length===0)throw new Error("FsError: code must be a non-empty errno name");super(n.startsWith(`${t}:`)?n:`${t}: ${n}`),this.code=t,this.bareMessage=n.startsWith(`${t}:`)?n.slice(t.length+(n[t.length+1]===" "?2:1)):n}}});function ke(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function zn(e,t){let n=ke(e),r=ke(t);return r===n||n==="/"||r.startsWith(`${n}/`)}function bt(e,t){if(e.includes("\0"))throw new me("ENOENT",`path contains null byte, ${t} '${e}'`)}function Sr(e){let t=ke(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Z8(e){if(typeof process>"u"||process.platform!=="win32"||!/^[A-Za-z]:[\\/]/.test(e))return e;let t=e[0].toLowerCase(),n=e.slice(2).replace(/\\/g,"/");return`/${t}${n}`}function Na(e,t){if(t=Z8(t),t.startsWith("/"))return ke(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return ke(n)}function wn(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ia(e,t){if(t.startsWith("/"))return ke(t);let n=Sr(e);return ke(wn(n,t))}var cu,Ur,uu,d1,xi=F(()=>{"use strict";Un();cu=40,Ur=493,uu=420,d1=511});function K8(e,t,n){if(!e)return e;let r=e.replace(/\n\s+at\s.*/g,"");return n&&(r=r.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),r=r.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),r=r.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),r=r.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),n&&(r=r.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),r}function Ge(e){return K8(e,!1,!1)}var Tn=F(()=>{"use strict"});function h1(e){if(e.identity!==void 0)return`identity:${e.identity}`;if(e.dev!==void 0&&e.ino!==void 0)return`inode:${String(e.dev)}:${String(e.ino)}`}function p1(e){return ht(e,"ENOENT")}async function ir(e,t,n){let r=ke(t),s;try{s=await e.stat(r)}catch(a){if(!p1(a))return{existence:"unknown"}}if(s!==void 0){let a=h1(s);try{return{existence:"existing",canonicalPath:ke(await e.realpath(r)),stableIdentity:a}}catch{return a===void 0?{existence:"unknown"}:{existence:"existing",stableIdentity:a}}}let i=[],o=r;for(;;){n?.checkpoint();let a=Sr(o);if(a===o)return{existence:"unknown"};i.unshift(o.slice(a==="/"?1:a.length+1)),o=a;try{let l=ke(await e.realpath(o));return{existence:"missing",canonicalPath:i.reduce((c,u)=>wn(c,u),l)}}catch(l){if(!p1(l))return{existence:"missing"}}}}async function Oa(e,t,n){let[r,s]=await Promise.all([ir(e,t),ir(e,n)]);return r.existence==="unknown"||s.existence==="unknown"?"unknown":r.existence==="missing"||s.existence==="missing"?r.existence!==s.existence?"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown":r.stableIdentity!==void 0&&s.stableIdentity!==void 0?r.stableIdentity===s.stableIdentity?"same":"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown"}async function Ta(e,t,n,r){let[s,i]=await Promise.all([ir(e,t,r),ir(e,n,r)]);return s.existence!=="existing"||s.canonicalPath===void 0||i.existence==="unknown"||i.canonicalPath===void 0?"unknown":zn(s.canonicalPath,i.canonicalPath)?"inside":"outside"}async function Ar(e,t){let n=e.budget??new Dt(e),r=[{kind:"enter",path:ke(e.root),depth:0}],s=new Set;for(;r.length>0;){n.checkpoint(0);let i=r.pop();if(!i)break;if(i.kind==="leave"){e.includeLeave&&await t({path:i.path,depth:i.depth,stat:i.stat,isSymlink:i.isSymlink,phase:"leave"}),i.identity&&s.delete(i.identity);continue}n.visit(i.depth);let o=await e.fs.lstat(i.path),a=o.isSymbolicLink,l=a&&e.symlinks==="follow"?await e.fs.stat(i.path):o;if(await t({path:i.path,depth:i.depth,stat:l,isSymlink:a,phase:"enter"}),!l.isDirectory||a&&e.symlinks!=="follow")continue;let c=h1(l)??await e.fs.realpath(i.path).then(ke).catch(()=>{});if(c!==void 0){if(s.has(c))throw new fu(e.site,i.path,"symbolic-link directory cycle detected");s.add(c)}r.push({kind:"leave",path:i.path,depth:i.depth,stat:l,isSymlink:a,identity:c});let u=await e.fs.readdir(i.path);n.checkpoint(),u.sort((f,d)=>f.localeCompare(d));for(let f=u.length-1;f>=0;f--)r.push({kind:"enter",path:wn(i.path,u[f]),depth:i.depth+1})}}var fu,Dt,Wn=F(()=>{"use strict";G();Un();xi();Tn();fu=class extends Error{operation;virtualPath;name="FileSystemPolicyError";constructor(t,n,r){super(`${t}: ${Ge(r)}`),this.operation=t,this.virtualPath=n}};Dt=class{options;entries=0;discoveredEntries=1;work=0;constructor(t){this.options=t}checkpoint(t=1){if(this.options.signal?.aborted)throw new _e;if(this.options.executionScope?.throwIfAborted(this.options.site),!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalWork-this.work)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal work"} limit exceeded (${this.options.limits.maxTraversalWork})`,"iterations");this.work+=t,this.options.executionScope?.consumeWork(t,`${this.options.site} filesystem traversal`)}visit(t){if(this.checkpoint(),t>this.options.limits.maxTraversalDepth)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} depth limit exceeded (${this.options.limits.maxTraversalDepth})`,"recursion");if(++this.entries>this.options.limits.maxTraversalEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations")}reserve(t){if(!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalEntries-this.discoveredEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations");this.discoveredEntries+=t}discover(t){this.reserve(t),this.checkpoint(t)}}});var w1={};ae(w1,{flagsForFuzzing:()=>tx,lsCommand:()=>J8});function nn(e,t,n){if(M(n)>e.limits.maxOutputSize-M(t))throw new C(`ls: output size limit exceeded (${e.limits.maxOutputSize} bytes)`,"output_size");return t+n}function g1(e,t){if(t>e.limits.maxArrayElements)throw new C(`ls: array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements")}function X8(e,t,n){g1(e,n),t.reserve(n)}function m1(e,t){let n=new $e(e.limits.maxOutputSize,"ls");for(let r=0;r<t.length;r++)r>0&&n.append(`
56
+ `,exitCode:1,internalStdinConsumed:0}}}};sr=!1;q8={name:"printf",flags:[{flag:"-v",type:"value",valueHint:"string"}],stdinType:"none",needsArgs:!0}});function ns(e,t){if(!Number.isSafeInteger(e)||e<0)throw new C(`${t}: invalid bounded allocation count`,"array_elements")}function c1(e){return new C(`${e}: invalid bounded allocation count`,"array_elements")}function Rs(e,t,n){ns(e,n),ns(t,n);let r=e+t;if(!Number.isSafeInteger(r))throw c1(n);return r}function u1(e,t,n){if(ns(e,n),ns(t,n),e!==0&&t>Math.floor(Number.MAX_SAFE_INTEGER/e))throw c1(n);return e*t}function f1(e,t,n,r){let s=new $e(n,r);return s.repeat(e,t),s.build()}function Bn(e,t,n,r){let s=new $e(n,r);for(let i=0;i<e.length;i++)i>0&&s.append(t),s.append(e[i]);return s.build()}var $e,St=F(()=>{"use strict";ue();G();$e=class{maxBytes;label;createLimitError;reservedBytes;chunks=[];usedBytes=0;constructor(t,n,r=void 0,s=0){this.maxBytes=t,this.label=n,this.createLimitError=r,this.reservedBytes=s,ns(t,n),ns(s,n),s>t&&this.fail()}fail(){throw this.createLimitError?.()??new C(`${this.label}: output size limit exceeded (${this.maxBytes} bytes)`,"output_size")}get byteLength(){return this.usedBytes}get remainingBytes(){return this.maxBytes-this.reservedBytes-this.usedBytes}reserve(t){ns(t,this.label),t>this.remainingBytes&&this.fail()}append(t){let n=M(t);return this.reserve(n),t&&this.chunks.push(t),this.usedBytes+=n,this}repeat(t,n){ns(n,this.label);let r=M(t);return r!==0&&n>Math.floor(this.remainingBytes/r)&&this.fail(),this.append(t.repeat(n))}reset(){this.chunks.length=0,this.usedBytes=0}build(){return this.chunks.join("")}}});function G8(e){if(typeof e=="object"&&e!==null&&"code"in e){let t=e.code;if(typeof t=="string"&&t.length>0)return t}}function ht(e,t){return G8(e)===t}var me,Un=F(()=>{"use strict";me=class extends Error{code;bareMessage;constructor(t,n){if(t.length===0)throw new Error("FsError: code must be a non-empty errno name");super(n.startsWith(`${t}:`)?n:`${t}: ${n}`),this.code=t,this.bareMessage=n.startsWith(`${t}:`)?n.slice(t.length+(n[t.length+1]===" "?2:1)):n}}});function ke(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let n=t.split("/").filter(s=>s&&s!=="."),r=[];for(let s of n)s===".."?r.pop():r.push(s);return`/${r.join("/")}`||"/"}function zn(e,t){let n=ke(e),r=ke(t);return r===n||n==="/"||r.startsWith(`${n}/`)}function bt(e,t){if(e.includes("\0"))throw new me("ENOENT",`path contains null byte, ${t} '${e}'`)}function Sr(e){let t=ke(e);if(t==="/")return"/";let n=t.lastIndexOf("/");return n===0?"/":t.slice(0,n)}function Z8(e){if(typeof process>"u"||process.platform!=="win32"||!/^[A-Za-z]:[\\/]/.test(e))return e;let t=e[0].toLowerCase(),n=e.slice(2).replace(/\\/g,"/");return`/${t}${n}`}function Na(e,t){if(t=Z8(t),t.startsWith("/"))return ke(t);let n=e==="/"?`/${t}`:`${e}/${t}`;return ke(n)}function wn(e,t){return e==="/"?`/${t}`:`${e}/${t}`}function Ia(e,t){if(t.startsWith("/"))return ke(t);let n=Sr(e);return ke(wn(n,t))}var cu,Ur,uu,d1,xi=F(()=>{"use strict";Un();cu=40,Ur=493,uu=420,d1=511});function K8(e,t,n){if(!e)return e;let r=e.replace(/\n\s+at\s.*/g,"");return n&&(r=r.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,"<path>")),r=r.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,"<path>"),r=r.replace(/node:internal\/[^\s'",)}\]:]+/g,"<internal>"),r=r.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,"<path>"),n&&(r=r.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,"<path>")),r}function Ze(e){return K8(e,!1,!1)}var Tn=F(()=>{"use strict"});function h1(e){if(e.identity!==void 0)return`identity:${e.identity}`;if(e.dev!==void 0&&e.ino!==void 0)return`inode:${String(e.dev)}:${String(e.ino)}`}function p1(e){return ht(e,"ENOENT")}async function ir(e,t,n){let r=ke(t),s;try{s=await e.stat(r)}catch(a){if(!p1(a))return{existence:"unknown"}}if(s!==void 0){let a=h1(s);try{return{existence:"existing",canonicalPath:ke(await e.realpath(r)),stableIdentity:a}}catch{return a===void 0?{existence:"unknown"}:{existence:"existing",stableIdentity:a}}}let i=[],o=r;for(;;){n?.checkpoint();let a=Sr(o);if(a===o)return{existence:"unknown"};i.unshift(o.slice(a==="/"?1:a.length+1)),o=a;try{let l=ke(await e.realpath(o));return{existence:"missing",canonicalPath:i.reduce((c,u)=>wn(c,u),l)}}catch(l){if(!p1(l))return{existence:"missing"}}}}async function Oa(e,t,n){let[r,s]=await Promise.all([ir(e,t),ir(e,n)]);return r.existence==="unknown"||s.existence==="unknown"?"unknown":r.existence==="missing"||s.existence==="missing"?r.existence!==s.existence?"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown":r.stableIdentity!==void 0&&s.stableIdentity!==void 0?r.stableIdentity===s.stableIdentity?"same":"different":r.canonicalPath!==void 0&&r.canonicalPath===s.canonicalPath?"same":"unknown"}async function Ta(e,t,n,r){let[s,i]=await Promise.all([ir(e,t,r),ir(e,n,r)]);return s.existence!=="existing"||s.canonicalPath===void 0||i.existence==="unknown"||i.canonicalPath===void 0?"unknown":zn(s.canonicalPath,i.canonicalPath)?"inside":"outside"}async function Ar(e,t){let n=e.budget??new Dt(e),r=[{kind:"enter",path:ke(e.root),depth:0}],s=new Set;for(;r.length>0;){n.checkpoint(0);let i=r.pop();if(!i)break;if(i.kind==="leave"){e.includeLeave&&await t({path:i.path,depth:i.depth,stat:i.stat,isSymlink:i.isSymlink,phase:"leave"}),i.identity&&s.delete(i.identity);continue}n.visit(i.depth);let o=await e.fs.lstat(i.path),a=o.isSymbolicLink,l=a&&e.symlinks==="follow"?await e.fs.stat(i.path):o;if(await t({path:i.path,depth:i.depth,stat:l,isSymlink:a,phase:"enter"}),!l.isDirectory||a&&e.symlinks!=="follow")continue;let c=h1(l)??await e.fs.realpath(i.path).then(ke).catch(()=>{});if(c!==void 0){if(s.has(c))throw new fu(e.site,i.path,"symbolic-link directory cycle detected");s.add(c)}r.push({kind:"leave",path:i.path,depth:i.depth,stat:l,isSymlink:a,identity:c});let u=await e.fs.readdir(i.path);n.checkpoint(),u.sort((f,d)=>f.localeCompare(d));for(let f=u.length-1;f>=0;f--)r.push({kind:"enter",path:wn(i.path,u[f]),depth:i.depth+1})}}var fu,Dt,Wn=F(()=>{"use strict";G();Un();xi();Tn();fu=class extends Error{operation;virtualPath;name="FileSystemPolicyError";constructor(t,n,r){super(`${t}: ${Ze(r)}`),this.operation=t,this.virtualPath=n}};Dt=class{options;entries=0;discoveredEntries=1;work=0;constructor(t){this.options=t}checkpoint(t=1){if(this.options.signal?.aborted)throw new Fe;if(this.options.executionScope?.throwIfAborted(this.options.site),!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalWork-this.work)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal work"} limit exceeded (${this.options.limits.maxTraversalWork})`,"iterations");this.work+=t,this.options.executionScope?.consumeWork(t,`${this.options.site} filesystem traversal`)}visit(t){if(this.checkpoint(),t>this.options.limits.maxTraversalDepth)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} depth limit exceeded (${this.options.limits.maxTraversalDepth})`,"recursion");if(++this.entries>this.options.limits.maxTraversalEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations")}reserve(t){if(!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalEntries-this.discoveredEntries)throw new C(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations");this.discoveredEntries+=t}discover(t){this.reserve(t),this.checkpoint(t)}}});var w1={};ae(w1,{flagsForFuzzing:()=>tx,lsCommand:()=>J8});function nn(e,t,n){if(M(n)>e.limits.maxOutputSize-M(t))throw new C(`ls: output size limit exceeded (${e.limits.maxOutputSize} bytes)`,"output_size");return t+n}function g1(e,t){if(t>e.limits.maxArrayElements)throw new C(`ls: array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements")}function X8(e,t,n){g1(e,n),t.reserve(n)}function m1(e,t){let n=new $e(e.limits.maxOutputSize,"ls");for(let r=0;r<t.length;r++)r>0&&n.append(`
57
57
  `),n.append(t[r]);return t.length>0&&n.append(`
58
58
  `),n.build()}function pu(e){if(e<1024)return String(e);if(e<1024*1024){let n=e/1024;return n<10?`${n.toFixed(1)}K`:`${Math.round(n)}K`}if(e<1024*1024*1024){let n=e/1048576;return n<10?`${n.toFixed(1)}M`:`${Math.round(n)}M`}let t=e/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function hu(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=String(e.getDate()).padStart(2," "),s=new Date,i=new Date(s.getTime()-4320*60*60*1e3);if(e>i){let a=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0");return`${n} ${r} ${a}:${l}`}let o=e.getFullYear();return`${n} ${r} ${o}`}function mo(e){return e.isDirectory?"/":e.isSymbolicLink?"@":(e.mode&73)!==0?"*":""}function ex(e,t,n){if(!t&&!n)return"name";if(t!==n)return t?"size":"time";let r="name";for(let s of e){if(s==="--")break;if(!(!s.startsWith("-")||s.startsWith("--")))for(let i of s.slice(1))i==="S"?r="size":i==="t"&&(r="time")}return r}async function du(e,t,n,r,s){return await mu(e,i=>t.fs.resolvePath(t.cwd,i),t,n,r,s)}async function mu(e,t,n,r,s,i){let o=[...e];if(r==="name")o.sort();else{i?.checkpoint(o.length);let a=new Map;for(let l of o)try{let c=await n.fs.lstat(t(l));a.set(l,r==="size"?c.size??0:(c.mtime??new Date(0)).getTime())}catch{a.set(l,0)}o.sort((l,c)=>{let u=(a.get(c)??0)-(a.get(l)??0);return u!==0?u:l<c?-1:l>c?1:0})}return s&&o.reverse(),o}async function y1(e,t,n,r,s,i,o,a=!1,l=!1,c="name",u=!1,f=!1,d=new Dt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"}),p=0,h=new Set,m=!1){let g=n||r,b=t.fs.resolvePath(t.cwd,e);try{m||d.visit(p);let y=await t.fs.stat(b);if(!y.isDirectory){let R=u?mo(await t.fs.lstat(b)):"";if(s){let N=y.size??0,$=l?pu(N).padStart(5):String(N).padStart(5),T=y.mtime??new Date(0),_=hu(T);return{stdout:`-rw-r--r-- 1 user user ${$} ${_} ${e}${R}
59
59
  `,stderr:"",exitCode:0}}return{stdout:`${e}${R}
@@ -64,7 +64,7 @@ Notes:
64
64
  `);let $=[];for(let _=0;_<N.length;_+=100){let z=N.slice(_,_+100),O=await Promise.all(z.map(async B=>{let U=b==="/"?`/${B}`:`${b}/${B}`;try{let L=await t.fs.stat(U),W=L.isDirectory?"drwxr-xr-x":"-rw-r--r--",D=u?mo(await t.fs.lstat(U)):"",Q=L.size??0,V=l?pu(Q).padStart(5):String(Q).padStart(5),Y=L.mtime??new Date(0),ee=hu(Y);return{name:B,line:`${W} 1 user user ${V} ${ee} ${B}${D}
65
65
  `}}catch{return{name:B,line:`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${B}
66
66
  `}}}));$.push(...O)}let T=new Map(N.map((_,z)=>[_,z]));$.sort((_,z)=>(T.get(_.name)??0)-(T.get(z.name)??0));for(let{line:_}of $)E=nn(t,E,_)}else if(u){let R=[],N=S.filter(T=>T!=="."&&T!==".."),$=S.filter(T=>T==="."||T==="..");for(let T of $)R.push(`${T}/`);for(let T=0;T<N.length;T+=100){let _=N.slice(T,T+100),z=await Promise.all(_.map(async O=>{let B=b==="/"?`/${O}`:`${b}/${O}`;try{let U=await t.fs.lstat(B);return`${O}${mo(U)}`}catch{return O}}));R.push(...z)}E=nn(t,E,m1(t,R))}else E=nn(t,E,m1(t,S));if(i){let R=S.filter(O=>O!=="."&&O!==".."),N=new Set(R),$=[];if(t.fs.readdirWithFileTypes){let O=await t.fs.readdirWithFileTypes(b);d.checkpoint(),g1(t,O.length),$=O.filter(B=>B.isDirectory&&N.has(B.name)).map(B=>({name:B.name,isDirectory:!0}))}else for(let O=0;O<R.length;O+=100){let B=R.slice(O,O+100),U=await Promise.all(B.map(async L=>{let W=b==="/"?`/${L}`:`${b}/${L}`;try{let D=await t.fs.stat(W);return{name:L,isDirectory:D.isDirectory}}catch{return{name:L,isDirectory:!1}}}));$.push(...U.filter(L=>L.isDirectory))}let T=await mu($.map(O=>O.name),O=>b==="/"?`/${O}`:`${b}/${O}`,t,c,a,d),_=new Map(T.map((O,B)=>[O,B]));$.sort((O,B)=>(_.get(O.name)??0)-(_.get(B.name)??0));let z=[];for(let O of $){let B=e==="."?`./${O.name}`:`${e}/${O.name}`,U=await y1(B,t,n,r,s,i,!1,a,l,c,u,!0,d,p+1,x);z.push({name:O.name,result:U})}z.sort((O,B)=>(_.get(O.name)??0)-(_.get(B.name)??0));for(let{result:O}of z)E=nn(t,E,`
67
- `),E=nn(t,E,O.stdout),A=nn(t,A,O.stderr),O.exitCode!==0&&(I=O.exitCode)}return{stdout:E,stderr:A,exitCode:I}}catch(y){if(y instanceof C||y instanceof _e)throw y;return{stdout:"",stderr:`ls: ${e}: No such file or directory
67
+ `),E=nn(t,E,O.stdout),A=nn(t,A,O.stderr),O.exitCode!==0&&(I=O.exitCode)}return{stdout:E,stderr:A,exitCode:I}}catch(y){if(y instanceof C||y instanceof Fe)throw y;return{stdout:"",stderr:`ls: ${e}: No such file or directory
68
68
  `,exitCode:2}}}var Q8,Y8,J8,tx,b1=F(()=>{"use strict";St();ue();Wn();G();Nt();ho();de();Q8={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},Y8={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},J8={name:"ls",async execute(e,t){if(Z(e))return q(Q8);let n=Pe("ls",e,Y8);if(!n.ok)return n.error;let r=n.result.flags.showAll,s=n.result.flags.showAlmostAll,i=n.result.flags.longFormat,o=n.result.flags.humanReadable,a=n.result.flags.recursive,l=n.result.flags.reverse,c=n.result.flags.classifyFiles,u=n.result.flags.directoryOnly,f=ex(e,n.result.flags.sortBySize,n.result.flags.sortByTime);n.result.flags.onePerLine;let d=n.result.positional;d.length===0&&d.push(".");let p="",h="",m=0,g=new Dt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(u){for(let S of await du(d,t,f,l,g)){g.visit(0);let E=t.fs.resolvePath(t.cwd,S);try{let A=await t.fs.stat(E);if(i){let I=A.isDirectory?"drwxr-xr-x":"-rw-r--r--",R=c?mo(await t.fs.lstat(E)):"",N=A.size??0,$=o?pu(N).padStart(5):String(N).padStart(5),T=A.mtime??new Date(0),_=hu(T);p=nn(t,p,`${I} 1 user user ${$} ${_} ${S}${R}
69
69
  `)}else{let I=c?mo(await t.fs.lstat(E)):"";p=nn(t,p,`${S}${I}
70
70
  `)}}catch{h=nn(t,h,`ls: cannot access '${S}': No such file or directory
@@ -76,11 +76,11 @@ Notes:
76
76
  `:ht(u,"EEXIST")?a+=`mkdir: cannot create directory '${c}': File exists
77
77
  `:ht(u,"EROFS")?a+=`mkdir: cannot create directory '${c}': Read-only file system
78
78
  `:ht(u,"EACCES")?a+=`mkdir: cannot create directory '${c}': Permission denied
79
- `:a+=`mkdir: cannot create directory '${c}': ${Ge(f)}
79
+ `:a+=`mkdir: cannot create directory '${c}': ${Ze(f)}
80
80
  `,l=1}return{stdout:o,stderr:a,exitCode:l}}},sx={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});async function S1(e,t,n){if(!e.createExclusive)throw new go(t,n.directory?"mkdir":"open");await e.createExclusive(t,n)}var go,gu=F(()=>{"use strict";go=class extends Error{code="ENOSYS";constructor(t,n){super(`ENOSYS: filesystem cannot create entries atomically, ${n} '${t}'`),this.name="ExclusiveCreateUnsupportedError"}}});var v1={};ae(v1,{flagsForFuzzing:()=>Sx,mktempCommand:()=>Ex});function C1(e,t){let n=!1,r=!1;for(let s of e){if(r||n){t(s,!1),n=!1;continue}if(s==="--"){r=!0,t(s,!1);continue}if(!s.startsWith("-")||s==="-"){t(s,!1);continue}(s==="--suffix"||s==="--tmpdir"||/^-[a-z]*p$/.test(s))&&(n=s!=="--tmpdir"),t(s,!0)}}function px(e){let t=new Set,n=new Set,r=new Set;for(let o of Object.values(A1))o.long&&t.add(o.long),o.short&&(n.add(o.short),o.type!=="boolean"&&r.add(o.short));let s=null,i=!1;return C1(e,(o,a)=>{if(!(i||s||!a)){if(o.startsWith("--")){let l=o.indexOf("="),c=l===-1?o.slice(2):o.slice(2,l);c==="help"||c==="version"?s=l===-1?c:`no-arg:${c}`:t.has(c)||(i=!0);return}for(let l of o.slice(1)){if(l==="h"){s="help";return}if(!n.has(l)){i=!0;return}if(r.has(l))return}}}),s}function hx(e){let t=[];return C1(e,(n,r)=>{t.push(r&&n==="--tmpdir"?"--tmpdir=":n)}),t}function gx(e){let t=new Uint8Array(Math.min(e,mx)),n="";for(;n.length<e;){crypto.getRandomValues(t);for(let r of t)if(!(r>=cx)&&(n+=yu[r%yu.length],n.length===e))break}return n}function yx(e,t){return e.endsWith("/")?`${e}${t}`:`${e}/${t}`}function Ps(e){return{stdout:"",stderr:`mktemp: ${e}
81
81
  `,exitCode:1}}function wx(e,t){let n=e,r=t??"";if(t===void 0){let i=e.lastIndexOf("X");i!==-1&&(n=e.slice(0,i+1),r=e.slice(i+1))}else if(!e.endsWith("X"))return Ps(`with --suffix, template '${e}' must end in X`);if(r.includes("/"))return Ps(`invalid suffix '${r}', contains directory separator`);let s=0;for(;s<n.length&&n[n.length-1-s]==="X";)s++;return s<ax?Ps(`too few X's in template '${e}'`):{stem:n,xCount:s,suffix:r}}function k1(e,t){return e?.code===t}async function bx(e,t){try{return await e.fs.lstat(t),!0}catch(n){if(k1(n,"ENOENT"))return!1;throw n}}function xx(e){return typeof e=="object"&&e!==null&&"exitCode"in e}var ix,ox,ax,lx,yu,cx,ux,fx,dx,A1,mx,Ex,Sx,N1=F(()=>{"use strict";gu();Tn();yn();Nt();de();ix=`mktemp (just-bash) 9.4
82
82
  `,ox="tmp.XXXXXXXXXX",ax=3,lx=100,yu="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",cx=256-256%yu.length,ux=384,fx=448,dx={name:"mktemp",summary:"create a temporary file or directory and print its name",usage:"mktemp [OPTION]... [TEMPLATE]",description:["Create a uniquely named temporary file (or directory with -d) and write","its name to standard output. TEMPLATE must end in at least three 'X's,","which are replaced with random characters; it defaults to tmp.XXXXXXXXXX.","Without -p/-t/--tmpdir a bare TEMPLATE is relative to the current","directory, while the default template is placed in $TMPDIR (or /tmp).","Files are created with mode 0600 and directories with mode 0700."],options:["-d, --directory create a directory, not a file","-u, --dry-run do not create anything, merely print a name","-q, --quiet suppress diagnostics about creation failure"," --suffix=SUFF append SUFF to TEMPLATE (must not contain a slash)","-p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR"," (defaults to $TMPDIR, or /tmp when unset)","-t interpret TEMPLATE as a single file name"," component, relative to the temporary directory","-h, --help display this help and exit"," --version output version information and exit"],examples:["mktemp","mktemp -d","mktemp /tmp/build-XXXXXX","mktemp --suffix=.txt fileXXXXXX"]},A1={directory:{short:"d",long:"directory",type:"boolean"},dryRun:{short:"u",long:"dry-run",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},tmpdir:{short:"p",long:"tmpdir",type:"string"},legacyT:{short:"t",type:"boolean"},suffix:{long:"suffix",type:"string"}};mx=65536;Ex={name:"mktemp",async execute(e,t){let n=px(e);if(n==="help")return q(dx);if(n==="version")return{stdout:ix,stderr:"",exitCode:0};if(n?.startsWith("no-arg:"))return Ps(`option '--${n.slice(7)}' doesn't allow an argument`);let r=Pe("mktemp",hx(e),A1);if(!r.ok)return r.error;let{flags:s,positional:i}=r.result;if(i.length>1)return Ps("too many templates");let o=i.length===1?i[0]:ox,a=wx(o,s.suffix);if(xx(a))return a;let l=t.env.get("TMPDIR"),c=l||"/tmp",u=null;if(s.legacyT){if(o.includes("/"))return Ps(`invalid template, '${o}', contains directory separator`);u=l||(s.tmpdir?s.tmpdir:"/tmp")}else if(s.tmpdir!==void 0||i.length===0){if(o.startsWith("/"))return Ps(`invalid template, '${o}'; with --tmpdir, it may not be absolute`);u=s.tmpdir?s.tmpdir:c}let f=s.directory?"directory":"file",d=u===null?a.stem:yx(u,a.stem),p=d.slice(0,d.length-a.xCount),h=m=>({stdout:"",stderr:s.quiet?"":`mktemp: failed to create ${f} via template '${o}': ${m}
83
- `,exitCode:1});if(!s.dryRun){let m=d.lastIndexOf("/"),g=t.fs.resolvePath(t.cwd,m===-1?".":d.slice(0,m)||"/");try{if(!(await t.fs.stat(g)).isDirectory)return h("Not a directory")}catch{return h("No such file or directory")}}for(let m=0;m<lx;m++){let g=`${p}${gx(a.xCount)}${a.suffix}`,b=t.fs.resolvePath(t.cwd,g);try{if(s.dryRun){if(await bx(t,b))continue}else await S1(t.fs,b,{mode:s.directory?fx:ux,directory:s.directory})}catch(y){if(k1(y,"EEXIST"))continue;return h(Ge(dt(y)))}return{stdout:`${g}
83
+ `,exitCode:1});if(!s.dryRun){let m=d.lastIndexOf("/"),g=t.fs.resolvePath(t.cwd,m===-1?".":d.slice(0,m)||"/");try{if(!(await t.fs.stat(g)).isDirectory)return h("Not a directory")}catch{return h("No such file or directory")}}for(let m=0;m<lx;m++){let g=`${p}${gx(a.xCount)}${a.suffix}`,b=t.fs.resolvePath(t.cwd,g);try{if(s.dryRun){if(await bx(t,b))continue}else await S1(t.fs,b,{mode:s.directory?fx:ux,directory:s.directory})}catch(y){if(k1(y,"EEXIST"))continue;return h(Ze(dt(y)))}return{stdout:`${g}
84
84
  `,stderr:"",exitCode:0}}return h("File exists")}},Sx={name:"mktemp",flags:[{flag:"-d",type:"boolean"},{flag:"-u",type:"boolean"},{flag:"-q",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-p",type:"value",valueHint:"path"},{flag:"--suffix",type:"value",valueHint:"string"}],needsArgs:!1}});var T1={};ae(T1,{flagsForFuzzing:()=>Nx,rmdirCommand:()=>kx});async function vx(e,t,n,r,s){let i="",o="",l=e.fs.resolvePath(e.cwd,t),c=await I1(e,l,t,r);if(i+=c.stdout,o+=c.stderr,c.exitCode!==0)return{stdout:i,stderr:o,exitCode:c.exitCode};if(n){let u=l,f=t;for(;;){s.visit(0);let d=O1(u),p=O1(f);if(d===u||d==="/"||d==="."||p==="."||p==="")break;let h=await I1(e,d,p,r);if(i+=h.stdout,h.exitCode!==0)break;u=d,f=p}}return{stdout:i,stderr:o,exitCode:0}}async function I1(e,t,n,r){try{if(!await e.fs.exists(t))return{stdout:"",stderr:`rmdir: failed to remove '${n}': No such file or directory
85
85
  `,exitCode:1};if(!(await e.fs.stat(t)).isDirectory)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Not a directory
86
86
  `,exitCode:1};if((await e.fs.readdir(t)).length>0)return{stdout:"",stderr:`rmdir: failed to remove '${n}': Directory not empty
@@ -104,7 +104,7 @@ Options:
104
104
  `)}catch(f){let d=dt(f),p=ht(f,"ENOENT");if(s&&p)continue;p?l+=`rm: cannot remove '${u}': No such file or directory
105
105
  `:ht(f,"ENOTEMPTY")?l+=`rm: cannot remove '${u}': Directory not empty
106
106
  `:ht(f,"EROFS")?l+=`rm: cannot remove '${u}': Read-only file system
107
- `:l+=`rm: cannot remove '${u}': ${Ge(d)}
107
+ `:l+=`rm: cannot remove '${u}': ${Ze(d)}
108
108
  `,c=1}return{stdout:a,stderr:l,exitCode:c}}},Px={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0}});var F1={};ae(F1,{cpCommand:()=>Fx,flagsForFuzzing:()=>Mx});var Dx,Lx,Fx,Mx,M1=F(()=>{"use strict";xi();Wn();G();yn();Nt();de();Un();Dx={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},Lx={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},Fx={name:"cp",async execute(e,t){if(Z(e))return q(Dx);let n=Pe("cp",e,Lx);if(!n.ok)return n.error;let r=n.result.flags.recursive||n.result.flags.recursiveUpper,s=n.result.flags.noClobber,i=n.result.flags.preserve,o=n.result.flags.verbose,a=n.result.positional;if(a.length<2)return{stdout:"",stderr:`cp: missing destination file operand
109
109
  `,exitCode:1};let l=a.pop()??"",c=a,u=t.fs.resolvePath(t.cwd,l),f="",d="",p=0,h=new Dt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp"}),m=!1;try{m=(await t.fs.stat(u)).isDirectory}catch{}if(c.length>1&&!m)return{stdout:"",stderr:`cp: target '${l}' is not a directory
110
110
  `,exitCode:1};for(let g of c)try{let b=t.fs.resolvePath(t.cwd,g),y=await t.fs.stat(b),w=u;if(m){let S=g.split("/").pop()||g;w=u==="/"?`/${S}`:`${u}/${S}`}if(y.isDirectory&&!r){d+=`cp: -r not specified; omitting directory '${g}'
@@ -113,7 +113,7 @@ Options:
113
113
  `,p=1;continue}}if(s)try{await t.fs.stat(w);continue}catch{}let x=await Oa(t.fs,b,w);if(x==="same"){d+=`cp: '${g}' and '${w}' are the same file
114
114
  `,p=1;continue}if(x==="unknown"){d+=`cp: cannot safely determine whether '${g}' and '${w}' are the same file
115
115
  `,p=1;continue}y.isDirectory&&await Ar({fs:t.fs,root:b,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"cp",symlinks:"never",budget:h},()=>{}),await t.fs.cp(b,w,{recursive:r}),o&&(f+=`'${g}' -> '${w}'
116
- `)}catch(b){if(b instanceof C||b instanceof _e)throw b;let y=dt(b);ht(b,"ENOENT")?d+=`cp: cannot stat '${g}': No such file or directory
116
+ `)}catch(b){if(b instanceof C||b instanceof Fe)throw b;let y=dt(b);ht(b,"ENOENT")?d+=`cp: cannot stat '${g}': No such file or directory
117
117
  `:ht(b,"EROFS")?d+=`cp: cannot create regular file '${l}': Read-only file system
118
118
  `:d+=`cp: cannot copy '${g}': ${y}
119
119
  `,p=1}return{stdout:f,stderr:d,exitCode:p}}},Mx={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var _1={};ae(_1,{flagsForFuzzing:()=>zx,mvCommand:()=>Ux});var _x,Bx,Ux,zx,B1=F(()=>{"use strict";xi();Wn();G();yn();Nt();de();Un();_x={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},Bx={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},Ux={name:"mv",async execute(e,t){if(Z(e))return q(_x);let n=Pe("mv",e,Bx);if(!n.ok)return n.error;let r=n.result.flags.force,s=n.result.flags.noClobber,i=n.result.flags.verbose,o=n.result.positional;if(s&&(r=!1),o.length<2)return{stdout:"",stderr:`mv: missing destination file operand
@@ -122,7 +122,7 @@ Options:
122
122
  `,d=1;continue}if(x==="unknown"){f+=`mv: cannot safely determine whether '${y}' is inside '${m}'
123
123
  `,d=1;continue}}if(s)try{await t.fs.stat(y);continue}catch{}let w=await Oa(t.fs,g,y);if(w==="same")continue;if(w==="unknown"){f+=`mv: cannot safely determine whether '${m}' and '${y}' are the same file
124
124
  `,d=1;continue}if(b.isDirectory&&await Ar({fs:t.fs,root:g,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"mv",symlinks:"never",budget:p},()=>{}),await t.fs.mv(g,y),i){let x=h?`${a}/${m.split("/").pop()||m}`:a;u+=`renamed '${m}' -> '${x}'
125
- `}}catch(g){if(g instanceof C||g instanceof _e)throw g;let b=dt(g);ht(g,"ENOENT")?f+=`mv: cannot stat '${m}': No such file or directory
125
+ `}}catch(g){if(g instanceof C||g instanceof Fe)throw g;let b=dt(g);ht(g,"ENOENT")?f+=`mv: cannot stat '${m}': No such file or directory
126
126
  `:ht(g,"EROFS")?f+=`mv: cannot move '${m}' to '${a}': Read-only file system
127
127
  `:f+=`mv: cannot move '${m}': ${b}
128
128
  `,d=1}return{stdout:u,stderr:f,exitCode:d}}},zx={name:"mv",flags:[{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var U1={};ae(U1,{flagsForFuzzing:()=>Hx,lnCommand:()=>jx});var Wx,jx,Hx,z1=F(()=>{"use strict";Tn();de();Un();Wx={name:"ln",summary:"make links between files",usage:"ln [OPTIONS] TARGET LINK_NAME",options:["-s create a symbolic link instead of a hard link","-f remove existing destination files","-n treat LINK_NAME as a normal file if it is a symbolic link to a directory","-v print name of each linked file"," --help display this help and exit"]},jx={name:"ln",async execute(e,t){if(Z(e))return q(Wx);let n=!1,r=!1,s=!1,i=0;for(;i<e.length&&e[i].startsWith("-");){let f=e[i];if(f==="-s"||f==="--symbolic")n=!0,i++;else if(f==="-f"||f==="--force")r=!0,i++;else if(f==="-v"||f==="--verbose")s=!0,i++;else if(f==="-n"||f==="--no-dereference")i++;else if(/^-[sfvn]+$/.test(f))f.includes("s")&&(n=!0),f.includes("f")&&(r=!0),f.includes("v")&&(s=!0),i++;else if(f==="--"){i++;break}else return se("ln",f)}let o=e.slice(i);if(o.length<2)return{stdout:"",stderr:`ln: missing file operand
@@ -132,7 +132,7 @@ Options:
132
132
  `,exitCode:1};try{if(n)await t.fs.symlink(a,c);else{let f=t.fs.resolvePath(t.cwd,a);if(!await t.fs.exists(f))return{stdout:"",stderr:`ln: failed to access '${a}': No such file or directory
133
133
  `,exitCode:1};await t.fs.link(f,c)}}catch(f){return ht(f,"EPERM")?{stdout:"",stderr:n?`ln: failed to create symbolic link '${l}': Operation not permitted
134
134
  `:`ln: '${a}': hard link not allowed for directory
135
- `,exitCode:1}:{stdout:"",stderr:`ln: ${Ge(f instanceof me?f.bareMessage:f instanceof Error?f.message:String(f))}
135
+ `,exitCode:1}:{stdout:"",stderr:`ln: ${Ze(f instanceof me?f.bareMessage:f instanceof Error?f.message:String(f))}
136
136
  `,exitCode:1}}let u="";return s&&(u=`'${l}' -> '${a}'
137
137
  `),{stdout:u,stderr:"",exitCode:0}}},Hx={name:"ln",flags:[{flag:"-s",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2}});var W1={};ae(W1,{chmodCommand:()=>qx,flagsForFuzzing:()=>Zx});async function Gx(e,t,n,r,s,i){let o=new Dt({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"});await Ar({fs:e.fs,root:t,symlinks:"never",budget:o,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"chmod"},async a=>{if(a.depth===0||a.phase!=="enter")return;let l=n!==void 0?n:r!==void 0?wu(r,a.stat.mode):420;await e.fs.chmod(a.path,l),s&&i.append(`mode of '${a.path}' changed to ${l.toString(8).padStart(4,"0")}
138
138
  `)})}function wu(e,t=420){if(/^[0-7]+$/.test(e))return parseInt(e,8);let n=t&4095,r=e.split(",");for(let s of r){let i=s.match(/^([ugoa]*)([+\-=])([rwxXst]*)$/);if(!i)throw new Error(`Invalid mode: ${e}`);let o=i[1]||"a",a=i[2],l=i[3];(o==="a"||o==="")&&(o="ugo");let c=0;l.includes("r")&&(c|=4),l.includes("w")&&(c|=2),(l.includes("x")||l.includes("X"))&&(c|=1);let u=0;l.includes("s")&&(o.includes("u")&&(u|=2048),o.includes("g")&&(u|=1024)),l.includes("t")&&(u|=512);for(let f of o){let d=0;f==="u"?d=6:f==="g"?d=3:f==="o"&&(d=0);let p=c<<d;a==="+"?n|=p:a==="-"?n&=~p:a==="="&&(n&=~(7<<d),f==="u"&&(n&=-2049),f==="g"&&(n&=-1025),f==="o"&&(n&=-513),n|=p)}a==="+"?n|=u:a==="-"?n&=~u:a==="="&&(l.includes("s")&&(o.includes("u")&&(n|=u&2048),o.includes("g")&&(n|=u&1024)),l.includes("t")&&(n|=u&512))}return n}var Vx,qx,Zx,j1=F(()=>{"use strict";St();vt();Wn();de();Vx={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},qx={name:"chmod",async execute(e,t){if(Z(e))return q(Vx);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
@@ -144,7 +144,7 @@ Options:
144
144
  `,stderr:"",exitCode:0}}},Xx={name:"pwd",flags:[{flag:"-P",type:"boolean"},{flag:"-L",type:"boolean"}]}});var q1={};ae(q1,{flagsForFuzzing:()=>Jx,readlinkCommand:()=>Yx});var Qx,Yx,Jx,G1=F(()=>{"use strict";Wn();G();de();Qx={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},Yx={name:"readlink",async execute(e,t){if(Z(e))return q(Qx);let n=!1,r=0;for(;r<e.length&&e[r].startsWith("-");){let l=e[r];if(l==="-f"||l==="--canonicalize")n=!0,r++;else if(l==="--"){r++;break}else return se("readlink",l)}let s=e.slice(r);if(s.length===0)return{stdout:"",stderr:`readlink: missing operand
145
145
  `,exitCode:1};let i="",o=!1,a=new Dt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"readlink",label:"symlink traversal"});for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{if(n){let u=c,f=new Set;for(;a.visit(f.size),!f.has(u);){f.add(u);try{let d=await t.fs.readlink(u);if(d.startsWith("/"))u=d;else{let p=u.substring(0,u.lastIndexOf("/"))||"/";u=t.fs.resolvePath(p,d)}}catch{break}}i+=`${u}
146
146
  `}else{let u=await t.fs.readlink(c);i+=`${u}
147
- `}}catch(u){if(u instanceof C||u instanceof _e)throw u;n?i+=`${c}
147
+ `}}catch(u){if(u instanceof C||u instanceof Fe)throw u;n?i+=`${c}
148
148
  `:o=!0}}return{stdout:i,stderr:"",exitCode:o?1:0}}},Jx={name:"readlink",flags:[{flag:"-f",type:"boolean"},{flag:"-e",type:"boolean"}],needsArgs:!0}});function $a(e,t){let n=10,r=null,s=!1,i=!1,o=!1,a=[];for(let l=0;l<e.length;l++){let c=e[l];if(c==="-n"&&l+1<e.length){let u=e[++l];t==="tail"&&u.startsWith("+")?(o=!0,n=parseInt(u.slice(1),10)):n=parseInt(u,10)}else if(t==="tail"&&c.startsWith("-n+"))o=!0,n=parseInt(c.slice(3),10);else if(c.startsWith("-n"))n=parseInt(c.slice(2),10);else if(c==="-c"&&l+1<e.length)r=parseInt(e[++l],10);else if(c.startsWith("-c"))r=parseInt(c.slice(2),10);else if(c.startsWith("--bytes="))r=parseInt(c.slice(8),10);else if(c.startsWith("--lines="))n=parseInt(c.slice(8),10);else if(c==="-q"||c==="--quiet"||c==="--silent")s=!0;else if(c==="-v"||c==="--verbose")i=!0;else if(c.match(/^-\d+$/))n=parseInt(c.slice(1),10);else{if(c.startsWith("--"))return{ok:!1,error:se(t,c)};if(c.startsWith("-")&&c!=="-")return{ok:!1,error:se(t,c)};a.push(c)}}return r!==null&&(Number.isNaN(r)||r<0)?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of bytes
149
149
  `,exitCode:1}}:Number.isNaN(n)||n<0?{ok:!1,error:{stdout:"",stderr:`${t}: invalid number of lines
150
150
  `,exitCode:1}}:{ok:!0,options:{lines:n,bytes:r,quiet:s,verbose:i,files:a,fromLine:o}}}async function Ra(e,t,n,r){let{quiet:s,verbose:i,files:o}=t;if(o.length>e.limits.maxArrayElements)throw new C(`${n}: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(o.length===0)return{stdout:r(e.stdin),stderr:"",exitCode:0,stdoutEncoding:"binary"};let a=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),l=new $e(a,n),c=new $e(a,n),u=0,f=0,d=i||!s&&o.length>1,p=0;for(let h=0;h<o.length;h++){let m=o[h];try{let g=e.fs.resolvePath(e.cwd,m);if((await e.fs.stat(g)).size>e.limits.maxInputBytes-f)throw new C(`${n}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");let y=await Ht(e.fs,g);if(y.length>e.limits.maxInputBytes-f)throw new C(`${n}: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");f+=y.length,e.executionScope?.consumeInput(y.length,n),d&&(p>0&&l.append(`
@@ -165,32 +165,32 @@ Options:
165
165
  Access: (${h}/${m})
166
166
  Modify: ${p.mtime.toISOString()}
167
167
  `)}}catch(p){ge(p),o+=`stat: cannot stat '${f}': No such file or directory
168
- `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},p9={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var te,j,P,jn,ve,je,Cm,rs,Pa,Su,Si,kr,Au,Cu,gt,Ai,ot,ku,or,vu,Nu,Ie,Iu,Da,wo,h9,m9,Ou,Tu,H,$u,Ei,Ru,Pu,We,im,om,am,lm,cm,um,fm,dm,pm,hm,mm,gm,ym,wm,bm,xm,Em,Sm,Am,Cr,bo,Du,Lu,Fu,Mu,_u,zr,km=F(()=>{te=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},j=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
169
- `,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(t){let n=String.fromCodePoint(t).toUpperCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}static toLowerCase(t){let n=String.fromCodePoint(t).toLowerCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}},P=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let n=t*this.SIZE;return[this.data[n],this.data[n+1],this.data[n+2]]}get length(){return this.data.length/this.SIZE}},jn=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 P(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 P(new Uint32Array([0,31,1,127,159,1]));static Cf=new P(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 P(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new P(new Uint32Array([55296,57343,1]));static L=new P(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 P(new Uint32Array([837,837,1]));static Ll=new P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new P(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 P(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static N=new P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new P(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 P(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 P(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new P(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new P(new Uint32Array([8232,8232,1]));static Zp=new P(new Uint32Array([8233,8233,1]));static Zs=new P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new P(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new P(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new P(new Uint32Array([82944,83526,1]));static Arabic=new P(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 P(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new P(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new P(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new P(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new P(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new P(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new P(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 P(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new P(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new P(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new P(new Uint32Array([10240,10495,1]));static Buginese=new P(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new P(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new P(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new P(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new P(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new P(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new P(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new P(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new P(new Uint32Array([69552,69579,1]));static Common=new P(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 P(new Uint32Array([924,956,32]));static Coptic=new P(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new P(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new P(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new P(new Uint32Array([77712,77810,1]));static Cyrillic=new P(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 P(new Uint32Array([66560,66639,1]));static Devanagari=new P(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new P(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 P(new Uint32Array([71680,71739,1]));static Duployan=new P(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new P(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new P(new Uint32Array([66816,66855,1]));static Elymaic=new P(new Uint32Array([69600,69622,1]));static Ethiopic=new P(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 P(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new P(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 P(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new P(new Uint32Array([66352,66378,1]));static Grantha=new P(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 P(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 P(new Uint32Array([181,837,656]));static Gujarati=new P(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 P(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new P(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 P(new Uint32Array([90368,90425,1]));static Han=new P(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 P(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 P(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new P(new Uint32Array([5920,5940,1]));static Hatran=new P(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new P(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 P(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new P(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new P(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new P(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new P(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new P(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new P(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 P(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 P(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new P(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new P(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 P(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new P(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new P(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new P(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new P(new Uint32Array([93504,93561,1]));static Lao=new P(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 P(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 P(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new P(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new P(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new P(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 P(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new P(new Uint32Array([66176,66204,1]));static Lydian=new P(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new P(new Uint32Array([69968,70006,1]));static Makasar=new P(new Uint32Array([73440,73464,1]));static Malayalam=new P(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 P(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new P(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new P(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new P(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 P(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new P(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new P(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new P(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new P(new Uint32Array([67968,67999,1]));static Miao=new P(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new P(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new P(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new P(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new P(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new P(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new P(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new P(new Uint32Array([124112,124153,1]));static Nandinagari=new P(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new P(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new P(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new P(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new P(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new P(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new P(new Uint32Array([5760,5788,1]));static Ol_Chiki=new P(new Uint32Array([7248,7295,1]));static Ol_Onal=new P(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new P(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new P(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new P(new Uint32Array([68224,68255,1]));static Old_Permic=new P(new Uint32Array([66384,66426,1]));static Old_Persian=new P(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new P(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new P(new Uint32Array([68192,68223,1]));static Old_Turkic=new P(new Uint32Array([68608,68680,1]));static Old_Uyghur=new P(new Uint32Array([69488,69513,1]));static Oriya=new P(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 P(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new P(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new P(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new P(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new P(new Uint32Array([72384,72440,1]));static Phags_Pa=new P(new Uint32Array([43072,43127,1]));static Phoenician=new P(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new P(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new P(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new P(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new P(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new P(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new P(new Uint32Array([70016,70111,1]));static Shavian=new P(new Uint32Array([66640,66687,1]));static Siddham=new P(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new P(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new P(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 P(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new P(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new P(new Uint32Array([72272,72354,1]));static Sundanese=new P(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new P(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new P(new Uint32Array([43008,43052,1]));static Syriac=new P(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new P(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new P(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new P(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new P(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new P(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new P(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new P(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 P(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new P(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new P(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 P(new Uint32Array([1920,1969,1]));static Thai=new P(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new P(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 P(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new P(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new P(new Uint32Array([67008,67059,1]));static Toto=new P(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new P(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 P(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new P(new Uint32Array([42240,42539,1]));static Vithkuqi=new P(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 P(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new P(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new P(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new P(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new P(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 P(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]))},ve=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(t,n){let r=0,s=t.length;for(;r<s;){let i=r+Math.floor((s-r)/2),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){let l=t.getStride(i);return(n-o)%l===0}n<o?s=i:r=i+1}return!1}static is(t,n){if(n<=this.MAX_LATIN1){for(let r=0;r<t.length;r++){let s=t.getHi(r);if(n>s)continue;let i=t.getLo(r);if(n<i)return!1;let o=t.getStride(r);return(n-i)%o===0}return!1}return t.length>0&&n>=t.getLo(0)&&this.is32(t,n)}static isUpper(t){if(t<=this.MAX_LATIN1){let n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return this.is(jn.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(jn.Print,t)}static simpleFold(t){if(jn.CASE_ORBIT.has(t))return jn.CASE_ORBIT.get(t);let n=j.toLowerCase(t);return n!==t?n:j.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t<0||n<0||t===n)return!0;if(t<=this.MAX_ASCII&&n<=this.MAX_ASCII)return j.CODES.get("A")<=t&&t<=j.CODES.get("Z")&&(t|=32),j.CODES.get("A")<=n&&n<=j.CODES.get("Z")&&(n|=32),t===n;for(let r=this.simpleFold(t);r!==t;r=this.simpleFold(r))if(r===n)return!0;return!1}},je=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(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")||j.CODES.get("a")<=t&&t<=j.CODES.get("z")||j.CODES.get("A")<=t&&t<=j.CODES.get("Z")}static unhex(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")?t-j.CODES.get("0"):j.CODES.get("a")<=t&&t<=j.CODES.get("f")?t-j.CODES.get("a")+10:j.CODES.get("A")<=t&&t<=j.CODES.get("F")?t-j.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(ve.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case j.CODES.get('"'):n+='\\"';break;case j.CODES.get("\\"):n+="\\\\";break;case j.CODES.get(" "):n+="\\t";break;case j.CODES.get(`
168
+ `,a=!0}}return{stdout:i,stderr:o,exitCode:a?1:0}}},p9={name:"stat",flags:[{flag:"-c",type:"value",valueHint:"format"},{flag:"-L",type:"boolean"}],needsArgs:!0}});var te,j,P,jn,ve,He,Cm,rs,Pa,Su,Si,kr,Au,Cu,gt,Ai,ot,ku,or,vu,Nu,Ie,Iu,Da,wo,h9,m9,Ou,Tu,H,$u,Ei,Ru,Pu,je,im,om,am,lm,cm,um,fm,dm,pm,hm,mm,gm,ym,wm,bm,xm,Em,Sm,Am,Cr,bo,Du,Lu,Fu,Mu,_u,zr,km=F(()=>{te=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},j=class{static CODES=new Map([["\x07",7],["\b",8],[" ",9],[`
169
+ `,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(t){let n=String.fromCodePoint(t).toUpperCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toLowerCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}static toLowerCase(t){let n=String.fromCodePoint(t).toLowerCase();if(n.length>1)return t;let r=String.fromCodePoint(n.codePointAt(0)).toUpperCase();return r.length>1||r.codePointAt(0)!==t?t:n.codePointAt(0)}},P=class{SIZE=3;constructor(t){this.data=t}getLo(t){return this.data[t*this.SIZE]}getHi(t){return this.data[t*this.SIZE+1]}getStride(t){return this.data[t*this.SIZE+2]}get(t){let n=t*this.SIZE;return[this.data[n],this.data[n+1],this.data[n+2]]}get length(){return this.data.length/this.SIZE}},jn=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 P(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 P(new Uint32Array([0,31,1,127,159,1]));static Cf=new P(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 P(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new P(new Uint32Array([55296,57343,1]));static L=new P(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 P(new Uint32Array([837,837,1]));static Ll=new P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new P(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 P(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static N=new P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new P(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 P(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 P(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new P(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new P(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 P(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 P(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 P(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 P(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 P(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 P(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 P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new P(new Uint32Array([8232,8232,1]));static Zp=new P(new Uint32Array([8233,8233,1]));static Zs=new P(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new P(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new P(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new P(new Uint32Array([82944,83526,1]));static Arabic=new P(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 P(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new P(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new P(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new P(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new P(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new P(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new P(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 P(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new P(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new P(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new P(new Uint32Array([10240,10495,1]));static Buginese=new P(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new P(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new P(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new P(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new P(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new P(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new P(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new P(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new P(new Uint32Array([69552,69579,1]));static Common=new P(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 P(new Uint32Array([924,956,32]));static Coptic=new P(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new P(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new P(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new P(new Uint32Array([77712,77810,1]));static Cyrillic=new P(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 P(new Uint32Array([66560,66639,1]));static Devanagari=new P(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new P(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 P(new Uint32Array([71680,71739,1]));static Duployan=new P(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new P(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new P(new Uint32Array([66816,66855,1]));static Elymaic=new P(new Uint32Array([69600,69622,1]));static Ethiopic=new P(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 P(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new P(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 P(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new P(new Uint32Array([66352,66378,1]));static Grantha=new P(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 P(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 P(new Uint32Array([181,837,656]));static Gujarati=new P(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 P(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new P(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 P(new Uint32Array([90368,90425,1]));static Han=new P(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 P(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 P(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new P(new Uint32Array([5920,5940,1]));static Hatran=new P(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new P(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 P(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new P(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new P(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 P(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new P(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new P(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new P(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new P(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new P(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 P(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 P(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new P(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new P(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 P(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new P(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new P(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new P(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new P(new Uint32Array([93504,93561,1]));static Lao=new P(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 P(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 P(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new P(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new P(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new P(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 P(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new P(new Uint32Array([66176,66204,1]));static Lydian=new P(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new P(new Uint32Array([69968,70006,1]));static Makasar=new P(new Uint32Array([73440,73464,1]));static Malayalam=new P(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 P(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new P(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new P(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new P(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 P(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new P(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new P(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new P(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new P(new Uint32Array([67968,67999,1]));static Miao=new P(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new P(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new P(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new P(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new P(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new P(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new P(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new P(new Uint32Array([124112,124153,1]));static Nandinagari=new P(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new P(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new P(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new P(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new P(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new P(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new P(new Uint32Array([5760,5788,1]));static Ol_Chiki=new P(new Uint32Array([7248,7295,1]));static Ol_Onal=new P(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new P(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new P(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new P(new Uint32Array([68224,68255,1]));static Old_Permic=new P(new Uint32Array([66384,66426,1]));static Old_Persian=new P(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new P(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new P(new Uint32Array([68192,68223,1]));static Old_Turkic=new P(new Uint32Array([68608,68680,1]));static Old_Uyghur=new P(new Uint32Array([69488,69513,1]));static Oriya=new P(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 P(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new P(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new P(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new P(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new P(new Uint32Array([72384,72440,1]));static Phags_Pa=new P(new Uint32Array([43072,43127,1]));static Phoenician=new P(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new P(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new P(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new P(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new P(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new P(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new P(new Uint32Array([70016,70111,1]));static Shavian=new P(new Uint32Array([66640,66687,1]));static Siddham=new P(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new P(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new P(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 P(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new P(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new P(new Uint32Array([72272,72354,1]));static Sundanese=new P(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new P(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new P(new Uint32Array([43008,43052,1]));static Syriac=new P(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new P(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new P(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new P(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new P(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new P(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new P(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new P(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 P(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new P(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new P(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 P(new Uint32Array([1920,1969,1]));static Thai=new P(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new P(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 P(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new P(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new P(new Uint32Array([67008,67059,1]));static Toto=new P(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new P(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 P(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new P(new Uint32Array([42240,42539,1]));static Vithkuqi=new P(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 P(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new P(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new P(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new P(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new P(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 P(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]))},ve=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(t,n){let r=0,s=t.length;for(;r<s;){let i=r+Math.floor((s-r)/2),o=t.getLo(i),a=t.getHi(i);if(o<=n&&n<=a){let l=t.getStride(i);return(n-o)%l===0}n<o?s=i:r=i+1}return!1}static is(t,n){if(n<=this.MAX_LATIN1){for(let r=0;r<t.length;r++){let s=t.getHi(r);if(n>s)continue;let i=t.getLo(r);if(n<i)return!1;let o=t.getStride(r);return(n-i)%o===0}return!1}return t.length>0&&n>=t.getLo(0)&&this.is32(t,n)}static isUpper(t){if(t<=this.MAX_LATIN1){let n=String.fromCodePoint(t);return n.toUpperCase()===n&&n.toLowerCase()!==n}return this.is(jn.Upper,t)}static isPrint(t){return t<=this.MAX_LATIN1?t>=32&&t<this.MAX_ASCII||t>=161&&t!==173:this.is(jn.Print,t)}static simpleFold(t){if(jn.CASE_ORBIT.has(t))return jn.CASE_ORBIT.get(t);let n=j.toLowerCase(t);return n!==t?n:j.toUpperCase(t)}static equalsIgnoreCase(t,n){if(t<0||n<0||t===n)return!0;if(t<=this.MAX_ASCII&&n<=this.MAX_ASCII)return j.CODES.get("A")<=t&&t<=j.CODES.get("Z")&&(t|=32),j.CODES.get("A")<=n&&n<=j.CODES.get("Z")&&(n|=32),t===n;for(let r=this.simpleFold(t);r!==t;r=this.simpleFold(r))if(r===n)return!0;return!1}},He=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(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")||j.CODES.get("a")<=t&&t<=j.CODES.get("z")||j.CODES.get("A")<=t&&t<=j.CODES.get("Z")}static unhex(t){return j.CODES.get("0")<=t&&t<=j.CODES.get("9")?t-j.CODES.get("0"):j.CODES.get("a")<=t&&t<=j.CODES.get("f")?t-j.CODES.get("a")+10:j.CODES.get("A")<=t&&t<=j.CODES.get("F")?t-j.CODES.get("A")+10:-1}static escapeRune(t){let n="";if(ve.isPrint(t))this.METACHARACTERS.indexOf(String.fromCodePoint(t))>=0&&(n+="\\"),n+=String.fromCodePoint(t);else switch(t){case j.CODES.get('"'):n+='\\"';break;case j.CODES.get("\\"):n+="\\\\";break;case j.CODES.get(" "):n+="\\t";break;case j.CODES.get(`
170
170
  `):n+="\\n";break;case j.CODES.get("\r"):n+="\\r";break;case j.CODES.get("\b"):n+="\\b";break;case j.CODES.get("\f"):n+="\\f";break;default:{let r=t.toString(16);t<256?(n+="\\x",r.length===1&&(n+="0"),n+=r):n+=`\\x{${r}}`;break}}return n}static stringToRunes(t){return String(t).split("").map(n=>n.codePointAt(0))}static runeToString(t){return String.fromCodePoint(t)}static isWordRune(t){return j.CODES.get("a")<=t&&t<=j.CODES.get("z")||j.CODES.get("A")<=t&&t<=j.CODES.get("Z")||j.CODES.get("0")<=t&&t<=j.CODES.get("9")||t===j.CODES.get("_")}static emptyOpContext(t,n){let r=0;return t<0&&(r|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),t===j.CODES.get(`
171
171
  `)&&(r|=this.EMPTY_BEGIN_LINE),n<0&&(r|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),n===j.CODES.get(`
172
- `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ve.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},Cm=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},rs=class e{static Encoding=Cm(["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}},Pa=class extends rs{constructor(t=null){super(),this.bytes=t}getEncoding(){return rs.Encoding.UTF_8}asCharSequence(){return je.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Su=class extends rs{constructor(t=null){super(),this.charSequence=t}getEncoding(){return rs.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},Si=class{static utf16(t){return new Su(t)}static utf8(t){return Array.isArray(t)?new Pa(t):new Pa(je.stringToUtf8ByteArray(t))}},kr=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Au=class extends kr{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return kr.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return je.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},Cu=class extends kr{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|je.charCount(n)}else return kr.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return je.emptyOpContext(n,r)}},gt=class{static fromUTF8(t,n=0,r=t.length){return new Au(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new Cu(t,n,r)}},Ai=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},ot=class extends Ai{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},ku=class extends Ai{constructor(t){super(t),this.name="RE2JSCompileException"}},or=class extends Ai{constructor(t){super(t),this.name="RE2JSGroupException"}},vu=class extends Ai{constructor(t){super(t),this.name="RE2JSFlagsException"}},Nu=class{static quoteReplacement(t){return t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(n=>{let r=n.codePointAt(0);return r===j.CODES.get("\\")||r===j.CODES.get("$")?`\\${n}`:n}).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof rs?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(Si.utf8(n)):this.resetMatcherInput(Si.utf16(n))}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(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new or(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new or(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new or(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new or(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new or("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new or("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,te.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,te.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new or(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,te.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?je.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalPerl(t):this.appendReplacementInternal(t),r}appendReplacementInternal(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===j.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("0")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount)throw new or(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get("}")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get("}"))throw new or("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalPerl(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(j.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(j.CODES.get("1")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get(">")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},Ie=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(t){let n='"';for(let r of t)n+=je.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&te.FOLD_CASE)!==0?ve.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}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&te.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 new Error("unhandled case in Inst.toString")}}},Iu=class{constructor(){this.inst=null,this.cap=[]}},Da=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},wo=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Da(n.prog.numInst()),n.q1=new Da(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(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?je.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new Iu,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===je.EMPTY_ALL||(r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==kr.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let d;for(n===0?d=je.emptyOpContext(-1,l):d=t.context(n);;){if(i.isEmpty()){if((s&je.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===te.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,d,null));let p=n+c;if(d=t.context(p),this.step(i,o,n,p,l,d,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let h=i;i=o,o=h}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let d=f.inst,p=!1;switch(d.op){case Ie.MATCH:if(a===te.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case Ie.RUNE:p=d.matchRune(i);break;case Ie.RUNE1:p=i===d.runes[0];break;case Ie.RUNE_ANY:p=!0;break;case Ie.RUNE_ANY_NOT_NL:p=i!==j.CODES.get(`
173
- `);break;default:throw new Error("bad inst")}p&&(f=this.add(n,d.out,s,f.cap,o,f)),f!==null&&(this.freeThread(f),t.denseThreads[u]=null)}t.clear()}add(t,n,r,s,i,o){if(n===0||t.contains(n))return o;let a=t.add(n),l=this.prog.inst[n];switch(l.op){case Ie.FAIL:break;case Ie.ALT:case Ie.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case Ie.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case Ie.NOP:o=this.add(t,l.out,r,s,i,o);break;case Ie.CAPTURE:if(l.arg<this.ncap){let c=s[l.arg];s[l.arg]=r,this.add(t,l.out,r,s,i,null),s[l.arg]=c}else o=this.add(t,l.out,r,s,i,o);break;case Ie.MATCH:case Ie.RUNE:case Ie.RUNE1:case Ie.RUNE_ANY:case Ie.RUNE_ANY_NOT_NL:o===null?o=this.alloc(l):o.inst=l,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),t.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}},h9=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},m9=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ou=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(ve.MAX_ASCII+1).fill(null),this.nextMap=new Map}},Tu=class{constructor(t){this.prog=t,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=1e4}computeClosure(t){let n=new Set,r=[...t],s=!1;for(;r.length>0;){let o=r.pop();if(n.has(o))continue;n.add(o);let a=this.prog.getInst(o);switch(a.op){case Ie.MATCH:s=!0;break;case Ie.ALT:case Ie.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case Ie.NOP:case Ie.CAPTURE:r.push(a.out);break;case Ie.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(n).sort(),isMatch:s}}getState(t){let n=this.computeClosure(t);if(!n)return null;let r=n.pcs,s=h9(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(m9(l.nfaStates,r))return l}else i=[],this.stateCache.set(s,i);if(this.stateCount>=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let o=new Ou(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===te.UNANCHORED&&n<=ve.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===te.UNANCHORED?0:ve.MAX_RUNE+1);if(t.nextMap.has(o))return t.nextMap.get(o)}let s=[];for(let o=0;o<t.nfaStates.length;o++){let a=t.nfaStates[o],l=this.prog.getInst(a);Ie.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===te.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===te.UNANCHORED&&n<=ve.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===te.UNANCHORED?0:ve.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=t.endPos(),i=this.startState;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(n===s)return!0}else return!0;let o=n;for(;o<s;){let a=t.step(o),l=a>>3,c=a&7;if(c===0)break;if(i=this.step(i,l,r),i===null)return null;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==te.UNANCHORED)return!1;o+=c}return!1}},H=class e{static Op=Cm(["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(t){return t===j.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&te.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 n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case e.Op.LITERAL:(this.flags&te.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=je.escapeRune(n);(this.flags&te.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&te.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";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]===ve.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,s=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=je.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=je.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],s=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=je.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=je.escapeRune(s))}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 n of this.subs){let r=n.maxCap();t<r&&(t=r)}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&te.WAS_DOLLAR)!==(t.flags&te.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 n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break}case e.Op.ALTERNATE:case e.Op.CONCAT:{if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break}case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.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}},$u=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new Ie(t))}skipNop(t){let n=this.inst[t];for(;n.op===Ie.NOP||n.op===Ie.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!Ie.isRuneOp(n.op)||n.runes.length!==1)return[n.op===Ie.MATCH,t];for(;Ie.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&te.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===Ie.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case Ie.EMPTY_WIDTH:t|=r.arg;break;case Ie.FAIL:return-1;case Ie.CAPTURE:case Ie.NOP:break;default:break e}n=r.out}return t}next(t){let n=this.inst[t>>1];return(t&1)===0?n.out:n.arg}patch(t,n){for(;t!==0;){let r=this.inst[t>>1];(t&1)===0?(t=r.out,r.out=n):(t=r.arg,r.arg=n)}}append(t,n){if(t===0)return n;if(n===0)return t;let r=t;for(;;){let i=this.next(r);if(i===0)break;r=i}let s=this.inst[r>>1];return(r&1)===0?s.out=n:s.arg=n,t}toString(){let t="";for(let n=0;n<this.inst.length;n++){let r=t.length;t+=n,n===this.start&&(t+="*"),t+=" ".substring(t.length-r),t+=this.inst[n],t+=`
172
+ `)&&(r|=this.EMPTY_END_LINE),this.isWordRune(t)!==this.isWordRune(n)?r|=this.EMPTY_WORD_BOUNDARY:r|=this.EMPTY_NO_WORD_BOUNDARY,r}static quoteMeta(t){return t.split("").map(n=>this.METACHARACTERS.indexOf(n)>=0?`\\${n}`:n).join("")}static charCount(t){return t>ve.MAX_BMP?2:1}static stringToUtf8ByteArray(t){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(t));{let n=[],r=0;for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=i&63|128):(i&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++s)&1023),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=i&63|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=i&63|128)}return n}}static utf8ByteArrayToString(t){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(t));{let n=[],r=0,s=0;for(;r<t.length;){let i=t[r++];if(i<128)n[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=t[r++];n[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=t[r++],a=t[r++],l=t[r++],c=((i&7)<<18|(o&63)<<12|(a&63)<<6|l&63)-65536;n[s++]=String.fromCharCode(55296+(c>>10)),n[s++]=String.fromCharCode(56320+(c&1023))}else{let o=t[r++],a=t[r++];n[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return n.join("")}}},Cm=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let s=e[r],i=t+r;n[s]=i,n[i]=s}return Object.freeze(n)},rs=class e{static Encoding=Cm(["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}},Pa=class extends rs{constructor(t=null){super(),this.bytes=t}getEncoding(){return rs.Encoding.UTF_8}asCharSequence(){return He.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Su=class extends rs{constructor(t=null){super(),this.charSequence=t}getEncoding(){return rs.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(t=>t.codePointAt(0))}length(){return this.charSequence.length}},Si=class{static utf16(t){return new Su(t)}static utf8(t){return Array.isArray(t)?new Pa(t):new Pa(He.stringToUtf8ByteArray(t))}},kr=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Au=class extends kr{constructor(t,n=0,r=t.length){super(),this.bytes=t,this.start=n,this.end=r}step(t){if(t+=this.start,t>=this.end)return kr.EOF();let n=this.bytes[t++]&255;return(n&128)===0?n<<3|1:(n&224)===192?(n=n&31,t>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n<<3|2)):(n&240)===224?(n=n&15,t+1>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|3)):(n=n&7,t+2>=this.end?kr.EOF():(n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n=n<<6|this.bytes[t++]&63,n<<3|4))}index(t,n){n+=this.start;let r=this.indexOf(this.bytes,t.prefixUTF8,n);return r<0?r:r-n}context(t){t+=this.start;let n=-1;if(t>this.start&&t<=this.end){let s=t-1;if(n=this.bytes[s--],n>=128){let i=t-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),n=this.step(s)>>3}}let r=t<this.end?this.step(t)>>3:-1;return He.emptyOpContext(n,r)}indexOf(t,n,r=0){let s=n.length;if(s===0)return-1;let i=t.length;for(let o=r;o<=i-s;o++)for(let a=0;a<s&&t[o+a]===n[a];a++)if(a===s-1)return o;return-1}},Cu=class extends kr{constructor(t,n=0,r=t.length){super(),this.charSequence=t,this.start=n,this.end=r}step(t){if(t+=this.start,t<this.end){let n=this.charSequence.codePointAt(t);return n<<3|He.charCount(n)}else return kr.EOF()}index(t,n){n+=this.start;let r=this.charSequence.indexOf(t.prefix,n);return r<0?r:r-n}context(t){t+=this.start;let n=t>0&&t<=this.charSequence.length?this.charSequence.codePointAt(t-1):-1,r=t<this.charSequence.length?this.charSequence.codePointAt(t):-1;return He.emptyOpContext(n,r)}},gt=class{static fromUTF8(t,n=0,r=t.length){return new Au(t,n,r)}static fromUTF16(t,n=0,r=t.length){return new Cu(t,n,r)}},Ai=class extends Error{constructor(t){super(t),this.name="RE2JSException"}},ot=class extends Ai{constructor(t,n=null){let r=`error parsing regexp: ${t}`;n&&(r+=`: \`${n}\``),super(r),this.name="RE2JSSyntaxException",this.message=r,this.error=t,this.input=n}getDescription(){return this.error}getPattern(){return this.input}},ku=class extends Ai{constructor(t){super(t),this.name="RE2JSCompileException"}},or=class extends Ai{constructor(t){super(t),this.name="RE2JSGroupException"}},vu=class extends Ai{constructor(t){super(t),this.name="RE2JSFlagsException"}},Nu=class{static quoteReplacement(t){return t.indexOf("\\")<0&&t.indexOf("$")<0?t:t.split("").map(n=>{let r=n.codePointAt(0);return r===j.CODES.get("\\")||r===j.CODES.get("$")?`\\${n}`:n}).join("")}constructor(t,n){if(t===null)throw new Error("pattern is null");this.patternInput=t;let r=this.patternInput.re2();this.patternGroupCount=r.numberOfCapturingGroups(),this.groups=[],this.namedGroups=r.namedGroups,this.numberOfInstructions=r.numberOfInstructions(),n instanceof rs?this.resetMatcherInput(n):Array.isArray(n)?this.resetMatcherInput(Si.utf8(n)):this.resetMatcherInput(Si.utf16(n))}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(t){if(t===null)throw new Error("input is null");return this.matcherInput=t,this.reset(),this}start(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new or(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t]}end(t=0){if(typeof t=="string"){let n=this.namedGroups[t];if(!Number.isFinite(n))throw new or(`group '${t}' not found`);t=n}return this.loadGroup(t),this.groups[2*t+1]}programSize(){return this.numberOfInstructions}group(t=0){if(typeof t=="string"){let s=this.namedGroups[t];if(!Number.isFinite(s))throw new or(`group '${t}' not found`);t=s}let n=this.start(t),r=this.end(t);return n<0&&r<0?null:this.substring(n,r)}groupCount(){return this.patternGroupCount}loadGroup(t){if(t<0||t>this.patternGroupCount)throw new or(`Group index out of bounds: ${t}`);if(!this.hasMatch)throw new or("perhaps no match attempted");if(t===0||this.hasGroups)return;let n=this.groups[1]+1;n>this.matcherInputLength&&(n=this.matcherInputLength);let r=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],n,this.anchorFlag,1+this.patternGroupCount);if(!r[0])throw new or("inconsistency in matching group data");this.groups=r[1],this.hasGroups=!0}matches(){return this.genMatch(0,te.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,te.ANCHOR_START)}find(t=null){if(t!==null){if(t<0||t>this.matcherInputLength)throw new or(`start index out of bounds: ${t}`);return this.reset(),this.genMatch(t,0)}return t=0,this.hasMatch&&(t=this.groups[1],this.groups[0]===this.groups[1]&&t++),this.genMatch(t,te.UNANCHORED)}genMatch(t,n){let r=this.patternInput.re2().matchMachineInput(this.matcherInput,t,this.matcherInputLength,n,1);return r[0]?(this.groups=r[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=n,!0):!1}substring(t,n){return this.matcherInput.isUTF8Encoding()?He.utf8ByteArrayToString(this.matcherInput.asBytes().slice(t,n)):this.matcherInput.asCharSequence().substring(t,n).toString()}inputLength(){return this.matcherInputLength}appendReplacement(t,n=!1){let r="",s=this.start(),i=this.end();return this.appendPos<s&&(r+=this.substring(this.appendPos,s)),this.appendPos=i,r+=n?this.appendReplacementInternalPerl(t):this.appendReplacementInternal(t),r}appendReplacementInternal(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++){if(t.codePointAt(i)===j.CODES.get("\\")){r<i&&(n+=t.substring(r,i)),i++,r=i;continue}if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("0")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount)throw new or(`n > number of groups: ${a}`);let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("{")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get("}")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get("}"))throw new or("named capture group is missing trailing '}'");let l=t.substring(i+1,a);n+=this.group(l),r=a+1}}}return r<s&&(n+=t.substring(r,s)),n}appendReplacementInternalPerl(t){let n="",r=0,s=t.length;for(let i=0;i<s-1;i++)if(t.codePointAt(i)===j.CODES.get("$")){let o=t.codePointAt(i+1);if(j.CODES.get("$")===o){r<i&&(n+=t.substring(r,i)),n+="$",i++,r=i+1;continue}else if(j.CODES.get("&")===o){r<i&&(n+=t.substring(r,i));let a=this.group(0);a!==null?n+=a:n+="$&",i++,r=i+1;continue}else if(j.CODES.get("1")<=o&&o<=j.CODES.get("9")){let a=o-j.CODES.get("0");for(r<i&&(n+=t.substring(r,i)),i+=2;i<s&&(o=t.codePointAt(i),!(o<j.CODES.get("0")||o>j.CODES.get("9")||a*10+o-j.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-j.CODES.get("0");if(a>this.patternGroupCount){n+=`$${a}`,r=i,i--;continue}let l=this.group(a);l!==null&&(n+=l),r=i,i--;continue}else if(o===j.CODES.get("<")){r<i&&(n+=t.substring(r,i)),i++;let a=i+1;for(;a<t.length&&t.codePointAt(a)!==j.CODES.get(">")&&t.codePointAt(a)!==j.CODES.get(" ");)a++;if(a===t.length||t.codePointAt(a)!==j.CODES.get(">")){n+=t.substring(i-1,a+1),r=a+1;continue}let l=t.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,l)?n+=this.group(l):n+=`$<${l}>`,r=a+1}}return r<s&&(n+=t.substring(r,s)),n}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(t,n=!1){return this.replace(t,!0,n)}replaceFirst(t,n=!1){return this.replace(t,!1,n)}replace(t,n=!0,r=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(t,r),!!n););return s+=this.appendTail(),s}},Ie=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(t){let n='"';for(let r of t)n+=He.escapeRune(r);return n+='"',n}constructor(t){this.op=t,this.out=0,this.arg=0,this.runes=[]}matchRune(t){if(this.runes.length===1){let s=this.runes[0];return(this.arg&te.FOLD_CASE)!==0?ve.equalsIgnoreCase(s,t):t===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(t<this.runes[s])return!1;if(t<=this.runes[s+1])return!0}let n=0,r=this.runes.length/2|0;for(;n<r;){let s=n+((r-n)/2|0);if(this.runes[2*s]<=t){if(t<=this.runes[2*s+1])return!0;n=s+1}else r=s}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&te.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 new Error("unhandled case in Inst.toString")}}},Iu=class{constructor(){this.inst=null,this.cap=[]}},Da=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(t){let n=this.sparse[t];return n<this.size&&this.densePcs[n]===t}isEmpty(){return this.size===0}add(t){let n=this.size++;return this.sparse[t]=n,this.denseThreads[n]=null,this.densePcs[n]=t,n}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let t="{";for(let n=0;n<this.size;n++)n!==0&&(t+=", "),t+=this.densePcs[n];return t+="}",t}},wo=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Da(n.prog.numInst()),n.q1=new Da(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(t){this.ncap=t,t>this.matchcap.length?this.initNewCap(t):this.resetCap(t)}resetCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}}initNewCap(t){for(let n=0;n<this.poolSize;n++){let r=this.pool[n];r.cap=Array(t).fill(0)}this.matchcap=Array(t).fill(0)}submatches(){return this.ncap===0?He.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(t){let n;return this.poolSize>0?(this.poolSize--,n=this.pool[this.poolSize]):n=new Iu,n.inst=t,n}freeQueue(t,n=0){let r=t.size-n,s=this.poolSize+r;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=n;i<t.size;i++){let o=t.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}t.clear()}freeThread(t){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=t,this.poolSize++}match(t,n,r){let s=this.re2.cond;if(s===He.EMPTY_ALL||(r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=t.step(n),l=a>>3,c=a&7,u=-1,f=0;a!==kr.EOF()&&(a=t.step(n+c),u=a>>3,f=a&7);let d;for(n===0?d=He.emptyOpContext(-1,l):d=t.context(n);;){if(i.isEmpty()){if((s&He.EMPTY_BEGIN_TEXT)!==0&&n!==0||this.matched)break;if(this.re2.prefix.length!==0&&u!==this.re2.prefixRune&&t.canCheckPrefix()){let m=t.index(this.re2,n);if(m<0)break;n+=m,a=t.step(n),l=a>>3,c=a&7,a=t.step(n+c),u=a>>3,f=a&7}}!this.matched&&(n===0||r===te.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=n),this.add(i,this.prog.start,n,this.matchcap,d,null));let p=n+c;if(d=t.context(p),this.step(i,o,n,p,l,d,r,n===t.endPos()),c===0||this.ncap===0&&this.matched)break;n+=c,l=u,c=f,l!==-1&&(a=t.step(n+c),u=a>>3,f=a&7);let h=i;i=o,o=h}return this.freeQueue(o),this.matched}step(t,n,r,s,i,o,a,l){let c=this.re2.longest;for(let u=0;u<t.size;u++){let f=t.denseThreads[u];if(f===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<f.cap[0]){this.freeThread(f);continue}let d=f.inst,p=!1;switch(d.op){case Ie.MATCH:if(a===te.ANCHOR_BOTH&&!l)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<r)&&(f.cap[1]=r,this.matchcap=f.cap.slice(0,this.ncap)),c||this.freeQueue(t,u+1),this.matched=!0;break;case Ie.RUNE:p=d.matchRune(i);break;case Ie.RUNE1:p=i===d.runes[0];break;case Ie.RUNE_ANY:p=!0;break;case Ie.RUNE_ANY_NOT_NL:p=i!==j.CODES.get(`
173
+ `);break;default:throw new Error("bad inst")}p&&(f=this.add(n,d.out,s,f.cap,o,f)),f!==null&&(this.freeThread(f),t.denseThreads[u]=null)}t.clear()}add(t,n,r,s,i,o){if(n===0||t.contains(n))return o;let a=t.add(n),l=this.prog.inst[n];switch(l.op){case Ie.FAIL:break;case Ie.ALT:case Ie.ALT_MATCH:o=this.add(t,l.out,r,s,i,o),o=this.add(t,l.arg,r,s,i,o);break;case Ie.EMPTY_WIDTH:(l.arg&~i)===0&&(o=this.add(t,l.out,r,s,i,o));break;case Ie.NOP:o=this.add(t,l.out,r,s,i,o);break;case Ie.CAPTURE:if(l.arg<this.ncap){let c=s[l.arg];s[l.arg]=r,this.add(t,l.out,r,s,i,null),s[l.arg]=c}else o=this.add(t,l.out,r,s,i,o);break;case Ie.MATCH:case Ie.RUNE:case Ie.RUNE1:case Ie.RUNE_ANY:case Ie.RUNE_ANY_NOT_NL:o===null?o=this.alloc(l):o.inst=l,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),t.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}},h9=e=>{let t=-2128831035;for(let n=0;n<e.length;n++)t^=e[n],t=Math.imul(t,16777619);return t},m9=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ou=class{constructor(t,n){this.nfaStates=t,this.isMatch=n,this.nextAscii=new Array(ve.MAX_ASCII+1).fill(null),this.nextMap=new Map}},Tu=class{constructor(t){this.prog=t,this.stateCache=new Map,this.stateCount=0,this.startState=null,this.stateLimit=1e4}computeClosure(t){let n=new Set,r=[...t],s=!1;for(;r.length>0;){let o=r.pop();if(n.has(o))continue;n.add(o);let a=this.prog.getInst(o);switch(a.op){case Ie.MATCH:s=!0;break;case Ie.ALT:case Ie.ALT_MATCH:r.push(a.out),r.push(a.arg);break;case Ie.NOP:case Ie.CAPTURE:r.push(a.out);break;case Ie.EMPTY_WIDTH:return null}}return{pcs:Int32Array.from(n).sort(),isMatch:s}}getState(t){let n=this.computeClosure(t);if(!n)return null;let r=n.pcs,s=h9(r),i=this.stateCache.get(s);if(i)for(let a=0;a<i.length;a++){let l=i[a];if(m9(l.nfaStates,r))return l}else i=[],this.stateCache.set(s,i);if(this.stateCount>=this.stateLimit)return this.stateCache.clear(),this.stateCount=0,this.startState=null,null;let o=new Ou(r,n.isMatch);return i.push(o),this.stateCount++,o}step(t,n,r){if(r===te.UNANCHORED&&n<=ve.MAX_ASCII){let o=t.nextAscii[n];if(o!==null)return o}else{let o=n+(r===te.UNANCHORED?0:ve.MAX_RUNE+1);if(t.nextMap.has(o))return t.nextMap.get(o)}let s=[];for(let o=0;o<t.nfaStates.length;o++){let a=t.nfaStates[o],l=this.prog.getInst(a);Ie.isRuneOp(l.op)&&l.matchRune(n)&&s.push(l.out)}r===te.UNANCHORED&&s.push(this.prog.start);let i=this.getState(s);if(r===te.UNANCHORED&&n<=ve.MAX_ASCII)t.nextAscii[n]=i;else{let o=n+(r===te.UNANCHORED?0:ve.MAX_RUNE+1);t.nextMap.set(o,i)}return i}match(t,n,r){if((r===te.ANCHOR_START||r===te.ANCHOR_BOTH)&&n!==0)return!1;if(!this.startState&&(this.startState=this.getState([this.prog.start]),!this.startState))return null;let s=t.endPos(),i=this.startState;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(n===s)return!0}else return!0;let o=n;for(;o<s;){let a=t.step(o),l=a>>3,c=a&7;if(c===0)break;if(i=this.step(i,l,r),i===null)return null;if(i.isMatch)if(r===te.ANCHOR_BOTH){if(o+c===s)return!0}else return!0;if(i.nfaStates.length===0&&r!==te.UNANCHORED)return!1;o+=c}return!1}},H=class e{static Op=Cm(["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(t){return t===j.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&te.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 n="";for(let r of this.subs)t+=n,n="|",t+=r.appendTo();break}case e.Op.LITERAL:(this.flags&te.FOLD_CASE)!==0&&(t+="(?i:");for(let n of this.runes)t+=He.escapeRune(n);(this.flags&te.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&te.WAS_DOLLAR)!==0?t+="(?-m:$)":t+="\\z";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]===ve.MAX_RUNE){t+="^";for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,s=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=He.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=He.escapeRune(s))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],s=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=He.escapeRune(r),r!==s&&(t+="-",t+=e.quoteIfHyphen(s),t+=He.escapeRune(s))}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 n of this.subs){let r=n.maxCap();t<r&&(t=r)}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&te.WAS_DOLLAR)!==(t.flags&te.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 n=0;n<this.runes.length;n++)if(this.runes[n]!==t.runes[n])return!1;break}case e.Op.ALTERNATE:case e.Op.CONCAT:{if(this.subs.length!==t.subs.length)return!1;for(let n=0;n<this.subs.length;++n)if(!this.subs[n].equals(t.subs[n]))return!1;break}case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break}case e.Op.REPEAT:{if((this.flags&te.NON_GREEDY)!==(t.flags&te.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}},$u=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(t){return this.inst[t]}numInst(){return this.inst.length}addInst(t){this.inst.push(new Ie(t))}skipNop(t){let n=this.inst[t];for(;n.op===Ie.NOP||n.op===Ie.CAPTURE;)n=this.inst[t],t=n.out;return n}prefix(){let t="",n=this.skipNop(this.start);if(!Ie.isRuneOp(n.op)||n.runes.length!==1)return[n.op===Ie.MATCH,t];for(;Ie.isRuneOp(n.op)&&n.runes.length===1&&(n.arg&te.FOLD_CASE)===0;)t+=String.fromCodePoint(n.runes[0]),n=this.skipNop(n.out);return[n.op===Ie.MATCH,t]}startCond(){let t=0,n=this.start;e:for(;;){let r=this.inst[n];switch(r.op){case Ie.EMPTY_WIDTH:t|=r.arg;break;case Ie.FAIL:return-1;case Ie.CAPTURE:case Ie.NOP:break;default:break e}n=r.out}return t}next(t){let n=this.inst[t>>1];return(t&1)===0?n.out:n.arg}patch(t,n){for(;t!==0;){let r=this.inst[t>>1];(t&1)===0?(t=r.out,r.out=n):(t=r.arg,r.arg=n)}}append(t,n){if(t===0)return n;if(n===0)return t;let r=t;for(;;){let i=this.next(r);if(i===0)break;r=i}let s=this.inst[r>>1];return(r&1)===0?s.out=n:s.arg=n,t}toString(){let t="";for(let n=0;n<this.inst.length;n++){let r=t.length;t+=n,n===this.start&&(t+="*"),t+=" ".substring(t.length-r),t+=this.inst[n],t+=`
174
174
  `}return t}},Ei=class{constructor(t=0,n=0,r=!1){this.i=t,this.out=n,this.nullable=r}},Ru=class e{static ANY_RUNE_NOT_NL(){return[0,j.CODES.get(`
175
175
  `)-1,j.CODES.get(`
176
176
  `)+1,ve.MAX_RUNE]}static ANY_RUNE(){return[0,ve.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(Ie.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new $u,this.newInst(Ie.FAIL)}newInst(t){return this.prog.addInst(t),new Ei(this.prog.numInst()-1,0,!0)}nop(){let t=this.newInst(Ie.NOP);return t.out=t.i<<1,t}fail(){return new Ei}cap(t){let n=this.newInst(Ie.CAPTURE);return n.out=n.i<<1,this.prog.getInst(n.i).arg=t,this.prog.numCap<t+1&&(this.prog.numCap=t+1),n}cat(t,n){return t.i===0||n.i===0?this.fail():(this.prog.patch(t.out,n.i),new Ei(t.i,n.out,t.nullable&&n.nullable))}alt(t,n){if(t.i===0)return n;if(n.i===0)return t;let r=this.newInst(Ie.ALT),s=this.prog.getInst(r.i);return s.out=t.i,s.arg=n.i,r.out=this.prog.append(t.out,n.out),r.nullable=t.nullable||n.nullable,r}loop(t,n){let r=this.newInst(Ie.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),this.prog.patch(t.out,r.i),r}quest(t,n){let r=this.newInst(Ie.ALT),s=this.prog.getInst(r.i);return n?(s.arg=t.i,r.out=r.i<<1):(s.out=t.i,r.out=r.i<<1|1),r.out=this.prog.append(r.out,t.out),r}star(t,n){return t.nullable?this.quest(this.plus(t,n),n):this.loop(t,n)}plus(t,n){return new Ei(t.i,this.loop(t,n).out,t.nullable)}empty(t){let n=this.newInst(Ie.EMPTY_WIDTH);return this.prog.getInst(n.i).arg=t,n.out=n.i<<1,n}rune(t,n){let r=this.newInst(Ie.RUNE);r.nullable=!1;let s=this.prog.getInst(r.i);return s.runes=t,n&=te.FOLD_CASE,(t.length!==1||ve.simpleFold(t[0])===t[0])&&(n&=-2),s.arg=n,r.out=r.i<<1,(n&te.FOLD_CASE)===0&&t.length===1||t.length===2&&t[0]===t[1]?s.op=Ie.RUNE1:t.length===2&&t[0]===0&&t[1]===ve.MAX_RUNE?s.op=Ie.RUNE_ANY:t.length===4&&t[0]===0&&t[1]===j.CODES.get(`
177
177
  `)-1&&t[2]===j.CODES.get(`
178
- `)+1&&t[3]===ve.MAX_RUNE&&(s.op=Ie.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case H.Op.NO_MATCH:return this.fail();case H.Op.EMPTY_MATCH:return this.nop();case H.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case H.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case H.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case H.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case H.Op.BEGIN_LINE:return this.empty(je.EMPTY_BEGIN_LINE);case H.Op.END_LINE:return this.empty(je.EMPTY_END_LINE);case H.Op.BEGIN_TEXT:return this.empty(je.EMPTY_BEGIN_TEXT);case H.Op.END_TEXT:return this.empty(je.EMPTY_END_TEXT);case H.Op.WORD_BOUNDARY:return this.empty(je.EMPTY_WORD_BOUNDARY);case H.Op.NO_WORD_BOUNDARY:return this.empty(je.EMPTY_NO_WORD_BOUNDARY);case H.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case H.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case H.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new ku("regexp: unhandled case in compile")}}},Pu=class e{static simplify(t){if(t===null)return null;switch(t.op){case H.Op.CAPTURE:case H.Op.CONCAT:case H.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=H.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case H.Op.STAR:case H.Op.PLUS:case H.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case H.Op.REPEAT:{if(t.min===0&&t.max===0)return new H(H.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(H.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(H.Op.PLUS,t.flags,n,null);let s=new H(H.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(H.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(H.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new H(H.Op.CONCAT);o.subs=[n,s],s=e.simplify1(H.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new H(H.Op.CONCAT);return s.subs=r.slice(0),s}return new H(H.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===H.Op.EMPTY_MATCH||t===r.op&&(n&te.NON_GREEDY)===(r.flags&te.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&te.NON_GREEDY)===(n&te.NON_GREEDY)&&r===s.subs[0]||(s=new H(t),s.flags=n,s.subs=[r]),s)}},We=class{constructor(t,n){this.sign=t,this.cls=n}},im=[48,57],om=[9,10,12,13,32,32],am=[48,57,65,90,95,95,97,122],lm=new Map([["\\d",new We(1,im)],["\\D",new We(-1,im)],["\\s",new We(1,om)],["\\S",new We(-1,om)],["\\w",new We(1,am)],["\\W",new We(-1,am)]]),cm=[48,57,65,90,97,122],um=[65,90,97,122],fm=[0,127],dm=[9,9,32,32],pm=[0,31,127,127],hm=[48,57],mm=[33,126],gm=[97,122],ym=[32,126],wm=[33,47,58,64,91,96,123,126],bm=[9,13,32,32],xm=[65,90],Em=[48,57,65,90,95,95,97,122],Sm=[48,57,65,70,97,102],Am=new Map([["[:alnum:]",new We(1,cm)],["[:^alnum:]",new We(-1,cm)],["[:alpha:]",new We(1,um)],["[:^alpha:]",new We(-1,um)],["[:ascii:]",new We(1,fm)],["[:^ascii:]",new We(-1,fm)],["[:blank:]",new We(1,dm)],["[:^blank:]",new We(-1,dm)],["[:cntrl:]",new We(1,pm)],["[:^cntrl:]",new We(-1,pm)],["[:digit:]",new We(1,hm)],["[:^digit:]",new We(-1,hm)],["[:graph:]",new We(1,mm)],["[:^graph:]",new We(-1,mm)],["[:lower:]",new We(1,gm)],["[:^lower:]",new We(-1,gm)],["[:print:]",new We(1,ym)],["[:^print:]",new We(-1,ym)],["[:punct:]",new We(1,wm)],["[:^punct:]",new We(-1,wm)],["[:space:]",new We(1,bm)],["[:^space:]",new We(-1,bm)],["[:upper:]",new We(1,xm)],["[:^upper:]",new We(-1,xm)],["[:word:]",new We(1,Em)],["[:^word:]",new We(-1,Em)],["[:xdigit:]",new We(1,Sm)],["[:^xdigit:]",new We(-1,Sm)]]),Cr=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=je.emptyInts()){this.r=t,this.len=t.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 n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&te.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=ve.MIN_FOLD&&n>=ve.MAX_FOLD)return this.appendRange(t,n);if(n<ve.MIN_FOLD||t>ve.MAX_FOLD)return this.appendRange(t,n);t<ve.MIN_FOLD&&(this.appendRange(t,ve.MIN_FOLD-1),t=ve.MIN_FOLD),n>ve.MAX_FOLD&&(this.appendRange(ve.MAX_FOLD+1,n),n=ve.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ve.simpleFold(r);s!==r;s=ve.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=ve.MAX_RUNE&&this.appendRange(n,ve.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ve.MAX_RUNE&&this.appendRange(n,ve.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=ve.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ve.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}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)}},bo=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},Du=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=je.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},Lu=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 P(new Uint32Array([0,ve.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?bo.of(e.ANY_TABLE,e.ANY_TABLE):jn.CATEGORIES.has(t)?bo.of(jn.CATEGORIES.get(t),jn.FOLD_CATEGORIES.get(t)):jn.SCRIPTS.has(t)?bo.of(jn.SCRIPTS.get(t),jn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ve.MIN_FOLD||t>ve.MAX_FOLD)return t;let n=t,r=t;for(t=ve.simpleFold(t);t!==r;t=ve.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===H.Op.EMPTY_MATCH)return null;if(t.op===H.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===H.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new H(H.Op.LITERAL);return r.flags=n,r.runes=je.stringToRunes(t),r}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 s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new ot(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ve.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==j.CODES.get("_")&&!je.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=j.CODES.get("0")&&t.peek()<=j.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===j.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===H.Op.LITERAL&&t.runes.length===1||t.op===H.Op.CHAR_CLASS||t.op===H.Op.ANY_CHAR_NOT_NL||t.op===H.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case H.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case H.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case H.Op.ANY_CHAR_NOT_NL:return n!==j.CODES.get(`
178
+ `)+1&&t[3]===ve.MAX_RUNE&&(s.op=Ie.RUNE_ANY_NOT_NL),r}compile(t){switch(t.op){case H.Op.NO_MATCH:return this.fail();case H.Op.EMPTY_MATCH:return this.nop();case H.Op.LITERAL:if(t.runes.length===0)return this.nop();{let n=null;for(let r of t.runes){let s=this.rune([r],t.flags);n=n===null?s:this.cat(n,s)}return n}case H.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case H.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case H.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case H.Op.BEGIN_LINE:return this.empty(He.EMPTY_BEGIN_LINE);case H.Op.END_LINE:return this.empty(He.EMPTY_END_LINE);case H.Op.BEGIN_TEXT:return this.empty(He.EMPTY_BEGIN_TEXT);case H.Op.END_TEXT:return this.empty(He.EMPTY_END_TEXT);case H.Op.WORD_BOUNDARY:return this.empty(He.EMPTY_WORD_BOUNDARY);case H.Op.NO_WORD_BOUNDARY:return this.empty(He.EMPTY_NO_WORD_BOUNDARY);case H.Op.CAPTURE:{let n=this.cap(t.cap<<1),r=this.compile(t.subs[0]),s=this.cap(t.cap<<1|1);return this.cat(this.cat(n,r),s)}case H.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&te.NON_GREEDY)!==0);case H.Op.CONCAT:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.cat(n,s)}return n}}case H.Op.ALTERNATE:{if(t.subs.length===0)return this.nop();{let n=null;for(let r of t.subs){let s=this.compile(r);n=n===null?s:this.alt(n,s)}return n}}default:throw new ku("regexp: unhandled case in compile")}}},Pu=class e{static simplify(t){if(t===null)return null;switch(t.op){case H.Op.CAPTURE:case H.Op.CONCAT:case H.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let s=t.subs[r],i=e.simplify(s);n===t&&i!==s&&(n=H.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=i)}return n}case H.Op.STAR:case H.Op.PLUS:case H.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case H.Op.REPEAT:{if(t.min===0&&t.max===0)return new H(H.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(H.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(H.Op.PLUS,t.flags,n,null);let s=new H(H.Op.CONCAT),i=[];for(let o=0;o<t.min-1;o++)i.push(n);return i.push(e.simplify1(H.Op.PLUS,t.flags,n,null)),s.subs=i.slice(0),s}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let s=0;s<t.min;s++)r.push(n)}if(t.max>t.min){let s=e.simplify1(H.Op.QUEST,t.flags,n,null);for(let i=t.min+1;i<t.max;i++){let o=new H(H.Op.CONCAT);o.subs=[n,s],s=e.simplify1(H.Op.QUEST,t.flags,o,null)}if(r===null)return s;r.push(s)}if(r!==null){let s=new H(H.Op.CONCAT);return s.subs=r.slice(0),s}return new H(H.Op.NO_MATCH)}}return t}static simplify1(t,n,r,s){return r.op===H.Op.EMPTY_MATCH||t===r.op&&(n&te.NON_GREEDY)===(r.flags&te.NON_GREEDY)?r:(s!==null&&s.op===t&&(s.flags&te.NON_GREEDY)===(n&te.NON_GREEDY)&&r===s.subs[0]||(s=new H(t),s.flags=n,s.subs=[r]),s)}},je=class{constructor(t,n){this.sign=t,this.cls=n}},im=[48,57],om=[9,10,12,13,32,32],am=[48,57,65,90,95,95,97,122],lm=new Map([["\\d",new je(1,im)],["\\D",new je(-1,im)],["\\s",new je(1,om)],["\\S",new je(-1,om)],["\\w",new je(1,am)],["\\W",new je(-1,am)]]),cm=[48,57,65,90,97,122],um=[65,90,97,122],fm=[0,127],dm=[9,9,32,32],pm=[0,31,127,127],hm=[48,57],mm=[33,126],gm=[97,122],ym=[32,126],wm=[33,47,58,64,91,96,123,126],bm=[9,13,32,32],xm=[65,90],Em=[48,57,65,90,95,95,97,122],Sm=[48,57,65,70,97,102],Am=new Map([["[:alnum:]",new je(1,cm)],["[:^alnum:]",new je(-1,cm)],["[:alpha:]",new je(1,um)],["[:^alpha:]",new je(-1,um)],["[:ascii:]",new je(1,fm)],["[:^ascii:]",new je(-1,fm)],["[:blank:]",new je(1,dm)],["[:^blank:]",new je(-1,dm)],["[:cntrl:]",new je(1,pm)],["[:^cntrl:]",new je(-1,pm)],["[:digit:]",new je(1,hm)],["[:^digit:]",new je(-1,hm)],["[:graph:]",new je(1,mm)],["[:^graph:]",new je(-1,mm)],["[:lower:]",new je(1,gm)],["[:^lower:]",new je(-1,gm)],["[:print:]",new je(1,ym)],["[:^print:]",new je(-1,ym)],["[:punct:]",new je(1,wm)],["[:^punct:]",new je(-1,wm)],["[:space:]",new je(1,bm)],["[:^space:]",new je(-1,bm)],["[:upper:]",new je(1,xm)],["[:^upper:]",new je(-1,xm)],["[:word:]",new je(1,Em)],["[:^word:]",new je(-1,Em)],["[:xdigit:]",new je(1,Sm)],["[:^xdigit:]",new je(-1,Sm)]]),Cr=class e{static charClassToString(t,n){let r="[";for(let s=0;s<n;s+=2){s>0&&(r+=" ");let i=t[s],o=t[s+1];i===o?r+=`0x${i.toString(16)}`:r+=`0x${i.toString(16)}-0x${o.toString(16)}`}return r+="]",r}static cmp(t,n,r,s){let i=t[n]-r;return i!==0?i:s-t[n+1]}static qsortIntPair(t,n,r){let s=((n+r)/2|0)&-2,i=t[s],o=t[s+1],a=n,l=r;for(;a<=l;){for(;a<r&&e.cmp(t,a,i,o)<0;)a+=2;for(;l>n&&e.cmp(t,l,i,o)>0;)l-=2;if(a<=l){if(a!==l){let c=t[a];t[a]=t[l],t[l]=c,c=t[a+1],t[a+1]=t[l+1],t[l+1]=c}a+=2,l-=2}}n<l&&e.qsortIntPair(t,n,l),a<r&&e.qsortIntPair(t,a,r)}constructor(t=He.emptyInts()){this.r=t,this.len=t.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 n=2;n<this.len;n+=2){let r=this.r[n],s=this.r[n+1];if(r<=this.r[t-1]+1){s>this.r[t-1]&&(this.r[t-1]=s);continue}this.r[t]=r,this.r[t+1]=s,t+=2}return this.len=t,this}appendLiteral(t,n){return(n&te.FOLD_CASE)!==0?this.appendFoldedRange(t,t):this.appendRange(t,t)}appendRange(t,n){if(this.len>0){for(let r=2;r<=4;r+=2)if(this.len>=r){let s=this.r[this.len-r],i=this.r[this.len-r+1];if(t<=i+1&&s<=n+1)return t<s&&(this.r[this.len-r]=t),n>i&&(this.r[this.len-r+1]=n),this}}return this.r[this.len++]=t,this.r[this.len++]=n,this}appendFoldedRange(t,n){if(t<=ve.MIN_FOLD&&n>=ve.MAX_FOLD)return this.appendRange(t,n);if(n<ve.MIN_FOLD||t>ve.MAX_FOLD)return this.appendRange(t,n);t<ve.MIN_FOLD&&(this.appendRange(t,ve.MIN_FOLD-1),t=ve.MIN_FOLD),n>ve.MAX_FOLD&&(this.appendRange(ve.MAX_FOLD+1,n),n=ve.MAX_FOLD);for(let r=t;r<=n;r++){this.appendRange(r,r);for(let s=ve.simpleFold(r);s!==r;s=ve.simpleFold(s))this.appendRange(s,s)}return this}appendClass(t){for(let n=0;n<t.length;n+=2)this.appendRange(t[n],t[n+1]);return this}appendFoldedClass(t){for(let n=0;n<t.length;n+=2)this.appendFoldedRange(t[n],t[n+1]);return this}appendNegatedClass(t){let n=0;for(let r=0;r<t.length;r+=2){let s=t[r],i=t[r+1];n<=s-1&&this.appendRange(n,s-1),n=i+1}return n<=ve.MAX_RUNE&&this.appendRange(n,ve.MAX_RUNE),this}appendTable(t){for(let n=0;n<t.length;++n){let r=t.getLo(n),s=t.getHi(n),i=t.getStride(n);if(i===1){this.appendRange(r,s);continue}for(let o=r;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(t){let n=0;for(let r=0;r<t.length;++r){let s=t.getLo(r),i=t.getHi(r),o=t.getStride(r);if(o===1){n<=s-1&&this.appendRange(n,s-1),n=i+1;continue}for(let a=s;a<=i;a+=o)n<=a-1&&this.appendRange(n,a-1),n=a+1}return n<=ve.MAX_RUNE&&this.appendRange(n,ve.MAX_RUNE),this}appendTableWithSign(t,n){return n<0?this.appendNegatedTable(t):this.appendTable(t)}negateClass(){let t=0,n=0;for(let r=0;r<this.len;r+=2){let s=this.r[r],i=this.r[r+1];t<=s-1&&(this.r[n]=t,this.r[n+1]=s-1,n+=2),t=i+1}return this.len=n,t<=ve.MAX_RUNE&&(this.r[this.len++]=t,this.r[this.len++]=ve.MAX_RUNE),this}appendClassWithSign(t,n){return n<0?this.appendNegatedClass(t):this.appendClass(t)}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)}},bo=class e{static of(t,n){return new e(t,n)}constructor(t,n){this.first=t,this.second=n}},Du=class{constructor(t){this.str=t,this.position=0}pos(){return this.position}rewindTo(t){this.position=t}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(t){this.position+=t}skipString(t){this.position+=t.length}pop(){let t=this.str.codePointAt(this.position);return this.position+=He.charCount(t),t}lookingAt(t){return this.rest().startsWith(t)}rest(){return this.str.substring(this.position)}from(t){return this.str.substring(t,this.position)}toString(){return this.rest()}},Lu=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 P(new Uint32Array([0,ve.MAX_RUNE,1]));static unicodeTable(t){return t==="Any"?bo.of(e.ANY_TABLE,e.ANY_TABLE):jn.CATEGORIES.has(t)?bo.of(jn.CATEGORIES.get(t),jn.FOLD_CATEGORIES.get(t)):jn.SCRIPTS.has(t)?bo.of(jn.SCRIPTS.get(t),jn.FOLD_SCRIPT.get(t)):null}static minFoldRune(t){if(t<ve.MIN_FOLD||t>ve.MAX_FOLD)return t;let n=t,r=t;for(t=ve.simpleFold(t);t!==r;t=ve.simpleFold(t))n>t&&(n=t);return n}static leadingRegexp(t){if(t.op===H.Op.EMPTY_MATCH)return null;if(t.op===H.Op.CONCAT&&t.subs.length>0){let n=t.subs[0];return n.op===H.Op.EMPTY_MATCH?null:n}return t}static literalRegexp(t,n){let r=new H(H.Op.LITERAL);return r.flags=n,r.runes=He.stringToRunes(t),r}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 s;if(!t.lookingAt(","))s=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt("}"))s=-1;else if((s=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt("}"))return-1;if(t.skip(1),r<0||r>1e3||s===-2||s>1e3||s>=0&&r>s)throw new ot(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|s&ve.MAX_BMP}static isValidCaptureName(t){if(t.length===0)return!1;for(let n=0;n<t.length;n++){let r=t.codePointAt(n);if(r!==j.CODES.get("_")&&!He.isalnum(r))return!1}return!0}static parseInt(t){let n=t.pos();for(;t.more()&&t.peek()>=j.CODES.get("0")&&t.peek()<=j.CODES.get("9");)t.skip(1);let r=t.from(n);return r.length===0||r.length>1&&r.codePointAt(0)===j.CODES.get("0")?-1:r.length>8?-2:parseFloat(r,10)}static isCharClass(t){return t.op===H.Op.LITERAL&&t.runes.length===1||t.op===H.Op.CHAR_CLASS||t.op===H.Op.ANY_CHAR_NOT_NL||t.op===H.Op.ANY_CHAR}static matchRune(t,n){switch(t.op){case H.Op.LITERAL:return t.runes.length===1&&t.runes[0]===n;case H.Op.CHAR_CLASS:for(let r=0;r<t.runes.length;r+=2)if(t.runes[r]<=n&&n<=t.runes[r+1])return!0;return!1;case H.Op.ANY_CHAR_NOT_NL:return n!==j.CODES.get(`
179
179
  `);case H.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case H.Op.ANY_CHAR:break;case H.Op.ANY_CHAR_NOT_NL:e.matchRune(n,j.CODES.get(`
180
- `))&&(t.op=H.Op.ANY_CHAR);break;case H.Op.CHAR_CLASS:n.op===H.Op.LITERAL?t.runes=new Cr(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Cr(t.runes).appendClass(n.runes).toArray();break;case H.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=H.Op.CHAR_CLASS,t.runes=new Cr().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 ot(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case j.CODES.get("1"):case j.CODES.get("2"):case j.CODES.get("3"):case j.CODES.get("4"):case j.CODES.get("5"):case j.CODES.get("6"):case j.CODES.get("7"):if(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"))break;case j.CODES.get("0"):{let s=r-j.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"));i++)s=s*8+t.peek()-j.CODES.get("0"),t.skip(1);return s}case j.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===j.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===j.CODES.get("}"))break;let l=je.unhex(r);if(l<0||(a=a*16+l,a>ve.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=je.unhex(r);if(!t.more())break;r=t.pop();let i=je.unhex(r);if(s<0||i<0)break;return s*16+i}case j.CODES.get("a"):return j.CODES.get("\x07");case j.CODES.get("f"):return j.CODES.get("\f");case j.CODES.get("n"):return j.CODES.get(`
181
- `);case j.CODES.get("r"):return j.CODES.get("\r");case j.CODES.get("t"):return j.CODES.get(" ");case j.CODES.get("v"):return j.CODES.get("\v");default:if(r<=ve.MAX_ASCII&&!je.isalnum(r))return r;break}throw new ot(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new ot(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static concatRunes(t,n){return[...t,...n]}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,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(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new H(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new ot(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===H.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 n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new ot(e.ERR_LARGE)}calcSize(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let r=0;switch(t.op){case H.Op.LITERAL:{r=t.runes.length;break}case H.Op.CAPTURE:case H.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case H.Op.PLUS:case H.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case H.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case H.Op.ALTERNATE:{for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break}case H.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size[t]=r,r}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new ot(e.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let r=1;for(let s of t.subs){let i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height[t]=r,r}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,n=t;for(;n>0&&!H.isPseudoOp(this.stack[n-1].op);)n--;let r=this.stack.slice(n,t);return this.stack=this.stack.slice(0,n),r}push(t){if(this.numRunes+=t.runes.length,t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===H.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ve.simpleFold(t.runes[0])===t.runes[2]&&ve.simpleFold(t.runes[2])===t.runes[0]||t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ve.simpleFold(t.runes[0])===t.runes[1]&&ve.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|te.FOLD_CASE))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|te.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let s=this.stack[r-1],i=this.stack[r-2];return s.op!==H.Op.LITERAL||i.op!==H.Op.LITERAL||(s.flags&te.FOLD_CASE)!==(i.flags&te.FOLD_CASE)?!1:(i.runes=e.concatRunes(i.runes,s.runes),t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1))}newLiteral(t,n){let r=this.newRegexp(H.Op.LITERAL);return r.flags=n,(n&te.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,o){let a=this.flags;if((a&te.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=te.NON_GREEDY),o!==-1))throw new ot(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new ot(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(H.isPseudoOp(c.op))throw new ot(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===H.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new ot(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===H.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(H.Op.EMPTY_MATCH)):this.push(this.collapse(t,H.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(H.Op.NO_MATCH)):this.push(this.collapse(t,H.Op.ALTERNATE))}cleanAlt(t){t.op===H.Op.CHAR_CLASS&&(t.runes=new Cr(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ve.MAX_RUNE?(t.runes=[],t.op=H.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===j.CODES.get(`
180
+ `))&&(t.op=H.Op.ANY_CHAR);break;case H.Op.CHAR_CLASS:n.op===H.Op.LITERAL?t.runes=new Cr(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new Cr(t.runes).appendClass(n.runes).toArray();break;case H.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=H.Op.CHAR_CLASS,t.runes=new Cr().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 ot(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case j.CODES.get("1"):case j.CODES.get("2"):case j.CODES.get("3"):case j.CODES.get("4"):case j.CODES.get("5"):case j.CODES.get("6"):case j.CODES.get("7"):if(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"))break;case j.CODES.get("0"):{let s=r-j.CODES.get("0");for(let i=1;i<3&&!(!t.more()||t.peek()<j.CODES.get("0")||t.peek()>j.CODES.get("7"));i++)s=s*8+t.peek()-j.CODES.get("0"),t.skip(1);return s}case j.CODES.get("x"):{if(!t.more())break;if(r=t.pop(),r===j.CODES.get("{")){let o=0,a=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===j.CODES.get("}"))break;let l=He.unhex(r);if(l<0||(a=a*16+l,a>ve.MAX_RUNE))break e;o++}if(o===0)break e;return a}let s=He.unhex(r);if(!t.more())break;r=t.pop();let i=He.unhex(r);if(s<0||i<0)break;return s*16+i}case j.CODES.get("a"):return j.CODES.get("\x07");case j.CODES.get("f"):return j.CODES.get("\f");case j.CODES.get("n"):return j.CODES.get(`
181
+ `);case j.CODES.get("r"):return j.CODES.get("\r");case j.CODES.get("t"):return j.CODES.get(" ");case j.CODES.get("v"):return j.CODES.get("\v");default:if(r<=ve.MAX_ASCII&&!He.isalnum(r))return r;break}throw new ot(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new ot(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt("\\")?e.parseEscape(t):t.pop()}static concatRunes(t,n){return[...t,...n]}constructor(t,n=0){this.wholeRegexp=t,this.flags=n,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(t){let n=this.free;return n!==null&&n.subs!==null&&n.subs.length>0?(this.free=n.subs[0],n.reinit(),n.op=t):(n=new H(t),this.numRegexp+=1),n}reuse(t){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,t)&&delete this.height[t],t.subs!==null&&t.subs.length>0&&(t.subs[0]=this.free),this.free=t}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new ot(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===H.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 n of this.stack)this.checkSize(n)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new ot(e.ERR_LARGE)}calcSize(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.size,t))return this.size[t];let r=0;switch(t.op){case H.Op.LITERAL:{r=t.runes.length;break}case H.Op.CAPTURE:case H.Op.STAR:{r=2+this.calcSize(t.subs[0]);break}case H.Op.PLUS:case H.Op.QUEST:{r=1+this.calcSize(t.subs[0]);break}case H.Op.CONCAT:{for(let s of t.subs)r=r+this.calcSize(s);break}case H.Op.ALTERNATE:{for(let s of t.subs)r=r+this.calcSize(s);t.subs.length>1&&(r=r+t.subs.length-1);break}case H.Op.REPEAT:{let s=this.calcSize(t.subs[0]);if(t.max===-1){t.min===0?r=2+s:r=1+t.min*s;break}r=t.max*s+(t.max-t.min);break}}return r=Math.max(1,r),this.size[t]=r,r}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let n of this.stack)this.checkHeight(n)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new ot(e.ERR_NESTING_DEPTH)}}calcHeight(t,n=!1){if(!n&&Object.prototype.hasOwnProperty.call(this.height,t))return this.height[t];let r=1;for(let s of t.subs){let i=this.calcHeight(s);r<1+i&&(r=1+i)}return this.height[t]=r,r}pop(){return this.stack.pop()}popToPseudo(){let t=this.stack.length,n=t;for(;n>0&&!H.isPseudoOp(this.stack[n-1].op);)n--;let r=this.stack.slice(n,t);return this.stack=this.stack.slice(0,n),r}push(t){if(this.numRunes+=t.runes.length,t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]===t.runes[1]){if(this.maybeConcat(t.runes[0],this.flags&-2))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags&-2}else if(t.op===H.Op.CHAR_CLASS&&t.runes.length===4&&t.runes[0]===t.runes[1]&&t.runes[2]===t.runes[3]&&ve.simpleFold(t.runes[0])===t.runes[2]&&ve.simpleFold(t.runes[2])===t.runes[0]||t.op===H.Op.CHAR_CLASS&&t.runes.length===2&&t.runes[0]+1===t.runes[1]&&ve.simpleFold(t.runes[0])===t.runes[1]&&ve.simpleFold(t.runes[1])===t.runes[0]){if(this.maybeConcat(t.runes[0],this.flags|te.FOLD_CASE))return null;t.op=H.Op.LITERAL,t.runes=[t.runes[0]],t.flags=this.flags|te.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(t),this.checkLimits(t),t}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let s=this.stack[r-1],i=this.stack[r-2];return s.op!==H.Op.LITERAL||i.op!==H.Op.LITERAL||(s.flags&te.FOLD_CASE)!==(i.flags&te.FOLD_CASE)?!1:(i.runes=e.concatRunes(i.runes,s.runes),t>=0?(s.runes=[t],s.flags=n,!0):(this.pop(),this.reuse(s),!1))}newLiteral(t,n){let r=this.newRegexp(H.Op.LITERAL);return r.flags=n,(n&te.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(t){this.push(this.newLiteral(t,this.flags))}op(t){let n=this.newRegexp(t);return n.flags=this.flags,this.push(n)}repeat(t,n,r,s,i,o){let a=this.flags;if((a&te.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=te.NON_GREEDY),o!==-1))throw new ot(e.ERR_INVALID_REPEAT_OP,i.from(o));let l=this.stack.length;if(l===0)throw new ot(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let c=this.stack[l-1];if(H.isPseudoOp(c.op))throw new ot(e.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=a,u.subs=[c],this.stack[l-1]=u,this.checkLimits(u),t===H.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new ot(e.ERR_INVALID_REPEAT_SIZE,i.from(s))}repeatIsValid(t,n){if(t.op===H.Op.REPEAT){let r=t.max;if(r===0)return!0;if(r<0&&(r=t.min),r>n)return!1;r>0&&(n=Math.trunc(n/r))}for(let r of t.subs)if(!this.repeatIsValid(r,n))return!1;return!0}concat(){this.maybeConcat(-1,0);let t=this.popToPseudo();return t.length===0?this.push(this.newRegexp(H.Op.EMPTY_MATCH)):this.push(this.collapse(t,H.Op.CONCAT))}alternate(){let t=this.popToPseudo();return t.length>0&&this.cleanAlt(t[t.length-1]),t.length===0?this.push(this.newRegexp(H.Op.NO_MATCH)):this.push(this.collapse(t,H.Op.ALTERNATE))}cleanAlt(t){t.op===H.Op.CHAR_CLASS&&(t.runes=new Cr(t.runes).cleanClass().toArray(),t.runes.length===2&&t.runes[0]===0&&t.runes[1]===ve.MAX_RUNE?(t.runes=[],t.op=H.Op.ANY_CHAR):t.runes.length===4&&t.runes[0]===0&&t.runes[1]===j.CODES.get(`
182
182
  `)-1&&t.runes[2]===j.CODES.get(`
183
- `)+1&&t.runes[3]===ve.MAX_RUNE&&(t.runes=[],t.op=H.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===H.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,d=0,p=0;if(u<r){let h=t[n+u];if(h.op===H.Op.CONCAT&&h.subs.length>0&&(h=h.subs[0]),h.op===H.Op.LITERAL&&(f=h.runes,d=h.runes.length,p=h.flags&te.FOLD_CASE),p===a){let m=0;for(;m<o&&m<d&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let h=this.newRegexp(H.Op.LITERAL);h.flags=a,h.runes=i.slice(0,o);for(let b=l;b<u;b++)t[n+b]=this.removeLeadingString(t[n+b],o),this.checkLimits(t[n+b]);let m=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),g=this.newRegexp(H.Op.CONCAT);g.subs=[h,m],t[s++]=g}l=u,i=f,o=d,a=p}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===H.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let p=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),h=this.newRegexp(H.Op.CONCAT);h.subs=[d,p],t[s++]=h}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let p=l+1;p<u;p++){let h=t[n+f],m=t[n+p];(h.op<m.op||h.op===m.op&&(h.runes!==null?h.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=p)}let d=t[n+l];t[n+l]=t[n+f],t[n+f]=d;for(let p=l+1;p<u;p++)e.mergeCharClass(t[n+l],t[n+p]),this.reuse(t[n+p]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===H.Op.EMPTY_MATCH&&t[n+u+1].op===H.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===H.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=H.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===H.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=H.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=H.Op.EMPTY_MATCH,t.subs=H.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(H.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&te.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new Du(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case j.CODES.get("("):if((this.flags&te.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(H.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case j.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case j.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case j.CODES.get("^"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.BEGIN_TEXT):this.op(H.Op.BEGIN_LINE),s.skip(1);break;case j.CODES.get("$"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.END_TEXT).flags|=te.WAS_DOLLAR:this.op(H.Op.END_LINE),s.skip(1);break;case j.CODES.get("."):(this.flags&te.DOT_NL)!==0?this.op(H.Op.ANY_CHAR):this.op(H.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case j.CODES.get("["):this.parseClass(s);break;case j.CODES.get("*"):case j.CODES.get("+"):case j.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case j.CODES.get("*"):a=H.Op.STAR;break;case j.CODES.get("+"):a=H.Op.PLUS;break;case j.CODES.get("?"):a=H.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case j.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&ve.MAX_BMP)<<16>>16,this.repeat(H.Op.REPEAT,n,r,o,s,t);break}case j.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&te.PERL_X)!==0&&s.more())switch(s.pop()){case j.CODES.get("A"):this.op(H.Op.BEGIN_TEXT);break e;case j.CODES.get("b"):this.op(H.Op.WORD_BOUNDARY);break e;case j.CODES.get("B"):this.op(H.Op.NO_WORD_BOUNDARY);break e;case j.CODES.get("C"):throw new ot(e.ERR_INVALID_ESCAPE,"\\C");case j.CODES.get("Q"):{let f=s.rest(),d=f.indexOf("\\E");d>=0&&(f=f.substring(0,d)),s.skipString(f),s.skipString("\\E");let p=0;for(;p<f.length;){let h=f.codePointAt(p);this.literal(h),p+=je.charCount(h)}break e}case j.CODES.get("z"):this.op(H.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(H.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Cr;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Cr;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new ot(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 a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new ot(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new ot(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(H.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new ot(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case j.CODES.get("i"):s|=te.FOLD_CASE,o=!0;break;case j.CODES.get("m"):s&=-17,o=!0;break;case j.CODES.get("s"):s|=te.DOT_NL,o=!0;break;case j.CODES.get("U"):s|=te.NON_GREEDY,o=!0;break;case j.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case j.CODES.get(":"):case j.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===j.CODES.get(":")&&this.op(H.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new ot(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(H.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===H.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 s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===H.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new ot(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==H.Op.LEFT_PAREN)throw new ot(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=H.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&te.PERL_X)===0||!t.more()||t.pop()!==j.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=lm.has(s)?lm.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&te.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=Am.has(i)?Am.get(i):null;if(o===null)throw new ot(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&te.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&te.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===j.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==j.CODES.get("{"))o=je.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===j.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new ot(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&te.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Cr().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(H.Op.CHAR_CLASS);r.flags=this.flags;let s=new Cr,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&te.CLASS_NL)===0&&s.appendRange(j.CODES.get(`
183
+ `)+1&&t.runes[3]===ve.MAX_RUNE&&(t.runes=[],t.op=H.Op.ANY_CHAR_NOT_NL))}collapse(t,n){if(t.length===1)return t[0];let r=0;for(let a of t)r+=a.op===n?a.subs.length:1;let s=new Array(r).fill(null),i=0;for(let a of t)a.op===n?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(n);if(o.subs=s,n===H.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){let a=o;o=o.subs[0],this.reuse(a)}return o}factor(t){if(t.length<2)return t;let n=0,r=t.length,s=0,i=null,o=0,a=0,l=0;for(let u=0;u<=r;u++){let f=null,d=0,p=0;if(u<r){let h=t[n+u];if(h.op===H.Op.CONCAT&&h.subs.length>0&&(h=h.subs[0]),h.op===H.Op.LITERAL&&(f=h.runes,d=h.runes.length,p=h.flags&te.FOLD_CASE),p===a){let m=0;for(;m<o&&m<d&&i[m]===f[m];)m++;if(m>0){o=m;continue}}}if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let h=this.newRegexp(H.Op.LITERAL);h.flags=a,h.runes=i.slice(0,o);for(let b=l;b<u;b++)t[n+b]=this.removeLeadingString(t[n+b],o),this.checkLimits(t[n+b]);let m=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),g=this.newRegexp(H.Op.CONCAT);g.subs=[h,m],t[s++]=g}l=u,i=f,o=d,a=p}r=s,n=0,l=0,s=0;let c=null;for(let u=0;u<=r;u++){let f=null;if(!(u<r&&(f=e.leadingRegexp(t[n+u]),c!==null&&c.equals(f)&&(e.isCharClass(c)||c.op===H.Op.REPEAT&&c.min===c.max&&e.isCharClass(c.subs[0]))))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let d=c;for(let m=l;m<u;m++){let g=m!==l;t[n+m]=this.removeLeadingRegexp(t[n+m],g),this.checkLimits(t[n+m])}let p=this.collapse(t.slice(n+l,n+u),H.Op.ALTERNATE),h=this.newRegexp(H.Op.CONCAT);h.subs=[d,p],t[s++]=h}l=u,c=f}}r=s,n=0,l=0,s=0;for(let u=0;u<=r;u++)if(!(u<r&&e.isCharClass(t[n+u]))){if(u!==l)if(u===l+1)t[s++]=t[n+l];else{let f=l;for(let p=l+1;p<u;p++){let h=t[n+f],m=t[n+p];(h.op<m.op||h.op===m.op&&(h.runes!==null?h.runes.length:0)<(m.runes!==null?m.runes.length:0))&&(f=p)}let d=t[n+l];t[n+l]=t[n+f],t[n+f]=d;for(let p=l+1;p<u;p++)e.mergeCharClass(t[n+l],t[n+p]),this.reuse(t[n+p]);this.cleanAlt(t[n+l]),t[s++]=t[n+l]}u<r&&(t[s++]=t[n+u]),l=u+1}r=s,n=0,l=0,s=0;for(let u=0;u<r;++u)u+1<r&&t[n+u].op===H.Op.EMPTY_MATCH&&t[n+u+1].op===H.Op.EMPTY_MATCH||(t[s++]=t[n+u]);return r=s,n=0,t.slice(n,r)}removeLeadingString(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){let r=this.removeLeadingString(t.subs[0],n);if(t.subs[0]=r,r.op===H.Op.EMPTY_MATCH)switch(this.reuse(r),t.subs.length){case 0:case 1:t.op=H.Op.EMPTY_MATCH,t.subs=null;break;case 2:{let s=t;t=t.subs[1],this.reuse(s);break}default:t.subs=t.subs.slice(1,t.subs.length);break}return t}return t.op===H.Op.LITERAL&&(t.runes=t.runes.slice(n,t.runes.length),t.runes.length===0&&(t.op=H.Op.EMPTY_MATCH)),t}removeLeadingRegexp(t,n){if(t.op===H.Op.CONCAT&&t.subs.length>0){switch(n&&this.reuse(t.subs[0]),t.subs=t.subs.slice(1,t.subs.length),t.subs.length){case 0:{t.op=H.Op.EMPTY_MATCH,t.subs=H.emptySubs();break}case 1:{let r=t;t=t.subs[0],this.reuse(r);break}}return t}return n&&this.reuse(t),this.newRegexp(H.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&te.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,s=new Du(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case j.CODES.get("("):if((this.flags&te.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(H.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case j.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case j.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case j.CODES.get("^"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.BEGIN_TEXT):this.op(H.Op.BEGIN_LINE),s.skip(1);break;case j.CODES.get("$"):(this.flags&te.ONE_LINE)!==0?this.op(H.Op.END_TEXT).flags|=te.WAS_DOLLAR:this.op(H.Op.END_LINE),s.skip(1);break;case j.CODES.get("."):(this.flags&te.DOT_NL)!==0?this.op(H.Op.ANY_CHAR):this.op(H.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case j.CODES.get("["):this.parseClass(s);break;case j.CODES.get("*"):case j.CODES.get("+"):case j.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case j.CODES.get("*"):a=H.Op.STAR;break;case j.CODES.get("+"):a=H.Op.PLUS;break;case j.CODES.get("?"):a=H.Op.QUEST;break}this.repeat(a,n,r,o,s,t);break}case j.CODES.get("{"):{o=s.pos();let a=e.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}n=a>>16,r=(a&ve.MAX_BMP)<<16>>16,this.repeat(H.Op.REPEAT,n,r,o,s,t);break}case j.CODES.get("\\"):{let a=s.pos();if(s.skip(1),(this.flags&te.PERL_X)!==0&&s.more())switch(s.pop()){case j.CODES.get("A"):this.op(H.Op.BEGIN_TEXT);break e;case j.CODES.get("b"):this.op(H.Op.WORD_BOUNDARY);break e;case j.CODES.get("B"):this.op(H.Op.NO_WORD_BOUNDARY);break e;case j.CODES.get("C"):throw new ot(e.ERR_INVALID_ESCAPE,"\\C");case j.CODES.get("Q"):{let f=s.rest(),d=f.indexOf("\\E");d>=0&&(f=f.substring(0,d)),s.skipString(f),s.skipString("\\E");let p=0;for(;p<f.length;){let h=f.codePointAt(p);this.literal(h),p+=He.charCount(h)}break e}case j.CODES.get("z"):this.op(H.Op.END_TEXT);break e;default:s.rewindTo(a);break}let l=this.newRegexp(H.Op.CHAR_CLASS);if(l.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){let u=new Cr;if(this.parseUnicodeClass(s,u)){l.runes=u.toArray(),this.push(l);break e}}let c=new Cr;if(this.parsePerlClassEscape(s,c)){l.runes=c.toArray(),this.push(l);break e}s.rewindTo(a),this.reuse(l),this.literal(e.parseEscape(s));break}default:this.literal(s.pop());break}t=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new ot(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 a=r.charAt(2)==="P"?4:3,l=r.indexOf(">");if(l<0)throw new ot(e.ERR_INVALID_NAMED_CAPTURE,r);let c=r.substring(a,l);if(t.skipString(c),t.skip(a+1),!e.isValidCaptureName(c))throw new ot(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,l+1));let u=this.op(H.Op.LEFT_PAREN);if(u.cap=++this.numCap,this.namedGroups[c])throw new ot(e.ERR_DUPLICATE_NAMED_CAPTURE,c);this.namedGroups[c]=this.numCap,u.name=c;return}t.skip(2);let s=this.flags,i=1,o=!1;e:for(;t.more();){let a=t.pop();switch(a){case j.CODES.get("i"):s|=te.FOLD_CASE,o=!0;break;case j.CODES.get("m"):s&=-17,o=!0;break;case j.CODES.get("s"):s|=te.DOT_NL,o=!0;break;case j.CODES.get("U"):s|=te.NON_GREEDY,o=!0;break;case j.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case j.CODES.get(":"):case j.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===j.CODES.get(":")&&this.op(H.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new ot(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(H.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===H.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 s=r;r=n,n=s,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let n=this.stack[t-1],r=this.stack[t-2];if(r.op===H.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=n,this.stack[t-1]=r,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new ot(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let n=this.pop(),r=this.pop();if(r.op!==H.Op.LEFT_PAREN)throw new ot(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=r.flags,r.cap===0?this.push(n):(r.op=H.Op.CAPTURE,r.subs=[n],this.push(r))}parsePerlClassEscape(t,n){let r=t.pos();if((this.flags&te.PERL_X)===0||!t.more()||t.pop()!==j.CODES.get("\\")||!t.more())return!1;t.pop();let s=t.from(r),i=lm.has(s)?lm.get(s):null;return i===null?!1:(n.appendGroup(i,(this.flags&te.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),s=r.indexOf(":]");if(s<0)return!1;let i=r.substring(0,s+2);t.skipString(i);let o=Am.has(i)?Am.get(i):null;if(o===null)throw new ot(e.ERR_INVALID_CHAR_RANGE,i);return n.appendGroup(o,(this.flags&te.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&te.UNICODE_GROUPS)===0||!t.lookingAt("\\p")&&!t.lookingAt("\\P"))return!1;t.skip(1);let s=1,i=t.pop();if(i===j.CODES.get("P")&&(s=-1),!t.more())throw t.rewindTo(r),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest());i=t.pop();let o;if(i!==j.CODES.get("{"))o=He.runeToString(i);else{let u=t.rest(),f=u.indexOf("}");if(f<0)throw t.rewindTo(r),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest());o=u.substring(0,f),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===j.CODES.get("^")&&(s=0-s,o=o.substring(1));let a=e.unicodeTable(o);if(a===null)throw new ot(e.ERR_INVALID_CHAR_RANGE,t.from(r));let l=a.first,c=a.second;if((this.flags&te.FOLD_CASE)===0||c===null)n.appendTableWithSign(l,s);else{let u=new Cr().appendTable(l).appendTable(c).cleanClass().toArray();n.appendClassWithSign(u,s)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(H.Op.CHAR_CLASS);r.flags=this.flags;let s=new Cr,i=1;t.more()&&t.lookingAt("^")&&(i=-1,t.skip(1),(this.flags&te.CLASS_NL)===0&&s.appendRange(j.CODES.get(`
184
184
  `),j.CODES.get(`
185
- `)));let o=!0;for(;!t.more()||t.peek()!==j.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&te.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);let l=e.parseClassChar(t,n),c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=e.parseClassChar(t,n),c<l)throw new ot(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&te.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},Fu=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}},Mu=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,te.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,te.POSIX,!0)}static compileImpl(t,n,r){let s=Lu.parse(t,n),i=s.maxCap();s=Pu.simplify(s);let o=Ru.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=je.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}static match(t,n){return e.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new Fu,this.dfa=new Tu(n)}executeEngine(t,n,r,s){if(s>0)return this.doExecuteNFA(t,n,r,s);let i=this.dfa.match(t,n,r);return i!==null?i?[]:null:this.doExecuteNFA(t,n,r,s)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=wo.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecuteNFA(t,n,r,s){let i=this.get(),o=!1;i?i.next!==null&&(i=wo.fromMachine(i),o=!0):(i=wo.fromRE2(this),o=!0),i.init(s);let a=i.match(t,n,r)?i.submatches():null;return this.put(i,o),a}match(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof rs||(t=Si.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let o=t.isUTF16Encoding()?gt.fromUTF16(t.asCharSequence(),0,r):gt.fromUTF8(t.asBytes(),0,r),a=this.executeEngine(o,n,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(t){return this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,o="",a=gt.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,te.UNANCHORED,2);if(c===null||c.length===0)break;o+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(o+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=a.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return o+=t.substring(s),o}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[],i=t.endPos();n<0&&(n=i+1);let o=0,a=0,l=-1;for(;a<n&&o<=i;){let c=this.executeEngine(t,o,te.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===o){c[0]===l&&(u=!1);let f=t.step(o);f<0?o=i+1:o+=f&7}else o=c[1];l=c[1],u&&(s.push(r(this.pad(c))),a++)}return s}findUTF8(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n);return r.length===0?null:r}},_u=class e{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,s=t.length;s===0&&(n="(?:)",r=!0);let i=0;for(;i<s;){let o=t[i];if(o==="\\"){if(i+1<s)switch(o=t[i+1],o){case"\\":{n+="\\\\",i+=2;continue}case"c":{if(i+2<s){let l=t[i+2];if(e.isUpperCaseAlpha(l)){n+="\\x",n+=(l.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),i+=3,r=!0;continue}}n+="\\c",i+=2;continue}case"u":{if(i+2<s){let l=t[i+2];if(e.isHexadecimal(l)){n+="\\x{"+l,i+=3;for(let c=0;c<3&&i<s&&(l=t[i],!!e.isHexadecimal(l));++i,++c)n+=l;n+="}",r=!0;continue}else if(l==="{"){n+="\\x",i+=2,r=!0;continue}}n+="\\u",i+=2;continue}default:{n+="\\";let l=e.getUtf8CharSize(o);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(o==="/"){n+="\\/",i+=1,r=!0;continue}else if(o==="("&&i+2<s&&t[i+1]==="?"&&t[i+2]==="<"&&(i+3>=s||t[i+3]!=="="&&t[i+3]!=="!")){n+="(?P<",i+=3,r=!0;continue}let a=e.getUtf8CharSize(o);n+=t.substring(i,i+a),i+=a}return r?n:t}},zr=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return je.quoteMeta(t)}static translateRegExp(t){return _u.translate(t)}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 vu("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=te.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=Mu.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).testExact(n)}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");let s=new e(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=Si.utf8(t)),new Nu(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?gt.fromUTF8(t):gt.fromUTF16(t);return this.re2Input.executeEngine(n,0,te.ANCHOR_BOTH,0)!==null}split(t,n=0){let r=this.matcher(t),s=[],i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(o,r.inputLength())),s}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function w9(e){let t=0;return e.includes("i")&&(t|=zr.CASE_INSENSITIVE),e.includes("m")&&(t|=zr.MULTILINE),e.includes("s")&&(t|=zr.DOTALL),t}function vm(e){return zr.translateRegExp(e)}function E9(e,t){let n=w9(t);if(e.length>x9)return zr.compile(vm(e),n);let r=`${n} ${e}`,s=xo.get(r);if(s!==void 0)return s;let i=zr.compile(vm(e),n);if(xo.size>=b9){let o=xo.keys().next().value;o!==void 0&&xo.delete(o)}return xo.set(r,i),i}function oe(e,t="",n={}){return new La(e,t,n)}var g9,y9,b9,x9,xo,La,Wr,Nm=F(()=>{"use strict";km();St();G();g9=1e6,y9=64*1024*1024;b9=256,x9=1024,xo=new Map;La=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;maxResults;maxOutputBytes;signal;assertResultCount(t){if(this.signal?.aborted)throw new Error("regular expression aborted");if(t>this.maxResults)throw new C(`regular expression result limit exceeded (${this.maxResults})`,"array_elements")}expandReplacement(t,n){let r=new $e(this.maxOutputBytes,"regular expression replacement"),s=this._re2.groupCount(),i=this._re2.namedGroups();for(let o=0;o<n.length;o++){let a=n[o];if(a==="\\"&&o+1<n.length){r.append(n[++o]);continue}if(a!=="$"||o+1>=n.length){r.append(a);continue}if(n[o+1]==="{"){let l=n.indexOf("}",o+2);if(l!==-1){let c=n.slice(o+2,l),u=i?.[c];if(u!==void 0){r.append(t.group(u)??""),o=l;continue}}}if(/\d/.test(n[o+1])){let l=o+1,c=0;for(;l<n.length&&/\d/.test(n[l]);){let u=c*10+Number(n[l]);if(u>s)break;c=u,l++}r.append(t.group(c)??""),o=l-1;continue}r.append(a)}return r.build()}acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}constructor(t,n="",r={}){if(this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m"),this.maxResults=r.maxResults??g9,this.maxOutputBytes=r.maxOutputBytes??y9,this.signal=r.signal,!Number.isSafeInteger(this.maxResults)||this.maxResults<0||!Number.isSafeInteger(this.maxOutputBytes)||this.maxOutputBytes<0)throw new Error("invalid regular expression limits");try{this._re2=E9(t,n)}catch(s){if(s instanceof ot){let i=s.message||"",o="";throw i.includes("(?=")||i.includes("(?!")||i.includes("(?<")||i.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?o=" 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.":(i.includes("backreference")||/\\[1-9]/.test(t))&&(o=" 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."),new SyntaxError(`Invalid regular expression: /${t}/: ${i}${o}`)}throw s}}test(t){return this._global&&(this._lastIndex=0),this.acquireMatcher(t).find()}exec(t){let n=this.acquireMatcher(t),r=this._global?this._lastIndex:0;if(!n.find(r))return this._global&&(this._lastIndex=0),null;let s=this._re2.groupCount(),i=[];i.push(n.group(0)??"");for(let l=1;l<=s;l++){let c=n.group(l);i.push(c)}let o=i;o.index=n.start(0),o.input=t;let a=this._re2.namedGroups();if(a&&Object.keys(a).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(a)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),o}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let n=[],r=this.acquireMatcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(this.assertResultCount(n.length+1),n.push(i),s=r.end(0),r.start(0)===r.end(0)&&s++,s>t.length)break}return n.length>0?n:null}replace(t,n){if(this._global&&(this._lastIndex=0),typeof n=="string"){let u=this._re2.matcher(t),f=new $e(this.maxOutputBytes,"regular expression replacement"),d=0,p=0,h=0;for(;u.find(p);){this.assertResultCount(++h);let m=u.start(0),g=u.end(0);if(f.append(t.slice(d,m)),f.append(this.expandReplacement(u,n)),d=g,p=g>m?g:g+1,!this._global||p>t.length)break}return f.append(t.slice(d)),f.build()}let r=new $e(this.maxOutputBytes,"regular expression replacement"),s=this._re2.matcher(t),i=0,o=0,a=0,l=this._re2.groupCount(),c=this._re2.namedGroups();for(;s.find(o);){this.assertResultCount(++a),r.append(t.slice(i,s.start(0)));let u=[],f=s.group(0)??"";for(let h=1;h<=l;h++)u.push(s.group(h));if(u.push(s.start(0)),u.push(t),c&&Object.keys(c).length>0){let h=Object.create(null);for(let[m,g]of Object.entries(c))h[m]=s.group(g)??"";u.push(h)}let d=s.start(0),p=s.end(0);if(r.append(n(f,...u)),i=p,o=i,d===p&&o++,!this._global||o>t.length)break}return r.append(t.slice(i)),r.build()}split(t,n){if(n===0)return[];let r=n===void 0||n<0?this.maxResults:Math.min(n,this.maxResults),s=[],i=this._re2.matcher(t),o=0,a=0;for(;s.length<r&&i.find(a);)this.assertResultCount(s.length+1),s.push(t.slice(o,i.start(0))),o=i.end(0),a=i.end(0)>i.start(0)?i.end(0):i.end(0)+1;return s.length<r&&s.push(t.slice(o)),s}search(t){let n=this.acquireMatcher(t);return n.find()?n.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let n=this._re2.matcher(t),r=this._re2.groupCount(),s=this._re2.namedGroups(),i=0,o=0;for(;n.find(i);){this.assertResultCount(++o);let a=[];a.push(n.group(0)??"");for(let c=1;c<=r;c++)a.push(n.group(c));let l=a;if(l.index=n.start(0),l.input=t,s&&Object.keys(s).length>0){let c=Object.create(null);for(let[u,f]of Object.entries(s)){let d=n.group(f);d!==null&&(c[u]=d)}l.groups=c}if(yield l,i=n.end(0),n.start(0)===n.end(0)&&i++,i>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new 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(t){this._lastIndex=t}};Wr=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,n){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,n)}split(t,n){return t.split(this._regex,n)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let n=this._regex.exec(t);for(;n!==null;)yield n,n[0].length===0&&this._regex.lastIndex++,n=this._regex.exec(t)}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(t){this._regex.lastIndex=t}}});var mt=F(()=>{"use strict";Nm()});function on(e,t,n){let r=typeof n=="boolean"?{ignoreCase:n}:n??{},s=t;r.stripQuotes&&(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1));let i=r.ignoreCase?`i:${s}`:s,o=Eo.get(i);if(!o){if(o=A9(s,r.ignoreCase),Eo.size>=S9){let a=Eo.keys().next().value;a!==void 0&&Eo.delete(a)}Eo.set(i,o)}return o.test(e)}function A9(e,t){let n="^";for(let r=0;r<e.length;r++){let s=e[r];if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=r+1;for(;i<e.length&&e[i]!=="]";)i++;n+=e.slice(r,i+1),r=i}else s==="."||s==="+"||s==="^"||s==="$"||s==="{"||s==="}"||s==="("||s===")"||s==="|"||s==="\\"?n+=`\\${s}`:n+=s}return n+="$",oe(n,t?"i":"")}var S9,Eo,Bu=F(()=>{"use strict";mt();S9=2048,Eo=new Map});function So(e,t){let n=e.ignoreCase?t.toLowerCase():t,r=e.needles;for(let s=0;s<r.length;s++)if(n.indexOf(r[s])!==-1)return!0;return!1}function Im(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(n,r,s)=>{if(r==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let i=parseInt(r,10);return t[i]??""})}function Ds(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:o=!1,filename:a="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:d="--",showColumn:p=!1,vimgrep:h=!1,showByteOffset:m=!1,replace:g=null,passthru:b=!1,multiline:y=!1,kResetGroup:w,preFilter:x,maxWork:S,maxMatches:E,signal:A}=n;if(y)return C9(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:m,replace:g,kResetGroup:w,preFilter:x,maxWork:S,maxMatches:E,signal:A});let I=0,R=(D=1)=>{if(A?.aborted)throw new _e;if(I+=D,S!==void 0&&I>S)throw new C(`search: matching work limit exceeded (${S})`,"iterations")},N=(D,Q)=>{if(E!==void 0&&D.length>=E)throw new C(`search: result limit exceeded (${E})`,"array_elements");D.push(Q)},$=1;for(let D=0;D<e.length;D++)if((D&1023)===0&&R(),e.charCodeAt(D)===10&&($++,E!==void 0&&$>E))throw new C(`search: line limit exceeded (${E})`,"array_elements");let T=e.split(`
185
+ `)));let o=!0;for(;!t.more()||t.peek()!==j.CODES.get("]")||o;){if(t.more()&&t.lookingAt("-")&&(this.flags&te.PERL_X)===0&&!o){let u=t.rest();if(u==="-"||!u.startsWith("-]"))throw t.rewindTo(n),new ot(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let a=t.pos();if(t.lookingAt("[:")){if(this.parseNamedClass(t,s))continue;t.rewindTo(a)}if(this.parseUnicodeClass(t,s)||this.parsePerlClassEscape(t,s))continue;t.rewindTo(a);let l=e.parseClassChar(t,n),c=l;if(t.more()&&t.lookingAt("-")){if(t.skip(1),t.more()&&t.lookingAt("]"))t.skip(-1);else if(c=e.parseClassChar(t,n),c<l)throw new ot(e.ERR_INVALID_CHAR_RANGE,t.from(a))}(this.flags&te.FOLD_CASE)===0?s.appendRange(l,c):s.appendFoldedRange(l,c)}t.skip(1),s.cleanClass(),i<0&&s.negateClass(),r.runes=s.toArray(),this.push(r)}},Fu=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}compareAndSet(t,n){return this.value===t?(this.value=n,!0):!1}},Mu=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,te.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,te.POSIX,!0)}static compileImpl(t,n,r){let s=Lu.parse(t,n),i=s.maxCap();s=Pu.simplify(s);let o=Ru.compileRegexp(s),a=new e(t,o,i,r),[l,c]=o.prefix();return a.prefixComplete=l,a.prefix=c,a.prefixUTF8=He.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}static match(t,n){return e.compile(t).match(n)}constructor(t,n,r=0,s=0){this.expr=t,this.prog=n,this.numSubexp=r,this.longest=s,this.cond=n.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new Fu,this.dfa=new Tu(n)}executeEngine(t,n,r,s){if(s>0)return this.doExecuteNFA(t,n,r,s);let i=this.dfa.match(t,n,r);return i!==null?i?[]:null:this.doExecuteNFA(t,n,r,s)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let t;do t=this.pooled.get();while(t&&!this.pooled.compareAndSet(t,t.next));return t}reset(){this.pooled.set(null)}put(t,n){let r=this.pooled.get();do r=this.pooled.get(),!n&&r&&(t=wo.fromMachine(t),n=!0),t.next!==r&&(t.next=r);while(!this.pooled.compareAndSet(r,t))}toString(){return this.expr}doExecuteNFA(t,n,r,s){let i=this.get(),o=!1;i?i.next!==null&&(i=wo.fromMachine(i),o=!0):(i=wo.fromRE2(this),o=!0),i.init(s);let a=i.match(t,n,r)?i.submatches():null;return this.put(i,o),a}match(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,0)!==null}matchWithGroup(t,n,r,s,i){return t instanceof rs||(t=Si.utf16(t)),this.matchMachineInput(t,n,r,s,i)}matchMachineInput(t,n,r,s,i){if(n>r)return[!1,null];let o=t.isUTF16Encoding()?gt.fromUTF16(t.asCharSequence(),0,r):gt.fromUTF8(t.asBytes(),0,r),a=this.executeEngine(o,n,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(t){return this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,0)!==null}replaceAll(t,n){return this.replaceAllFunc(t,()=>n,2*t.length+1)}replaceFirst(t,n){return this.replaceAllFunc(t,()=>n,1)}replaceAllFunc(t,n,r){let s=0,i=0,o="",a=gt.fromUTF16(t),l=0;for(;i<=t.length;){let c=this.executeEngine(a,i,te.UNANCHORED,2);if(c===null||c.length===0)break;o+=t.substring(s,c[0]),(c[1]>s||c[0]===0)&&(o+=n(t.substring(c[0],c[1])),l++),s=c[1];let u=a.step(i)&7;if(i+u>c[1]?i+=u:i+1>c[1]?i++:i=c[1],l>=r)break}return o+=t.substring(s),o}pad(t){if(t===null)return null;let n=(1+this.numSubexp)*2;if(t.length<n){let r=new Array(n).fill(-1);for(let s=0;s<t.length;s++)r[s]=t[s];t=r}return t}allMatches(t,n,r=s=>s){let s=[],i=t.endPos();n<0&&(n=i+1);let o=0,a=0,l=-1;for(;a<n&&o<=i;){let c=this.executeEngine(t,o,te.UNANCHORED,this.prog.numCap);if(c===null||c.length===0)break;let u=!0;if(c[1]===o){c[0]===l&&(u=!1);let f=t.step(o);f<0?o=i+1:o+=f&7}else o=c[1];l=c[1],u&&(s.push(r(this.pad(c))),a++)}return s}findUTF8(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:t.slice(n[0],n[1])}findUTF8Index(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,2);return n===null?null:n.slice(0,2)}find(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2);return n===null?"":t.substring(n[0],n[1])}findIndex(t){return this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,2)}findUTF8Submatch(t){let n=this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.slice(n[2*s],n[2*s+1]));return r}findUTF8SubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF8(t),0,te.UNANCHORED,this.prog.numCap))}findSubmatch(t){let n=this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap);if(n===null)return null;let r=new Array(1+this.numSubexp).fill(null);for(let s=0;s<r.length;s++)2*s<n.length&&n[2*s]>=0&&(r[s]=t.substring(n[2*s],n[2*s+1]));return r}findSubmatchIndex(t){return this.pad(this.executeEngine(gt.fromUTF16(t),0,te.UNANCHORED,this.prog.numCap))}findAllUTF8(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>t.slice(s[0],s[1]));return r.length===0?null:r}findAllUTF8Index(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAll(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>t.substring(s[0],s[1]));return r.length===0?null:r}findAllIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>s.slice(0,2));return r.length===0?null:r}findAllUTF8Submatch(t,n){let r=this.allMatches(gt.fromUTF8(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.slice(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllUTF8SubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF8(t),n);return r.length===0?null:r}findAllSubmatch(t,n){let r=this.allMatches(gt.fromUTF16(t),n,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=t.substring(s[2*o],s[2*o+1]));return i});return r.length===0?null:r}findAllSubmatchIndex(t,n){let r=this.allMatches(gt.fromUTF16(t),n);return r.length===0?null:r}},_u=class e{static isUpperCaseAlpha(t){return"A"<=t&&t<="Z"}static isHexadecimal(t){return"0"<=t&&t<="9"||"A"<=t&&t<="F"||"a"<=t&&t<="f"}static getUtf8CharSize(t){let n=t.charCodeAt(0);return n<128?1:n<2048?2:n<65536?3:4}static translate(t){if(typeof t!="string")return t;let n="",r=!1,s=t.length;s===0&&(n="(?:)",r=!0);let i=0;for(;i<s;){let o=t[i];if(o==="\\"){if(i+1<s)switch(o=t[i+1],o){case"\\":{n+="\\\\",i+=2;continue}case"c":{if(i+2<s){let l=t[i+2];if(e.isUpperCaseAlpha(l)){n+="\\x",n+=(l.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(l.charCodeAt(0)-64&15).toString(16).toUpperCase(),i+=3,r=!0;continue}}n+="\\c",i+=2;continue}case"u":{if(i+2<s){let l=t[i+2];if(e.isHexadecimal(l)){n+="\\x{"+l,i+=3;for(let c=0;c<3&&i<s&&(l=t[i],!!e.isHexadecimal(l));++i,++c)n+=l;n+="}",r=!0;continue}else if(l==="{"){n+="\\x",i+=2,r=!0;continue}}n+="\\u",i+=2;continue}default:{n+="\\";let l=e.getUtf8CharSize(o);n+=t.substring(i+1,i+1+l),i+=l+1;continue}}}else if(o==="/"){n+="\\/",i+=1,r=!0;continue}else if(o==="("&&i+2<s&&t[i+1]==="?"&&t[i+2]==="<"&&(i+3>=s||t[i+3]!=="="&&t[i+3]!=="!")){n+="(?P<",i+=3,r=!0;continue}let a=e.getUtf8CharSize(o);n+=t.substring(i,i+a),i+=a}return r?n:t}},zr=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(t){return He.quoteMeta(t)}static translateRegExp(t){return _u.translate(t)}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 vu("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=te.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);let i=new e(t,n);return i.re2Input=Mu.compileImpl(r,s,(n&e.LONGEST_MATCH)!==0),i}static matches(t,n){return e.compile(t).testExact(n)}static initTest(t,n,r){if(t==null)throw new Error("pattern is null");if(r==null)throw new Error("re2 is null");let s=new e(t,n);return s.re2Input=r,s}constructor(t,n){this.patternInput=t,this.flagsInput=n}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(t){return this.testExact(t)}matcher(t){return Array.isArray(t)&&(t=Si.utf8(t)),new Nu(this,t)}test(t){return Array.isArray(t)?this.re2Input.matchUTF8(t):this.re2Input.match(t)}testExact(t){let n=Array.isArray(t)?gt.fromUTF8(t):gt.fromUTF16(t);return this.re2Input.executeEngine(n,0,te.ANCHOR_BOTH,0)!==null}split(t,n=0){let r=this.matcher(t),s=[],i=0,o=0;for(;r.find();){if(o===0&&r.end()===0){o=r.end();continue}if(n>0&&s.length===n-1)break;if(o===r.start()){if(n===0){i+=1,o=r.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.start())),o=r.end()}if(n===0&&o!==r.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(r.substring(o,r.inputLength()))}return(n!==0||s.length===0)&&s.push(r.substring(o,r.inputLength())),s}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(t){return this===t?!0:t===null||this.constructor!==t.constructor?!1:this.flagsInput===t.flagsInput&&this.patternInput===t.patternInput}}});function w9(e){let t=0;return e.includes("i")&&(t|=zr.CASE_INSENSITIVE),e.includes("m")&&(t|=zr.MULTILINE),e.includes("s")&&(t|=zr.DOTALL),t}function vm(e){return zr.translateRegExp(e)}function E9(e,t){let n=w9(t);if(e.length>x9)return zr.compile(vm(e),n);let r=`${n} ${e}`,s=xo.get(r);if(s!==void 0)return s;let i=zr.compile(vm(e),n);if(xo.size>=b9){let o=xo.keys().next().value;o!==void 0&&xo.delete(o)}return xo.set(r,i),i}function oe(e,t="",n={}){return new La(e,t,n)}var g9,y9,b9,x9,xo,La,Wr,Nm=F(()=>{"use strict";km();St();G();g9=1e6,y9=64*1024*1024;b9=256,x9=1024,xo=new Map;La=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;_matcher=null;_matcherInput=null;maxResults;maxOutputBytes;signal;assertResultCount(t){if(this.signal?.aborted)throw new Error("regular expression aborted");if(t>this.maxResults)throw new C(`regular expression result limit exceeded (${this.maxResults})`,"array_elements")}expandReplacement(t,n){let r=new $e(this.maxOutputBytes,"regular expression replacement"),s=this._re2.groupCount(),i=this._re2.namedGroups();for(let o=0;o<n.length;o++){let a=n[o];if(a==="\\"&&o+1<n.length){r.append(n[++o]);continue}if(a!=="$"||o+1>=n.length){r.append(a);continue}if(n[o+1]==="{"){let l=n.indexOf("}",o+2);if(l!==-1){let c=n.slice(o+2,l),u=i?.[c];if(u!==void 0){r.append(t.group(u)??""),o=l;continue}}}if(/\d/.test(n[o+1])){let l=o+1,c=0;for(;l<n.length&&/\d/.test(n[l]);){let u=c*10+Number(n[l]);if(u>s)break;c=u,l++}r.append(t.group(c)??""),o=l-1;continue}r.append(a)}return r.build()}acquireMatcher(t){return this._matcher===null?(this._matcher=this._re2.matcher(t),this._matcherInput=t,this._matcher):(this._matcherInput!==t&&(this._matcher.matcherInput.charSequence=t,this._matcherInput=t),this._matcher.reset(),this._matcher)}constructor(t,n="",r={}){if(this._pattern=t,this._flags=n,this._global=n.includes("g"),this._ignoreCase=n.includes("i"),this._multiline=n.includes("m"),this.maxResults=r.maxResults??g9,this.maxOutputBytes=r.maxOutputBytes??y9,this.signal=r.signal,!Number.isSafeInteger(this.maxResults)||this.maxResults<0||!Number.isSafeInteger(this.maxOutputBytes)||this.maxOutputBytes<0)throw new Error("invalid regular expression limits");try{this._re2=E9(t,n)}catch(s){if(s instanceof ot){let i=s.message||"",o="";throw i.includes("(?=")||i.includes("(?!")||i.includes("(?<")||i.includes("(?<!")||t.includes("(?=")||t.includes("(?!")||t.includes("(?<=")||t.includes("(?<!")?o=" 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.":(i.includes("backreference")||/\\[1-9]/.test(t))&&(o=" 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."),new SyntaxError(`Invalid regular expression: /${t}/: ${i}${o}`)}throw s}}test(t){return this._global&&(this._lastIndex=0),this.acquireMatcher(t).find()}exec(t){let n=this.acquireMatcher(t),r=this._global?this._lastIndex:0;if(!n.find(r))return this._global&&(this._lastIndex=0),null;let s=this._re2.groupCount(),i=[];i.push(n.group(0)??"");for(let l=1;l<=s;l++){let c=n.group(l);i.push(c)}let o=i;o.index=n.start(0),o.input=t;let a=this._re2.namedGroups();if(a&&Object.keys(a).length>0){let l=Object.create(null);for(let[c,u]of Object.entries(a)){let f=n.group(u);f!==null&&(l[c]=f)}o.groups=l}return this._global&&(this._lastIndex=n.end(0),n.start(0)===n.end(0)&&this._lastIndex++),o}match(t){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(t);let n=[],r=this.acquireMatcher(t),s=0;for(;r.find(s);){let i=r.group(0)??"";if(this.assertResultCount(n.length+1),n.push(i),s=r.end(0),r.start(0)===r.end(0)&&s++,s>t.length)break}return n.length>0?n:null}replace(t,n){if(this._global&&(this._lastIndex=0),typeof n=="string"){let u=this._re2.matcher(t),f=new $e(this.maxOutputBytes,"regular expression replacement"),d=0,p=0,h=0;for(;u.find(p);){this.assertResultCount(++h);let m=u.start(0),g=u.end(0);if(f.append(t.slice(d,m)),f.append(this.expandReplacement(u,n)),d=g,p=g>m?g:g+1,!this._global||p>t.length)break}return f.append(t.slice(d)),f.build()}let r=new $e(this.maxOutputBytes,"regular expression replacement"),s=this._re2.matcher(t),i=0,o=0,a=0,l=this._re2.groupCount(),c=this._re2.namedGroups();for(;s.find(o);){this.assertResultCount(++a),r.append(t.slice(i,s.start(0)));let u=[],f=s.group(0)??"";for(let h=1;h<=l;h++)u.push(s.group(h));if(u.push(s.start(0)),u.push(t),c&&Object.keys(c).length>0){let h=Object.create(null);for(let[m,g]of Object.entries(c))h[m]=s.group(g)??"";u.push(h)}let d=s.start(0),p=s.end(0);if(r.append(n(f,...u)),i=p,o=i,d===p&&o++,!this._global||o>t.length)break}return r.append(t.slice(i)),r.build()}split(t,n){if(n===0)return[];let r=n===void 0||n<0?this.maxResults:Math.min(n,this.maxResults),s=[],i=this._re2.matcher(t),o=0,a=0;for(;s.length<r&&i.find(a);)this.assertResultCount(s.length+1),s.push(t.slice(o,i.start(0))),o=i.end(0),a=i.end(0)>i.start(0)?i.end(0):i.end(0)+1;return s.length<r&&s.push(t.slice(o)),s}search(t){let n=this.acquireMatcher(t);return n.find()?n.start(0):-1}*matchAll(t){if(!this._global)throw new Error("matchAll requires global flag");this._lastIndex=0;let n=this._re2.matcher(t),r=this._re2.groupCount(),s=this._re2.namedGroups(),i=0,o=0;for(;n.find(i);){this.assertResultCount(++o);let a=[];a.push(n.group(0)??"");for(let c=1;c<=r;c++)a.push(n.group(c));let l=a;if(l.index=n.start(0),l.input=t,s&&Object.keys(s).length>0){let c=Object.create(null);for(let[u,f]of Object.entries(s)){let d=n.group(f);d!==null&&(c[u]=d)}l.groups=c}if(yield l,i=n.end(0),n.start(0)===n.end(0)&&i++,i>t.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=new 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(t){this._lastIndex=t}};Wr=class{_regex;constructor(t){this._regex=t}test(t){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(t)}exec(t){return this._regex.exec(t)}match(t){return this._regex.global&&(this._regex.lastIndex=0),t.match(this._regex)}replace(t,n){return this._regex.global&&(this._regex.lastIndex=0),t.replace(this._regex,n)}split(t,n){return t.split(this._regex,n)}search(t){return t.search(this._regex)}*matchAll(t){if(!this._regex.global)throw new Error("matchAll requires global flag");this._regex.lastIndex=0;let n=this._regex.exec(t);for(;n!==null;)yield n,n[0].length===0&&this._regex.lastIndex++,n=this._regex.exec(t)}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(t){this._regex.lastIndex=t}}});var mt=F(()=>{"use strict";Nm()});function on(e,t,n){let r=typeof n=="boolean"?{ignoreCase:n}:n??{},s=t;r.stripQuotes&&(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1));let i=r.ignoreCase?`i:${s}`:s,o=Eo.get(i);if(!o){if(o=A9(s,r.ignoreCase),Eo.size>=S9){let a=Eo.keys().next().value;a!==void 0&&Eo.delete(a)}Eo.set(i,o)}return o.test(e)}function A9(e,t){let n="^";for(let r=0;r<e.length;r++){let s=e[r];if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=r+1;for(;i<e.length&&e[i]!=="]";)i++;n+=e.slice(r,i+1),r=i}else s==="."||s==="+"||s==="^"||s==="$"||s==="{"||s==="}"||s==="("||s===")"||s==="|"||s==="\\"?n+=`\\${s}`:n+=s}return n+="$",oe(n,t?"i":"")}var S9,Eo,Bu=F(()=>{"use strict";mt();S9=2048,Eo=new Map});function So(e,t){let n=e.ignoreCase?t.toLowerCase():t,r=e.needles;for(let s=0;s<r.length;s++)if(n.indexOf(r[s])!==-1)return!0;return!1}function Im(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(n,r,s)=>{if(r==="&")return t[0];if(s!==void 0)return t.groups?.[s]??"";let i=parseInt(r,10);return t[i]??""})}function Ds(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:s=!1,countOnly:i=!1,countMatches:o=!1,filename:a="",onlyMatching:l=!1,beforeContext:c=0,afterContext:u=0,maxCount:f=0,contextSeparator:d="--",showColumn:p=!1,vimgrep:h=!1,showByteOffset:m=!1,replace:g=null,passthru:b=!1,multiline:y=!1,kResetGroup:w,preFilter:x,maxWork:S,maxMatches:E,signal:A}=n;if(y)return C9(e,t,{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:m,replace:g,kResetGroup:w,preFilter:x,maxWork:S,maxMatches:E,signal:A});let I=0,R=(D=1)=>{if(A?.aborted)throw new Fe;if(I+=D,S!==void 0&&I>S)throw new C(`search: matching work limit exceeded (${S})`,"iterations")},N=(D,Q)=>{if(E!==void 0&&D.length>=E)throw new C(`search: result limit exceeded (${E})`,"array_elements");D.push(Q)},$=1;for(let D=0;D<e.length;D++)if((D&1023)===0&&R(),e.charCodeAt(D)===10&&($++,E!==void 0&&$>E))throw new C(`search: line limit exceeded (${E})`,"array_elements");let T=e.split(`
186
186
  `),_=T.length,z=_>0&&T[_-1]===""?_-1:_;if(i||o){let D=0,Q=(o||l)&&!r;for(let Y=0;Y<z;Y++){R();let ee=T[Y];if(!(x&&!r&&!So(x,ee)))if(t.lastIndex=0,Q)for(let Se=t.exec(ee);Se!==null;Se=t.exec(ee))R(),D++,Se[0].length===0&&t.lastIndex++;else t.test(ee)!==r&&D++}return{output:`${a?`${a}:${D}`:String(D)}
187
- `,matched:D>0,matchCount:D}}if(c===0&&u===0&&!b){let D=[],Q=!1,V=0,Y=0;for(let ee=0;ee<z&&(R(),!(f>0&&V>=f));ee++){let Se=T[ee],Te=null;if(x&&!So(x,Se)||(t.lastIndex=0,Te=t.exec(Se)),Te!==null!==r)if(Q=!0,V++,l)for(let pe=Te;pe!==null;pe=t.exec(Se)){R();let Le=w!==void 0?pe[w]??"":pe[0],ie=g!==null?Im(g,pe):Le,re=a?`${a}:`:"";m&&(re+=`${Y+pe.index}:`),s&&(re+=`${ee+1}:`),p&&(re+=`${pe.index+1}:`),N(D,re+ie),pe[0].length===0&&t.lastIndex++}else if(h)for(let pe=Te;pe!==null;pe=t.exec(Se)){R();let Le=a?`${a}:`:"";m&&(Le+=`${Y+pe.index}:`),s&&(Le+=`${ee+1}:`),p&&(Le+=`${pe.index+1}:`),N(D,Le+Se),pe[0].length===0&&t.lastIndex++}else{let pe=Te?Te.index+1:1,Le=Se;g!==null&&(t.lastIndex=0,Le=t.replace(Se,(...re)=>{if(re[0].length===0)return"";let ye=re,Me=re[re.length-1];return typeof Me=="object"&&Me!==null?(ye.groups=Me,ye.input=re[re.length-2],ye.index=re[re.length-3]):(ye.input=re[re.length-1],ye.index=re[re.length-2]),Im(g,ye)}));let ie=a?`${a}:`:"";m&&(ie+=`${Y+(Te?Te.index:0)}:`),s&&(ie+=`${ee+1}:`),p&&(ie+=`${pe}:`),N(D,ie+Le)}Y+=Se.length+1}return{output:D.length>0?`${D.join(`
187
+ `,matched:D>0,matchCount:D}}if(c===0&&u===0&&!b){let D=[],Q=!1,V=0,Y=0;for(let ee=0;ee<z&&(R(),!(f>0&&V>=f));ee++){let Se=T[ee],Te=null;if(x&&!So(x,Se)||(t.lastIndex=0,Te=t.exec(Se)),Te!==null!==r)if(Q=!0,V++,l)for(let pe=Te;pe!==null;pe=t.exec(Se)){R();let Le=w!==void 0?pe[w]??"":pe[0],ie=g!==null?Im(g,pe):Le,re=a?`${a}:`:"";m&&(re+=`${Y+pe.index}:`),s&&(re+=`${ee+1}:`),p&&(re+=`${pe.index+1}:`),N(D,re+ie),pe[0].length===0&&t.lastIndex++}else if(h)for(let pe=Te;pe!==null;pe=t.exec(Se)){R();let Le=a?`${a}:`:"";m&&(Le+=`${Y+pe.index}:`),s&&(Le+=`${ee+1}:`),p&&(Le+=`${pe.index+1}:`),N(D,Le+Se),pe[0].length===0&&t.lastIndex++}else{let pe=Te?Te.index+1:1,Le=Se;g!==null&&(t.lastIndex=0,Le=t.replace(Se,(...re)=>{if(re[0].length===0)return"";let ye=re,Be=re[re.length-1];return typeof Be=="object"&&Be!==null?(ye.groups=Be,ye.input=re[re.length-2],ye.index=re[re.length-3]):(ye.input=re[re.length-1],ye.index=re[re.length-2]),Im(g,ye)}));let ie=a?`${a}:`:"";m&&(ie+=`${Y+(Te?Te.index:0)}:`),s&&(ie+=`${ee+1}:`),p&&(ie+=`${pe}:`),N(D,ie+Le)}Y+=Se.length+1}return{output:D.length>0?`${D.join(`
188
188
  `)}
189
189
  `:"",matched:Q,matchCount:V}}if(b){let D=[],Q=!1,V=0;for(let Y=0;Y<z;Y++){R();let ee=T[Y],Se;x&&!So(x,ee)?Se=!1:(t.lastIndex=0,Se=t.test(ee));let Te=Se!==r;Te&&(Q=!0,V++);let Ae=Te?":":"-",pe=a?`${a}${Ae}`:"";s&&(pe+=`${Y+1}${Ae}`),N(D,pe+ee)}return{output:D.length>0?`${D.join(`
190
190
  `)}
191
191
  `:"",matched:Q,matchCount:V}}let O=[],B=0,U=new Set,L=-1,W=[];for(let D=0;D<z&&(R(),!(f>0&&B>=f));D++){let Q=T[D],V;if(x&&!So(x,Q)?V=!1:(t.lastIndex=0,V=t.test(Q)),V!==r){if(E!==void 0&&W.length>=E)throw new C(`search: match limit exceeded (${E})`,"array_elements");W.push(D),B++}}for(let D of W){R();let Q=Math.max(0,D-c);L>=0&&Q>L+1&&N(O,d);for(let Y=Q;Y<D;Y++)if(R(),!U.has(Y)){U.add(Y),L=Y;let ee=T[Y];s&&(ee=`${Y+1}-${ee}`),a&&(ee=`${a}-${ee}`),N(O,ee)}if(!U.has(D)){U.add(D),L=D;let Y=T[D];if(l){t.lastIndex=0;for(let ee=t.exec(Y);ee!==null;ee=t.exec(Y)){R();let Se=w!==void 0?ee[w]??"":ee[0],Te=g!==null?g:Se,Ae=a?`${a}:`:"";s&&(Ae+=`${D+1}:`),p&&(Ae+=`${ee.index+1}:`),N(O,Ae+Te),ee[0].length===0&&t.lastIndex++}}else{let ee=Y;s&&(ee=`${D+1}:${ee}`),a&&(ee=`${a}:${ee}`),N(O,ee)}}let V=Math.min(z-1,D+u);for(let Y=D+1;Y<=V;Y++)if(R(),!U.has(Y)){U.add(Y),L=Y;let ee=T[Y];s&&(ee=`${Y+1}-${ee}`),a&&(ee=`${a}-${ee}`),N(O,ee)}}return{output:O.length>0?`${O.join(`
192
192
  `)}
193
- `:"",matched:B>0,matchCount:B}}function C9(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:h,replace:m,kResetGroup:g,preFilter:b,maxWork:y,maxMatches:w,signal:x}=n,S=0,E=(U=1)=>{if(x?.aborted)throw new _e;if(S+=U,y!==void 0&&S>y)throw new C(`search: matching work limit exceeded (${y})`,"iterations")};if(b&&!r&&!So(b,e))return i||o?{output:`${a?`${a}:0`:"0"}
193
+ `:"",matched:B>0,matchCount:B}}function C9(e,t,n){let{invertMatch:r,showLineNumbers:s,countOnly:i,countMatches:o,filename:a,onlyMatching:l,beforeContext:c,afterContext:u,maxCount:f,contextSeparator:d,showColumn:p,showByteOffset:h,replace:m,kResetGroup:g,preFilter:b,maxWork:y,maxMatches:w,signal:x}=n,S=0,E=(U=1)=>{if(x?.aborted)throw new Fe;if(S+=U,y!==void 0&&S>y)throw new C(`search: matching work limit exceeded (${y})`,"iterations")};if(b&&!r&&!So(b,e))return i||o?{output:`${a?`${a}:0`:"0"}
194
194
  `,matched:!1,matchCount:0}:{output:"",matched:!1,matchCount:0};let A=[0];for(let U=0;U<e.length;U++)if((U&1023)===0&&E(),e[U]===`
195
195
  `){if(w!==void 0&&A.length>=w)throw new C(`search: line index limit exceeded (${w})`,"array_elements");A.push(U+1)}let I=e.split(`
196
196
  `),R=I.length,N=R>0&&I[R-1]===""?R-1:R,$=U=>{let L=0,W=A.length;for(;L<W;){let D=L+Math.floor((W-L)/2);A[D]<=U?L=D+1:W=D}return Math.max(0,L-1)},T=U=>{let L=$(U);return U-A[L]+1};if(i||o){let U=0,L=0,W=-1;t.lastIndex=0;for(let V=t.exec(e);V!==null&&(E(),!(f>0&&U>=f));V=t.exec(e)){if(U++,!o){let Y=$(V.index),ee=$(V.index+Math.max(0,V[0].length-1)),Se=Math.max(Y,W+1);Se<=ee&&(L+=ee-Se+1,W=ee)}V[0].length===0&&t.lastIndex++}let D=o?r?0:U:r?N-L:L;return{output:`${a?`${a}:${D}`:String(D)}
@@ -201,23 +201,23 @@ Modify: ${p.mtime.toISOString()}
201
201
  `:"",matched:!0,matchCount:_.length}}var Om=F(()=>{"use strict";G()});function Tm(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 s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s),o=k9.get(i);if(o){r+=o,n=s+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 Ci(e,t){let n,r;switch(t.mode){case"fixed":n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":{if(n=Tm(e),n=n.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),t.mode==="perl"){n=O9(n),n=T9(n),n=$9(n);let a=L9(n);n=a.pattern,r=a.kResetGroup}break}default:n=Tm(e),n=_9(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^(?:${n})$`);let s=/\\u\{[0-9A-Fa-f]+\}/.test(n),i="g"+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.multilineDotall?"s":"")+(s?"u":""),o=v9(n,t.ignoreCase??!1);return{regex:oe(n,i),kResetGroup:r,preFilter:o??void 0}}function v9(e,t){let n=e;if(n.startsWith("\\b(?:")&&n.endsWith(")\\b")?n=n.slice(5,n.length-3):n.startsWith("\\b")&&n.endsWith("\\b")&&n.length>=4&&(n=n.slice(2,n.length-2)),n.length===0)return null;let r=N9(n);if(r===null)return null;let s=[];for(let i of r){let o=I9(i);if(o===null||o.length===0)return null;s.push(o)}return s.length===0?null:{needles:t?s.map(i=>i.toLowerCase()):s,ignoreCase:t}}function N9(e){let t=[],n=0,r=!1,s=0;for(let i=0;i<e.length;i++){let o=e[i];if(o==="\\"){i++;continue}if(r){o==="]"&&(r=!1);continue}if(o==="[")r=!0;else if(o==="(")n++;else if(o===")"){if(n--,n<0)return null}else o==="|"&&n===0&&(t.push(e.slice(s,i)),s=i+1)}return n!==0||r?null:(t.push(e.slice(s)),t)}function I9(e){let t=e;if(t.startsWith("^")&&(t=t.slice(1)),t.endsWith("$")){let r=0;for(let s=t.length-2;s>=0&&t[s]==="\\";s--)r++;r%2===0&&(t=t.slice(0,-1))}if(t.length===0)return null;let n="";for(let r=0;r<t.length;r++){let s=t[r];if(s==="\\"){let i=t[r+1];if(i===void 0||/[dDwWsSbBAZzGQE0-9ckpPNXRxuU]/.test(i))return null;i==="n"?n+=`
202
202
  `:i==="t"?n+=" ":i==="r"?n+="\r":i==="f"?n+="\f":i==="v"?n+="\v":n+=i,r++;continue}if(/[.*+?^${}()|[\]]/.test(s))return null;n+=s}return n}function O9(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 T9(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,"\\u{$1}")}function $9(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 s=r[1]||"",i=r[2]||"",o=r[3];if(o===":"){let a=n+r[0].length-1,l=R9(e,n);if(l!==-1){let c=e.slice(a+1,l),u=P9(c,s,i);t+=`(?:${u})`,n=l+1;continue}}else if(o===")"||o===""){n+=r[0].length;continue}}}t+=e[n],n++}return t}function R9(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 P9(e,t,n){let r=e;return t.includes("i")&&(r=D9(r)),r}function D9(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 s=[];for(;n<e.length&&e[n]!=="]";)if(e[n]==="\\")s.push(e[n]),n++,n<e.length&&(s.push(e[n]),n++);else if(e[n]==="-"&&s.length>0&&n+1<e.length&&e[n+1]!=="]"){let i=s[s.length-1],o=e[n+1];s.push("-"),s.push(o),/[a-z]/.test(i)&&/[a-z]/.test(o)?(s.push(i.toUpperCase()),s.push("-"),s.push(o.toUpperCase())):/[A-Z]/.test(i)&&/[A-Z]/.test(o)&&(s.push(i.toLowerCase()),s.push("-"),s.push(o.toLowerCase())),n+=2}else{let i=e[n];if(s.push(i),/[a-zA-Z]/.test(i)){let o=i===i.toLowerCase()?i.toUpperCase():i.toLowerCase();s.includes(o)||s.push(o)}n++}t+=s.join(""),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let s=r.toLowerCase(),i=r.toUpperCase();t+=`[${i}${s}]`}else t+=r;n++}return t}function L9(e){let t=F9(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),s=M9(n);return{pattern:`(?:${n})(${r})`,kResetGroup:s+1}}function F9(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 M9(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 s=e[n+3];if(s==="="||s==="!"){n++;continue}t++,n++;continue}}}else t++;n++}return t}function Fa(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 _9(e){let t="",n=0,r=!0,s=0;for(;n<e.length;){let i=e[n];if(i==="["){for(t+=i,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(i==="\\"&&n+1<e.length){let o=e[n+1];if(o==="|"){t+="|",n+=2,r=!0;continue}if(o==="("){t+="(",n+=2,s++,r=!0;continue}if(o===")"){t+=")",n+=2,s=Math.max(0,s-1),r=!1;continue}if(o==="{"){let l=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(l){let c=l[1],u=l[2]!==void 0,f=l[3]||"";u?t+=`{${c},${f}}`:t+=`{${c}}`,n+=l[0].length,r=!1;continue}t+="\\{",n+=2,r=!1;continue}if(o==="}"){t+="\\}",n+=2,r=!1;continue}t+=i+o,n+=2,r=!1;continue}if(i==="*"&&r){t+="\\*",n++;continue}if(i==="^"){if(r){t+="^",n++;continue}t+="\\^",n++;continue}if(i==="$"){let o=n===e.length-1,a=n+2<e.length&&e[n+1]==="\\"&&e[n+2]===")";o||a?t+="$":t+="\\$",n++,r=!1;continue}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?t+=`\\${i}`:t+=i,n++,r=!1}return t}var k9,$m=F(()=>{"use strict";mt();k9=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_"]])});var Uu=F(()=>{"use strict";Om();$m()});var _a={};ae(_a,{egrepCommand:()=>G9,egrepFlagsForFuzzing:()=>X9,fgrepCommand:()=>q9,fgrepFlagsForFuzzing:()=>K9,flagsForFuzzing:()=>Z9,grepCommand:()=>zu});function Rm(e){let t=e.limits.maxLoopIterations,n=e.limits.maxArrayElements;return Math.max(t,Math.min(n,t*10))}function Hn(e){if(++e.operations>e.maxOperations)throw new C(`grep: glob operation limit exceeded (${e.maxOperations})`,"glob_operations")}function Ao(e){if(e.results>=e.maxResults)throw new C(`grep: array element limit exceeded (${e.maxResults})`,"array_elements");e.results++}function z9(e){return e.split(`
203
203
  `)}function W9(e){if(e==="")return[];let t=e.split(`
204
- `);return t[t.length-1]===""&&t.pop(),t}function j9(e,t){return e.length===1?{pattern:e[0],mode:t}:t==="fixed"?{pattern:e.map(n=>`(?:${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join("|"),mode:"extended"}:t==="basic"?{pattern:e.join("\\|"),mode:t}:{pattern:e.map(n=>`(?:${n})`).join("|"),mode:t}}async function Dm(e,t,n,r,s,i=0){if(i>=Pm)return;let o=n.fs.resolvePath(n.cwd,e);try{if(Hn(s),!(await n.fs.stat(o)).isDirectory){let c=e.split("/").pop()||"";if(t){let u=t.replace(/^\//,"");on(c,u,{stripQuotes:!0})&&(Ao(s),r.push(e))}return}Hn(s);let l=await n.fs.readdir(o);for(let c of l){let u=e==="."?c:`${e}/${c}`,f=n.fs.resolvePath(n.cwd,u);if(Hn(s),(await n.fs.stat(f)).isDirectory)await Dm(u,t,n,r,s,i+1);else if(t){let p=t.replace(/^\//,"");on(c,p,{stripQuotes:!0})&&(Ao(s),r.push(u))}}}catch(a){ge(a)}}async function V9(e,t,n){let r=[],s=e.lastIndexOf("/"),i,o;if(s===-1?(i=t.cwd,o=e):(i=e.slice(0,s)||"/",o=e.slice(s+1)),e.includes("**")){let l=[],c=e.split("**"),u=c[0].replace(/\/$/,"")||".",f=c[1]||"";return await Dm(u,f,t,l,n),l.map(d=>({path:d}))}let a=t.fs.resolvePath(t.cwd,i);try{if(t.fs.readdirWithFileTypes){Hn(n);let l=await t.fs.readdirWithFileTypes(a);for(let c of l)if(Hn(n),on(c.name,o,{stripQuotes:!0})){let u=s===-1?c.name:`${i}/${c.name}`;Ao(n),r.push({path:u,isFile:c.isFile})}}else{Hn(n);let l=await t.fs.readdir(a);for(let c of l)if(Hn(n),on(c,o,{stripQuotes:!0})){let u=s===-1?c:`${i}/${c}`;Ao(n),r.push({path:u})}}}catch(l){ge(l)}return r.sort((l,c)=>l.path.localeCompare(c.path))}async function Ma(e,t,n=[],r=[],s=[],i,o={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},a=[],l=0){if(l>=Pm)return a;let c=t.fs.resolvePath(t.cwd,e);try{let u,f;if(i!==void 0)u=i,f=!i;else{Hn(o);let p=await t.fs.stat(c);u=p.isFile,f=p.isDirectory}if(u){let p=e.split("/").pop()||e;return r.length>0&&r.some(h=>on(p,h,{stripQuotes:!0}))||n.length>0&&!n.some(h=>on(p,h,{stripQuotes:!0}))||(Ao(o),a.push({path:e,isFile:!0})),a}if(!f)return a;let d=e.split("/").pop()||e;if(s.length>0&&s.some(p=>on(d,p,{stripQuotes:!0})))return a;if(t.fs.readdirWithFileTypes){Hn(o);let p=await t.fs.readdirWithFileTypes(c);for(let h of p){if(Hn(o),h.name.startsWith("."))continue;let m=e==="."?h.name:`${e}/${h.name}`;await Ma(m,t,n,r,s,h.isFile,o,a,l+1)}}else{Hn(o);let p=await t.fs.readdir(c);for(let h of p){if(Hn(o),h.startsWith("."))continue;let m=e==="."?h:`${e}/${h}`;await Ma(m,t,n,r,s,void 0,o,a,l+1)}}}catch(u){ge(u)}return a}var B9,U9,H9,zu,Pm,q9,G9,Z9,K9,X9,Ba=F(()=>{"use strict";ue();vt();G();Bu();de();Uu();B9="(standard input)";U9="[^\\s\\S]";H9={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",description:["Search for PATTERN in each FILE.","With no FILE, or when FILE is -, read standard input."],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","-f FILE, --file=FILE obtain patterns from FILE, one per line"," --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"]},zu={name:"grep",async execute(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=0,y=0,w=0,x=[],S=[],E=[],A=[],I=[],R=[],N=!0;for(let ie=0;ie<e.length;ie++){let re=e[ie];if(N&&re==="--"){N=!1;continue}if(N&&re==="--help")return q(H9);if(N&&re.startsWith("-")&&re!=="-"){if(re==="-e"&&ie+1<e.length){A.push(e[++ie]);continue}if(re.startsWith("--file=")){I.push(re.slice(7));continue}if(re.startsWith("--include=")){x.push(re.slice(10));continue}if(re.startsWith("--exclude=")){S.push(re.slice(10));continue}if(re.startsWith("--exclude-dir=")){E.push(re.slice(14));continue}if(re.startsWith("--max-count=")){b=parseInt(re.slice(12),10);continue}let Xe=re.match(/^-m(\d+)$/);if(Xe){b=parseInt(Xe[1],10);continue}if(re==="-m"&&ie+1<e.length){b=parseInt(e[++ie],10);continue}let ye=re.match(/^-([ABC])(\d+)$/);if(ye){let ze=parseInt(ye[2],10);ye[1]==="A"?w=ze:ye[1]==="B"?y=ze:ye[1]==="C"&&(y=ze,w=ze);continue}if((re==="-A"||re==="-B"||re==="-C")&&ie+1<e.length){let ze=parseInt(e[++ie],10);re==="-A"?w=ze:re==="-B"?y=ze:(y=ze,w=ze);continue}let Me=re.startsWith("--")?[re]:re.slice(1).split("");for(let ze=0;ze<Me.length;ze++){let he=Me[ze];if(he==="f"||he==="--file"){let Mr=he==="f"?Me.slice(ze+1).join(""):"";if(Mr.length>0)I.push(Mr);else if(ie+1<e.length)I.push(e[++ie]);else return{stdout:"",stderr:he==="f"?`grep: option requires an argument -- 'f'
204
+ `);return t[t.length-1]===""&&t.pop(),t}function j9(e,t){return e.length===1?{pattern:e[0],mode:t}:t==="fixed"?{pattern:e.map(n=>`(?:${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join("|"),mode:"extended"}:t==="basic"?{pattern:e.join("\\|"),mode:t}:{pattern:e.map(n=>`(?:${n})`).join("|"),mode:t}}async function Dm(e,t,n,r,s,i=0){if(i>=Pm)return;let o=n.fs.resolvePath(n.cwd,e);try{if(Hn(s),!(await n.fs.stat(o)).isDirectory){let c=e.split("/").pop()||"";if(t){let u=t.replace(/^\//,"");on(c,u,{stripQuotes:!0})&&(Ao(s),r.push(e))}return}Hn(s);let l=await n.fs.readdir(o);for(let c of l){let u=e==="."?c:`${e}/${c}`,f=n.fs.resolvePath(n.cwd,u);if(Hn(s),(await n.fs.stat(f)).isDirectory)await Dm(u,t,n,r,s,i+1);else if(t){let p=t.replace(/^\//,"");on(c,p,{stripQuotes:!0})&&(Ao(s),r.push(u))}}}catch(a){ge(a)}}async function V9(e,t,n){let r=[],s=e.lastIndexOf("/"),i,o;if(s===-1?(i=t.cwd,o=e):(i=e.slice(0,s)||"/",o=e.slice(s+1)),e.includes("**")){let l=[],c=e.split("**"),u=c[0].replace(/\/$/,"")||".",f=c[1]||"";return await Dm(u,f,t,l,n),l.map(d=>({path:d}))}let a=t.fs.resolvePath(t.cwd,i);try{if(t.fs.readdirWithFileTypes){Hn(n);let l=await t.fs.readdirWithFileTypes(a);for(let c of l)if(Hn(n),on(c.name,o,{stripQuotes:!0})){let u=s===-1?c.name:`${i}/${c.name}`;Ao(n),r.push({path:u,isFile:c.isFile})}}else{Hn(n);let l=await t.fs.readdir(a);for(let c of l)if(Hn(n),on(c,o,{stripQuotes:!0})){let u=s===-1?c:`${i}/${c}`;Ao(n),r.push({path:u})}}}catch(l){ge(l)}return r.sort((l,c)=>l.path.localeCompare(c.path))}async function Ma(e,t,n=[],r=[],s=[],i,o={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},a=[],l=0){if(l>=Pm)return a;let c=t.fs.resolvePath(t.cwd,e);try{let u,f;if(i!==void 0)u=i,f=!i;else{Hn(o);let p=await t.fs.stat(c);u=p.isFile,f=p.isDirectory}if(u){let p=e.split("/").pop()||e;return r.length>0&&r.some(h=>on(p,h,{stripQuotes:!0}))||n.length>0&&!n.some(h=>on(p,h,{stripQuotes:!0}))||(Ao(o),a.push({path:e,isFile:!0})),a}if(!f)return a;let d=e.split("/").pop()||e;if(s.length>0&&s.some(p=>on(d,p,{stripQuotes:!0})))return a;if(t.fs.readdirWithFileTypes){Hn(o);let p=await t.fs.readdirWithFileTypes(c);for(let h of p){if(Hn(o),h.name.startsWith("."))continue;let m=e==="."?h.name:`${e}/${h.name}`;await Ma(m,t,n,r,s,h.isFile,o,a,l+1)}}else{Hn(o);let p=await t.fs.readdir(c);for(let h of p){if(Hn(o),h.startsWith("."))continue;let m=e==="."?h:`${e}/${h}`;await Ma(m,t,n,r,s,void 0,o,a,l+1)}}}catch(u){ge(u)}return a}var B9,U9,H9,zu,Pm,q9,G9,Z9,K9,X9,Ba=F(()=>{"use strict";ue();vt();G();Bu();de();Uu();B9="(standard input)";U9="[^\\s\\S]";H9={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",description:["Search for PATTERN in each FILE.","With no FILE, or when FILE is -, read standard input."],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","-f FILE, --file=FILE obtain patterns from FILE, one per line"," --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"]},zu={name:"grep",async execute(e,t){let n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=0,y=0,w=0,x=[],S=[],E=[],A=[],I=[],R=[],N=!0;for(let ie=0;ie<e.length;ie++){let re=e[ie];if(N&&re==="--"){N=!1;continue}if(N&&re==="--help")return q(H9);if(N&&re.startsWith("-")&&re!=="-"){if(re==="-e"&&ie+1<e.length){A.push(e[++ie]);continue}if(re.startsWith("--file=")){I.push(re.slice(7));continue}if(re.startsWith("--include=")){x.push(re.slice(10));continue}if(re.startsWith("--exclude=")){S.push(re.slice(10));continue}if(re.startsWith("--exclude-dir=")){E.push(re.slice(14));continue}if(re.startsWith("--max-count=")){b=parseInt(re.slice(12),10);continue}let We=re.match(/^-m(\d+)$/);if(We){b=parseInt(We[1],10);continue}if(re==="-m"&&ie+1<e.length){b=parseInt(e[++ie],10);continue}let ye=re.match(/^-([ABC])(\d+)$/);if(ye){let _e=parseInt(ye[2],10);ye[1]==="A"?w=_e:ye[1]==="B"?y=_e:ye[1]==="C"&&(y=_e,w=_e);continue}if((re==="-A"||re==="-B"||re==="-C")&&ie+1<e.length){let _e=parseInt(e[++ie],10);re==="-A"?w=_e:re==="-B"?y=_e:(y=_e,w=_e);continue}let Be=re.startsWith("--")?[re]:re.slice(1).split("");for(let _e=0;_e<Be.length;_e++){let he=Be[_e];if(he==="f"||he==="--file"){let Mr=he==="f"?Be.slice(_e+1).join(""):"";if(Mr.length>0)I.push(Mr);else if(ie+1<e.length)I.push(e[++ie]);else return{stdout:"",stderr:he==="f"?`grep: option requires an argument -- 'f'
205
205
  `:`grep: option '--file' requires an argument
206
206
  `,exitCode:2};break}if(he==="i"||he==="--ignore-case")n=!0;else if(he==="n"||he==="--line-number")r=!0;else if(he==="v"||he==="--invert-match")s=!0;else if(he==="c"||he==="--count")i=!0;else if(he==="l"||he==="--files-with-matches")o=!0;else if(he==="L"||he==="--files-without-match")a=!0;else if(he==="r"||he==="R"||he==="--recursive")l=!0;else if(he==="w"||he==="--word-regexp")c=!0;else if(he==="x"||he==="--line-regexp")u=!0;else if(he==="E"||he==="--extended-regexp")f=!0;else if(he==="P"||he==="--perl-regexp")d=!0;else if(he==="F"||he==="--fixed-strings")p=!0;else if(he==="o"||he==="--only-matching")h=!0;else if(he==="h"||he==="--no-filename")m=!0;else if(he==="q"||he==="--quiet"||he==="--silent")g=!0;else{if(he.startsWith("--"))return se("grep",he);if(he.length===1)return se("grep",`-${he}`)}}}else R.push(re)}if(A.length===0&&I.length===0){let ie=R.shift();if(ie===void 0)return{stdout:"",stderr:`grep: missing pattern
207
207
  `,exitCode:2};A.push(ie)}A=A.flatMap(z9);let $=!1;for(let ie of I){let re;if(ie==="")return{stdout:"",stderr:`grep: : No such file or directory
208
208
  `,exitCode:2};if(ie==="-")re=$?"":fe(t.stdin),$=!0;else try{let ye=t.fs.resolvePath(t.cwd,ie);if((await t.fs.stat(ye)).isDirectory)return{stdout:"",stderr:`grep: ${ie}: Is a directory
209
209
  `,exitCode:2};re=await t.fs.readFile(ye)}catch(ye){return ge(ye),{stdout:"",stderr:`grep: ${ie}: No such file or directory
210
- `,exitCode:2}}let Xe=W9(re);if(A.length+Xe.length>t.limits.maxArrayElements)throw new C(`grep: array element limit exceeded (${t.limits.maxArrayElements})`,"array_elements");A.push(...Xe)}if(A.length===0&&!s&&!a)return{stdout:"",stderr:"",exitCode:1};let T=R,_=p?"fixed":f?"extended":d?"perl":"basic";if(_==="perl"&&new Set(A).size>1)return{stdout:"",stderr:`grep: the -P option only supports a single pattern
210
+ `,exitCode:2}}let We=W9(re);if(A.length+We.length>t.limits.maxArrayElements)throw new C(`grep: array element limit exceeded (${t.limits.maxArrayElements})`,"array_elements");A.push(...We)}if(A.length===0&&!s&&!a)return{stdout:"",stderr:"",exitCode:1};let T=R,_=p?"fixed":f?"extended":d?"perl":"basic";if(_==="perl"&&new Set(A).size>1)return{stdout:"",stderr:`grep: the -P option only supports a single pattern
211
211
  `,exitCode:2};if(A.length>1&&_!=="fixed")for(let ie of A)try{Ci(ie,{mode:_})}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${ie}
212
212
  `,exitCode:2}}let z=A.length===0?{pattern:U9,mode:"extended"}:j9(A,_),O,B,U;try{let ie=Ci(z.pattern,{mode:z.mode,ignoreCase:n,wholeWord:c,lineRegexp:u});O=ie.regex,B=ie.kResetGroup,U=ie.preFilter}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${A.join(`
213
213
  `)}
214
214
  `,exitCode:2}}if(T.length===0&&t.stdin!==void 0){let ie=$?"":fe(t.stdin),re=Ds(ie,O,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:"",onlyMatching:h,beforeContext:y,afterContext:w,maxCount:b,kResetGroup:B,preFilter:U,maxWork:Rm(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return g?{stdout:"",stderr:"",exitCode:re.matched?0:1}:{stdout:re.output,stderr:"",exitCode:re.matched?0:1}}if(T.length===0)return{stdout:"",stderr:`grep: no input files
215
- `,exitCode:2};let L="",W="",D=!1,Q=!1,V=[],Y={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},ee=ie=>{if(ie.length>Y.maxResults-V.length)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push(...ie)},Se=!1,Te=!1;for(let ie of T){if(ie==="-"){if(V.length>=Y.maxResults)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push({path:B9,isFile:!0,isStdin:!0,stdinAtEof:Se}),Se=!0;continue}if(Te=!0,ie.includes("*")||ie.includes("?")||ie.includes("[")){let re=await V9(ie,t,Y);if(l)for(let Xe of re){let ye=await Ma(Xe.path,t,x,S,E,Xe.isFile,Y);ee(ye)}else ee(re)}else if(l){let re=await Ma(ie,t,x,S,E,void 0,Y);ee(re)}else{if(V.length>=Y.maxResults)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push({path:ie})}}let Ae=(V.length>1||l&&Te)&&!m,pe=50;for(let ie=0;ie<V.length;ie+=pe){let re=V.slice(ie,ie+pe),Xe=await Promise.all(re.map(async ye=>{let Me=ye.path,ze=Me.split("/").pop()||Me;if(S.length>0&&!l&&!ye.isStdin&&S.some(he=>on(ze,he,{stripQuotes:!0}))||x.length>0&&!l&&!ye.isStdin&&!x.some(he=>on(ze,he,{stripQuotes:!0})))return null;try{let he;if(ye.isStdin)he=ye.stdinAtEof||t.stdin===void 0?"":fe(t.stdin);else{let _r=t.fs.resolvePath(t.cwd,Me),On=!1;if(ye.isFile===void 0?On=(await t.fs.stat(_r)).isDirectory:On=!ye.isFile,On)return l?null:{error:`grep: ${Me}: Is a directory
216
- `,isDirectory:!0};he=await t.fs.readFile(_r)}if(U&&!s){let _r=U.ignoreCase?he.toLowerCase():he;if(!U.needles.some(On=>_r.includes(On))){if(i){let On=Ae?`${Me}:0`:"0";return{file:Me,result:{output:`${On}
217
- `,matched:!1,matchCount:0}}}return{file:Me,result:{output:"",matched:!1,matchCount:0}}}}let Mr=Ds(he,O,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:Ae?Me:"",onlyMatching:h,beforeContext:y,afterContext:w,maxCount:b,kResetGroup:B,preFilter:U,maxWork:Rm(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return{file:Me,result:Mr}}catch(he){return ge(he),{error:`grep: ${Me}: No such file or directory
218
- `,isDirectory:!1}}}));for(let ye of Xe){if(ye===null)continue;if("error"in ye&&ye.error){W+=ye.error,ye.isDirectory||(Q=!0);continue}if(!("file"in ye)||!ye.result)continue;let{file:Me,result:ze}=ye;if(ze.matched){if(D=!0,g)return{stdout:"",stderr:"",exitCode:0};o?L+=`${Me}
219
- `:a||(L+=ze.output)}else a?L+=`${Me}
220
- `:i&&!o&&(L+=ze.output)}}let Le;return Q?Le=2:Le=D?0:1,g?{stdout:"",stderr:"",exitCode:Le}:{stdout:L,stderr:W,exitCode:Le}}},Pm=256;q9={name:"fgrep",async execute(e,t){return zu.execute(["-F",...e],t)}},G9={name:"egrep",async execute(e,t){return zu.execute(["-E",...e],t)}},Z9={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"},{flag:"-f",type:"value",valueHint:"path"}],stdinType:"text",needsArgs:!0},K9={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},X9={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function Fm(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function Ze(e){return!Lm.has(e)}function Je(e,t,n){Fm(e,"safeSet"),Ze(t)&&(e[t]=n)}function Ls(e,t){return Fm(e,"safeHasOwn"),Object.hasOwn(e,t)}function ki(e,t={}){let n=t.maxDepth??2e3,r=t.maxElements??1e6,s=new WeakMap,i=t.elementBudget??{used:0};if(!Number.isSafeInteger(i.used)||i.used<0||i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements");let o=()=>{if(++i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements")},a=(u,f,d)=>{if(u===null||typeof u!="object"||u instanceof Date)return u;let p=s.get(u);if(p!==void 0)return p;if(f>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let h=Array.isArray(u)?[]:Object.create(null);return s.set(u,h),d.push({source:u,target:h,depth:f}),h},l=[],c=a(e,0,l);for(;l.length>0;){let u=l.pop();if(!u)break;let{source:f,target:d,depth:p}=u;if(Array.isArray(f)&&Array.isArray(d)){if(f.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");d.length=f.length;for(let b=f.length-1;b>=0;b--)o(),d[b]=a(f[b],p+1,l);continue}let h=f,m=d,g=Object.keys(h);if(g.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");for(let b=0;b<g.length;b++){o();let y=g[b];m[y]=a(h[y],p+1,l)}}return c}function et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Mm(e){return Object.assign(Object.create(null),e)}function Lt(e){return Object.assign(Object.create(null),e)}function Wu(...e){return Object.assign(Object.create(null),...e)}var Lm,VD,ar=F(()=>{"use strict";G();Lm=new Set(["__proto__","constructor","prototype"]),VD=new Set([...Lm,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function Bm(){let e=[];for(let[t,n]of Object.entries(_m).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
215
+ `,exitCode:2};let L="",W="",D=!1,Q=!1,V=[],Y={operations:0,results:0,maxOperations:t.limits.maxGlobOperations,maxResults:t.limits.maxArrayElements},ee=ie=>{if(ie.length>Y.maxResults-V.length)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push(...ie)},Se=!1,Te=!1;for(let ie of T){if(ie==="-"){if(V.length>=Y.maxResults)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push({path:B9,isFile:!0,isStdin:!0,stdinAtEof:Se}),Se=!0;continue}if(Te=!0,ie.includes("*")||ie.includes("?")||ie.includes("[")){let re=await V9(ie,t,Y);if(l)for(let We of re){let ye=await Ma(We.path,t,x,S,E,We.isFile,Y);ee(ye)}else ee(re)}else if(l){let re=await Ma(ie,t,x,S,E,void 0,Y);ee(re)}else{if(V.length>=Y.maxResults)throw new C(`grep: array element limit exceeded (${Y.maxResults})`,"array_elements");V.push({path:ie})}}let Ae=(V.length>1||l&&Te)&&!m,pe=50;for(let ie=0;ie<V.length;ie+=pe){let re=V.slice(ie,ie+pe),We=await Promise.all(re.map(async ye=>{let Be=ye.path,_e=Be.split("/").pop()||Be;if(S.length>0&&!l&&!ye.isStdin&&S.some(he=>on(_e,he,{stripQuotes:!0}))||x.length>0&&!l&&!ye.isStdin&&!x.some(he=>on(_e,he,{stripQuotes:!0})))return null;try{let he;if(ye.isStdin)he=ye.stdinAtEof||t.stdin===void 0?"":fe(t.stdin);else{let _r=t.fs.resolvePath(t.cwd,Be),On=!1;if(ye.isFile===void 0?On=(await t.fs.stat(_r)).isDirectory:On=!ye.isFile,On)return l?null:{error:`grep: ${Be}: Is a directory
216
+ `,isDirectory:!0};he=await t.fs.readFile(_r)}if(U&&!s){let _r=U.ignoreCase?he.toLowerCase():he;if(!U.needles.some(On=>_r.includes(On))){if(i){let On=Ae?`${Be}:0`:"0";return{file:Be,result:{output:`${On}
217
+ `,matched:!1,matchCount:0}}}return{file:Be,result:{output:"",matched:!1,matchCount:0}}}}let Mr=Ds(he,O,{invertMatch:s,showLineNumbers:r,countOnly:i,filename:Ae?Be:"",onlyMatching:h,beforeContext:y,afterContext:w,maxCount:b,kResetGroup:B,preFilter:U,maxWork:Rm(t),maxMatches:t.limits.maxArrayElements,signal:t.signal});return{file:Be,result:Mr}}catch(he){return ge(he),{error:`grep: ${Be}: No such file or directory
218
+ `,isDirectory:!1}}}));for(let ye of We){if(ye===null)continue;if("error"in ye&&ye.error){W+=ye.error,ye.isDirectory||(Q=!0);continue}if(!("file"in ye)||!ye.result)continue;let{file:Be,result:_e}=ye;if(_e.matched){if(D=!0,g)return{stdout:"",stderr:"",exitCode:0};o?L+=`${Be}
219
+ `:a||(L+=_e.output)}else a?L+=`${Be}
220
+ `:i&&!o&&(L+=_e.output)}}let Le;return Q?Le=2:Le=D?0:1,g?{stdout:"",stderr:"",exitCode:Le}:{stdout:L,stderr:W,exitCode:Le}}},Pm=256;q9={name:"fgrep",async execute(e,t){return zu.execute(["-F",...e],t)}},G9={name:"egrep",async execute(e,t){return zu.execute(["-E",...e],t)}},Z9={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"},{flag:"-f",type:"value",valueHint:"path"}],stdinType:"text",needsArgs:!0},K9={name:"fgrep",flags:[],stdinType:"text",needsArgs:!0},X9={name:"egrep",flags:[],stdinType:"text",needsArgs:!0}});function Fm(e,t){if(Array.isArray(e))throw new TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw new TypeError(`${t}: expected null-prototype object, got prototypal object`)}function Ke(e){return!Lm.has(e)}function Je(e,t,n){Fm(e,"safeSet"),Ke(t)&&(e[t]=n)}function Ls(e,t){return Fm(e,"safeHasOwn"),Object.hasOwn(e,t)}function ki(e,t={}){let n=t.maxDepth??2e3,r=t.maxElements??1e6,s=new WeakMap,i=t.elementBudget??{used:0};if(!Number.isSafeInteger(i.used)||i.used<0||i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements");let o=()=>{if(++i.used>r)throw new C(`query input element limit exceeded (${r})`,"array_elements")},a=(u,f,d)=>{if(u===null||typeof u!="object"||u instanceof Date)return u;let p=s.get(u);if(p!==void 0)return p;if(f>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let h=Array.isArray(u)?[]:Object.create(null);return s.set(u,h),d.push({source:u,target:h,depth:f}),h},l=[],c=a(e,0,l);for(;l.length>0;){let u=l.pop();if(!u)break;let{source:f,target:d,depth:p}=u;if(Array.isArray(f)&&Array.isArray(d)){if(f.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");d.length=f.length;for(let b=f.length-1;b>=0;b--)o(),d[b]=a(f[b],p+1,l);continue}let h=f,m=d,g=Object.keys(h);if(g.length>r-i.used)throw new C(`query input element limit exceeded (${r})`,"array_elements");for(let b=0;b<g.length;b++){o();let y=g[b];m[y]=a(h[y],p+1,l)}}return c}function et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Mm(e){return Object.assign(Object.create(null),e)}function Lt(e){return Object.assign(Object.create(null),e)}function Wu(...e){return Object.assign(Object.create(null),...e)}var Lm,VD,ar=F(()=>{"use strict";G();Lm=new Set(["__proto__","constructor","prototype"]),VD=new Set([...Lm,"__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])});function Bm(){let e=[];for(let[t,n]of Object.entries(_m).sort()){let r=[];for(let s of n.extensions)r.push(`*${s}`);for(let s of n.globs)r.push(s);e.push(`${t}: ${r.join(", ")}`)}return`${e.join(`
221
221
  `)}
222
222
  `}var _m,Co,ju=F(()=>{"use strict";mt();ar();_m=Mm({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:[]}}),Co=class{types;constructor(){this.types=new Map(Object.entries(_m).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let r=t.slice(0,n),s=t.slice(n+1);if(s.startsWith("include:")){let i=s.slice(8),o=this.types.get(i);if(o){let a=this.types.get(r)||{extensions:[],globs:[]};a.extensions.push(...o.extensions),a.globs.push(...o.globs),this.types.set(r,a)}}else{let i=this.types.get(r)||{extensions:[],globs:[]};if(s.startsWith("*.")&&!s.slice(2).includes("*")){let o=s.slice(1);i.extensions.includes(o)||i.extensions.push(o)}else i.globs.includes(s)||i.globs.push(s);this.types.set(r,i)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let r=t.toLowerCase();for(let s of n){if(s==="all"){if(this.matchesAnyType(t))return!0;continue}let i=this.types.get(s);if(i){for(let o of i.extensions)if(r.endsWith(o))return!0;for(let o of i.globs)if(o.includes("*")){let a=o.replace(/\./g,"\\.").replace(/\*/g,".*");if(oe(`^${a}$`,"i").test(t))return!0}else if(r===o.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let r of this.types.values()){for(let s of r.extensions)if(n.endsWith(s))return!0;for(let s of r.globs)if(s.includes("*")){let i=s.replace(/\./g,"\\.").replace(/\*/g,".*");if(oe(`^${i}$`,"i").test(t))return!0}else if(n===s.toLowerCase())return!0}return!1}}});function Um(){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:512*1024*1024,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var zm=F(()=>{"use strict"});function Q9(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 Y9(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
223
223
  `,exitCode:1}}function J9(e,t){return!/^\d+$/.test(t)||!Number.isSafeInteger(Number(t))?{stdout:"",stderr:`rg: invalid --${e} value: ${t}
@@ -339,22 +339,22 @@ Addresses:
339
339
  `,exitCode:1};let{commands:c,error:u,silentMode:f}=l0(r,a,t.limits);if(u)return{stdout:"",stderr:`sed: ${u}
340
340
  `,exitCode:1};let d=!!(i||f);if(o){if(l.length===0)return{stdout:"",stderr:`sed: -i requires at least one file argument
341
341
  `,exitCode:1};for(let m of l){if(m==="-")continue;let g=t.fs.resolvePath(t.cwd,m);try{let b=await n("in-place input read",()=>t.fs.readFile(g)),y=await n("in-place processing",()=>Ju(b,c,d,{limits:t.limits,filename:m,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(y.errorMessage)return{stdout:"",stderr:`${y.errorMessage}
342
- `,exitCode:y.exitCode??1};await n("in-place output write",()=>t.fs.writeFile(g,y.output))}catch(b){if(b instanceof Ce)throw b;return b instanceof C?{stdout:"",stderr:`sed: ${Ge(b.message)}
342
+ `,exitCode:y.exitCode??1};await n("in-place output write",()=>t.fs.writeFile(g,y.output))}catch(b){if(b instanceof Ce)throw b;return b instanceof C?{stdout:"",stderr:`sed: ${Ze(b.message)}
343
343
  `,exitCode:C.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
344
344
  `,exitCode:1}}}return{stdout:"",stderr:"",exitCode:0}}let p="";if(l.length===0){p=fe(t.stdin);try{let m=await n("stdin processing",()=>Ju(p,c,d,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
345
- `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ce)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ge(m.message)}
346
- `,exitCode:C.EXIT_CODE};throw m}}let h=!1;for(let m of l){let g;if(m==="-")h?g="":(g=fe(t.stdin),h=!0);else{let b=t.fs.resolvePath(t.cwd,m);try{g=await n("input file read",()=>t.fs.readFile(b))}catch(y){if(y instanceof Ce)throw y;return y instanceof C?{stdout:"",stderr:`sed: ${Ge(y.message)}
345
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ce)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ze(m.message)}
346
+ `,exitCode:C.EXIT_CODE};throw m}}let h=!1;for(let m of l){let g;if(m==="-")h?g="":(g=fe(t.stdin),h=!0);else{let b=t.fs.resolvePath(t.cwd,m);try{g=await n("input file read",()=>t.fs.readFile(b))}catch(y){if(y instanceof Ce)throw y;return y instanceof C?{stdout:"",stderr:`sed: ${Ze(y.message)}
347
347
  `,exitCode:C.EXIT_CODE}:{stdout:"",stderr:`sed: ${m}: No such file or directory
348
348
  `,exitCode:1}}}p.length>0&&g.length>0&&!p.endsWith(`
349
349
  `)&&(p+=`
350
350
  `),p+=g}try{let m=await n("final processing",()=>Ju(p,c,d,{limits:t.limits,filename:l.length===1?l[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:m.output,stderr:m.errorMessage?`${m.errorMessage}
351
- `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ce)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ge(m.message)}
351
+ `:"",exitCode:m.exitCode??0}}catch(m){if(m instanceof Ce)throw m;if(m instanceof C)return{stdout:"",stderr:`sed: ${Ze(m.message)}
352
352
  `,exitCode:C.EXIT_CODE};throw m}}},PE={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 Vt(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function bn(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function _s(...e){return Object.assign(Object.create(null),...e)}var jr=F(()=>{"use strict"});function ef(e={}){let{fieldSep:t=FE,maxIterations:n=DE,maxRecursionDepth:r=LE,maxOutputSize:s=0,maxArrayElements:i=1e5,fs:o,cwd:a,exec:l,coverage:c,requireDefenseContext:u}=e;return{FS:" ",OFS:" ",ORS:`
353
353
  `,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,getlineCommandStreams:new Map,getlineFileStreams:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:s,maxArrayElements:i,arrayElementCount:0,recordsProcessed:0,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:o,cwd:a,exec:l,coverage:c,requireDefenseContext:u}}var DE,LE,FE,h0=F(()=>{"use strict";mt();DE=1e4,LE=100,FE=new Wr(/\s+/)});function m0(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}var g0=F(()=>{"use strict"});function Vn(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function qt(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function nf(e){return new $e(e,"awk string",()=>new C(`string size limit exceeded (${e} bytes)`,"string_length"))}function Hr(e){return e.maxOutputSize>0?e.maxOutputSize:w0}function Wa(e,t,n,r,s){let i=nf(s),o=0,a=0,l=0;for(let c of t.matchAll(e)){let u=c.index??0;a++,i.append(e.slice(o,u)),n(a)?(i.append(r(c)),l++):i.append(c[0]),o=u+c[0].length}return i.append(e.slice(o)),{value:i.build(),replacements:l}}async function ja(e,t){if(e.type==="regex")return e.pattern;let n=qt(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function b0(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(Vn(await t.evalExpr(e.index)))}`:"$0":"$0"}function x0(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return qt(t.vars[e]??"")}function E0(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 ME(e,t,n){return e.length===0?t.line.length:qt(await n.evalExpr(e[0])).length}async function _E(e,t,n){if(e.length<2)return"";let r=qt(await n.evalExpr(e[0])),s=Math.floor(Vn(await n.evalExpr(e[1])))-1;if(e.length>=3){let i=Math.floor(Vn(await n.evalExpr(e[2])));return r.substr(Math.max(0,s),i)}return r.substr(Math.max(0,s))}async function BE(e,t,n){if(e.length<2)return 0;let r=qt(await n.evalExpr(e[0])),s=qt(await n.evalExpr(e[1])),i=r.indexOf(s);return i===-1?0:i+1}async function UE(e,t,n){if(e.length<2)return 0;let r=qt(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let i=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=oe(u.pattern);else{let f=qt(await n.evalExpr(u));o=f===" "?oe("\\s+"):f}}else t.FS===" "&&(o=oe("\\s+"));let a=Object.keys(t.arrays[i]??{}).length,l=t.maxArrayElements-t.arrayElementCount+a,c=typeof o=="string"?r.split(o,l+1):o.split(r,l+1);if(c.length>l)throw new C(`array element limit exceeded (${t.maxArrayElements})`,"array_elements");t.arrays[i]=Object.create(null);for(let u=0;u<c.length;u++)t.arrays[i][String(u+1)]=c[u];return t.arrayElementCount+=c.length-a,c.length}async function zE(e,t,n){if(e.length<2)return 0;let r=await ja(e[0],n),s=qt(await n.evalExpr(e[1])),i=await b0(e[2],n),o=x0(i,t);try{let a=oe(r,"g"),l=Wa(o,a,c=>c===1,c=>S0(s,c[0],Hr(t)),Hr(t));return E0(i,l.value,t),l.replacements}catch(a){return ge(a),0}}async function WE(e,t,n){if(e.length<2)return 0;let r=await ja(e[0],n),s=qt(await n.evalExpr(e[1])),i=await b0(e[2],n),o=x0(i,t);try{let a=oe(r,"g"),l=Wa(o,a,()=>!0,c=>S0(s,c[0],Hr(t)),Hr(t));return E0(i,l.value,t),l.replacements}catch(a){return ge(a),0}}function S0(e,t,n){let r=nf(n),s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let i=e[s+1];i==="&"?(r.append("&"),s+=2):i==="\\"?(r.append("\\"),s+=2):(r.append(e[s+1]),s+=2)}else e[s]==="&"?(r.append(t),s++):(r.append(e[s]),s++);return r.build()}async function jE(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=qt(await n.evalExpr(e[0])),s=await ja(e[1],n);try{let o=oe(s).exec(r);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function HE(e,t,n){if(e.length<3)return"";let r=await ja(e[0],n),s=qt(await n.evalExpr(e[1])),i=qt(await n.evalExpr(e[2])),o=e.length>=4?qt(await n.evalExpr(e[3])):t.line;try{let a=i.toLowerCase()==="g",l=a?0:parseInt(i,10)||1;if(a){let c=oe(r,"g");return Wa(o,c,()=>!0,u=>y0(s,u[0],u.slice(1),Hr(t)),Hr(t)).value}else{let c=oe(r,"g");return Wa(o,c,u=>u===l,u=>y0(s,u[0],u.slice(1),Hr(t)),Hr(t)).value}}catch(a){return ge(a),o}}function y0(e,t,n,r){let s=nf(r),i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let o=e[i+1];if(o==="&")s.append("&"),i+=2;else if(o==="0")s.append(t),i+=2;else if(o>="1"&&o<="9"){let a=parseInt(o,10)-1;s.append(n[a]||""),i+=2}else o==="n"?(s.append(`
354
354
  `),i+=2):o==="t"?(s.append(" "),i+=2):(s.append(o),i+=2)}else e[i]==="&"?(s.append(t),i++):(s.append(e[i]),i++);return s.build()}async function VE(e,t,n){return e.length===0?"":qt(await n.evalExpr(e[0])).toLowerCase()}async function qE(e,t,n){return e.length===0?"":qt(await n.evalExpr(e[0])).toUpperCase()}async function GE(e,t,n){if(e.length===0)return"";let r=qt(await n.evalExpr(e[0])),s=[];for(let i=1;i<e.length;i++)s.push(await n.evalExpr(e[i]));return Ha(r,s,Hr(t))}async function ZE(e,t,n){return e.length===0?0:Math.floor(Vn(await n.evalExpr(e[0])))}async function KE(e,t,n){return e.length===0?0:Math.sqrt(Vn(await n.evalExpr(e[0])))}async function XE(e,t,n){return e.length===0?0:Math.sin(Vn(await n.evalExpr(e[0])))}async function QE(e,t,n){return e.length===0?0:Math.cos(Vn(await n.evalExpr(e[0])))}async function YE(e,t,n){let r=e.length>0?Vn(await n.evalExpr(e[0])):0,s=e.length>1?Vn(await n.evalExpr(e[1])):0;return Math.atan2(r,s)}async function JE(e,t,n){return e.length===0?0:Math.log(Vn(await n.evalExpr(e[0])))}async function eS(e,t,n){return e.length===0?1:Math.exp(Vn(await n.evalExpr(e[0])))}function tS(e,t,n){return t.random?t.random():Math.random()}async function nS(e,t,n){let r=e.length>0?Vn(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function rS(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function tf(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}function Ha(e,t,n=w0){let r=0,s="",i=0,o=0,a=Math.min(sS,n),l=c=>{let u=M(c);if(u>n-i)throw new C(`formatted string size limit exceeded (${n} bytes)`,"string_length");s+=c,i+=u};for(;o<e.length;)if(e[o]==="%"&&o+1<e.length){let c=o+1,u="",f="",d="",p,h=c;for(;c<e.length&&/\d/.test(e[c]);)c++;c>h&&e[c]==="$"?(p=parseInt(e.substring(h,c),10)-1,c++):c=h;let m=()=>{if(c<e.length){if(c+1<e.length&&(e[c]==="h"&&e[c+1]==="h"||e[c]==="l"&&e[c+1]==="l")){c+=2;return}/[lzjh]/.test(e[c])&&c++}};for(;c<e.length&&/[-+ #0]/.test(e[c]);)u+=e[c++];if(e[c]==="*"){let w=t[r++],x=w!==void 0?Math.floor(Number(w)):0;if(!Number.isFinite(x)||!Number.isSafeInteger(x))throw new C(`printf width limit exceeded (${a} bytes)`,"string_length");x<0?(u+="-",f=String(-x)):f=String(x),c++}else for(;c<e.length&&/\d/.test(e[c]);)f+=e[c++];if(f&&parseInt(f,10)>a)throw new C(`printf width limit exceeded (${a} bytes)`,"string_length");if(e[c]==="."){if(c++,e[c]==="*"){let w=t[r++],x=w!==void 0?Math.floor(Number(w)):0;if(!Number.isFinite(x)||!Number.isSafeInteger(x))throw new C(`printf precision limit exceeded (${a} bytes)`,"string_length");d=x<0?"":String(x),c++}else for(;c<e.length&&/\d/.test(e[c]);)d+=e[c++];if(d&&parseInt(d,10)>a)throw new C(`printf precision limit exceeded (${a} bytes)`,"string_length")}m();let g=e[c],y=t[p!==void 0?p:r];switch(g){case"s":{let w=y!==void 0?String(y):"";if(d&&(w=w.substring(0,parseInt(d,10))),f){let x=parseInt(f,10);u.includes("-")?w=w.padEnd(x):w=w.padStart(x)}l(w),p===void 0&&r++;break}case"d":case"i":{let w=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(w)&&(w=0);let x=w<0,S=Math.abs(w).toString();if(d){let I=parseInt(d,10);S=S.padStart(I,"0")}let E="";x?E="-":u.includes("+")?E="+":u.includes(" ")&&(E=" ");let A=E+S;if(f){let I=parseInt(f,10);u.includes("-")?A=A.padEnd(I):u.includes("0")&&!d?A=E+S.padStart(I-E.length,"0"):A=A.padStart(I)}l(A),p===void 0&&r++;break}case"f":{let w=y!==void 0?Number(y):0;Number.isNaN(w)&&(w=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=w.toFixed(x);if(f){let E=parseInt(f,10);u.includes("-")?S=S.padEnd(E):S=S.padStart(E)}l(S),p===void 0&&r++;break}case"e":case"E":{let w=y!==void 0?Number(y):0;Number.isNaN(w)&&(w=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=w.toExponential(x);if(g==="E"&&(S=S.toUpperCase()),f){let E=parseInt(f,10);u.includes("-")?S=S.padEnd(E):S=S.padStart(E)}l(S),p===void 0&&r++;break}case"g":case"G":{let w=y!==void 0?Number(y):0;Number.isNaN(w)&&(w=0);let x=d?parseInt(d,10):6;if(x>100)throw new C("printf floating-point precision limit exceeded (100 digits)","string_length");let S=w!==0?Math.floor(Math.log10(Math.abs(w))):0,E;if(w===0?E="0":S<-4||S>=x?(E=w.toExponential(x-1),g==="G"&&(E=E.toUpperCase())):E=w.toPrecision(x),E.includes(".")&&(E=E.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),E.includes("e")&&(E=E.replace(/\.?0+e/,"e")),f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"x":case"X":{let w=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(w)&&(w=0);let x=Math.abs(w).toString(16);if(g==="X"&&(x=x.toUpperCase()),d){let A=parseInt(d,10);x=x.padStart(A,"0")}let S=w<0?"-":"",E=S+x;if(f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):u.includes("0")&&!d?E=S+x.padStart(A-S.length,"0"):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"o":{let w=y!==void 0?Math.floor(Number(y)):0;Number.isNaN(w)&&(w=0);let x=Math.abs(w).toString(8);if(d){let A=parseInt(d,10);x=x.padStart(A,"0")}let S=w<0?"-":"",E=S+x;if(f){let A=parseInt(f,10);u.includes("-")?E=E.padEnd(A):u.includes("0")&&!d?E=S+x.padStart(A-S.length,"0"):E=E.padStart(A)}l(E),p===void 0&&r++;break}case"c":{l(typeof y=="number"?String.fromCharCode(y):String(y??"").charAt(0)||""),p===void 0&&r++;break}case"%":l("%");break;default:l(e.substring(o,c+1))}o=c+1}else if(e[o]==="\\"&&o+1<e.length){let c=e[o+1];switch(c){case"n":l(`
355
355
  `);break;case"t":l(" ");break;case"r":l("\r");break;case"\\":l("\\");break;default:l(c)}o+=2}else l(e[o++]);return s}var w0,sS,A0,rf=F(()=>{"use strict";St();ue();vt();G();mt();w0=10*1024*1024;sS=1e4;A0=new Map([["length",ME],["substr",_E],["index",BE],["split",UE],["sub",zE],["gsub",WE],["match",jE],["gensub",HE],["tolower",VE],["toupper",qE],["sprintf",GE],["int",ZE],["sqrt",KE],["sin",XE],["cos",QE],["atan2",YE],["log",JE],["exp",eS],["rand",tS],["srand",nS],["system",rS("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",tf("systime")],["mktime",tf("mktime")],["strftime",tf("strftime")]])});function ln(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function xt(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function tt(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function sf(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function No(e,t){try{return oe(e).test(t)}catch{return!1}}var Ni=F(()=>{"use strict";mt()});function C0(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Va(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function of(e,t,n){if(t===0)e.line=tt(n),e.fields=C0(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=tt(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function Ii(e,t){e.line=t,e.fields=C0(e,t),e.NF=e.fields.length}function k0(e,t){if(e.FS=t,t===" ")e.fieldSep=new Wr(/\s+/);else try{e.fieldSep=oe(t)}catch{e.fieldSep=oe(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}var qa=F(()=>{"use strict";mt();Ni()});function Ga(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 Oi(e,t,n){switch(t){case"FS":k0(e,tt(n));return;case"OFS":e.OFS=tt(n);return;case"ORS":e.ORS=tt(n);return;case"OFMT":e.OFMT=tt(n);return;case"NR":e.NR=Math.floor(xt(n));return;case"NF":{let r=Math.floor(xt(n));if(r<e.NF)e.fields=e.fields.slice(0,r),e.line=e.fields.join(e.OFS);else if(r>e.NF){for(;e.fields.length<r;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=r;return}case"FNR":e.FNR=Math.floor(xt(n));return;case"FILENAME":e.FILENAME=tt(n);return;case"RSTART":e.RSTART=Math.floor(xt(n));return;case"RLENGTH":e.RLENGTH=Math.floor(xt(n));return;case"SUBSEP":e.SUBSEP=tt(n);return}e.vars[t]=n}function Io(e,t){let n=t,r=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!r.has(n);)r.add(n),n=s,s=e.arrayAliases.get(n);return n}function Za(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let r=Io(e,t);return e.arrays[r]?.[n]??""}function af(e,t,n,r){let s=Io(e,t);if(e.arrays[s]||(e.arrays[s]=Object.create(null)),!(n in e.arrays[s])){if(e.arrayElementCount>=e.maxArrayElements)throw new C(`array element limit exceeded (${e.maxArrayElements})`,"array_elements");e.arrayElementCount++}e.arrays[s][n]=r}function v0(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let r=Io(e,t);return e.arrays[r]?.[n]!==void 0}function N0(e,t,n){let r=Io(e,t);e.arrays[r]&&(n in e.arrays[r]&&e.arrayElementCount--,delete e.arrays[r][n])}function I0(e,t){let n=Io(e,t);e.arrayElementCount-=Object.keys(e.arrays[n]??{}).length,delete e.arrays[n]}var lf=F(()=>{"use strict";G();qa();Ni()});function T0(e){O0=e}function xn(e,t){It(e.requireDefenseContext,"awk",t)}function Qe(e,t,n){return an(e.requireDefenseContext,"awk",t,n)}async function Ne(e,t){switch(xn(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 No(t.pattern,e.line)?1:0;case"field":return iS(e,t);case"variable":return Ga(e,t.name);case"array_access":return oS(e,t);case"binary":return aS(e,t);case"unary":return uS(e,t);case"ternary":return ln(await Qe(e,"ternary condition evaluation",()=>Ne(e,t.condition)))?await Qe(e,"ternary consequent evaluation",()=>Ne(e,t.consequent)):await Qe(e,"ternary alternate evaluation",()=>Ne(e,t.alternate));case"call":return fS(e,t.name,t.args);case"assignment":return pS(e,t);case"pre_increment":return hS(e,t.operand);case"pre_decrement":return mS(e,t.operand);case"post_increment":return gS(e,t.operand);case"post_decrement":return yS(e,t.operand);case"in":return wS(e,t.key,t.array);case"getline":return bS(e,t.variable,t.file,t.command);case"tuple":return SS(e,t.elements);default:return""}}async function iS(e,t){xn(e,"field reference evaluation");let n=Math.floor(xt(await Qe(e,"field index evaluation",()=>Ne(e,t.index))));return Va(e,n)}async function oS(e,t){xn(e,"array access evaluation");let n=tt(await Qe(e,"array key evaluation",()=>Ne(e,t.key)));return Za(e,t.array,n)}async function aS(e,t){xn(e,"binary expression evaluation");let n=t.operator;if(n==="||")return ln(await Qe(e,"logical-or left evaluation",()=>Ne(e,t.left)))||ln(await Qe(e,"logical-or right evaluation",()=>Ne(e,t.right)))?1:0;if(n==="&&")return ln(await Qe(e,"logical-and left evaluation",()=>Ne(e,t.left)))&&ln(await Qe(e,"logical-and right evaluation",()=>Ne(e,t.right)))?1:0;if(n==="~"){let a=await Qe(e,"regex left evaluation",()=>Ne(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:tt(await Qe(e,"regex right evaluation",()=>Ne(e,t.right)));try{return oe(l).test(tt(a))?1:0}catch{return 0}}if(n==="!~"){let a=await Qe(e,"negated-regex left evaluation",()=>Ne(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let l=t.right.type==="regex"?t.right.pattern:tt(await Qe(e,"negated-regex right evaluation",()=>Ne(e,t.right)));try{return oe(l).test(tt(a))?0:1}catch{return 1}}let r=await Qe(e,"binary left evaluation",()=>Ne(e,t.left)),s=await Qe(e,"binary right evaluation",()=>Ne(e,t.right));if(n===" "){let a=tt(r)+tt(s);if(e.maxOutputSize>0&&a.length>e.maxOutputSize)throw new C(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return a}if(lS(n))return cS(r,s,n);let i=xt(r),o=xt(s);return m0(i,o,n)}function lS(e){return["<","<=",">",">=","==","!="].includes(e)}function cS(e,t,n){let r=sf(e),s=sf(t);if(r&&s){let a=xt(e),l=xt(t);switch(n){case"<":return a<l?1:0;case"<=":return a<=l?1:0;case">":return a>l?1:0;case">=":return a>=l?1:0;case"==":return a===l?1:0;case"!=":return a!==l?1:0}}let i=tt(e),o=tt(t);switch(n){case"<":return i<o?1:0;case"<=":return i<=o?1:0;case">":return i>o?1:0;case">=":return i>=o?1:0;case"==":return i===o?1:0;case"!=":return i!==o?1:0}return 0}async function uS(e,t){xn(e,"unary expression evaluation");let n=await Qe(e,"unary operand evaluation",()=>Ne(e,t.operand));switch(t.operator){case"!":return ln(n)?0:1;case"-":return-xt(n);case"+":return+xt(n);default:return n}}async function fS(e,t,n){xn(e,"function call evaluation");let r=A0.get(t);if(r)return r(n,e,{evalExpr:i=>Ne(e,i)});let s=e.functions.get(t);return s?dS(e,s,n):""}async function dS(e,t,n){if(xn(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new C(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let r=Object.create(null);for(let a of t.params)r[a]=e.vars[a];let s=[];for(let a=0;a<t.params.length;a++){let l=t.params[a];if(a<n.length){let c=n[a];c.type==="variable"&&(e.arrayAliases.set(l,c.name),s.push(l));let u=await Qe(e,"user function argument evaluation",()=>Ne(e,c));e.vars[l]=u}else e.vars[l]=""}e.hasReturn=!1,e.returnValue=void 0;let i=O0;i&&await Qe(e,"user function body execution",()=>i(e,t.body.statements));let o=e.returnValue??"";for(let a of t.params)r[a]!==void 0?e.vars[a]=r[a]:delete e.vars[a];for(let a of s)e.arrayAliases.delete(a);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function pS(e,t){xn(e,"assignment evaluation");let n=await Qe(e,"assignment value evaluation",()=>Ne(e,t.value)),r=t.target,s=t.operator,i;if(s==="=")i=n;else{let o;if(r.type==="field"){let c=Math.floor(xt(await Qe(e,"assignment field index",()=>Ne(e,r.index))));o=Va(e,c)}else if(r.type==="variable")o=Ga(e,r.name);else{let c=tt(await Qe(e,"assignment array key",()=>Ne(e,r.key)));o=Za(e,r.array,c)}let a=xt(o),l=xt(n);switch(s){case"+=":i=a+l;break;case"-=":i=a-l;break;case"*=":i=a*l;break;case"/=":i=l!==0?a/l:0;break;case"%=":i=l!==0?a%l:0;break;case"^=":i=a**l;break;default:i=n}}if(r.type==="field"){let o=Math.floor(xt(await Qe(e,"assignment target field index",()=>Ne(e,r.index))));of(e,o,i)}else if(r.type==="variable")Oi(e,r.name,i);else{let o=tt(await Qe(e,"assignment target array key",()=>Ne(e,r.key)));af(e,r.array,o,i)}return i}async function Ka(e,t,n,r){xn(e,"inc/dec evaluation");let s;if(t.type==="field"){let i=Math.floor(xt(await Qe(e,"inc/dec field index",()=>Ne(e,t.index))));s=xt(Va(e,i)),of(e,i,s+n)}else if(t.type==="variable")s=xt(Ga(e,t.name)),Oi(e,t.name,s+n);else{let i=tt(await Qe(e,"inc/dec array key",()=>Ne(e,t.key)));s=xt(Za(e,t.array,i)),af(e,t.array,i,s+n)}return r?s+n:s}async function hS(e,t){return Ka(e,t,1,!0)}async function mS(e,t){return Ka(e,t,-1,!0)}async function gS(e,t){return Ka(e,t,1,!1)}async function yS(e,t){return Ka(e,t,-1,!1)}async function wS(e,t,n){xn(e,"in-expression evaluation");let r;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let i of t.elements)s.push(tt(await Qe(e,"tuple key element evaluation",()=>Ne(e,i))));r=s.join(e.SUBSEP)}else r=tt(await Qe(e,"in-expression key evaluation",()=>Ne(e,t)));return v0(e,n,r)?1:0}async function bS(e,t,n,r){if(xn(e,"getline evaluation"),r)return xS(e,t,r);if(n)return ES(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let i=e.lines[s];return t?Oi(e,t,i):Ii(e,i),e.NR++,e.lineIndex=s,1}async function xS(e,t,n){let r=e.exec;if(!r)return-1;xn(e,"getline command source");let s=tt(await Qe(e,"getline command expression",()=>Ne(e,n))),i=e.getlineCommandStreams.get(s);if(!i)try{let l=await Qe(e,"getline command exec",()=>r(s)),u=fe(l.stdout).split(`
356
356
  `);u.length>0&&u[u.length-1]===""&&u.pop(),i={lines:u,index:-1},e.getlineCommandStreams.set(s,i)}catch(l){if(l instanceof Ce)throw l;return-1}let o=i.index+1;if(o>=i.lines.length)return 0;let a=i.lines[o];return i.index=o,t?Oi(e,t,a):Ii(e,a),1}async function ES(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;xn(e,"getline file source");let s=tt(await Qe(e,"getline filename evaluation",()=>Ne(e,n)));if(s==="/dev/null")return 0;let i=r.resolvePath(e.cwd,s),o=e.getlineFileStreams.get(i);if(!o)try{let u=(await Qe(e,"getline file read",()=>r.readFile(i))).split(`
357
- `);u.length>0&&u[u.length-1]===""&&u.pop(),o={lines:u,index:-1},e.getlineFileStreams.set(i,o)}catch(c){if(c instanceof Ce)throw c;return-1}let a=o.index+1;if(a>=o.lines.length)return 0;let l=o.lines[a];return o.index=a,t?Oi(e,t,l):Ii(e,l),1}async function SS(e,t){if(xn(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Qe(e,"tuple intermediate element",()=>Ne(e,t[n]));return Qe(e,"tuple final element",()=>Ne(e,t[t.length-1]))}var O0,cf=F(()=>{"use strict";ue();G();mt();vr();mn();g0();rf();qa();Ni();lf();O0=null});function uf(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new C(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function cr(e,t){It(e.requireDefenseContext,"awk",t)}function Ve(e,t,n){return an(e.requireDefenseContext,"awk",t,n)}async function Ti(e,t){cr(e,"block execution");for(let n of t)if(await Ve(e,"statement execution",()=>Bs(e,n)),AS(e))break}function AS(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Bs(e,t){switch(cr(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await Ve(e,"nested block statement",()=>Ti(e,t.statements));break;case"expr_stmt":await Ve(e,"expression statement",()=>Ne(e,t.expression));break;case"print":await Ve(e,"print statement",()=>CS(e,t.args,t.output));break;case"printf":await Ve(e,"printf statement",()=>kS(e,t.format,t.args,t.output));break;case"if":await Ve(e,"if statement",()=>vS(e,t));break;case"while":await Ve(e,"while statement",()=>NS(e,t));break;case"do_while":await Ve(e,"do-while statement",()=>IS(e,t));break;case"for":await Ve(e,"for statement",()=>OS(e,t));break;case"for_in":await Ve(e,"for-in statement",()=>TS(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(xt(await Ve(e,"exit code expression",()=>Ne(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await Ve(e,"return expression",()=>Ne(e,n)):""}break;case"delete":await Ve(e,"delete statement",()=>$S(e,t.target));break}}async function CS(e,t,n){cr(e,"print execution");let r=[];for(let i of t){let o=await Ve(e,"print argument evaluation",()=>Ne(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(Ha(e.OFMT,[o],e.maxOutputSize||void 0)):r.push(tt(o))}let s=r.join(e.OFS)+e.ORS;n?await Ve(e,"print redirection write",()=>$0(e,n.redirect,n.file,s)):(e.output+=s,uf(e))}async function kS(e,t,n,r){cr(e,"printf execution");let s=tt(await Ve(e,"printf format evaluation",()=>Ne(e,t))),i=[];for(let l of n)i.push(await Ve(e,"printf argument evaluation",()=>Ne(e,l)));let o=e.maxOutputSize>0?Math.max(0,e.maxOutputSize-M(e.output)):void 0,a=Ha(s,i,o);r?await Ve(e,"printf redirection write",()=>$0(e,r.redirect,r.file,a)):(e.output+=a,uf(e))}async function $0(e,t,n,r){cr(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,uf(e);return}let i=tt(await Ve(e,"redirection filename evaluation",()=>Ne(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await Ve(e,"redirection append write",()=>s.appendFile(o,r)):(await Ve(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await Ve(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function vS(e,t){if(cr(e,"if execution"),ln(await Ve(e,"if condition evaluation",()=>Ne(e,t.condition))))await Ve(e,"if consequent execution",()=>Bs(e,t.consequent));else if(t.alternate){let n=t.alternate;await Ve(e,"if alternate execution",()=>Bs(e,n))}}async function NS(e,t){cr(e,"while execution");let n=0;for(;ln(await Ve(e,"while condition evaluation",()=>Ne(e,t.condition)));){if(n++,n>e.maxIterations)throw new C(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Ve(e,"while body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function IS(e,t){cr(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new C(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Ve(e,"do-while body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(ln(await Ve(e,"do-while condition evaluation",()=>Ne(e,t.condition))))}async function OS(e,t){cr(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await Ve(e,"for init evaluation",()=>Ne(e,n));let i=0;for(;!r||ln(await Ve(e,"for condition evaluation",()=>Ne(e,r)));){if(i++,i>e.maxIterations)throw new C(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await Ve(e,"for body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await Ve(e,"for update evaluation",()=>Ne(e,s))}}async function TS(e,t){cr(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 Ve(e,"for-in body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function $S(e,t){if(cr(e,"delete execution"),t.type==="array_access"){let n=tt(await Ve(e,"delete key evaluation",()=>Ne(e,t.key)));N0(e,t.array,n)}else t.type==="variable"&&I0(e,t.name)}var R0=F(()=>{"use strict";G();vr();kt();rf();cf();Ni();lf();T0(Ti)});var Oo,P0=F(()=>{"use strict";G();vr();cf();qa();R0();Ni();Oo=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){It(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return an(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>Ti(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){if(this.ctx.recordsProcessed++,this.ctx.recordsProcessed>this.ctx.maxIterations)throw new C(`record limit exceeded (${this.ctx.maxIterations})`,"iterations");Ii(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>Ti(this.ctx,r.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 t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>Ti(this.ctx,t.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(t,n){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return No(r.pattern,this.ctx.line);case"expr_pattern":return ln(await this.withDefenseContext("expression pattern evaluation",()=>Ne(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return No(t.pattern,this.ctx.line);case"expr_pattern":return ln(await this.withDefenseContext("nested expression pattern",()=>Ne(this.ctx,t.expression)));default:return!1}}}});var D0=F(()=>{"use strict";h0();P0()});function PS(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 v,RS,DS,Xa,L0=F(()=>{"use strict";G();(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"})(v||(v={}));RS=new Map([["BEGIN",v.BEGIN],["END",v.END],["if",v.IF],["else",v.ELSE],["while",v.WHILE],["do",v.DO],["for",v.FOR],["in",v.IN],["break",v.BREAK],["continue",v.CONTINUE],["next",v.NEXT],["nextfile",v.NEXTFILE],["exit",v.EXIT],["return",v.RETURN],["delete",v.DELETE],["function",v.FUNCTION],["print",v.PRINT],["printf",v.PRINTF],["getline",v.GETLINE]]);DS=new Set([v.COMMA,v.LBRACE,v.AND,v.OR,v.QUESTION,v.COLON,v.DO,v.ELSE,v.IF,v.WHILE]),Xa=class{maxTokens;input;pos=0;line=1;column=1;lastTokenType=null;constructor(t,n=1e5){this.maxTokens=n,this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();if(n){if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");t.push(n),this.lastTokenType=n.type}}if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");return t.push(this.makeToken(v.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
357
+ `);u.length>0&&u[u.length-1]===""&&u.pop(),o={lines:u,index:-1},e.getlineFileStreams.set(i,o)}catch(c){if(c instanceof Ce)throw c;return-1}let a=o.index+1;if(a>=o.lines.length)return 0;let l=o.lines[a];return o.index=a,t?Oi(e,t,l):Ii(e,l),1}async function SS(e,t){if(xn(e,"tuple evaluation"),t.length===0)return"";for(let n=0;n<t.length-1;n++)await Qe(e,"tuple intermediate element",()=>Ne(e,t[n]));return Qe(e,"tuple final element",()=>Ne(e,t[t.length-1]))}var O0,cf=F(()=>{"use strict";ue();G();mt();vr();mn();g0();rf();qa();Ni();lf();O0=null});function uf(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new C(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output)}function cr(e,t){It(e.requireDefenseContext,"awk",t)}function qe(e,t,n){return an(e.requireDefenseContext,"awk",t,n)}async function Ti(e,t){cr(e,"block execution");for(let n of t)if(await qe(e,"statement execution",()=>Bs(e,n)),AS(e))break}function AS(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Bs(e,t){switch(cr(e,"single statement execution"),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case"block":await qe(e,"nested block statement",()=>Ti(e,t.statements));break;case"expr_stmt":await qe(e,"expression statement",()=>Ne(e,t.expression));break;case"print":await qe(e,"print statement",()=>CS(e,t.args,t.output));break;case"printf":await qe(e,"printf statement",()=>kS(e,t.format,t.args,t.output));break;case"if":await qe(e,"if statement",()=>vS(e,t));break;case"while":await qe(e,"while statement",()=>NS(e,t));break;case"do_while":await qe(e,"do-while statement",()=>IS(e,t));break;case"for":await qe(e,"for statement",()=>OS(e,t));break;case"for_in":await qe(e,"for-in statement",()=>TS(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(xt(await qe(e,"exit code expression",()=>Ne(e,n)))):0}break;case"return":e.hasReturn=!0;{let n=t.value;e.returnValue=n?await qe(e,"return expression",()=>Ne(e,n)):""}break;case"delete":await qe(e,"delete statement",()=>$S(e,t.target));break}}async function CS(e,t,n){cr(e,"print execution");let r=[];for(let i of t){let o=await qe(e,"print argument evaluation",()=>Ne(e,i));typeof o=="number"?Number.isInteger(o)&&Math.abs(o)<Number.MAX_SAFE_INTEGER?r.push(String(o)):r.push(Ha(e.OFMT,[o],e.maxOutputSize||void 0)):r.push(tt(o))}let s=r.join(e.OFS)+e.ORS;n?await qe(e,"print redirection write",()=>$0(e,n.redirect,n.file,s)):(e.output+=s,uf(e))}async function kS(e,t,n,r){cr(e,"printf execution");let s=tt(await qe(e,"printf format evaluation",()=>Ne(e,t))),i=[];for(let l of n)i.push(await qe(e,"printf argument evaluation",()=>Ne(e,l)));let o=e.maxOutputSize>0?Math.max(0,e.maxOutputSize-M(e.output)):void 0,a=Ha(s,i,o);r?await qe(e,"printf redirection write",()=>$0(e,r.redirect,r.file,a)):(e.output+=a,uf(e))}async function $0(e,t,n,r){cr(e,"file write execution");let s=e.fs;if(!s||!e.cwd){e.output+=r,uf(e);return}let i=tt(await qe(e,"redirection filename evaluation",()=>Ne(e,n))),o=s.resolvePath(e.cwd,i);t===">"?e.openedFiles.has(o)?await qe(e,"redirection append write",()=>s.appendFile(o,r)):(await qe(e,"redirection overwrite write",()=>s.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await qe(e,"redirection append mode write",()=>s.appendFile(o,r)))}async function vS(e,t){if(cr(e,"if execution"),ln(await qe(e,"if condition evaluation",()=>Ne(e,t.condition))))await qe(e,"if consequent execution",()=>Bs(e,t.consequent));else if(t.alternate){let n=t.alternate;await qe(e,"if alternate execution",()=>Bs(e,n))}}async function NS(e,t){cr(e,"while execution");let n=0;for(;ln(await qe(e,"while condition evaluation",()=>Ne(e,t.condition)));){if(n++,n>e.maxIterations)throw new C(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await qe(e,"while body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function IS(e,t){cr(e,"do-while execution");let n=0;do{if(n++,n>e.maxIterations)throw new C(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await qe(e,"do-while body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(ln(await qe(e,"do-while condition evaluation",()=>Ne(e,t.condition))))}async function OS(e,t){cr(e,"for execution");let n=t.init,r=t.condition,s=t.update;n&&await qe(e,"for init evaluation",()=>Ne(e,n));let i=0;for(;!r||ln(await qe(e,"for condition evaluation",()=>Ne(e,r)));){if(i++,i>e.maxIterations)throw new C(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,"iterations",e.output);if(e.loopContinue=!1,await qe(e,"for body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;s&&await qe(e,"for update evaluation",()=>Ne(e,s))}}async function TS(e,t){cr(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 qe(e,"for-in body execution",()=>Bs(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function $S(e,t){if(cr(e,"delete execution"),t.type==="array_access"){let n=tt(await qe(e,"delete key evaluation",()=>Ne(e,t.key)));N0(e,t.array,n)}else t.type==="variable"&&I0(e,t.name)}var R0=F(()=>{"use strict";G();vr();kt();rf();cf();Ni();lf();T0(Ti)});var Oo,P0=F(()=>{"use strict";G();vr();cf();qa();R0();Ni();Oo=class{ctx;program=null;rangeStates=[];constructor(t){this.ctx=t}assertDefenseContext(t){It(this.ctx.requireDefenseContext,"awk",t)}withDefenseContext(t,n){return an(this.ctx.requireDefenseContext,"awk",t,n)}execute(t){this.assertDefenseContext("program initialization"),this.program=t,this.ctx.output="";for(let n of t.functions)this.ctx.functions.set(n.name,n);this.rangeStates=t.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext("BEGIN execution entry"),!!this.program){for(let t of this.program.rules)if(t.pattern?.type==="begin"&&(await this.withDefenseContext("BEGIN block execution",()=>Ti(this.ctx,t.action.statements)),this.ctx.shouldExit))break}}async executeLine(t){if(this.assertDefenseContext("line execution entry"),!(!this.program||this.ctx.shouldExit)){if(this.ctx.recordsProcessed++,this.ctx.recordsProcessed>this.ctx.maxIterations)throw new C(`record limit exceeded (${this.ctx.maxIterations})`,"iterations");Ii(this.ctx,t),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let n=0;n<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);n++){let r=this.program.rules[n];r.pattern?.type==="begin"||r.pattern?.type==="end"||await this.withDefenseContext("rule match",()=>this.matchesRule(r,n))&&await this.withDefenseContext("rule block execution",()=>Ti(this.ctx,r.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 t of this.program.rules)if(t.pattern?.type==="end"&&(await this.withDefenseContext("END block execution",()=>Ti(this.ctx,t.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(t,n){this.assertDefenseContext("rule matching");let r=t.pattern;if(!r)return!0;switch(r.type){case"begin":case"end":return!1;case"regex_pattern":return No(r.pattern,this.ctx.line);case"expr_pattern":return ln(await this.withDefenseContext("expression pattern evaluation",()=>Ne(this.ctx,r.expression)));case"range":{let s=await this.withDefenseContext("range start pattern",()=>this.matchPattern(r.start)),i=await this.withDefenseContext("range end pattern",()=>this.matchPattern(r.end));return this.rangeStates[n]?(i&&(this.rangeStates[n]=!1),!0):s?(this.rangeStates[n]=!0,i&&(this.rangeStates[n]=!1),!0):!1}default:return!1}}async matchPattern(t){switch(this.assertDefenseContext("pattern matching"),t.type){case"regex_pattern":return No(t.pattern,this.ctx.line);case"expr_pattern":return ln(await this.withDefenseContext("nested expression pattern",()=>Ne(this.ctx,t.expression)));default:return!1}}}});var D0=F(()=>{"use strict";h0();P0()});function PS(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 v,RS,DS,Xa,L0=F(()=>{"use strict";G();(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"})(v||(v={}));RS=new Map([["BEGIN",v.BEGIN],["END",v.END],["if",v.IF],["else",v.ELSE],["while",v.WHILE],["do",v.DO],["for",v.FOR],["in",v.IN],["break",v.BREAK],["continue",v.CONTINUE],["next",v.NEXT],["nextfile",v.NEXTFILE],["exit",v.EXIT],["return",v.RETURN],["delete",v.DELETE],["function",v.FUNCTION],["print",v.PRINT],["printf",v.PRINTF],["getline",v.GETLINE]]);DS=new Set([v.COMMA,v.LBRACE,v.AND,v.OR,v.QUESTION,v.COLON,v.DO,v.ELSE,v.IF,v.WHILE]),Xa=class{maxTokens;input;pos=0;line=1;column=1;lastTokenType=null;constructor(t,n=1e5){this.maxTokens=n,this.input=t}tokenize(){let t=[];for(;this.pos<this.input.length;){let n=this.nextToken();if(n){if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");t.push(n),this.lastTokenType=n.type}}if(t.length>=this.maxTokens)throw new C(`awk: token limit exceeded (${this.maxTokens})`,"array_elements");return t.push(this.makeToken(v.EOF,"")),t}makeToken(t,n){return{type:t,value:n,line:this.line,column:this.column}}peek(t=0){return this.input[this.pos+t]||""}advance(){let t=this.input[this.pos++]||"";return t===`
358
358
  `?(this.line++,this.column=1):this.column++,t}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.peek();if(t===" "||t===" "||t==="\r")this.advance();else if(t==="\\")if(this.peek(1)===`
359
359
  `)this.advance(),this.advance();else break;else if(t==="#")for(;this.pos<this.input.length&&this.peek()!==`
360
360
  `;)this.advance();else break}}nextToken(){for(this.skipWhitespace();this.peek()===`
@@ -424,7 +424,7 @@ Try 'comm --help' for more information.
424
424
  \\n, \\t, \\r escape sequences`},d5=new Map([["[:alnum:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"],["[:alpha:]","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"],["[:blank:]"," "],["[:cntrl:]",Array.from({length:32},(e,t)=>String.fromCharCode(t)).join("").concat("\x7F")],["[:digit:]","0123456789"],["[:graph:]",Array.from({length:94},(e,t)=>String.fromCharCode(33+t)).join("")],["[:lower:]","abcdefghijklmnopqrstuvwxyz"],["[:print:]",Array.from({length:95},(e,t)=>String.fromCharCode(32+t)).join("")],["[:punct:]","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"],["[:space:]",`
425
425
  \r\f\v`],["[:upper:]","ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["[:xdigit:]","0123456789ABCDEFabcdef"]]);p5={complement:{short:"c",long:"complement",type:"boolean"},complementUpper:{short:"C",type:"boolean"},delete:{short:"d",long:"delete",type:"boolean"},squeeze:{short:"s",long:"squeeze-repeats",type:"boolean"}},h5={name:"tr",async execute(e,t){if(Z(e))return q(f5);let n=Pe("tr",e,p5);if(!n.ok)return n.error;let r=n.result.flags.complement||n.result.flags.complementUpper,s=n.result.flags.delete,i=n.result.flags.squeeze,o=n.result.positional;if(o.length<1)return{stdout:"",stderr:`tr: missing operand
426
426
  `,exitCode:1};if(!s&&!i&&o.length<2)return{stdout:"",stderr:`tr: missing operand after SET1
427
- `,exitCode:1};let a,l,c=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),u=t.limits.maxLoopIterations,f=t.limits.maxArrayElements,d=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength);try{let x={iterations:0};a=pg(o[0],c,u,x),l=o.length>1?pg(o[1],c,u,x):""}catch(x){return ge(x),{stdout:"",stderr:`${Ge(x.message)}
427
+ `,exitCode:1};let a,l,c=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),u=t.limits.maxLoopIterations,f=t.limits.maxArrayElements,d=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength);try{let x={iterations:0};a=pg(o[0],c,u,x),l=o.length>1?pg(o[1],c,u,x):""}catch(x){return ge(x),{stdout:"",stderr:`${Ze(x.message)}
428
428
  `,exitCode:1}}if(t.stdin.length>c)throw new C(`tr: input size limit exceeded (${c} bytes)`,"string_length");let p=fe(t.stdin);if(a.length>f||l.length>f)throw new C(`tr: array element limit exceeded (${f})`,"array_elements");let h=new Set(a),m=new Set(l),g=x=>{let S=h.has(x);return r?!S:S},b="",y=0,w=x=>{let S=M(x);if(S>d-y)throw new C(`tr: output size limit exceeded (${d} bytes)`,"output_size");b+=x,y+=S};if(s)for(let x of p)g(x)||w(x);else if(i&&o.length===1){let x="";for(let S of p)g(S)&&S===x||(w(S),x=S)}else{let x="",S=E=>{i&&m.has(E)&&E===x||(w(E),x=E)};if(r){let E=l.length>0?l[l.length-1]:"";for(let A of p)h.has(A)?S(A):S(E)}else{let E=new Map;for(let A=0;A<a.length;A++){let I=A<l.length?l[A]:l[l.length-1];E.set(a[A],I)}for(let A of p)S(E.get(A)??A)}}return{stdout:b,stderr:"",exitCode:0}}},m5={name:"tr",flags:[{flag:"-c",type:"boolean"},{flag:"-C",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-s",type:"boolean"}],stdinType:"text",needsArgs:!0}});var gg={};ae(gg,{flagsForFuzzing:()=>b5,rev:()=>w5});function y5(e){return Array.from(e).reverse().join("")}var g5,w5,b5,yg=F(()=>{"use strict";ue();de();g5={name:"rev",summary:"reverse lines characterwise",usage:"rev [file ...]",description:"Copies the specified files to standard output, reversing the order of characters in every line. If no files are specified, standard input is read.",examples:["echo 'hello' | rev # Output: olleh","rev file.txt # Reverse each line in file"]};w5={name:"rev",execute:async(e,t)=>{if(Z(e))return q(g5);let n=[];for(let i of e)if(i==="--"){let o=e.indexOf(i);n.push(...e.slice(o+1));break}else{if(i.startsWith("-")&&i!=="-")return se("rev",i);n.push(i)}let r="",s=i=>{let o=i.split(`
429
429
  `),a=i.endsWith(`
430
430
  `)&&o[o.length-1]==="";return a&&o.pop(),o.map(y5).join(`
@@ -473,7 +473,7 @@ Try 'comm --help' for more information.
473
473
  `};n.tabStops=a,s++}else if(o==="--tabs"&&s+1<e.length){let a=tl(e[s+1]);if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${e[s+1]}'
474
474
  `};n.tabStops=a,s+=2}else if(o.startsWith("--tabs=")){let a=tl(o.slice(7));if(!a)return{exitCode:1,stdout:"",stderr:`unexpand: invalid tab size: '${o.slice(7)}'
475
475
  `};n.tabStops=a,s++}else if(o==="-a"||o==="--all")n.allBlanks=!0,s++;else if(o==="--"){r.push(...e.slice(s+1));break}else{if(o.startsWith("-")&&o!=="-")return se("unexpand",o);r.push(o),s++}}let i="";if(r.length===0){let o=fe(t.stdin)??"";i=Ig(o,n)}else for(let o of r){let a=t.fs.resolvePath(t.cwd,o),l=await t.fs.readFile(a);if(l===null)return{exitCode:1,stdout:i,stderr:`unexpand: ${o}: No such file or directory
476
- `};i+=Ig(l,n)}return{exitCode:0,stdout:i,stderr:""}}},_5={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Pg={};ae(Pg,{flagsForFuzzing:()=>W5,strings:()=>z5});function U5(e){return e>=32&&e<=126||e===9}function $g(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function Rg(e,t,n,r=!1,s){let i=[],o=0,a=0,l=typeof e=="string"&&!r?new TextEncoder().encode(e):e;if(l.length>n.maxStringLength-n.inputBytes)throw new C(`strings: aggregate input size limit exceeded (${n.maxStringLength} bytes)`,"string_length");n.inputBytes+=l.length;let c=new TextDecoder,u=(d,p)=>typeof l=="string"?l.slice(d,p):c.decode(l.subarray(d,p)),f=d=>{if(++n.iterations>n.maxIterations)throw new C(`strings: iteration limit exceeded (${n.maxIterations})`,"iterations");if(n.resultCount>=n.maxArrayElements)throw new C(`strings: array element limit exceeded (${n.maxArrayElements})`,"array_elements");let p=d.length+1;if(p>n.maxOutputSize-n.outputBytes)throw new C(`strings: output size limit exceeded (${n.maxOutputSize} bytes)`,"output_size");i.push(d),n.resultCount++,n.outputBytes+=p};for(let d=0;d<l.length;d++){if((d&4095)===0&&s?.aborted)throw new _e;let p=typeof l=="string"?l.charCodeAt(d)&255:l[d];if(U5(p)){if(o===0&&(a=d),o>=n.maxStringLength)throw new C(`strings: string length limit exceeded (${n.maxStringLength} bytes)`,"string_length");o++}else{if(o>=t.minLength){let h=$g(a,t.offsetFormat);f(`${h}${u(a,d)}`)}o=0}}if(o>=t.minLength){let d=$g(a,t.offsetFormat);f(`${d}${u(a,l.length)}`)}return i}var B5,z5,W5,Dg=F(()=>{"use strict";G();de();B5={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};z5={name:"strings",execute:async(e,t)=>{if(Z(e))return q(B5);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let l=e[s];if(l==="-n"&&s+1<e.length){let c=Number.parseInt(e[s+1],10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
476
+ `};i+=Ig(l,n)}return{exitCode:0,stdout:i,stderr:""}}},_5={name:"unexpand",flags:[{flag:"-t",type:"value",valueHint:"number"},{flag:"-a",type:"boolean"}],stdinType:"text",needsFiles:!0}});var Pg={};ae(Pg,{flagsForFuzzing:()=>W5,strings:()=>z5});function U5(e){return e>=32&&e<=126||e===9}function $g(e,t){if(t===null)return"";switch(t){case"o":return`${e.toString(8).padStart(7," ")} `;case"x":return`${e.toString(16).padStart(7," ")} `;case"d":return`${e.toString(10).padStart(7," ")} `;default:return t}}function Rg(e,t,n,r=!1,s){let i=[],o=0,a=0,l=typeof e=="string"&&!r?new TextEncoder().encode(e):e;if(l.length>n.maxStringLength-n.inputBytes)throw new C(`strings: aggregate input size limit exceeded (${n.maxStringLength} bytes)`,"string_length");n.inputBytes+=l.length;let c=new TextDecoder,u=(d,p)=>typeof l=="string"?l.slice(d,p):c.decode(l.subarray(d,p)),f=d=>{if(++n.iterations>n.maxIterations)throw new C(`strings: iteration limit exceeded (${n.maxIterations})`,"iterations");if(n.resultCount>=n.maxArrayElements)throw new C(`strings: array element limit exceeded (${n.maxArrayElements})`,"array_elements");let p=d.length+1;if(p>n.maxOutputSize-n.outputBytes)throw new C(`strings: output size limit exceeded (${n.maxOutputSize} bytes)`,"output_size");i.push(d),n.resultCount++,n.outputBytes+=p};for(let d=0;d<l.length;d++){if((d&4095)===0&&s?.aborted)throw new Fe;let p=typeof l=="string"?l.charCodeAt(d)&255:l[d];if(U5(p)){if(o===0&&(a=d),o>=n.maxStringLength)throw new C(`strings: string length limit exceeded (${n.maxStringLength} bytes)`,"string_length");o++}else{if(o>=t.minLength){let h=$g(a,t.offsetFormat);f(`${h}${u(a,d)}`)}o=0}}if(o>=t.minLength){let d=$g(a,t.offsetFormat);f(`${d}${u(a,l.length)}`)}return i}var B5,z5,W5,Dg=F(()=>{"use strict";G();de();B5={name:"strings",summary:"print the sequences of printable characters in files",usage:"strings [OPTION]... [FILE]...",description:"For each FILE, print the printable character sequences that are at least MIN characters long. If no FILE is specified, standard input is read.",options:["-n MIN Print sequences of at least MIN characters (default: 4)","-t FORMAT Print offset before each string (o=octal, x=hex, d=decimal)","-a Scan the entire file (default behavior)","-e ENCODING Select character encoding (s=7-bit, S=8-bit)"],examples:["strings file.bin # Extract strings (min 4 chars)","strings -n 8 file.bin # Extract strings (min 8 chars)","strings -t x file.bin # Show hex offset","echo 'hello' | strings # Read from stdin"]};z5={name:"strings",execute:async(e,t)=>{if(Z(e))return q(B5);let n={minLength:4,offsetFormat:null},r=[],s=0;for(;s<e.length;){let l=e[s];if(l==="-n"&&s+1<e.length){let c=Number.parseInt(e[s+1],10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${e[s+1]}'
477
477
  `};n.minLength=c,s+=2}else if(l.match(/^-n\d+$/)){let c=Number.parseInt(l.slice(2),10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${l.slice(2)}'
478
478
  `};n.minLength=c,s++}else if(l.match(/^-\d+$/)){let c=Number.parseInt(l.slice(1),10);if(Number.isNaN(c)||c<1)return{exitCode:1,stdout:"",stderr:`strings: invalid minimum string length: '${l.slice(1)}'
479
479
  `};n.minLength=c,s++}else if(l==="-t"&&s+1<e.length){let c=e[s+1];if(c!=="o"&&c!=="x"&&c!=="d")return{exitCode:1,stdout:"",stderr:`strings: invalid radix: '${c}'
@@ -534,8 +534,8 @@ Try 'comm --help' for more information.
534
534
  `:`find: invalid argument \`${B}' to \`${O}'
535
535
  `,exitCode:1};let U=Number(B);if(!Number.isSafeInteger(U))return{stdout:"",stderr:`find: invalid argument \`${B}' to \`${O}'
536
536
  `,exitCode:1};O==="-maxdepth"?r=U:s=U,z++}else O==="-depth"&&(i=!0)}let{expr:a,error:l}=Kg(e,o);if(l)return{stdout:"",stderr:l,exitCode:1};let c=sl(a),u=c.length>0;c.some(z=>z.type==="delete")&&(i=!0);let f=[],d=0,p=t.executionScope?new En(t.executionScope,"find"):void 0,h=[],m=[],g=0,b=new Dt({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),y=z=>{if(p)p.append("stdout",z);else{let O=M(z);if(O>t.limits.maxOutputSize-g)throw new C(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");z&&h.push(z),g+=O}},w=z=>{if(p)p.append("stderr",z);else{let O=M(z);if(O>t.limits.maxOutputSize-g)throw new C(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");z&&m.push(z),g+=O}},x=qg(a),S=new Map;for(let z of x){let O=t.fs.resolvePath(t.cwd,z);try{let B=await t.fs.stat(O);S.set(z,B.mtime?.getTime()??Date.now())}catch{}}let E=c.some(z=>{if(z.type!=="printf")return!1;let O=z.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(O)}),A=To(a)||E,I=$o(a),R=Po(a),N=Ro(a),$=typeof t.fs.readdirWithFileTypes=="function";for(let z of n){let W=function(V){let Y={path:V.relativePath,name:V.name,size:V.stat?.size??0,mtime:V.stat?.mtime?.getTime()??Date.now(),mode:V.stat?.mode??420,isDirectory:V.isDirectory,depth:V.depth,startingPoint:z},ee=V.unreadable===void 0?[]:[{action:{type:"diagnostic",message:`find: ${V.relativePath}: ${V.unreadable}
537
- `},path:V.relativePath,printfData:Y}],Se=ie=>i?[...ee,...ie]:[...ie,...ee];if(!(s===null||V.depth>=s))return ee;let Ae=!0,pe=[];if(a!==null){let ie=Date.now(),re;if(N)re=Us(a,V.name,V.relativePath,V.isFile,V.isDirectory);else{let Xe={name:V.name,relativePath:V.relativePath,isFile:V.isFile,isDirectory:V.isDirectory,isEmpty:V.isEmpty,mtime:V.stat?.mtime?.getTime()??Date.now(),size:V.stat?.size??0,mode:V.stat?.mode??420,newerRefTimes:S};re=qn(a,Xe)}Ae=re.matches,pe=re.actions??[],B.evalCalls++,B.evalTime+=Date.now()-ie}if(!u&&Ae&&(pe=[{type:"print"}]),pe.length===0)return ee;b.checkpoint(pe.length);let Le=[];for(let ie of pe)Le.push({action:ie,path:V.relativePath,printfData:Y});return Se(Le)};var _=W;z.length>1&&z.endsWith("/")&&(z=z.slice(0,-1));let O=t.fs.resolvePath(t.cwd,z);try{await t.fs.stat(O)}catch{w(`find: ${z}: No such file or directory
538
- `),d=1;continue}let B=wA(),U=Date.now();async function L(V){let{path:Y,depth:ee,typeInfo:Se}=V;if(b.visit(ee),B.nodeCount++,ee>(r??t.limits.maxTraversalDepth))return null;let Te,Ae,pe;if(Se&&!A)Te=Se.isFile,Ae=Se.isDirectory;else{try{let Jr=Date.now();pe=await t.fs.lstat(Y),B.statCalls++,B.statTime+=Date.now()-Jr}catch{return null}if(!pe)return null;Te=pe.isFile,Ae=pe.isDirectory}let Le;Y===O?Le=z.split("/").pop()||z:Le=Y.split("/").pop()||"";let ie=Y===O?z:z==="."?`./${Y.slice(O==="/"?O.length:O.length+1)}`:z+Y.slice(O.length),re=[],Xe=null,ye=null,Me=!1;Ae&&R&&!i&&(Me=Gg(a,{name:Le,relativePath:ie,isFile:Te,isDirectory:Ae}).shouldPrune,Me&&B.earlyPrunes++);let he=!(ee>=(r??t.limits.maxTraversalDepth))&&!Me,Mr=(he||I)&&!Me,_r;if(Ae&&Mr){let Jr=Date.now();try{$&&t.fs.readdirWithFileTypes?Xe=await t.fs.readdirWithFileTypes(Y):ye=await t.fs.readdir(Y)}catch(Qt){let rr=kA(Qt);if(rr===null)throw Qt;_r=rr,B.readdirCalls++,B.readdirTime+=Date.now()-Jr}if(Xe!==null){b.checkpoint(),b.discover(Xe.length),ye=[];for(let Qt of Xe)ye.push(Qt.name);if(B.readdirCalls++,B.readdirTime+=Date.now()-Jr,he)for(let Qt=0;Qt<Xe.length;Qt++){let rr=Xe[Qt];re.push({path:Y==="/"?`/${rr.name}`:`${Y}/${rr.name}`,depth:ee+1,typeInfo:{isFile:rr.isFile,isDirectory:rr.isDirectory},resultIndex:Qt})}}else if(ye!==null&&(b.checkpoint(),b.discover(ye.length),B.readdirCalls++,B.readdirTime+=Date.now()-Jr,he))for(let Qt=0;Qt<ye.length;Qt++){let rr=ye[Qt];re.push({path:Y==="/"?`/${rr}`:`${Y}/${rr}`,depth:ee+1,resultIndex:Qt})}}let On=Te?(pe?.size??0)===0:ye!==null&&ye.length===0,ba=Me;if(!i&&a!==null&&!Me&&R){let Jr=Date.now(),Qt={name:Le,relativePath:ie,isFile:Te,isDirectory:Ae,isEmpty:On,mtime:pe?.mtime?.getTime()??Date.now(),size:pe?.size??0,mode:pe?.mode??420,newerRefTimes:S};ba=qn(a,Qt).pruned,B.evalCalls++,B.evalTime+=Date.now()-Jr}return{relativePath:ie,name:Le,isFile:Te,isDirectory:Ae,isEmpty:On,stat:pe,depth:ee,children:ba?[]:re,pruned:ba,unreadable:_r}}async function D(){let V={effects:[]};if(i){let Y=[],ee=[{item:{path:O,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],Se=new Map,Te=0;for(;Te<ee.length;){let Ae=Date.now(),pe=Math.min(ee.length,Te+Qg),Le=ee.slice(Te,pe);Te=pe;let ie=await Promise.all(Le.map(re=>L(re.item)));B.batchCount++,B.batchTime+=Date.now()-Ae;for(let re=0;re<Le.length;re++){let Xe=ie[re],ye=Le[re];if(!Xe)continue;let Me=Y.length;if(ye.parentIndex>=0){let ze=Se.get(ye.parentIndex)||[];ze.push(Me),Se.set(ye.parentIndex,ze)}Y.push({node:Xe,parentIndex:ye.parentIndex,childIndices:[]});for(let ze=0;ze<Xe.children.length;ze++)ee.push({item:Xe.children[ze],parentIndex:Me,childOrderInParent:ze})}}for(let[Ae,pe]of Se)Ae>=0&&Ae<Y.length&&(Y[Ae].childIndices=pe);if(Y.length>0){let Ae=[{index:0,visited:!1}];for(;Ae.length>0;){b.checkpoint();let pe=Ae.pop();if(!pe)break;let Le=Y[pe.index];if(Le){if(pe.visited){for(let ie of W(Le.node))V.effects.push(ie);continue}Ae.push({index:pe.index,visited:!0});for(let ie=Le.childIndices.length-1;ie>=0;ie--)Ae.push({index:Le.childIndices[ie],visited:!1})}}}}else{let Y=new Map,ee=0,Se=[{item:{path:O,depth:0,resultIndex:0},orderIndex:ee++}],Te=new Map,Ae=0;for(;Ae<Se.length;){let Le=Date.now(),ie=Math.min(Se.length,Ae+Qg),re=Se.slice(Ae,ie);Ae=ie;let Xe=await Promise.all(re.map(async({item:ye,orderIndex:Me})=>{let ze=await L(ye);return ze?{node:ze,orderIndex:Me}:null}));B.batchCount++,B.batchTime+=Date.now()-Le;for(let ye of Xe){if(!ye)continue;let{node:Me,orderIndex:ze}=ye,he=W(Me);if(he.length>0&&Y.set(ze,he),Me.children.length>0){let Mr=[];for(let _r of Me.children){let On=ee++;Mr.push(On),Se.push({item:_r,orderIndex:On})}Te.set(ze,Mr)}}}let pe=[0];for(;pe.length>0;){b.checkpoint();let Le=pe.pop();if(Le===void 0)break;let ie=Y.get(Le);if(ie)for(let Xe of ie)V.effects.push(Xe);let re=Te.get(Le);if(re)for(let Xe=re.length-1;Xe>=0;Xe--)pe.push(re[Xe])}}return V}let Q=await D();for(let V of Q.effects)f.push(V);if(t.trace){let V=Date.now()-U;bA(t.trace,B,V),t.trace({category:"find",name:"searchPath",durationMs:V,details:{path:z,resultsFound:Q.effects.filter(Y=>Y.action.type!=="diagnostic").length}})}}let T=new Map;for(let z of f){let{action:O,path:B}=z;switch(O.type){case"diagnostic":w(O.message),d=1;break;case"print":y(`${B}
537
+ `},path:V.relativePath,printfData:Y}],Se=ie=>i?[...ee,...ie]:[...ie,...ee];if(!(s===null||V.depth>=s))return ee;let Ae=!0,pe=[];if(a!==null){let ie=Date.now(),re;if(N)re=Us(a,V.name,V.relativePath,V.isFile,V.isDirectory);else{let We={name:V.name,relativePath:V.relativePath,isFile:V.isFile,isDirectory:V.isDirectory,isEmpty:V.isEmpty,mtime:V.stat?.mtime?.getTime()??Date.now(),size:V.stat?.size??0,mode:V.stat?.mode??420,newerRefTimes:S};re=qn(a,We)}Ae=re.matches,pe=re.actions??[],B.evalCalls++,B.evalTime+=Date.now()-ie}if(!u&&Ae&&(pe=[{type:"print"}]),pe.length===0)return ee;b.checkpoint(pe.length);let Le=[];for(let ie of pe)Le.push({action:ie,path:V.relativePath,printfData:Y});return Se(Le)};var _=W;z.length>1&&z.endsWith("/")&&(z=z.slice(0,-1));let O=t.fs.resolvePath(t.cwd,z);try{await t.fs.stat(O)}catch{w(`find: ${z}: No such file or directory
538
+ `),d=1;continue}let B=wA(),U=Date.now();async function L(V){let{path:Y,depth:ee,typeInfo:Se}=V;if(b.visit(ee),B.nodeCount++,ee>(r??t.limits.maxTraversalDepth))return null;let Te,Ae,pe;if(Se&&!A)Te=Se.isFile,Ae=Se.isDirectory;else{try{let Jr=Date.now();pe=await t.fs.lstat(Y),B.statCalls++,B.statTime+=Date.now()-Jr}catch{return null}if(!pe)return null;Te=pe.isFile,Ae=pe.isDirectory}let Le;Y===O?Le=z.split("/").pop()||z:Le=Y.split("/").pop()||"";let ie=Y===O?z:z==="."?`./${Y.slice(O==="/"?O.length:O.length+1)}`:z+Y.slice(O.length),re=[],We=null,ye=null,Be=!1;Ae&&R&&!i&&(Be=Gg(a,{name:Le,relativePath:ie,isFile:Te,isDirectory:Ae}).shouldPrune,Be&&B.earlyPrunes++);let he=!(ee>=(r??t.limits.maxTraversalDepth))&&!Be,Mr=(he||I)&&!Be,_r;if(Ae&&Mr){let Jr=Date.now();try{$&&t.fs.readdirWithFileTypes?We=await t.fs.readdirWithFileTypes(Y):ye=await t.fs.readdir(Y)}catch(Qt){let rr=kA(Qt);if(rr===null)throw Qt;_r=rr,B.readdirCalls++,B.readdirTime+=Date.now()-Jr}if(We!==null){b.checkpoint(),b.discover(We.length),ye=[];for(let Qt of We)ye.push(Qt.name);if(B.readdirCalls++,B.readdirTime+=Date.now()-Jr,he)for(let Qt=0;Qt<We.length;Qt++){let rr=We[Qt];re.push({path:Y==="/"?`/${rr.name}`:`${Y}/${rr.name}`,depth:ee+1,typeInfo:{isFile:rr.isFile,isDirectory:rr.isDirectory},resultIndex:Qt})}}else if(ye!==null&&(b.checkpoint(),b.discover(ye.length),B.readdirCalls++,B.readdirTime+=Date.now()-Jr,he))for(let Qt=0;Qt<ye.length;Qt++){let rr=ye[Qt];re.push({path:Y==="/"?`/${rr}`:`${Y}/${rr}`,depth:ee+1,resultIndex:Qt})}}let On=Te?(pe?.size??0)===0:ye!==null&&ye.length===0,ba=Be;if(!i&&a!==null&&!Be&&R){let Jr=Date.now(),Qt={name:Le,relativePath:ie,isFile:Te,isDirectory:Ae,isEmpty:On,mtime:pe?.mtime?.getTime()??Date.now(),size:pe?.size??0,mode:pe?.mode??420,newerRefTimes:S};ba=qn(a,Qt).pruned,B.evalCalls++,B.evalTime+=Date.now()-Jr}return{relativePath:ie,name:Le,isFile:Te,isDirectory:Ae,isEmpty:On,stat:pe,depth:ee,children:ba?[]:re,pruned:ba,unreadable:_r}}async function D(){let V={effects:[]};if(i){let Y=[],ee=[{item:{path:O,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],Se=new Map,Te=0;for(;Te<ee.length;){let Ae=Date.now(),pe=Math.min(ee.length,Te+Qg),Le=ee.slice(Te,pe);Te=pe;let ie=await Promise.all(Le.map(re=>L(re.item).catch(We=>{if(We instanceof Fe)return null;throw We})));B.batchCount++,B.batchTime+=Date.now()-Ae;for(let re=0;re<Le.length;re++){let We=ie[re],ye=Le[re];if(!We)continue;let Be=Y.length;if(ye.parentIndex>=0){let _e=Se.get(ye.parentIndex)||[];_e.push(Be),Se.set(ye.parentIndex,_e)}Y.push({node:We,parentIndex:ye.parentIndex,childIndices:[]});for(let _e=0;_e<We.children.length;_e++)ee.push({item:We.children[_e],parentIndex:Be,childOrderInParent:_e})}}for(let[Ae,pe]of Se)Ae>=0&&Ae<Y.length&&(Y[Ae].childIndices=pe);if(Y.length>0){let Ae=[{index:0,visited:!1}];for(;Ae.length>0;){b.checkpoint();let pe=Ae.pop();if(!pe)break;let Le=Y[pe.index];if(Le){if(pe.visited){for(let ie of W(Le.node))V.effects.push(ie);continue}Ae.push({index:pe.index,visited:!0});for(let ie=Le.childIndices.length-1;ie>=0;ie--)Ae.push({index:Le.childIndices[ie],visited:!1})}}}}else{let Y=new Map,ee=0,Se=[{item:{path:O,depth:0,resultIndex:0},orderIndex:ee++}],Te=new Map,Ae=0;for(;Ae<Se.length;){let Le=Date.now(),ie=Math.min(Se.length,Ae+Qg),re=Se.slice(Ae,ie);Ae=ie;let We=await Promise.all(re.map(async({item:ye,orderIndex:Be})=>{try{let _e=await L(ye);return _e?{node:_e,orderIndex:Be}:null}catch(_e){if(_e instanceof Fe)return null;throw _e}}));B.batchCount++,B.batchTime+=Date.now()-Le;for(let ye of We){if(!ye)continue;let{node:Be,orderIndex:_e}=ye,he=W(Be);if(he.length>0&&Y.set(_e,he),Be.children.length>0){let Mr=[];for(let _r of Be.children){let On=ee++;Mr.push(On),Se.push({item:_r,orderIndex:On})}Te.set(_e,Mr)}}}let pe=[0];for(;pe.length>0;){b.checkpoint();let Le=pe.pop();if(Le===void 0)break;let ie=Y.get(Le);if(ie)for(let We of ie)V.effects.push(We);let re=Te.get(Le);if(re)for(let We=re.length-1;We>=0;We--)pe.push(re[We])}}return V}let Q=await D();for(let V of Q.effects)f.push(V);if(t.trace){let V=Date.now()-U;bA(t.trace,B,V),t.trace({category:"find",name:"searchPath",durationMs:V,details:{path:z,resultsFound:Q.effects.filter(Y=>Y.action.type!=="diagnostic").length}})}}let T=new Map;for(let z of f){let{action:O,path:B}=z;switch(O.type){case"diagnostic":w(O.message),d=1;break;case"print":y(`${B}
539
539
  `);break;case"print0":y(`${B}\0`);break;case"printf":y(SA(O.format,z.printfData));break;case"delete":{let U=t.fs.resolvePath(t.cwd,B);try{await t.fs.rm(U,{recursive:!1})}catch(L){let W=L instanceof Error?L.message:String(L);w(`find: cannot delete '${B}': ${W}
540
540
  `),d=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
541
541
  `,exitCode:1};if(O.batchMode){let W=T.get(O)??[];W.push(B),T.set(O,W);break}let U=O.command.map(W=>W==="{}"?B:W),L=await t.exec($n([U[0]]),{cwd:t.cwd,signal:t.signal,args:U.slice(1)});p?p.appendResult(L):(y(L.stdout),w(L.stderr)),L.exitCode!==0&&(d=L.exitCode);break}}}for(let[z,O]of T){if(z.type!=="exec"||!t.exec||O.length===0)continue;let B=[];for(let L of z.command)L==="{}"?B.push(...O):B.push(L);let U=await t.exec($n([B[0]]),{cwd:t.cwd,signal:t.signal,args:B.slice(1)});p?p.appendResult(U):(y(U.stdout),w(U.stderr)),U.exitCode!==0&&(d=U.exitCode)}return p?.build(d)??{stdout:h.join(""),stderr:m.join(""),exitCode:d}}};CA=new Map([["EACCES","Permission denied"],["EIO","Input/output error"],["ELOOP","Too many levels of symbolic links"],["ENAMETOOLONG","File name too long"],["ENOENT","No such file or directory"],["ENOTDIR","Not a directory"],["EPERM","Permission denied"]]);NA={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}});var e2={};ae(e2,{basenameCommand:()=>OA,flagsForFuzzing:()=>TA});var IA,OA,TA,t2=F(()=>{"use strict";de();IA={name:"basename",summary:"strip directory and suffix from filenames",usage:`basename NAME [SUFFIX]
@@ -557,7 +557,7 @@ basename OPTION... NAME...`,options:["-a, --multiple support multiple argument
557
557
  ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"s"}`),i+=`
558
558
  `,{stdout:i,stderr:o,exitCode:o?1:0}}};_A={name:"tree",flags:[{flag:"-a",type:"boolean"},{flag:"-d",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-L",type:"value",valueHint:"number"}],needsFiles:!0}});var a2={};ae(a2,{duCommand:()=>zA,flagsForFuzzing:()=>jA});async function WA(e,t,n,r,s){let i={output:"",totalSize:0,stderr:""},o=new Map;return await Ar({fs:e.fs,root:t,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"du",symlinks:"never",includeLeave:!0},a=>{let l=a.path.slice(t.length).replace(/^\//,""),c=l?n==="."?l:`${n}/${l}`:n,u=a.path==="/"?"/":a.path.slice(0,a.path.lastIndexOf("/"))||"/";if(a.phase==="enter"){if(a.stat.isDirectory){o.set(a.path,0);return}o.set(u,(o.get(u)??0)+a.stat.size),(r.allFiles||a.depth===s)&&!r.summarize&&(i.output+=`${yf(a.stat.size,r.humanReadable)} ${c}
559
559
  `),a.depth===s&&(i.totalSize=a.stat.size);return}let f=o.get(a.path)??0;a.depth>s?o.set(u,(o.get(u)??0)+f):i.totalSize=f;let d=a.depth-s;(r.summarize&&d===0||!r.summarize&&(r.maxDepth===null||d<=r.maxDepth))&&(i.output+=`${yf(f,r.humanReadable)} ${c}
560
- `)}),i}function yf(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 BA,UA,zA,jA,l2=F(()=>{"use strict";Wn();G();Nt();de();BA={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"]},UA={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"}},zA={name:"du",async execute(e,t){if(Z(e))return q(BA);let n=Pe("du",e,UA);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},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await WA(t,c,l,r,0);i+=u.output,a+=u.totalSize,o+=u.stderr}catch(u){if(u instanceof C||u instanceof _e)throw u;o+=`du: cannot access '${l}': No such file or directory
560
+ `)}),i}function yf(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 BA,UA,zA,jA,l2=F(()=>{"use strict";Wn();G();Nt();de();BA={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"]},UA={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"}},zA={name:"du",async execute(e,t){if(Z(e))return q(BA);let n=Pe("du",e,UA);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},s=n.result.positional;s.length===0&&s.push(".");let i="",o="",a=0;for(let l of s){let c=t.fs.resolvePath(t.cwd,l);try{await t.fs.stat(c);let u=await WA(t,c,l,r,0);i+=u.output,a+=u.totalSize,o+=u.stderr}catch(u){if(u instanceof C||u instanceof Fe)throw u;o+=`du: cannot access '${l}': No such file or directory
561
561
  `}}return r.grandTotal&&s.length>0&&(i+=`${yf(a,r.humanReadable)} total
562
562
  `),{stdout:i,stderr:o,exitCode:o?1:0}}};jA={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}});var wf={};ae(wf,{envCommand:()=>VA,flagsForFuzzing:()=>ZA,printenvCommand:()=>GA,printenvFlagsForFuzzing:()=>KA});var HA,VA,qA,GA,ZA,KA,bf=F(()=>{"use strict";ue();jr();de();HA={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"]},VA={name:"env",async execute(e,t){if(Z(e))return q(HA);let n=!1,r=[],s=new Map,i=-1;for(let l=0;l<e.length;l++){let c=e[l];if(c==="-i"||c==="--ignore-environment")n=!0;else if(c==="-u"&&l+1<e.length)r.push(e[++l]);else if(c.startsWith("-u"))r.push(c.slice(2));else if(c.startsWith("--unset="))r.push(c.slice(8));else{if(c.startsWith("--")&&c!=="--")return se("env",c);if(c.startsWith("-")&&c!=="-"){for(let u of c.slice(1))if(u!=="i"&&u!=="u")return se("env",`-${u}`);c.includes("i")&&(n=!0)}else if(c.includes("=")&&i===-1){let u=c.indexOf("="),f=c.slice(0,u),d=c.slice(u+1);s.set(f,d)}else{i=l;break}}}let o;if(n)o=new Map(s);else{o=new Map(t.env);for(let l of r)o.delete(l);for(let[l,c]of s)o.set(l,c)}if(i===-1){let l=[];for(let[c,u]of o)l.push(`${c}=${u}`);return{stdout:l.join(`
563
563
  `)+(l.length>0?`
@@ -585,8 +585,8 @@ ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"
585
585
  `,exitCode:1};let s=_s(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((l,c)=>{s[String(c+1)]=l});let i=e;if(i.startsWith("#!")){let l=i.indexOf(`
586
586
  `);l!==-1&&(i=i.slice(l+1))}let o=r.execWithInheritedStdin;return o?await o(i,{env:s,cwd:r.cwd,signal:r.signal}):await r.exec(i,{env:s,cwd:r.cwd,stdin:r.stdin,stdinKind:"bytes",signal:r.signal})}var b2,wC,bC,xC,EC,kf=F(()=>{"use strict";ue();jr();de();b2={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).']},wC={name:"bash",async execute(e,t){if(Z(e))return q(b2);if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"bash",o=e.slice(3);return Di(s,i,o,t)}if(e.length===0){let s=fe(t.stdin);return s.trim()?Di(s,"bash",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Di(i,n,r,t)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
587
587
  `,exitCode:127}}}},bC={name:"sh",async execute(e,t){if(Z(e))return q({...b2,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(e[0]==="-c"&&e.length>=2){let s=e[1],i=e[2]||"sh",o=e.slice(3);return Di(s,i,o,t)}if(e.length===0){let s=fe(t.stdin);return s.trim()?Di(s,"sh",[],t):{stdout:"",stderr:"",exitCode:0}}let n=e[0],r=e.slice(1);try{let s=t.fs.resolvePath(t.cwd,n),i=await t.fs.readFile(s);return Di(i,n,r,t)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
588
- `,exitCode:127}}}};xC={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},EC={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function Do(e,t,n=1){let r=e.limits.maxArrayElements;if(n<0||t>r-n)throw new C(`query result element limit exceeded (${r})`,"array_elements")}function vf(e,t,n,r,s,i,o,a,l,c){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((f,d)=>{let p=s(f,n[0],r)[0],h=s(d,n[0],r)[0];return o(p,h)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let d=0,p=e.length;for(;d<p;){let h=d+p>>>1;o(e[h],f)<0?d=h+1:p=h}return d<e.length&&o(e[d],f)===0?d:-d-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let d of e){let p=s(d,n[0],r)[0],h=JSON.stringify(p);u.has(h)||u.set(h,{item:d,key:p})}let f=[...u.values()];return f.sort((d,p)=>o(d.key,p.key)),[f.map(d=>d.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let d=JSON.stringify(s(f,n[0],r)[0]);u.has(d)||u.set(d,[]),u.get(d)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)<0?u:f})];case"add":{let u=f=>{let d=f.filter(p=>p!==null);return d.length===0?null:d.every(p=>typeof p=="number")?d.reduce((p,h)=>p+h,0):d.every(p=>typeof p=="string")?d.join(""):d.every(p=>Array.isArray(p))?d.flat():d.every(p=>p&&typeof p=="object"&&!Array.isArray(p))?_s(...d):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[e]:[];case"map":{if(n.length===0||!Array.isArray(e))return[null];Do(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);Do(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}case"map_values":{if(n.length===0)return[null];if(Array.isArray(e)){Do(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);Do(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}if(e&&typeof e=="object"){let u=Object.create(null),f=Object.keys(e);Do(r,0,f.length);for(let d of f){if(!Ze(d))continue;let p=e[d],h=s(p,n[0],r);h.length>0&&Je(u,d,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[Object.hasOwn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[Object.hasOwn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var x2=F(()=>{"use strict";jr();G();ar()});function Nf(e,t,n,r,s,i,o,a){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof a)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof a)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=r.limits.maxArrayElements,c=(h,m)=>{if(h.length>=l)throw new a(`query result element limit exceeded (${l})`,"array_elements");h.push(m)},u=s(e,n[0],r);if(n.length===1){let h=[];for(let m of u){let g=m;for(let b=0;b<g;b++)c(h,b)}return h}let f=s(e,n[1],r);if(n.length===2){let h=[];for(let m of u)for(let g of f){let b=m,y=g;for(let w=b;w<y;w++)c(h,w)}return h}let d=s(e,n[2],r),p=[];for(let h of u)for(let m of f)for(let g of d){let b=h,y=m,w=g;if(w!==0)if(w>0)for(let x=b;x<y;x+=w)c(p,x);else for(let x=b;x>y;x+=w)c(p,x)}return p}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(d){if(d instanceof a)throw d;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof a)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof a)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(o))return[l];let d=s(l,n[1],r);if(d.length===0)return[l];l=d[0]}throw new a(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(o);f++){l.push(c);let p=s(c,n[1],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new a(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let d=s(c,n[0],r);if(d.length===0)break;c=d[0]}if(l.length>=u)throw new a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var E2=F(()=>{"use strict"});function If(e,t){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${t} timestamp is outside the supported range`);return new Date(e*1e3)}function A2(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!t)return null;let[,n,r,s,i,o,a]=t.map(Number),l=Date.UTC(n,r-1,s,i,o,a);if(!Number.isFinite(l))return null;let c=new Date(l);return c.getUTCFullYear()!==n||c.getUTCMonth()!==r-1||c.getUTCDate()!==s||c.getUTCHours()!==i||c.getUTCMinutes()!==o||c.getUTCSeconds()!==a?null:c}function Of(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=If(e,"gmtime"),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),d=i.getUTCDay(),p=Date.UTC(o,0,1),h=Math.floor((i.getTime()-p)/(1440*60*1e3));return[[o,a,l,c,u,f,d,h]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=If(e,"strftime");else if(Array.isArray(e)){let[d,p,h,m=0,g=0,b=0]=e;if(typeof d!="number"||typeof p!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(d,p,h??1,m??0,g??0,b??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(d,p=2)=>String(d).padStart(p,"0");return[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o!==S2)throw new Error(`strptime format is not supported: ${o}`);let a=A2(e);if(a){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),d=a.getUTCMinutes(),p=a.getUTCSeconds(),h=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,d,p,h,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=A2(e);if(!i)throw new Error(`date "${e}" does not match format "${S2}"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[If(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var S2,C2=F(()=>{"use strict";S2="%Y-%m-%dT%H:%M:%SZ"});function Gn(e){return e!==!1&&e!==null}function Li(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Lo(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function k2(e,t,n={}){let r=n.maxDepth??2e3,s=Lt(e),i=[{target:s,source:t,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;if(o.depth>r)throw new C(`query depth limit exceeded (${r})`,"recursion");for(let a of Object.keys(o.source)){if(n.visit?.(),!Ze(a))continue;let l=Ls(o.target,a)?et(o.target[a]):null,c=et(o.source[a]);if(l&&c){let u=Lt(l);Je(o.target,a,u),i.push({target:u,source:c,depth:o.depth+1})}else Je(o.target,a,o.source[a])}}return s}function Vr(e,t=3e3){if(e===null||typeof e!="object")return 0;if(t<=1)return t;let n=(c,u)=>({value:c,keys:Array.isArray(c)?void 0:Object.keys(c),nextChild:0,pathDepth:u,maxChildDepth:0}),r=c=>c.keys!==void 0?c.keys.length:c.value.length,s=c=>{if(c.keys){let u=c.keys[c.nextChild++];return c.value[u]}return c.value[c.nextChild++]},i=new WeakMap,o=new WeakMap,a=e,l=[n(a,1)];for(i.set(a,"visiting");l.length>0;){let c=l[l.length-1];if(c.nextChild<r(c)){let d=s(c);if(d===null||typeof d!="object")continue;let p=i.get(d);if(p==="visiting")return t;if(p==="done"){let g=o.get(d)??0;if(c.pathDepth+g>=t)return t;c.maxChildDepth=Math.max(c.maxChildDepth,g);continue}let h=c.pathDepth+1;if(h>=t)return t;let m=d;i.set(d,"visiting"),l.push(n(m,h));continue}let u=c.maxChildDepth+1;o.set(c.value,u),i.set(c.value,"done"),l.pop();let f=l.at(-1);if(f)f.maxChildDepth=Math.max(f.maxChildDepth,u);else return u}return 0}function il(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;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?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let a=0;a<Math.min(e.length,t.length);a++){let l=il(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=et(e),o=et(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=il(i[c],o[c]);if(u!==0)return u}}return 0}function ol(e,t){if(Li(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(s=>e.some(i=>ol(i,s)));let n=et(e),r=et(t);return n&&r?Object.keys(r).every(s=>Ls(n,s)&&ol(n[s],r[s])):!1}var Fo=F(()=>{"use strict";G();ar()});function AC(e){let t=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),i="";for(let o=r;o<s;o++)i+=String.fromCharCode(e[o]);t.push(i)}return t.join("")}function CC(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Tf(e,t,n){switch(t){case"@base64":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"utf-8").toString("base64")];let r=new TextEncoder().encode(e);return[btoa(AC(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=CC(atob(e));return[new TextDecoder("utf-8",{fatal:!1}).decode(r)]}return[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(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
589
- `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=n??SC;return Vr(e,r+1)>r?[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 SC,v2=F(()=>{"use strict";Fo();SC=2e3});function $f(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let d=0;d<c;d++)if(!i(e[u+d],a[d])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var N2=F(()=>{"use strict"});function Rf(e,t,n,r,s){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 i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],o=s(e,n[1],r)[0];return[e*i+o]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}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":if(typeof e=="number"){let i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var I2=F(()=>{"use strict"});function Fi(e){let t=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:t}}function Mi(e){throw new C(e,"array_elements")}function Pf(e,t){let n=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&n>Math.floor(t/r)&&Mi(`query combination limit exceeded (${t})`),n*=r}return n}function Df(e,t,n,r,s,i,o,a){switch(t){case"recurse":{let l=[],c=Fi(r),u=n.length>=2?n[1]:null,f=[{value:e,depth:0}],d=0;for(;f.length>0;){let p=f.pop();if(!p)break;if(++d>c.maxIterations)throw new C(`query iteration limit exceeded (${c.maxIterations})`,"iterations");if(p.depth>c.maxDepth)throw new C(`query depth limit exceeded (${c.maxDepth})`,"recursion");if(u&&!s(p.value,u,r).some(i))continue;l.length>=c.maxResults&&Mi(`query result element limit exceeded (${c.maxResults})`),l.push(p.value);let h=[];n.length===0?Array.isArray(p.value)?h=p.value:p.value&&typeof p.value=="object"&&(h=Object.keys(p.value).map(m=>p.value[m])):h=s(p.value,n[0],r).filter(m=>m!=null),f.length>c.maxResults-h.length&&Mi(`query traversal queue limit exceeded (${c.maxResults})`);for(let m=h.length-1;m>=0;m--)f.push({value:h[m],depth:p.depth+1})}return l}case"recurse_down":return a(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=Fi(r),c=new WeakSet,u=new WeakMap,f=[{value:e,depth:0,expanded:!1}],d=e,p=0;for(;f.length>0;){let h=f.pop();if(!h)break;if(++p>l.maxIterations)throw new C(`query iteration limit exceeded (${l.maxIterations})`,"iterations");if(h.depth>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let m=h.value!==null&&typeof h.value=="object"?h.value:null;if(!h.expanded&&m){if(c.has(m))continue;c.add(m),f.push({...h,expanded:!0});let y=et(h.value),w=Array.isArray(h.value)?h.value:Object.keys(y??{}).map(x=>y?.[x]);f.length>l.maxResults-w.length&&Mi(`query traversal queue limit exceeded (${l.maxResults})`);for(let x=w.length-1;x>=0;x--)f.push({value:w[x],depth:h.depth+1,expanded:!1});continue}let g=h.value;if(Array.isArray(h.value))g=h.value.map(y=>y!==null&&typeof y=="object"?u.get(y)??y:y);else if(m){let y=Object.create(null),w=et(h.value);for(let x of Object.keys(w??{})){if(!Ze(x))continue;let S=w?.[x];Je(y,x,S!==null&&typeof S=="object"?u.get(S)??S:S)}g=y}let b=s(g,n[0],r)[0];m&&u.set(m,b),h.depth===0&&(d=b)}return[d]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Fi(r),c=0;for(let f of e)Array.isArray(f)&&(c=Math.max(c,f.length));Pf([e.length,c],l.maxResults);let u=[];for(let f=0;f<c;f++)u.push(e.map(d=>Array.isArray(d)?d[f]:null));return[u]}case"combinations":{if(n.length>0){let h=s(e,n[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(h)||!Number.isSafeInteger(h)||h<0)throw new Error("combinations length must be a finite non-negative integer");let m=Fi(r);if(h>m.maxDepth||h>m.maxResults)throw new C(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(h===0)return m.maxResults<1&&Mi("query combination limit exceeded (0)"),[[]];let g=Pf(Array.from({length:h},()=>e.length),m.maxResults);if(g===0)return[];let b=[],y=new Array(h).fill(0);for(let w=0;w<g;w++){b.push(y.map(x=>e[x]));for(let x=h-1;x>=0&&(y[x]++,!(y[x]<e.length));x--)y[x]=0}return b}if(!Array.isArray(e))return[];if(e.length===0)return Fi(r).maxResults<1&&Mi("query combination limit exceeded (0)"),[[]];for(let p of e)if(!Array.isArray(p))return[];let l=Fi(r),c=e;if(c.length>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let u=Pf(c.map(p=>p.length),l.maxResults);if(u===0)return[];let f=[],d=new Array(c.length).fill(0);for(let p=0;p<u;p++){f.push(d.map((h,m)=>c[m][h]));for(let h=c.length-1;h>=0&&(d[h]++,!(d[h]<c[h].length));h--)d[h]=0}return f}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var O2=F(()=>{"use strict";G();ar()});function cn(e){return e.limits.maxArrayElements}function Lf(e,t){let n=Object.create(null);return Je(n,"key",e),Je(n,"value",t),n}function al(e,t){let n=cn(e);if(t>=n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function kC(e,t){let n=t.limits.maxDepth??Ff;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new C(`query array index limit exceeded (${r})`,"array_elements")}else if(typeof s!="string")throw new Error("stream path components must be strings or integers")}function Mf(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]: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[M(e)];let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{if(Array.isArray(e)){if(e.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");return[e.map((o,a)=>Lf(a,o))]}let i=et(e);if(i){let o=Object.keys(i);if(o.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");return[o.map(a=>Lf(a,i[a]))]}return[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=et(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);Ze(u)&&Je(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=et(e);if(i){let o=Object.keys(i);if(o.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");let a=[];for(let c of o){let u=Lf(c,i[c]),f=s(u,n[0],r);if(a.length>cn(r)-f.length)throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");for(let d of f)a.push(d)}let l=Object.create(null);for(let c of a){let u=et(c);if(u){let f=u.key??u.name??u.k,d=u.value??u.v;if(f!==void 0){let p=String(f);Ze(p)&&Je(l,p,d)}}}return[l]}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?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??Ff;return Vr(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[ki(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(o){throw o instanceof C?o:new 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 i=e.trim()===""?Number.NaN:Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}throw new 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 new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=r.limits.maxDepth??Ff,a=[{value:e,path:[]}],l=new WeakSet,c=0;for(;a.length>0;){let u=a.pop();if(!u)break;if(++c>r.limits.maxIterations)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(u.path.length>o)throw new C(`query depth limit exceeded (${o})`,"recursion");let f=u.value;if(f===null||typeof f!="object")al(r,i.length),i.push([u.path,f]);else if(Array.isArray(f)){if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");if(l.add(f),f.length===0)al(r,i.length),i.push([u.path,[]]);else{if(a.length>cn(r)-f.length)throw new C(`query traversal queue limit exceeded (${cn(r)})`,"array_elements");for(let d=f.length-1;d>=0;d--)a.push({value:f[d],path:[...u.path,d]})}}else{if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");l.add(f);let d=Object.keys(f);if(d.length===0)al(r,i.length),i.push([u.path,Object.create(null)]);else{if(a.length>cn(r)-d.length)throw new C(`query traversal queue limit exceeded (${cn(r)})`,"array_elements");for(let p=d.length-1;p>=0;p--){let h=d[p];a.push({value:f[h],path:[...u.path,h]})}}}}return al(r,i.length),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r);if(i.length>cn(r))throw new C(`query stream item limit exceeded (${cn(r)})`,"array_elements");let o=null,a=0;for(let l of i){if(!Array.isArray(l)||l.length===1&&Array.isArray(l[0])&&l[0].length===0||l.length!==2)continue;let[c,u]=l;if(!Array.isArray(c))continue;if(kC(c,r),c.length===0){o=u;continue}o===null&&(o=typeof c[0]=="number"?[]:Object.create(null));let f=o;for(let p=0;p<c.length-1;p++){let h=c[p],m=c[p+1];if(Array.isArray(f)&&typeof h=="number"){let g=h+1-f.length;if(g>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,g);f.length<=h;)f.push(null);f[h]===null&&(f[h]=typeof m=="number"?[]:Object.create(null)),f=f[h]}else{let g=et(f);if(g){let b=String(h);if(!Ze(b))continue;(g[b]===null||g[b]===void 0)&&Je(g,b,typeof m=="number"?[]:Object.create(null)),f=g[b]}}}let d=c[c.length-1];if(Array.isArray(f)&&typeof d=="number"){let p=d+1-f.length;if(p>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,p);f.length<=d;)f.push(null);f[d]=u}else{let p=et(f);if(p){let h=String(d);Ze(h)&&Je(p,h,u)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var Ff,T2=F(()=>{"use strict";ue();G();ar();Fo();Ff=2e3});function $2(e,t){if(!Array.isArray(e))throw new Error("path must be an array");let n=t.limits.maxDepth;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements,s=0;for(let i of e)if(typeof i=="number"){if(!Number.isSafeInteger(i)||i<0||i>=r)throw new C(`query array index limit exceeded (${r})`,"array_elements");let o=i+1;if(s>r-o)throw new C(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=o}else if(typeof i!="string")throw new Error("path components must be strings or integers");return Sn(t,s+e.length),e}function R2(e,t,n){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let i=s.pop();if(!i)break;if(Sn(t),i.path.length>t.limits.maxDepth)throw new C(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(!(i.value!==null&&typeof i.value=="object")){(n||!i.isRoot)&&(Ft(t,r.length),r.push(i.path));continue}!n&&!i.isRoot&&(Ft(t,r.length),r.push(i.path));let a=Array.isArray(i.value)?i.value.map((l,c)=>[c,l]):Object.keys(i.value).map(l=>[l,i.value[l]]);Ft(t,r.length,s.length+a.length);for(let l=a.length-1;l>=0;l--){let[c,u]=a[l],f=[...i.path,c];s.push({value:u,path:f,isRoot:!1})}}return r}function _f(e,t,n,r,s,i,o,a,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let d of u){let p=d,h=e;for(let m of p){if(h==null){h=null;break}if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=et(h);if(!g||!Object.hasOwn(g,m)){h=null;break}h=g[m]}else{h=null;break}}f.push(h)}return f}case"setpath":{if(n.length<2)return[null];let u=s(e,n[0],r),f=$2(u[0],r),p=s(e,n[1],r)[0];return[o(e,f,p)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],d=e;for(let p of f.sort((h,m)=>m.length-h.length))d=a(d,p);return[d]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let d of n)c(e,d,r,[],u);let f=null;for(let d of u){for(let h of d)if(typeof h=="number"&&h<0)throw new Error("Out of bounds negative array index");$2(d,r);let p=e;for(let h of d){if(p==null)break;if(Array.isArray(p)&&typeof h=="number")p=p[h];else if(typeof h=="string"){let m=et(p);if(!m||!Object.hasOwn(m,h)){p=null;break}p=m[h]}else{p=null;break}}f=o(f,d,p)}return[f]}case"paths":{let u=R2(e,r,!1);return n.length>0?u.filter(f=>{let d=e;for(let h of f)if(Array.isArray(d)&&typeof h=="number")d=d[h];else if(typeof h=="string"){let m=et(d);if(!m||!Object.hasOwn(m,h))return!1;d=m[h]}else return!1;return s(d,n[0],r).some(i)}):u}case"leaf_paths":return R2(e,r,!0);default:return null}}var P2=F(()=>{"use strict";G();Bf();ar()});function Uf(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);Ze(f)&&Je(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let d=String(f[0]);Ze(d)&&Je(c,d,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);Ze(f)&&Je(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=et(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Ls(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var D2=F(()=>{"use strict";ar()});function F2(e){return e.limits.maxArrayElements}function L2(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function zs(e,t){let n=F2(e);if(!Number.isSafeInteger(t)||t<0||t>n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function vC(e,t,n){if(e==="")return t===""?0:1;if(t==="")return e.length;let r=1,s=0;for(;;){let i=e.indexOf(t,s);if(i<0||(r++,r>n))return r;s=i+t.length}}function zf(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return zs(r,i.length),i.map(o=>{let a=String(o),l=0;for(let c=0;c<e.length;c++){let u=e[c]===null?"":typeof e[c]=="string"?e[c]:String(e[c]);if(l+=M(u),c>0&&(l+=M(a)),l>L2(r))throw new C(`query string size limit exceeded (${L2(r)} bytes)`,"string_length")}return e.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(a)})}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return zs(r,vC(e,o,F2(r))),[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g",l=oe(o,a.includes("g")?a:`${a}g`),c=1;for(let f of l.matchAll(e))c+=Math.max(1,f.length),zs(r,c);let u=l.split(e);return zs(r,u.length),u}catch(a){if(a instanceof C)throw a;return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",l=oe(o,a.includes("g")?a:`${a}g`),c=[];for(let u of l.matchAll(e))zs(r,c.length+1),u.length>1?(zs(r,u.length-1),c.push(u.slice(1))):c.push(u[0]);return c}catch(a){if(a instanceof C)throw a;return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[oe(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=oe(o,`${a}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,d)=>({offset:u?.[d+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=oe(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[oe(a,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[oe(a,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let i=0;for(let o of e)i++,zs(r,i);return[Array.from(e).map(o=>o.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var M2=F(()=>{"use strict";G();mt();kt()});function Wf(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[Number.POSITIVE_INFINITY];case"nan":return[Number.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 _2=F(()=>{"use strict"});var B2=F(()=>{"use strict";x2();E2();C2();v2();N2();I2();O2();T2();P2();D2();M2();_2()});function ll(e,t,n){if(t.length===0)return n;let[r,...s]=t;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=ll(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!Ze(r))return e??Object.create(null);let i=et(e),o=i?Lt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return Je(o,r,ll(a,s,n)),o}function cl(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!Ze(i))return e;let o=Lt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=cl(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!Ze(s))return e;let i=Lt(e);return Object.hasOwn(i,s)&&Je(i,s,cl(i[s],r)),i}return e}var U2=F(()=>{"use strict";ar()});function js(e,t){return new C(e,t)}function Sn(e,t=1){if(!Number.isSafeInteger(t)||t<0||e.budget.operations>e.limits.maxIterations-t)throw js(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=t}function Ft(e,t,n=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(n)||t<0||n<0||t>r-n)throw js(`query result element limit exceeded (${r})`,"array_elements")}function Ws(e,t,n){Ft(e,t.length,n.length);for(let r of n)t.push(r)}function Zn(e,t,n){let r=[];for(let s of t){Sn(e);let i=n(s);Ws(e,r,i)}return r}function OC(e){let t=new Map;if(e?.namedArgs)for(let[n,r]of e.namedArgs)t.set(`$${n}`,r);return{vars:t,limits:{maxIterations:e?.limits?.maxIterations??NC,maxDepth:e?.limits?.maxDepth??H2,maxStringLength:e?.limits?.maxStringLength??z2,maxOutputSize:e?.limits?.maxOutputSize??z2,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,namedArgs:e?.namedArgs,positionalArgs:e?.positionalArgs,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function dl(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,namedArgs:e.namedArgs,positionalArgs:e.positionalArgs,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function Mo(e,t,n){switch(t.type){case"var":return dl(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],o=s<n.length?n[s]:null,a=Mo(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=et(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=ne(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Ls(r,o)?r[o]:null;i.keyVar&&(s=dl(s,i.keyVar,a));let l=Mo(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function TC(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=et(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function is(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?is(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?is(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=is(e.left);return t===null?null:jf(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 jf(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=is(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=is(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=jf(e,t.left);return n===null?null:jf(n,t.right)}return t.type==="Identity"?e:null}function W2(e,t,n){if(t.type==="Comma"){let r=[];try{let s=ne(e,t.left,n);Ws(n,r,s)}catch(s){if(s instanceof C)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=ne(e,t.right,n);Ws(n,r,s)}catch(s){if(s instanceof C)throw s;return r}return r}return ne(e,t,n)}function ne(e,t,n){let r=n&&"vars"in n?n:OC(n);if(r.defenseContextChecked||(It(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),Sn(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,js(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=$C(e,t,r);return Ft(r,0,s.length),s}finally{r.budget.callDepth--}}function $C(e,t,n){switch(n.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{let i=et(s);if(i){if(!Object.hasOwn(i,t.name))return[null];let a=i[t.name];return[a===void 0?null:a]}if(s===null)return[null];let o=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${o} with string "${t.name}"`)})}case"Index":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{let i=ne(s,t.index,n);return Zn(n,i,o=>{if(typeof o=="number"&&Array.isArray(s)){if(Number.isNaN(o))return[null];let a=Math.trunc(o),l=a<0?s.length+a:a;return l>=0&&l<s.length?[s[l]]:[null]}if(typeof o=="string"){let a=et(s);return!a||!Object.hasOwn(a,o)?[null]:[a[o]]}return[null]})})}case"Slice":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{if(s===null)return[null];if(!Array.isArray(s)&&typeof s!="string")throw new Error(`Cannot slice ${typeof s} (${JSON.stringify(s)})`);let i=s.length,o=t.start?ne(e,t.start,n):[0],a=t.end?ne(e,t.end,n):[i];return Ft(n,0,o.length*a.length),Zn(n,o,l=>a.map(c=>{let u=l,f=c,d=Number.isNaN(u)?0:Number.isInteger(u)?u:Math.floor(u),p=Number.isNaN(f)?i:Number.isInteger(f)?f:Math.ceil(f),h=j2(d,i),m=j2(p,i);return Array.isArray(s),s.slice(h,m)}))})}case"Iterate":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=ne(e,t.left,n),s=is(t.left),i=[];for(let o of r)try{if(s!==null){let a={...n,currentPath:[...n.currentPath??[],...s]},l=ne(o,t.right,a);Ws(n,i,l)}else{let a=ne(o,t.right,n);Ws(n,i,a)}}catch(a){throw a instanceof _i?a.withPrependedResults(i):a}return i}case"Comma":{let r=ne(e,t.left,n),s=ne(e,t.right,n);return Ft(n,r.length,s.length),[...r,...s]}case"Literal":return[t.value];case"Array":return t.elements?[ne(e,t.elements,n)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of t.entries){let i=typeof s.key=="string"?[s.key]:ne(e,s.key,n),o=ne(e,s.value,n),a=[],l=i.filter(f=>typeof f=="string"&&Ze(f)).length,c=l+(i.length-l),u=r.length*c*o.length;Ft(n,0,u);for(let f of r)for(let d of i){if(typeof d!="string"){let p=d===null?"null":Array.isArray(d)?"array":typeof d;throw new Error(`Cannot use ${p} (${JSON.stringify(d)}) as object key`)}if(!Ze(d)){for(let p of o)a.push(Lt(f));continue}for(let p of o){let h=Lt(f);Je(h,d,p),a.push(h)}}r.length=0,Ws(n,r,a)}return r}case"Paren":return ne(e,t.expr,n);case"BinaryOp":return DC(e,t.op,t.left,t.right,n);case"UnaryOp":return ne(e,t.operand,n).map(s=>{if(t.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let i=o=>o.length>5?`"${o.slice(0,3)}...`:JSON.stringify(o);throw new Error(`string (${i(s)}) cannot be negated`)}return null}return t.op==="not"?!Gn(s):null});case"Cond":{let r=ne(e,t.cond,n);return Zn(n,r,s=>{if(Gn(s))return ne(e,t.then,n);for(let i of t.elifs)if(ne(e,i.cond,n).some(Gn))return ne(e,i.then,n);return t.else?ne(e,t.else,n):[e]})}case"Try":try{return ne(e,t.body,n)}catch(r){if(r instanceof C)throw r;if(t.catch){let s=r instanceof fl?r.value:r instanceof Error?r.message:String(r);return ne(s,t.catch,n)}return[]}case"Call":return V2(e,t.name,t.args,n);case"VarBind":{let r=ne(e,t.value,n);return Zn(n,r,s=>{let i=null,o=[];if(t.pattern?o.push(t.pattern):t.name&&o.push({type:"var",name:t.name}),t.alternatives)for(let a of t.alternatives)o.push(a);for(let a of o)if(i=Mo(n,a,s),i!==null)break;return i===null?[]:ne(e,t.body,i)})}case"VarRef":{if(t.name==="$ENV")return[n.env?Vt(n.env):Object.create(null)];if(t.name==="$ARGS"){let s=Object.create(null);if(n.namedArgs)for(let[o,a]of n.namedArgs)Object.defineProperty(s,o,{value:a,enumerable:!0,writable:!0,configurable:!0});let i=Object.create(null);return i.positional=n.positionalArgs?[...n.positionalArgs]:[],i.named=s,[i]}let r=n.vars.get(t.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,i=[{val:e,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;let{val:a,depth:l}=o;if(Sn(n),l>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(a&&typeof a=="object"){if(s.has(a))continue;s.add(a)}if(Ft(n,r.length),r.push(a),Array.isArray(a))for(let c=a.length-1;c>=0;c--)i.push({val:a[c],depth:l+1});else if(a&&typeof a=="object"){let c=Object.keys(a);for(let u=c.length-1;u>=0;u--)i.push({val:a[c[u]],depth:l+1})}}return r}case"Optional":try{return ne(e,t.expr,n)}catch(r){if(r instanceof C)throw r;return[]}case"StringInterp":{let r=new $e(n.limits.maxStringLength,"query string interpolation",()=>new C(`string size limit exceeded (${n.limits.maxStringLength} bytes)`,"string_length"));for(let s of t.parts){if(typeof s=="string"){r.append(s);continue}let i=ne(e,s,n);for(let o of i){if(Sn(n),Vr(o,n.limits.maxDepth+1)>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");r.append(typeof o=="string"?o:JSON.stringify(o))}}return[r.build()]}case"UpdateOp":return[RC(e,t.path,t.op,t.value,n)];case"Reduce":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=n.limits.maxDepth??H2;for(let o of r){let a;if(t.pattern){if(a=Mo(n,t.pattern,o),a===null)continue}else a=dl(n,t.varName,o);if(s=ne(s,t.update,a)[0],Vr(s,i+1)>i)return[null]}return[s]}case"Foreach":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=[];for(let o of r)try{let a;if(t.pattern){if(a=Mo(n,t.pattern,o),a===null)continue}else a=dl(n,t.varName,o);if(s=ne(s,t.update,a)[0],t.extract){let l=ne(s,t.extract,a);Ws(n,i,l)}else Ft(n,i.length),i.push(s)}catch(a){throw a instanceof _i?a.withPrependedResults(i):a}return i}case"Label":try{return ne(e,t.body,{...n,labels:new Set([...n.labels??[],t.name])})}catch(r){if(r instanceof _i&&r.label===t.name)return r.partialResults;throw r}case"Break":throw new _i(t.name);case"Def":{let r=new Map(n.funcs??[]),s=`${t.name}/${t.params.length}`;r.set(s,{params:t.params,body:t.funcBody,closure:new Map(n.funcs??[])});let i={...n,funcs:r};return ne(e,t.body,i)}default:{let r=t;throw new Error(`Unknown AST node type: ${r.type}`)}}}function j2(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function RC(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return ne(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?(Ft(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"?Wu(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!Ze(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let d=Lt(f),p=Object.hasOwn(d,c.name)?d[c.name]:void 0;return Je(d,c.name,u(p)),d}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=Lt(l),d=Object.hasOwn(f,c.name)?f[c.name]:void 0;return Je(f,c.name,u(d)),f}return l}case"Index":{let d=ne(e,c.index,s)[0];if(typeof d=="number"&&Number.isNaN(d))throw new Error("Cannot set array element at NaN index");if(typeof d=="number"&&!Number.isFinite(d))throw new Error("array index must be finite");if(typeof d=="number"&&!Number.isInteger(d)&&(d=Math.trunc(d)),c.base)return o(l,c.base,p=>{if(typeof d=="number"&&Array.isArray(p)){let h=[...p],m=d<0?h.length+d:d;if(m>=0){Ft(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=p.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(typeof d=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!Ze(d))return p;let h=Lt(p),m=Object.hasOwn(h,d)?h[d]:void 0;return Je(h,d,u(m)),h}return p});if(typeof d=="number"){if(!Number.isSafeInteger(d)||d>536870911)throw new Error("Array index too large");if(d<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let h=[...l],m=d<0?h.length+d:d;if(m>=0){Ft(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=l.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(l==null){Ft(s,0,d+1);let h=new Array(d+1).fill(null);return h[d]=u(null),h}return l}if(typeof d=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!Ze(d))return l;let p=Lt(l),h=Object.hasOwn(p,d)?p[d]:void 0;return Je(p,d,u(h)),p}return l}case"Iterate":{let f=d=>{if(Array.isArray(d)){Ft(s,0,d.length);let p=[];for(let h of d)Sn(s),p.push(u(h));return p}if(d&&typeof d=="object"){let p=Object.create(null);for(let[h,m]of Object.entries(d))Ze(h)&&Je(p,h,u(m));return p}return d};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,d=>d);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=ne(e,r,s);return i(l,c[0]??null)})}function PC(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!Ze(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=Lt(i);return Je(l,o.name,a),l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Ze(c))return i;let u=Lt(i);return Je(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!Ze(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!Ze(o.name))return i;let l=Lt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Ze(c))return i;let u=Lt(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(p,h,m){switch(h.type){case"Identity":return m;case"Field":{if(!Ze(h.name))return p;if(p&&typeof p=="object"&&!Array.isArray(p)){let g=Lt(p);return Je(g,h.name,m),g}return p}case"Index":{let b=ne(e,h.index,n)[0];if(typeof b=="number"&&Array.isArray(p)){let y=[...p],w=b<0?y.length+b:b;return w>=0&&w<y.length&&(y[w]=m),y}if(typeof b=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!Ze(b))return p;let y=Lt(p);return Je(y,b,m),y}return p}case"Pipe":{let g=ne(p,h.left,n)[0],b=u(g,h.right,m);return u(p,h.left,b)}default:return p}};var a=u;let l=o.left,c=o.right,f=ne(i,l,n)[0];if(f==null)return i;let d=s(f,c);return u(i,l,d)}default:return i}}return s(e,t)}function DC(e,t,n,r,s){if(t==="and"){let l=ne(e,n,s);return Zn(s,l,c=>{if(!Gn(c))return[!1];let u=ne(e,r,s);return Zn(s,u,f=>[Gn(f)])})}if(t==="or"){let l=ne(e,n,s);return Zn(s,l,c=>{if(Gn(c))return[!0];let u=ne(e,r,s);return Zn(s,u,f=>[Gn(f)])})}if(t==="//"){let c=ne(e,n,s).filter(u=>u!=null&&u!==!1);return c.length>0?c:ne(e,r,s)}let i=ne(e,n,s),o=ne(e,r,s),a=i.length*o.length;return Ft(s,0,a),Sn(s,a),i.flatMap(l=>o.map(c=>{switch(t){case"+":if(l===null)return c;if(c===null)return l;if(typeof l=="number"&&typeof c=="number")return l+c;if(typeof l=="string"&&typeof c=="string"){let u=s.limits.maxStringLength;if(M(l)+M(c)>u)throw new C(`string size limit exceeded (${u} bytes)`,"string_length");return l+c}return Array.isArray(l)&&Array.isArray(c)?(Ft(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"&&!Array.isArray(l)&&!Array.isArray(c)?Wu(l,c):null;case"-":if(typeof l=="number"&&typeof c=="number")return l-c;if(Array.isArray(l)&&Array.isArray(c)){let u=new Set(c.map(f=>JSON.stringify(f)));return l.filter(f=>!u.has(JSON.stringify(f)))}if(typeof l=="string"&&typeof c=="string"){let u=f=>f.length>10?`"${f.slice(0,10)}...`:JSON.stringify(f);throw new Error(`string (${u(l)}) and string (${u(c)}) cannot be subtracted`)}return null;case"*":if(typeof l=="number"&&typeof c=="number")return l*c;if(typeof l=="string"&&typeof c=="number"){if(!Number.isFinite(c))throw new Error(`invalid string repetition count: ${c}`);let u=Math.trunc(c);if(u<0)return null;let f=M(l),d=s.limits.maxStringLength;if(f>0&&u>Math.floor(d/f))throw new C(`string size limit exceeded (${d} bytes)`,"string_length");return l.repeat(u)}{let u=et(l),f=et(c);if(u&&f)return k2(u,f,{maxDepth:s.limits.maxDepth,visit:()=>Sn(s)})}return null;case"/":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided because the divisor is zero`);return l/c}return typeof l=="string"&&typeof c=="string"?l.split(c):null;case"%":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(l)&&!Number.isNaN(l)?!Number.isFinite(c)&&!Number.isNaN(c)&&l<0&&c>0?-1:0:l%c}return null;case"==":return Li(l,c);case"!=":return!Li(l,c);case"<":return Lo(l,c)<0;case"<=":return Lo(l,c)<=0;case">":return Lo(l,c)>0;case">=":return Lo(l,c)>=0;default:return null}}))}function V2(e,t,n,r){let s=IC.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=Rf(e,t,n,r,ne);if(i!==null)return i;let o=zf(e,t,n,r,ne);if(o!==null)return o;let a=Of(e,t,n,r,ne);if(a!==null)return a;let l=Tf(e,t,r.limits.maxDepth);if(l!==null)return l;let c=Wf(e,t);if(c!==null)return c;let u=Mf(e,t,n,r,ne);if(u!==null)return u;let f=vf(e,t,n,r,ne,W2,il,Gn,ol,C);if(f!==null)return f;let d=_f(e,t,n,r,ne,Gn,ll,cl,PC,ul);if(d!==null)return d;let p=$f(e,t,n,r,ne,Li);if(p!==null)return p;let h=Nf(e,t,n,r,ne,W2,Gn,C);if(h!==null)return h;let m=Df(e,t,n,r,ne,Gn,TC,V2);if(m!==null)return m;let g=Uf(e,t,n,r,ne,Li);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"]];case"error":{let b=n.length>0?ne(e,n[0],r)[0]:e;throw new fl(b)}case"env":return[r.env?Vt(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let b=`${t}/${n.length}`,y=r.funcs?.get(b);if(y){let w=y.closure??r.funcs??new Map,x=new Map(w);x.set(b,y);for(let E=0;E<y.params.length;E++){let A=y.params[E],I=n[E];if(I){let R=ne(e,I,r),N;if(R.length===0)N={type:"Call",name:"empty",args:[]};else if(R.length===1)N={type:"Literal",value:R[0]};else{N={type:"Literal",value:R[R.length-1]};for(let $=R.length-2;$>=0;$--)N={type:"Comma",left:{type:"Literal",value:R[$]},right:N}}x.set(`${A}/0`,{params:[],body:N})}}let S={...r,funcs:x};return ne(e,y.body,S)}throw new Error(`Unknown function: ${t}`)}}}function ul(e,t,n,r,s){if(Sn(n),r.length>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");let i=l=>{if(l.length>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");Ft(n,s.length),s.push(l)};if(t.type==="Comma"){let l=t;ul(e,l.left,n,r,s),ul(e,l.right,n,r,s);return}let o=is(t);if(o!==null){i([...r,...o]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let l=0;l<e.length;l++)Sn(n),i([...r,l]);else if(e&&typeof e=="object")for(let l of Object.keys(e))Sn(n),i([...r,l]);return}if(t.type==="Recurse"){let l=[{value:e,path:[]}];for(;l.length>0;){let c=l.pop();if(!c)break;if(Sn(n),i([...r,...c.path]),c.value&&typeof c.value=="object"){let u=Array.isArray(c.value)?c.value.map((f,d)=>[d,f]):Object.keys(c.value).map(f=>[f,c.value[f]]);Ft(n,0,l.length+u.length);for(let f=u.length-1;f>=0;f--){let[d,p]=u[f];l.push({value:p,path:[...c.path,d]})}}}return}if(t.type==="Pipe"){let l=is(t.left);if(l!==null){let c=ne(e,t.left,n);for(let u of c)ul(u,t.right,n,[...r,...l],s);return}}ne(e,t,n).length>0&&i(r)}var _i,fl,NC,z2,H2,IC,Bf=F(()=>{"use strict";St();jr();G();vr();kt();B2();U2();ar();Fo();_i=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},fl=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},NC=1e4,z2=10*1024*1024,H2=2e3,IC=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 G2(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
588
+ `,exitCode:127}}}};xC={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},EC={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"}});function Do(e,t,n=1){let r=e.limits.maxArrayElements;if(n<0||t>r-n)throw new C(`query result element limit exceeded (${r})`,"array_elements")}function vf(e,t,n,r,s,i,o,a,l,c){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((f,d)=>{let p=s(f,n[0],r)[0],h=s(d,n[0],r)[0];return o(p,h)})];case"bsearch":{if(!Array.isArray(e)){let f=e===null?"null":typeof e=="object"?"object":typeof e;throw new Error(`${f} (${JSON.stringify(e)}) cannot be searched from`)}return n.length===0?[null]:s(e,n[0],r).map(f=>{let d=0,p=e.length;for(;d<p;){let h=d+p>>>1;o(e[h],f)<0?d=h+1:p=h}return d<e.length&&o(e[d],f)===0?d:-d-1})}case"unique_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let d of e){let p=s(d,n[0],r)[0],h=JSON.stringify(p);u.has(h)||u.set(h,{item:d,key:p})}let f=[...u.values()];return f.sort((d,p)=>o(d.key,p.key)),[f.map(d=>d.item)]}case"group_by":{if(!Array.isArray(e)||n.length===0)return[null];let u=new Map;for(let f of e){let d=JSON.stringify(s(f,n[0],r)[0]);u.has(d)||u.set(d,[]),u.get(d)?.push(f)}return[[...u.values()]]}case"max":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)>0?u:f)]:[null];case"max_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)>0?u:f})];case"min":return Array.isArray(e)&&e.length>0?[e.reduce((u,f)=>o(u,f)<0?u:f)]:[null];case"min_by":return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((u,f)=>{let d=s(u,n[0],r)[0],p=s(f,n[0],r)[0];return o(d,p)<0?u:f})];case"add":{let u=f=>{let d=f.filter(p=>p!==null);return d.length===0?null:d.every(p=>typeof p=="number")?d.reduce((p,h)=>p+h,0):d.every(p=>typeof p=="string")?d.join(""):d.every(p=>Array.isArray(p))?d.flat():d.every(p=>p&&typeof p=="object"&&!Array.isArray(p))?_s(...d):null};if(n.length>=1){let f=s(e,n[0],r);return[u(f)]}return Array.isArray(e)?[u(e)]:[null]}case"any":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(s(f,n[1],r).some(a))return[!0]}catch(u){if(u instanceof c)throw u}return[!1]}return n.length===1?Array.isArray(e)?[e.some(u=>a(s(u,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(a)]:[!1]}case"all":{if(n.length>=2){try{let u=i(e,n[0],r);for(let f of u)if(!s(f,n[1],r).some(a))return[!1]}catch(u){if(u instanceof c)throw u}return[!0]}return n.length===1?Array.isArray(e)?[e.every(u=>a(s(u,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(a)]:[!0]}case"select":return n.length===0?[e]:s(e,n[0],r).some(a)?[e]:[];case"map":{if(n.length===0||!Array.isArray(e))return[null];Do(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);Do(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}case"map_values":{if(n.length===0)return[null];if(Array.isArray(e)){Do(r,0,e.length);let u=[];for(let f of e){let d=s(f,n[0],r);Do(r,u.length,d.length);for(let p of d)u.push(p)}return[u]}if(e&&typeof e=="object"){let u=Object.create(null),f=Object.keys(e);Do(r,0,f.length);for(let d of f){if(!Ke(d))continue;let p=e[d],h=s(p,n[0],r);h.length>0&&Je(u,d,h[0])}return[u]}return[null]}case"has":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(e)&&typeof f=="number"?[f>=0&&f<e.length]:e&&typeof e=="object"&&typeof f=="string"?[Object.hasOwn(e,f)]:[!1]}case"in":{if(n.length===0)return[!1];let f=s(e,n[0],r)[0];return Array.isArray(f)&&typeof e=="number"?[e>=0&&e<f.length]:f&&typeof f=="object"&&typeof e=="string"?[Object.hasOwn(f,e)]:[!1]}case"contains":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(e,u[0])]}case"inside":{if(n.length===0)return[!1];let u=s(e,n[0],r);return[l(u[0],e)]}default:return null}}var x2=F(()=>{"use strict";jr();G();ar()});function Nf(e,t,n,r,s,i,o,a){switch(t){case"first":if(n.length>0)try{let l=i(e,n[0],r);return l.length>0?[l[0]]:[]}catch(l){if(l instanceof a)throw l;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case"last":if(n.length>0){let l=s(e,n[0],r);return l.length>0?[l[l.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case"nth":{if(n.length<1)return[null];let l=s(e,n[0],r);if(n.length>1){for(let u of l)if(u<0)throw new Error("nth doesn't support negative indices");let c;try{c=i(e,n[1],r)}catch(u){if(u instanceof a)throw u;c=[]}return l.flatMap(u=>{let f=u;return f<c.length?[c[f]]:[]})}return Array.isArray(e)?l.flatMap(c=>{let u=c;if(u<0)throw new Error("nth doesn't support negative indices");return u<e.length?[e[u]]:[null]}):[null]}case"range":{if(n.length===0)return[];let l=r.limits.maxArrayElements,c=(h,m)=>{if(h.length>=l)throw new a(`query result element limit exceeded (${l})`,"array_elements");h.push(m)},u=s(e,n[0],r);if(n.length===1){let h=[];for(let m of u){let g=m;for(let b=0;b<g;b++)c(h,b)}return h}let f=s(e,n[1],r);if(n.length===2){let h=[];for(let m of u)for(let g of f){let b=m,y=g;for(let w=b;w<y;w++)c(h,w)}return h}let d=s(e,n[2],r),p=[];for(let h of u)for(let m of f)for(let g of d){let b=h,y=m,w=g;if(w!==0)if(w>0)for(let x=b;x<y;x+=w)c(p,x);else for(let x=b;x>y;x+=w)c(p,x)}return p}case"limit":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("limit doesn't support negative count");if(u===0)return[];let f;try{f=i(e,n[1],r)}catch(d){if(d instanceof a)throw d;f=[]}return f.slice(0,u)});case"isempty":{if(n.length<1)return[!0];try{return[i(e,n[0],r).length===0]}catch(l){if(l instanceof a)throw l;return[!0]}}case"isvalid":{if(n.length<1)return[!0];try{return[s(e,n[0],r).length>0]}catch(l){if(l instanceof a)throw l;return[!1]}}case"skip":return n.length<2?[]:s(e,n[0],r).flatMap(c=>{let u=c;if(u<0)throw new Error("skip doesn't support negative count");return s(e,n[1],r).slice(u)});case"until":{if(n.length<2)return[e];let l=e,c=r.limits.maxIterations;for(let u=0;u<c;u++){if(s(l,n[0],r).some(o))return[l];let d=s(l,n[1],r);if(d.length===0)return[l];l=d[0]}throw new a(`jq until: too many iterations (${c}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(n.length<2)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u&&s(c,n[0],r).some(o);f++){l.push(c);let p=s(c,n[1],r);if(p.length===0)break;c=p[0]}if(l.length>=u)throw new a(`jq while: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}case"repeat":{if(n.length===0)return[e];let l=[],c=e,u=r.limits.maxIterations;for(let f=0;f<u;f++){l.push(c);let d=s(c,n[0],r);if(d.length===0)break;c=d[0]}if(l.length>=u)throw new a(`jq repeat: too many iterations (${u}), increase executionLimits.maxJqIterations`,"iterations");return l}default:return null}}var E2=F(()=>{"use strict"});function If(e,t){if(!Number.isFinite(e)||Math.abs(e)>864e10)throw new Error(`${t} timestamp is outside the supported range`);return new Date(e*1e3)}function A2(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(!t)return null;let[,n,r,s,i,o,a]=t.map(Number),l=Date.UTC(n,r-1,s,i,o,a);if(!Number.isFinite(l))return null;let c=new Date(l);return c.getUTCFullYear()!==n||c.getUTCMonth()!==r-1||c.getUTCDate()!==s||c.getUTCHours()!==i||c.getUTCMinutes()!==o||c.getUTCSeconds()!==a?null:c}function Of(e,t,n,r,s){switch(t){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof e!="number")return[null];let i=If(e,"gmtime"),o=i.getUTCFullYear(),a=i.getUTCMonth(),l=i.getUTCDate(),c=i.getUTCHours(),u=i.getUTCMinutes(),f=i.getUTCSeconds(),d=i.getUTCDay(),p=Date.UTC(o,0,1),h=Math.floor((i.getTime()-p)/(1440*60*1e3));return[[o,a,l,c,u,f,d,h]]}case"mktime":{if(!Array.isArray(e))throw new Error("mktime requires parsed datetime inputs");let[i,o,a,l=0,c=0,u=0]=e;if(typeof i!="number"||typeof o!="number")throw new Error("mktime requires parsed datetime inputs");let f=Date.UTC(i,o,a??1,l??0,c??0,u??0);return[Math.floor(f/1e3)]}case"strftime":{if(n.length===0)return[null];let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strftime/1 requires a string format");let a;if(typeof e=="number")a=If(e,"strftime");else if(Array.isArray(e)){let[d,p,h,m=0,g=0,b=0]=e;if(typeof d!="number"||typeof p!="number")throw new Error("strftime/1 requires parsed datetime inputs");a=new Date(Date.UTC(d,p,h??1,m??0,g??0,b??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],u=(d,p=2)=>String(d).padStart(p,"0");return[o.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,u(a.getUTCMonth()+1)).replace(/%d/g,u(a.getUTCDate())).replace(/%H/g,u(a.getUTCHours())).replace(/%M/g,u(a.getUTCMinutes())).replace(/%S/g,u(a.getUTCSeconds())).replace(/%A/g,l[a.getUTCDay()]).replace(/%B/g,c[a.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(n.length===0)return[null];if(typeof e!="string")throw new Error("strptime/1 requires a string input");let o=s(e,n[0],r)[0];if(typeof o!="string")throw new Error("strptime/1 requires a string format");if(o!==S2)throw new Error(`strptime format is not supported: ${o}`);let a=A2(e);if(a){let l=a.getUTCFullYear(),c=a.getUTCMonth(),u=a.getUTCDate(),f=a.getUTCHours(),d=a.getUTCMinutes(),p=a.getUTCSeconds(),h=a.getUTCDay(),m=Date.UTC(l,0,1),g=Math.floor((a.getTime()-m)/(1440*60*1e3));return[[l,c,u,f,d,p,h,g]]}throw new Error(`Cannot parse date: ${e}`)}case"fromdate":{if(typeof e!="string")throw new Error("fromdate requires a string input");let i=A2(e);if(!i)throw new Error(`date "${e}" does not match format "${S2}"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof e!="number")throw new Error("todate requires a number input");return[If(e,"todate").toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}var S2,C2=F(()=>{"use strict";S2="%Y-%m-%dT%H:%M:%SZ"});function Gn(e){return e!==!1&&e!==null}function Li(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Lo(e,t){return typeof e=="number"&&typeof t=="number"?e-t:typeof e=="string"&&typeof t=="string"?e.localeCompare(t):0}function k2(e,t,n={}){let r=n.maxDepth??2e3,s=Lt(e),i=[{target:s,source:t,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;if(o.depth>r)throw new C(`query depth limit exceeded (${r})`,"recursion");for(let a of Object.keys(o.source)){if(n.visit?.(),!Ke(a))continue;let l=Ls(o.target,a)?et(o.target[a]):null,c=et(o.source[a]);if(l&&c){let u=Lt(l);Je(o.target,a,u),i.push({target:u,source:c,depth:o.depth+1})}else Je(o.target,a,o.source[a])}}return s}function Vr(e,t=3e3){if(e===null||typeof e!="object")return 0;if(t<=1)return t;let n=(c,u)=>({value:c,keys:Array.isArray(c)?void 0:Object.keys(c),nextChild:0,pathDepth:u,maxChildDepth:0}),r=c=>c.keys!==void 0?c.keys.length:c.value.length,s=c=>{if(c.keys){let u=c.keys[c.nextChild++];return c.value[u]}return c.value[c.nextChild++]},i=new WeakMap,o=new WeakMap,a=e,l=[n(a,1)];for(i.set(a,"visiting");l.length>0;){let c=l[l.length-1];if(c.nextChild<r(c)){let d=s(c);if(d===null||typeof d!="object")continue;let p=i.get(d);if(p==="visiting")return t;if(p==="done"){let g=o.get(d)??0;if(c.pathDepth+g>=t)return t;c.maxChildDepth=Math.max(c.maxChildDepth,g);continue}let h=c.pathDepth+1;if(h>=t)return t;let m=d;i.set(d,"visiting"),l.push(n(m,h));continue}let u=c.maxChildDepth+1;o.set(c.value,u),i.set(c.value,"done"),l.pop();let f=l.at(-1);if(f)f.maxChildDepth=Math.max(f.maxChildDepth,u);else return u}return 0}function il(e,t){let n=a=>a===null?0:typeof a=="boolean"?1:typeof a=="number"?2:typeof a=="string"?3:Array.isArray(a)?4:typeof a=="object"?5:6,r=n(e),s=n(t);if(r!==s)return r-s;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?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let a=0;a<Math.min(e.length,t.length);a++){let l=il(e[a],t[a]);if(l!==0)return l}return e.length-t.length}let i=et(e),o=et(t);if(i&&o){let a=Object.keys(i).sort(),l=Object.keys(o).sort();for(let c=0;c<Math.min(a.length,l.length);c++){let u=a[c].localeCompare(l[c]);if(u!==0)return u}if(a.length!==l.length)return a.length-l.length;for(let c of a){let u=il(i[c],o[c]);if(u!==0)return u}}return 0}function ol(e,t){if(Li(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(s=>e.some(i=>ol(i,s)));let n=et(e),r=et(t);return n&&r?Object.keys(r).every(s=>Ls(n,s)&&ol(n[s],r[s])):!1}var Fo=F(()=>{"use strict";G();ar()});function AC(e){let t=[];for(let r=0;r<e.length;r+=32768){let s=Math.min(r+32768,e.length),i="";for(let o=r;o<s;o++)i+=String.fromCharCode(e[o]);t.push(i)}return t.join("")}function CC(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Tf(e,t,n){switch(t){case"@base64":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"utf-8").toString("base64")];let r=new TextEncoder().encode(e);return[btoa(AC(r))]}return[null];case"@base64d":if(typeof e=="string"){if(typeof Buffer<"u")return[Buffer.from(e,"base64").toString("utf-8")];let r=CC(atob(e));return[new TextDecoder("utf-8",{fatal:!1}).decode(r)]}return[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(s=>{if(s===null)return"";if(typeof s=="boolean")return s?"true":"false";if(typeof s=="number")return String(s);let i=String(s);return i.includes(",")||i.includes('"')||i.includes(`
589
+ `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(e)?[e.map(r=>String(r??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let r=n??SC;return Vr(e,r+1)>r?[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 SC,v2=F(()=>{"use strict";Fo();SC=2e3});function $f(e,t,n,r,s,i){switch(t){case"index":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){if(a===""&&e==="")return null;let l=e.indexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let c=0;c<=e.length-a.length;c++){let u=!0;for(let f=0;f<a.length;f++)if(!i(e[c+f],a[f])){u=!1;break}if(u)return c}return null}let l=e.findIndex(c=>i(c,a));return l>=0?l:null}return null});case"rindex":return n.length===0?[null]:s(e,n[0],r).map(a=>{if(typeof e=="string"&&typeof a=="string"){let l=e.lastIndexOf(a);return l>=0?l:null}if(Array.isArray(e)){if(Array.isArray(a)){for(let l=e.length-a.length;l>=0;l--){let c=!0;for(let u=0;u<a.length;u++)if(!i(e[l+u],a[u])){c=!1;break}if(c)return l}return null}for(let l=e.length-1;l>=0;l--)if(i(e[l],a))return l;return null}return null});case"indices":return n.length===0?[[]]:s(e,n[0],r).map(a=>{let l=[];if(typeof e=="string"&&typeof a=="string"){let c=e.indexOf(a);for(;c!==-1;)l.push(c),c=e.indexOf(a,c+1)}else if(Array.isArray(e))if(Array.isArray(a)){let c=a.length;if(c===0)for(let u=0;u<=e.length;u++)l.push(u);else for(let u=0;u<=e.length-c;u++){let f=!0;for(let d=0;d<c;d++)if(!i(e[u+d],a[d])){f=!1;break}f&&l.push(u)}}else for(let c=0;c<e.length;c++)i(e[c],a)&&l.push(c);return l});default:return null}}var N2=F(()=>{"use strict"});function Rf(e,t,n,r,s){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 i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[a**l]}case"atan2":{if(n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=i[0],l=o[0];return typeof a!="number"||typeof l!="number"?[null]:[Math.atan2(a,l)]}case"hypot":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.hypot(e,i)]}case"fma":{if(typeof e!="number"||n.length<2)return[null];let i=s(e,n[0],r)[0],o=s(e,n[1],r)[0];return[e*i+o]}case"copysign":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.sign(i)*Math.abs(e)]}case"drem":case"remainder":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e-Math.round(e/i)*i]}case"fdim":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(0,e-i)]}case"fmax":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.max(e,i)]}case"fmin":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[Math.min(e,i)]}case"ldexp":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}case"scalbn":case"scalbln":{if(typeof e!="number"||n.length===0)return[null];let i=s(e,n[0],r)[0];return[e*2**i]}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":if(typeof e=="number"){let i=Math.floor(Math.log2(Math.abs(e)));return[e/2**i]}return[null];case"frexp":if(typeof e=="number"){if(e===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**i,i]]}return[null];case"modf":if(typeof e=="number"){let i=Math.trunc(e);return[[e-i,i]]}return[null];default:return null}}var I2=F(()=>{"use strict"});function Fi(e){let t=e.limits.maxIterations;return{maxDepth:e.limits.maxDepth,maxResults:e.limits.maxArrayElements,maxIterations:t}}function Mi(e){throw new C(e,"array_elements")}function Pf(e,t){let n=1;for(let r of e){if(!Number.isSafeInteger(r)||r<0)throw new Error("combinations requires finite array lengths");r!==0&&n>Math.floor(t/r)&&Mi(`query combination limit exceeded (${t})`),n*=r}return n}function Df(e,t,n,r,s,i,o,a){switch(t){case"recurse":{let l=[],c=Fi(r),u=n.length>=2?n[1]:null,f=[{value:e,depth:0}],d=0;for(;f.length>0;){let p=f.pop();if(!p)break;if(++d>c.maxIterations)throw new C(`query iteration limit exceeded (${c.maxIterations})`,"iterations");if(p.depth>c.maxDepth)throw new C(`query depth limit exceeded (${c.maxDepth})`,"recursion");if(u&&!s(p.value,u,r).some(i))continue;l.length>=c.maxResults&&Mi(`query result element limit exceeded (${c.maxResults})`),l.push(p.value);let h=[];n.length===0?Array.isArray(p.value)?h=p.value:p.value&&typeof p.value=="object"&&(h=Object.keys(p.value).map(m=>p.value[m])):h=s(p.value,n[0],r).filter(m=>m!=null),f.length>c.maxResults-h.length&&Mi(`query traversal queue limit exceeded (${c.maxResults})`);for(let m=h.length-1;m>=0;m--)f.push({value:h[m],depth:p.depth+1})}return l}case"recurse_down":return a(e,"recurse",n,r);case"walk":{if(n.length===0)return[e];let l=Fi(r),c=new WeakSet,u=new WeakMap,f=[{value:e,depth:0,expanded:!1}],d=e,p=0;for(;f.length>0;){let h=f.pop();if(!h)break;if(++p>l.maxIterations)throw new C(`query iteration limit exceeded (${l.maxIterations})`,"iterations");if(h.depth>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let m=h.value!==null&&typeof h.value=="object"?h.value:null;if(!h.expanded&&m){if(c.has(m))continue;c.add(m),f.push({...h,expanded:!0});let y=et(h.value),w=Array.isArray(h.value)?h.value:Object.keys(y??{}).map(x=>y?.[x]);f.length>l.maxResults-w.length&&Mi(`query traversal queue limit exceeded (${l.maxResults})`);for(let x=w.length-1;x>=0;x--)f.push({value:w[x],depth:h.depth+1,expanded:!1});continue}let g=h.value;if(Array.isArray(h.value))g=h.value.map(y=>y!==null&&typeof y=="object"?u.get(y)??y:y);else if(m){let y=Object.create(null),w=et(h.value);for(let x of Object.keys(w??{})){if(!Ke(x))continue;let S=w?.[x];Je(y,x,S!==null&&typeof S=="object"?u.get(S)??S:S)}g=y}let b=s(g,n[0],r)[0];m&&u.set(m,b),h.depth===0&&(d=b)}return[d]}case"transpose":{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let l=Fi(r),c=0;for(let f of e)Array.isArray(f)&&(c=Math.max(c,f.length));Pf([e.length,c],l.maxResults);let u=[];for(let f=0;f<c;f++)u.push(e.map(d=>Array.isArray(d)?d[f]:null));return[u]}case"combinations":{if(n.length>0){let h=s(e,n[0],r)[0];if(!Array.isArray(e))return[];if(!Number.isFinite(h)||!Number.isSafeInteger(h)||h<0)throw new Error("combinations length must be a finite non-negative integer");let m=Fi(r);if(h>m.maxDepth||h>m.maxResults)throw new C(`query depth limit exceeded (${m.maxDepth})`,"recursion");if(h===0)return m.maxResults<1&&Mi("query combination limit exceeded (0)"),[[]];let g=Pf(Array.from({length:h},()=>e.length),m.maxResults);if(g===0)return[];let b=[],y=new Array(h).fill(0);for(let w=0;w<g;w++){b.push(y.map(x=>e[x]));for(let x=h-1;x>=0&&(y[x]++,!(y[x]<e.length));x--)y[x]=0}return b}if(!Array.isArray(e))return[];if(e.length===0)return Fi(r).maxResults<1&&Mi("query combination limit exceeded (0)"),[[]];for(let p of e)if(!Array.isArray(p))return[];let l=Fi(r),c=e;if(c.length>l.maxDepth)throw new C(`query depth limit exceeded (${l.maxDepth})`,"recursion");let u=Pf(c.map(p=>p.length),l.maxResults);if(u===0)return[];let f=[],d=new Array(c.length).fill(0);for(let p=0;p<u;p++){f.push(d.map((h,m)=>c[m][h]));for(let h=c.length-1;h>=0&&(d[h]++,!(d[h]<c[h].length));h--)d[h]=0}return f}case"parent":{if(r.root===void 0||r.currentPath===void 0)return[];let l=r.currentPath;if(l.length===0)return[];let c=n.length>0?s(e,n[0],r)[0]:1;if(c>=0){if(c>l.length)return[];let u=l.slice(0,l.length-c);return[o(r.root,u)]}else{let u=-c-1;if(u>=l.length)return[e];let f=l.slice(0,u);return[o(r.root,f)]}}case"parents":{if(r.root===void 0||r.currentPath===void 0)return[[]];let l=r.currentPath,c=[];for(let u=l.length-1;u>=0;u--)c.push(o(r.root,l.slice(0,u)));return[c]}case"root":return r.root!==void 0?[r.root]:[];default:return null}}var O2=F(()=>{"use strict";G();ar()});function cn(e){return e.limits.maxArrayElements}function Lf(e,t){let n=Object.create(null);return Je(n,"key",e),Je(n,"value",t),n}function al(e,t){let n=cn(e);if(t>=n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function kC(e,t){let n=t.limits.maxDepth??Ff;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements;for(let s of e)if(typeof s=="number"){if(!Number.isSafeInteger(s)||s<0||s>=r)throw new C(`query array index limit exceeded (${r})`,"array_elements")}else if(typeof s!="string")throw new Error("stream path components must be strings or integers")}function Mf(e,t,n,r,s){switch(t){case"keys":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e).sort()]:[null];case"keys_unsorted":return Array.isArray(e)?[e.map((i,o)=>o)]:e&&typeof e=="object"?[Object.keys(e)]:[null];case"length":return typeof e=="string"?[e.length]: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[M(e)];let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) only strings have UTF-8 byte length`)}case"to_entries":{if(Array.isArray(e)){if(e.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");return[e.map((o,a)=>Lf(a,o))]}let i=et(e);if(i){let o=Object.keys(i);if(o.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");return[o.map(a=>Lf(a,i[a]))]}return[null]}case"from_entries":if(Array.isArray(e)){let i=Object.create(null);for(let o of e){let a=et(o);if(a){let l=a.key??a.Key??a.name??a.Name??a.k,c=a.value??a.Value??a.v;if(l!==void 0){let u=String(l);Ke(u)&&Je(i,u,c)}}}return[i]}return[null];case"with_entries":{if(n.length===0)return[e];let i=et(e);if(i){let o=Object.keys(i);if(o.length>cn(r))throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");let a=[];for(let c of o){let u=Lf(c,i[c]),f=s(u,n[0],r);if(a.length>cn(r)-f.length)throw new C(`query result element limit exceeded (${cn(r)})`,"array_elements");for(let d of f)a.push(d)}let l=Object.create(null);for(let c of a){let u=et(c);if(u){let f=u.key??u.name??u.k,d=u.value??u.v;if(f!==void 0){let p=String(f);Ke(p)&&Je(l,p,d)}}}return[l]}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?s(e,n[0],r):[Number.POSITIVE_INFINITY]).map(o=>{let a=o;if(a<0)throw new Error("flatten depth must not be negative");return e.flat(a)}):[null];case"unique":if(Array.isArray(e)){let i=new Set,o=[];for(let a of e){let l=JSON.stringify(a);i.has(l)||(i.add(l),o.push(a))}return[o]}return[null];case"tojson":case"tojsonstream":{let i=r.limits.maxDepth??Ff;return Vr(e,i+1)>i?[null]:[JSON.stringify(e)]}case"fromjson":{if(typeof e=="string"){let i=e.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[ki(JSON.parse(e),{maxDepth:r.limits.maxDepth,maxElements:r.limits.maxArrayElements})]}catch(o){throw o instanceof C?o:new 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 i=e.trim()===""?Number.NaN:Number(e);if(Number.isNaN(i))throw new Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[i]}throw new 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 new Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let i=e===null?"null":Array.isArray(e)?"array":typeof e,o=i==="array"||i==="object"?JSON.stringify(e):String(e);throw new Error(`${i} (${o}) cannot be parsed as a boolean`)}case"tostream":{let i=[],o=r.limits.maxDepth??Ff,a=[{value:e,path:[]}],l=new WeakSet,c=0;for(;a.length>0;){let u=a.pop();if(!u)break;if(++c>r.limits.maxIterations)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");if(u.path.length>o)throw new C(`query depth limit exceeded (${o})`,"recursion");let f=u.value;if(f===null||typeof f!="object")al(r,i.length),i.push([u.path,f]);else if(Array.isArray(f)){if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");if(l.add(f),f.length===0)al(r,i.length),i.push([u.path,[]]);else{if(a.length>cn(r)-f.length)throw new C(`query traversal queue limit exceeded (${cn(r)})`,"array_elements");for(let d=f.length-1;d>=0;d--)a.push({value:f[d],path:[...u.path,d]})}}else{if(l.has(f))throw new C("cyclic value cannot be converted to a stream","recursion");l.add(f);let d=Object.keys(f);if(d.length===0)al(r,i.length),i.push([u.path,Object.create(null)]);else{if(a.length>cn(r)-d.length)throw new C(`query traversal queue limit exceeded (${cn(r)})`,"array_elements");for(let p=d.length-1;p>=0;p--){let h=d[p];a.push({value:f[h],path:[...u.path,h]})}}}}return al(r,i.length),i.push([[]]),i}case"fromstream":{if(n.length===0)return[e];let i=s(e,n[0],r);if(i.length>cn(r))throw new C(`query stream item limit exceeded (${cn(r)})`,"array_elements");let o=null,a=0;for(let l of i){if(!Array.isArray(l)||l.length===1&&Array.isArray(l[0])&&l[0].length===0||l.length!==2)continue;let[c,u]=l;if(!Array.isArray(c))continue;if(kC(c,r),c.length===0){o=u;continue}o===null&&(o=typeof c[0]=="number"?[]:Object.create(null));let f=o;for(let p=0;p<c.length-1;p++){let h=c[p],m=c[p+1];if(Array.isArray(f)&&typeof h=="number"){let g=h+1-f.length;if(g>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,g);f.length<=h;)f.push(null);f[h]===null&&(f[h]=typeof m=="number"?[]:Object.create(null)),f=f[h]}else{let g=et(f);if(g){let b=String(h);if(!Ke(b))continue;(g[b]===null||g[b]===void 0)&&Je(g,b,typeof m=="number"?[]:Object.create(null)),f=g[b]}}}let d=c[c.length-1];if(Array.isArray(f)&&typeof d=="number"){let p=d+1-f.length;if(p>r.limits.maxIterations-a)throw new C(`query iteration limit exceeded (${r.limits.maxIterations})`,"iterations");for(a+=Math.max(0,p);f.length<=d;)f.push(null);f[d]=u}else{let p=et(f);if(p){let h=String(d);Ke(h)&&Je(p,h,u)}}}return[o]}case"truncate_stream":{let i=typeof e=="number"?Math.floor(e):0;if(n.length===0)return[];let o=[],a=s(e,n[0],r);for(let l of a)if(Array.isArray(l)){if(l.length===1&&Array.isArray(l[0])){let c=l[0];c.length>i&&o.push([c.slice(i)]);continue}if(l.length===2&&Array.isArray(l[0])){let c=l[0],u=l[1];c.length>i&&o.push([c.slice(i),u])}}return o}default:return null}}var Ff,T2=F(()=>{"use strict";ue();G();ar();Fo();Ff=2e3});function $2(e,t){if(!Array.isArray(e))throw new Error("path must be an array");let n=t.limits.maxDepth;if(e.length>n)throw new C(`query depth limit exceeded (${n})`,"recursion");let r=t.limits.maxArrayElements,s=0;for(let i of e)if(typeof i=="number"){if(!Number.isSafeInteger(i)||i<0||i>=r)throw new C(`query array index limit exceeded (${r})`,"array_elements");let o=i+1;if(s>r-o)throw new C(`query cumulative array allocation limit exceeded (${r})`,"array_elements");s+=o}else if(typeof i!="string")throw new Error("path components must be strings or integers");return Sn(t,s+e.length),e}function R2(e,t,n){let r=[],s=[{value:e,path:[],isRoot:!0}];for(;s.length>0;){let i=s.pop();if(!i)break;if(Sn(t),i.path.length>t.limits.maxDepth)throw new C(`query depth limit exceeded (${t.limits.maxDepth})`,"recursion");if(!(i.value!==null&&typeof i.value=="object")){(n||!i.isRoot)&&(Ft(t,r.length),r.push(i.path));continue}!n&&!i.isRoot&&(Ft(t,r.length),r.push(i.path));let a=Array.isArray(i.value)?i.value.map((l,c)=>[c,l]):Object.keys(i.value).map(l=>[l,i.value[l]]);Ft(t,r.length,s.length+a.length);for(let l=a.length-1;l>=0;l--){let[c,u]=a[l],f=[...i.path,c];s.push({value:u,path:f,isRoot:!1})}}return r}function _f(e,t,n,r,s,i,o,a,l,c){switch(t){case"getpath":{if(n.length===0)return[null];let u=s(e,n[0],r),f=[];for(let d of u){let p=d,h=e;for(let m of p){if(h==null){h=null;break}if(Array.isArray(h)&&typeof m=="number")h=h[m];else if(typeof m=="string"){let g=et(h);if(!g||!Object.hasOwn(g,m)){h=null;break}h=g[m]}else{h=null;break}}f.push(h)}return f}case"setpath":{if(n.length<2)return[null];let u=s(e,n[0],r),f=$2(u[0],r),p=s(e,n[1],r)[0];return[o(e,f,p)]}case"delpaths":{if(n.length===0)return[e];let f=s(e,n[0],r)[0],d=e;for(let p of f.sort((h,m)=>m.length-h.length))d=a(d,p);return[d]}case"path":{if(n.length===0)return[[]];let u=[];return c(e,n[0],r,[],u),u}case"del":return n.length===0?[e]:[l(e,n[0],r)];case"pick":{if(n.length===0)return[null];let u=[];for(let d of n)c(e,d,r,[],u);let f=null;for(let d of u){for(let h of d)if(typeof h=="number"&&h<0)throw new Error("Out of bounds negative array index");$2(d,r);let p=e;for(let h of d){if(p==null)break;if(Array.isArray(p)&&typeof h=="number")p=p[h];else if(typeof h=="string"){let m=et(p);if(!m||!Object.hasOwn(m,h)){p=null;break}p=m[h]}else{p=null;break}}f=o(f,d,p)}return[f]}case"paths":{let u=R2(e,r,!1);return n.length>0?u.filter(f=>{let d=e;for(let h of f)if(Array.isArray(d)&&typeof h=="number")d=d[h];else if(typeof h=="string"){let m=et(d);if(!m||!Object.hasOwn(m,h))return!1;d=m[h]}else return!1;return s(d,n[0],r).some(i)}):u}case"leaf_paths":return R2(e,r,!0);default:return null}}var P2=F(()=>{"use strict";G();Bf();ar()});function Uf(e,t,n,r,s,i){switch(t){case"IN":{if(n.length===0)return[!1];if(n.length===1){let c=s(e,n[0],r);for(let u of c)if(i(e,u))return[!0];return[!1]}let o=s(e,n[0],r),a=s(e,n[1],r),l=new Set(a.map(c=>JSON.stringify(c)));for(let c of o)if(l.has(JSON.stringify(c)))return[!0];return[!1]}case"INDEX":{if(n.length===0)return[Object.create(null)];if(n.length===1){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=String(u);Ke(f)&&Je(c,f,u)}return[c]}if(n.length===2){let l=s(e,n[0],r),c=Object.create(null);for(let u of l){let f=s(u,n[1],r);if(f.length>0){let d=String(f[0]);Ke(d)&&Je(c,d,u)}}return[c]}let o=s(e,n[0],r),a=Object.create(null);for(let l of o){let c=s(l,n[1],r),u=s(l,n[2],r);if(c.length>0&&u.length>0){let f=String(c[0]);Ke(f)&&Je(a,f,u[0])}}return[a]}case"JOIN":{if(n.length<2)return[null];let o=et(s(e,n[0],r)[0]);if(!o)return[null];if(!Array.isArray(e))return[null];let a=[];for(let l of e){let c=s(l,n[1],r),u=c.length>0?String(c[0]):"",f=Ls(o,u)?o[u]:null;a.push([l,f])}return[a]}default:return null}}var D2=F(()=>{"use strict";ar()});function F2(e){return e.limits.maxArrayElements}function L2(e){return Math.min(e.limits.maxStringLength,e.limits.maxOutputSize)}function zs(e,t){let n=F2(e);if(!Number.isSafeInteger(t)||t<0||t>n)throw new C(`query result element limit exceeded (${n})`,"array_elements")}function vC(e,t,n){if(e==="")return t===""?0:1;if(t==="")return e.length;let r=1,s=0;for(;;){let i=e.indexOf(t,s);if(i<0||(r++,r>n))return r;s=i+t.length}}function zf(e,t,n,r,s){switch(t){case"join":{if(!Array.isArray(e))return[null];let i=n.length>0?s(e,n[0],r):[""];for(let o of e)if(Array.isArray(o)||o!==null&&typeof o=="object")throw new Error("cannot join: contains arrays or objects");return zs(r,i.length),i.map(o=>{let a=String(o),l=0;for(let c=0;c<e.length;c++){let u=e[c]===null?"":typeof e[c]=="string"?e[c]:String(e[c]);if(l+=M(u),c>0&&(l+=M(a)),l>L2(r))throw new C(`query string size limit exceeded (${L2(r)} bytes)`,"string_length")}return e.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(a)})}case"split":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);return zs(r,vC(e,o,F2(r))),[e.split(o)]}case"splits":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"g",l=oe(o,a.includes("g")?a:`${a}g`),c=1;for(let f of l.matchAll(e))c+=Math.max(1,f.length),zs(r,c);let u=l.split(e);return zs(r,u.length),u}catch(a){if(a instanceof C)throw a;return[]}}case"scan":{if(typeof e!="string"||n.length===0)return[];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",l=oe(o,a.includes("g")?a:`${a}g`),c=[];for(let u of l.matchAll(e))zs(r,c.length+1),u.length>1?(zs(r,u.length-1),c.push(u.slice(1))):c.push(u[0]);return c}catch(a){if(a instanceof C)throw a;return[]}}case"test":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"";return[oe(o,a).test(e)]}catch{return[!1]}}case"match":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=oe(o,`${a}d`).exec(e);if(!c)return[];let u=c.indices;return[{offset:c.index,length:c[0].length,string:c[0],captures:c.slice(1).map((f,d)=>({offset:u?.[d+1]?.[0]??null,length:f?.length??0,string:f??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof e!="string"||n.length===0)return[null];let i=s(e,n[0],r),o=String(i[0]);try{let a=n.length>1?String(s(e,n[1],r)[0]):"",c=oe(o,a).match(e);return!c||!c.groups?[Object.create(null)]:[c.groups]}catch{return[null]}}case"sub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"";return[oe(a,c).replace(e,l)]}catch{return[e]}}case"gsub":{if(typeof e!="string"||n.length<2)return[null];let i=s(e,n[0],r),o=s(e,n[1],r),a=String(i[0]),l=String(o[0]);try{let c=n.length>2?String(s(e,n[2],r)[0]):"g",u=c.includes("g")?c:`${c}g`;return[oe(a,u).replace(e,l)]}catch{return[e]}}case"ascii_downcase":return typeof e=="string"?[e.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof e=="string"?[e.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return[e.startsWith(o)?e.slice(o.length):e]}case"rtrimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);return o===""?[e]:[e.endsWith(o)?e.slice(0,-o.length):e]}case"trimstr":{if(typeof e!="string"||n.length===0)return[e];let i=s(e,n[0],r),o=String(i[0]);if(o==="")return[e];let a=e;return a.startsWith(o)&&(a=a.slice(o.length)),a.endsWith(o)&&(a=a.slice(0,-o.length)),[a]}case"trim":if(typeof e=="string")return[e.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof e=="string")return[e.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof e=="string")return[e.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.startsWith(String(i[0]))]}case"endswith":{if(typeof e!="string"||n.length===0)return[!1];let i=s(e,n[0],r);return[e.endsWith(String(i[0]))]}case"ascii":return typeof e=="string"&&e.length>0?[e.charCodeAt(0)]:[null];case"explode":if(typeof e=="string"){let i=0;for(let o of e)i++,zs(r,i);return[Array.from(e).map(o=>o.codePointAt(0))]}return[null];case"implode":if(!Array.isArray(e))throw new Error("implode input must be an array");return[e.map(a=>{if(typeof a=="string")throw new Error(`string (${JSON.stringify(a)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof a!="number"||Number.isNaN(a))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let l=Math.trunc(a);return l<0||l>1114111||l>=55296&&l<=57343?String.fromCodePoint(65533):String.fromCodePoint(l)}).join("")];default:return null}}var M2=F(()=>{"use strict";G();mt();kt()});function Wf(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[Number.POSITIVE_INFINITY];case"nan":return[Number.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 _2=F(()=>{"use strict"});var B2=F(()=>{"use strict";x2();E2();C2();v2();N2();I2();O2();T2();P2();D2();M2();_2()});function ll(e,t,n){if(t.length===0)return n;let[r,...s]=t;if(typeof r=="number"){if(e&&typeof e=="object"&&!Array.isArray(e))throw new Error("Cannot index object with number");if(r>536870911)throw new Error("Array index too large");if(r<0)throw new Error("Out of bounds negative array index");let c=Array.isArray(e)?[...e]:[];for(;c.length<=r;)c.push(null);return c[r]=ll(c[r],s,n),c}if(Array.isArray(e))throw new Error("Cannot index array with string");if(!Ke(r))return e??Object.create(null);let i=et(e),o=i?Lt(i):Object.create(null),a=Object.hasOwn(o,r)?o[r]:void 0;return Je(o,r,ll(a,s,n)),o}function cl(e,t){if(t.length===0)return null;if(t.length===1){let s=t[0];if(Array.isArray(e)&&typeof s=="number"){let i=[...e];return i.splice(s,1),i}if(e&&typeof e=="object"&&!Array.isArray(e)){let i=String(s);if(!Ke(i))return e;let o=Lt(e);return delete o[i],o}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n=="number"){let s=[...e];return s[n]=cl(s[n],r),s}if(e&&typeof e=="object"&&!Array.isArray(e)){let s=String(n);if(!Ke(s))return e;let i=Lt(e);return Object.hasOwn(i,s)&&Je(i,s,cl(i[s],r)),i}return e}var U2=F(()=>{"use strict";ar()});function js(e,t){return new C(e,t)}function Sn(e,t=1){if(!Number.isSafeInteger(t)||t<0||e.budget.operations>e.limits.maxIterations-t)throw js(`query evaluation: too many iterations (${e.limits.maxIterations})`,"iterations");e.budget.operations+=t}function Ft(e,t,n=1){let r=e.limits.maxArrayElements;if(!Number.isSafeInteger(t)||!Number.isSafeInteger(n)||t<0||n<0||t>r-n)throw js(`query result element limit exceeded (${r})`,"array_elements")}function Ws(e,t,n){Ft(e,t.length,n.length);for(let r of n)t.push(r)}function Zn(e,t,n){let r=[];for(let s of t){Sn(e);let i=n(s);Ws(e,r,i)}return r}function OC(e){let t=new Map;if(e?.namedArgs)for(let[n,r]of e.namedArgs)t.set(`$${n}`,r);return{vars:t,limits:{maxIterations:e?.limits?.maxIterations??NC,maxDepth:e?.limits?.maxDepth??H2,maxStringLength:e?.limits?.maxStringLength??z2,maxOutputSize:e?.limits?.maxOutputSize??z2,maxArrayElements:e?.limits?.maxArrayElements??1e5},env:e?.env,namedArgs:e?.namedArgs,positionalArgs:e?.positionalArgs,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1,budget:e?.budget??{operations:0,callDepth:0}}}function dl(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,namedArgs:e.namedArgs,positionalArgs:e.positionalArgs,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage,budget:e.budget}}function Mo(e,t,n){switch(t.type){case"var":return dl(e,t.name,n);case"array":{if(!Array.isArray(n))return null;let r=e;for(let s=0;s<t.elements.length;s++){let i=t.elements[s],o=s<n.length?n[s]:null,a=Mo(r,i,o);if(a===null)return null;r=a}return r}case"object":{let r=et(n);if(!r)return null;let s=e;for(let i of t.fields){let o;if(typeof i.key=="string")o=i.key;else{let c=ne(n,i.key,e);if(c.length===0)return null;o=String(c[0])}let a=Ls(r,o)?r[o]:null;i.keyVar&&(s=dl(s,i.keyVar,a));let l=Mo(s,i.pattern,a);if(l===null)return null;s=l}return s}}}function TC(e,t){let n=e;for(let r of t)if(n&&typeof n=="object")if(Array.isArray(n))if(typeof r=="number")n=n[r];else return;else{let s=et(n);if(s&&typeof r=="string"&&Object.hasOwn(s,r))n=s[r];else return}else return;return n}function is(e){if(e.type==="Identity")return[];if(e.type==="Field"){let t=e.base?is(e.base):[];return t===null?null:[...t,e.name]}if(e.type==="Index"&&e.index.type==="Literal"){let t=e.base?is(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=is(e.left);return t===null?null:jf(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 jf(e,t){if(t.type==="Call"){if(t.name==="parent"){let n=1;if(t.args.length>0&&t.args[0].type==="Literal"){let r=t.args[0].value;typeof r=="number"&&(n=r)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let r=-n-1;return e.slice(0,Math.min(r,e.length))}}if(t.name==="root")return[]}if(t.type==="Field"){let n=is(t);if(n!==null)return[...e,...n]}if(t.type==="Index"&&t.index.type==="Literal"){let n=is(t);if(n!==null)return[...e,...n]}if(t.type==="Pipe"){let n=jf(e,t.left);return n===null?null:jf(n,t.right)}return t.type==="Identity"?e:null}function W2(e,t,n){if(t.type==="Comma"){let r=[];try{let s=ne(e,t.left,n);Ws(n,r,s)}catch(s){if(s instanceof C)throw s;if(r.length>0)return r;throw new Error("evaluation failed")}try{let s=ne(e,t.right,n);Ws(n,r,s)}catch(s){if(s instanceof C)throw s;return r}return r}return ne(e,t,n)}function ne(e,t,n){let r=n&&"vars"in n?n:OC(n);if(r.defenseContextChecked||(It(r.requireDefenseContext,"query-engine","evaluation"),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),Sn(r),r.budget.callDepth++,r.budget.callDepth>r.limits.maxDepth)throw r.budget.callDepth--,js(`query depth limit exceeded (${r.limits.maxDepth})`,"recursion");try{let s=$C(e,t,r);return Ft(r,0,s.length),s}finally{r.budget.callDepth--}}function $C(e,t,n){switch(n.coverage?.hit(`jq:node:${t.type}`),t.type){case"Identity":return[e];case"Field":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{let i=et(s);if(i){if(!Object.hasOwn(i,t.name))return[null];let a=i[t.name];return[a===void 0?null:a]}if(s===null)return[null];let o=Array.isArray(s)?"array":typeof s;throw new Error(`Cannot index ${o} with string "${t.name}"`)})}case"Index":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{let i=ne(s,t.index,n);return Zn(n,i,o=>{if(typeof o=="number"&&Array.isArray(s)){if(Number.isNaN(o))return[null];let a=Math.trunc(o),l=a<0?s.length+a:a;return l>=0&&l<s.length?[s[l]]:[null]}if(typeof o=="string"){let a=et(s);return!a||!Object.hasOwn(a,o)?[null]:[a[o]]}return[null]})})}case"Slice":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>{if(s===null)return[null];if(!Array.isArray(s)&&typeof s!="string")throw new Error(`Cannot slice ${typeof s} (${JSON.stringify(s)})`);let i=s.length,o=t.start?ne(e,t.start,n):[0],a=t.end?ne(e,t.end,n):[i];return Ft(n,0,o.length*a.length),Zn(n,o,l=>a.map(c=>{let u=l,f=c,d=Number.isNaN(u)?0:Number.isInteger(u)?u:Math.floor(u),p=Number.isNaN(f)?i:Number.isInteger(f)?f:Math.ceil(f),h=j2(d,i),m=j2(p,i);return Array.isArray(s),s.slice(h,m)}))})}case"Iterate":{let r=t.base?ne(e,t.base,n):[e];return Zn(n,r,s=>Array.isArray(s)?s:s&&typeof s=="object"?Object.values(s):[])}case"Pipe":{let r=ne(e,t.left,n),s=is(t.left),i=[];for(let o of r)try{if(s!==null){let a={...n,currentPath:[...n.currentPath??[],...s]},l=ne(o,t.right,a);Ws(n,i,l)}else{let a=ne(o,t.right,n);Ws(n,i,a)}}catch(a){throw a instanceof _i?a.withPrependedResults(i):a}return i}case"Comma":{let r=ne(e,t.left,n),s=ne(e,t.right,n);return Ft(n,r.length,s.length),[...r,...s]}case"Literal":return[t.value];case"Array":return t.elements?[ne(e,t.elements,n)]:[[]];case"Object":{let r=[Object.create(null)];for(let s of t.entries){let i=typeof s.key=="string"?[s.key]:ne(e,s.key,n),o=ne(e,s.value,n),a=[],l=i.filter(f=>typeof f=="string"&&Ke(f)).length,c=l+(i.length-l),u=r.length*c*o.length;Ft(n,0,u);for(let f of r)for(let d of i){if(typeof d!="string"){let p=d===null?"null":Array.isArray(d)?"array":typeof d;throw new Error(`Cannot use ${p} (${JSON.stringify(d)}) as object key`)}if(!Ke(d)){for(let p of o)a.push(Lt(f));continue}for(let p of o){let h=Lt(f);Je(h,d,p),a.push(h)}}r.length=0,Ws(n,r,a)}return r}case"Paren":return ne(e,t.expr,n);case"BinaryOp":return DC(e,t.op,t.left,t.right,n);case"UnaryOp":return ne(e,t.operand,n).map(s=>{if(t.op==="-"){if(typeof s=="number")return-s;if(typeof s=="string"){let i=o=>o.length>5?`"${o.slice(0,3)}...`:JSON.stringify(o);throw new Error(`string (${i(s)}) cannot be negated`)}return null}return t.op==="not"?!Gn(s):null});case"Cond":{let r=ne(e,t.cond,n);return Zn(n,r,s=>{if(Gn(s))return ne(e,t.then,n);for(let i of t.elifs)if(ne(e,i.cond,n).some(Gn))return ne(e,i.then,n);return t.else?ne(e,t.else,n):[e]})}case"Try":try{return ne(e,t.body,n)}catch(r){if(r instanceof C)throw r;if(t.catch){let s=r instanceof fl?r.value:r instanceof Error?r.message:String(r);return ne(s,t.catch,n)}return[]}case"Call":return V2(e,t.name,t.args,n);case"VarBind":{let r=ne(e,t.value,n);return Zn(n,r,s=>{let i=null,o=[];if(t.pattern?o.push(t.pattern):t.name&&o.push({type:"var",name:t.name}),t.alternatives)for(let a of t.alternatives)o.push(a);for(let a of o)if(i=Mo(n,a,s),i!==null)break;return i===null?[]:ne(e,t.body,i)})}case"VarRef":{if(t.name==="$ENV")return[n.env?Vt(n.env):Object.create(null)];if(t.name==="$ARGS"){let s=Object.create(null);if(n.namedArgs)for(let[o,a]of n.namedArgs)Object.defineProperty(s,o,{value:a,enumerable:!0,writable:!0,configurable:!0});let i=Object.create(null);return i.positional=n.positionalArgs?[...n.positionalArgs]:[],i.named=s,[i]}let r=n.vars.get(t.name);return r!==void 0?[r]:[null]}case"Recurse":{let r=[],s=new WeakSet,i=[{val:e,depth:0}];for(;i.length>0;){let o=i.pop();if(!o)break;let{val:a,depth:l}=o;if(Sn(n),l>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");if(a&&typeof a=="object"){if(s.has(a))continue;s.add(a)}if(Ft(n,r.length),r.push(a),Array.isArray(a))for(let c=a.length-1;c>=0;c--)i.push({val:a[c],depth:l+1});else if(a&&typeof a=="object"){let c=Object.keys(a);for(let u=c.length-1;u>=0;u--)i.push({val:a[c[u]],depth:l+1})}}return r}case"Optional":try{return ne(e,t.expr,n)}catch(r){if(r instanceof C)throw r;return[]}case"StringInterp":{let r=new $e(n.limits.maxStringLength,"query string interpolation",()=>new C(`string size limit exceeded (${n.limits.maxStringLength} bytes)`,"string_length"));for(let s of t.parts){if(typeof s=="string"){r.append(s);continue}let i=ne(e,s,n);for(let o of i){if(Sn(n),Vr(o,n.limits.maxDepth+1)>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");r.append(typeof o=="string"?o:JSON.stringify(o))}}return[r.build()]}case"UpdateOp":return[RC(e,t.path,t.op,t.value,n)];case"Reduce":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=n.limits.maxDepth??H2;for(let o of r){let a;if(t.pattern){if(a=Mo(n,t.pattern,o),a===null)continue}else a=dl(n,t.varName,o);if(s=ne(s,t.update,a)[0],Vr(s,i+1)>i)return[null]}return[s]}case"Foreach":{let r=ne(e,t.expr,n),s=ne(e,t.init,n)[0],i=[];for(let o of r)try{let a;if(t.pattern){if(a=Mo(n,t.pattern,o),a===null)continue}else a=dl(n,t.varName,o);if(s=ne(s,t.update,a)[0],t.extract){let l=ne(s,t.extract,a);Ws(n,i,l)}else Ft(n,i.length),i.push(s)}catch(a){throw a instanceof _i?a.withPrependedResults(i):a}return i}case"Label":try{return ne(e,t.body,{...n,labels:new Set([...n.labels??[],t.name])})}catch(r){if(r instanceof _i&&r.label===t.name)return r.partialResults;throw r}case"Break":throw new _i(t.name);case"Def":{let r=new Map(n.funcs??[]),s=`${t.name}/${t.params.length}`;r.set(s,{params:t.params,body:t.funcBody,closure:new Map(n.funcs??[])});let i={...n,funcs:r};return ne(e,t.body,i)}default:{let r=t;throw new Error(`Unknown AST node type: ${r.type}`)}}}function j2(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function RC(e,t,n,r,s){function i(l,c){switch(n){case"=":return c;case"|=":return ne(l,r,s)[0]??null;case"+=":return typeof l=="number"&&typeof c=="number"||typeof l=="string"&&typeof c=="string"?l+c:Array.isArray(l)&&Array.isArray(c)?(Ft(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"?Wu(l,c):c;case"-=":return typeof l=="number"&&typeof c=="number"?l-c:l;case"*=":return typeof l=="number"&&typeof c=="number"?l*c:l;case"/=":return typeof l=="number"&&typeof c=="number"?l/c:l;case"%=":return typeof l=="number"&&typeof c=="number"?l%c:l;case"//=":return l===null||l===!1?c:l;default:return c}}function o(l,c,u){switch(c.type){case"Identity":return u(l);case"Field":{if(!Ke(c.name))return l;if(c.base)return o(l,c.base,f=>{if(f&&typeof f=="object"&&!Array.isArray(f)){let d=Lt(f),p=Object.hasOwn(d,c.name)?d[c.name]:void 0;return Je(d,c.name,u(p)),d}return f});if(l&&typeof l=="object"&&!Array.isArray(l)){let f=Lt(l),d=Object.hasOwn(f,c.name)?f[c.name]:void 0;return Je(f,c.name,u(d)),f}return l}case"Index":{let d=ne(e,c.index,s)[0];if(typeof d=="number"&&Number.isNaN(d))throw new Error("Cannot set array element at NaN index");if(typeof d=="number"&&!Number.isFinite(d))throw new Error("array index must be finite");if(typeof d=="number"&&!Number.isInteger(d)&&(d=Math.trunc(d)),c.base)return o(l,c.base,p=>{if(typeof d=="number"&&Array.isArray(p)){let h=[...p],m=d<0?h.length+d:d;if(m>=0){Ft(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=p.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(typeof d=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!Ke(d))return p;let h=Lt(p),m=Object.hasOwn(h,d)?h[d]:void 0;return Je(h,d,u(m)),h}return p});if(typeof d=="number"){if(!Number.isSafeInteger(d)||d>536870911)throw new Error("Array index too large");if(d<0&&(!l||!Array.isArray(l)))throw new Error("Out of bounds negative array index");if(Array.isArray(l)){let h=[...l],m=d<0?h.length+d:d;if(m>=0){Ft(s,0,m+1),h.length<=m&&(h.length=m+1);for(let g=l.length;g<m;g++)h[g]=null;h[m]=u(h[m])}return h}if(l==null){Ft(s,0,d+1);let h=new Array(d+1).fill(null);return h[d]=u(null),h}return l}if(typeof d=="string"&&l&&typeof l=="object"&&!Array.isArray(l)){if(!Ke(d))return l;let p=Lt(l),h=Object.hasOwn(p,d)?p[d]:void 0;return Je(p,d,u(h)),p}return l}case"Iterate":{let f=d=>{if(Array.isArray(d)){Ft(s,0,d.length);let p=[];for(let h of d)Sn(s),p.push(u(h));return p}if(d&&typeof d=="object"){let p=Object.create(null);for(let[h,m]of Object.entries(d))Ke(h)&&Je(p,h,u(m));return p}return d};return c.base?o(l,c.base,f):f(l)}case"Pipe":{let f=o(l,c.left,d=>d);return o(f,c.right,u)}default:return u(l)}}return o(e,t,l=>{if(n==="|=")return i(l,l);let c=ne(e,r,s);return i(l,c[0]??null)})}function PC(e,t,n){function r(i,o,a){switch(o.type){case"Identity":return a;case"Field":{if(!Ke(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0],c=r(l,{type:"Field",name:o.name},a);return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){let l=Lt(i);return Je(l,o.name,a),l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0],f=r(u,{type:"Index",index:o.index},a);return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&(u[f]=a),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Ke(c))return i;let u=Lt(i);return Je(u,c,a),u}return i}default:return i}}function s(i,o){switch(o.type){case"Identity":return null;case"Field":{if(!Ke(o.name))return i;if(o.base){let l=ne(i,o.base,n)[0];if(l==null)return i;let c=s(l,{type:"Field",name:o.name});return r(i,o.base,c)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!Ke(o.name))return i;let l=Lt(i);return delete l[o.name],l}return i}case"Index":{if(o.base){let u=ne(i,o.base,n)[0];if(u==null)return i;let f=s(u,{type:"Index",index:o.index});return r(i,o.base,f)}let c=ne(e,o.index,n)[0];if(typeof c=="number"&&Array.isArray(i)){let u=[...i],f=c<0?u.length+c:c;return f>=0&&f<u.length&&u.splice(f,1),u}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!Ke(c))return i;let u=Lt(i);return delete u[c],u}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let u=function(p,h,m){switch(h.type){case"Identity":return m;case"Field":{if(!Ke(h.name))return p;if(p&&typeof p=="object"&&!Array.isArray(p)){let g=Lt(p);return Je(g,h.name,m),g}return p}case"Index":{let b=ne(e,h.index,n)[0];if(typeof b=="number"&&Array.isArray(p)){let y=[...p],w=b<0?y.length+b:b;return w>=0&&w<y.length&&(y[w]=m),y}if(typeof b=="string"&&p&&typeof p=="object"&&!Array.isArray(p)){if(!Ke(b))return p;let y=Lt(p);return Je(y,b,m),y}return p}case"Pipe":{let g=ne(p,h.left,n)[0],b=u(g,h.right,m);return u(p,h.left,b)}default:return p}};var a=u;let l=o.left,c=o.right,f=ne(i,l,n)[0];if(f==null)return i;let d=s(f,c);return u(i,l,d)}default:return i}}return s(e,t)}function DC(e,t,n,r,s){if(t==="and"){let l=ne(e,n,s);return Zn(s,l,c=>{if(!Gn(c))return[!1];let u=ne(e,r,s);return Zn(s,u,f=>[Gn(f)])})}if(t==="or"){let l=ne(e,n,s);return Zn(s,l,c=>{if(Gn(c))return[!0];let u=ne(e,r,s);return Zn(s,u,f=>[Gn(f)])})}if(t==="//"){let c=ne(e,n,s).filter(u=>u!=null&&u!==!1);return c.length>0?c:ne(e,r,s)}let i=ne(e,n,s),o=ne(e,r,s),a=i.length*o.length;return Ft(s,0,a),Sn(s,a),i.flatMap(l=>o.map(c=>{switch(t){case"+":if(l===null)return c;if(c===null)return l;if(typeof l=="number"&&typeof c=="number")return l+c;if(typeof l=="string"&&typeof c=="string"){let u=s.limits.maxStringLength;if(M(l)+M(c)>u)throw new C(`string size limit exceeded (${u} bytes)`,"string_length");return l+c}return Array.isArray(l)&&Array.isArray(c)?(Ft(s,l.length,c.length),[...l,...c]):l&&c&&typeof l=="object"&&typeof c=="object"&&!Array.isArray(l)&&!Array.isArray(c)?Wu(l,c):null;case"-":if(typeof l=="number"&&typeof c=="number")return l-c;if(Array.isArray(l)&&Array.isArray(c)){let u=new Set(c.map(f=>JSON.stringify(f)));return l.filter(f=>!u.has(JSON.stringify(f)))}if(typeof l=="string"&&typeof c=="string"){let u=f=>f.length>10?`"${f.slice(0,10)}...`:JSON.stringify(f);throw new Error(`string (${u(l)}) and string (${u(c)}) cannot be subtracted`)}return null;case"*":if(typeof l=="number"&&typeof c=="number")return l*c;if(typeof l=="string"&&typeof c=="number"){if(!Number.isFinite(c))throw new Error(`invalid string repetition count: ${c}`);let u=Math.trunc(c);if(u<0)return null;let f=M(l),d=s.limits.maxStringLength;if(f>0&&u>Math.floor(d/f))throw new C(`string size limit exceeded (${d} bytes)`,"string_length");return l.repeat(u)}{let u=et(l),f=et(c);if(u&&f)return k2(u,f,{maxDepth:s.limits.maxDepth,visit:()=>Sn(s)})}return null;case"/":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided because the divisor is zero`);return l/c}return typeof l=="string"&&typeof c=="string"?l.split(c):null;case"%":if(typeof l=="number"&&typeof c=="number"){if(c===0)throw new Error(`number (${l}) and number (${c}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(l)&&!Number.isNaN(l)?!Number.isFinite(c)&&!Number.isNaN(c)&&l<0&&c>0?-1:0:l%c}return null;case"==":return Li(l,c);case"!=":return!Li(l,c);case"<":return Lo(l,c)<0;case"<=":return Lo(l,c)<=0;case">":return Lo(l,c)>0;case">=":return Lo(l,c)>=0;default:return null}}))}function V2(e,t,n,r){let s=IC.get(t);if(s)return typeof e=="number"?[s(e)]:[null];let i=Rf(e,t,n,r,ne);if(i!==null)return i;let o=zf(e,t,n,r,ne);if(o!==null)return o;let a=Of(e,t,n,r,ne);if(a!==null)return a;let l=Tf(e,t,r.limits.maxDepth);if(l!==null)return l;let c=Wf(e,t);if(c!==null)return c;let u=Mf(e,t,n,r,ne);if(u!==null)return u;let f=vf(e,t,n,r,ne,W2,il,Gn,ol,C);if(f!==null)return f;let d=_f(e,t,n,r,ne,Gn,ll,cl,PC,ul);if(d!==null)return d;let p=$f(e,t,n,r,ne,Li);if(p!==null)return p;let h=Nf(e,t,n,r,ne,W2,Gn,C);if(h!==null)return h;let m=Df(e,t,n,r,ne,Gn,TC,V2);if(m!==null)return m;let g=Uf(e,t,n,r,ne,Li);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"]];case"error":{let b=n.length>0?ne(e,n[0],r)[0]:e;throw new fl(b)}case"env":return[r.env?Vt(r.env):Object.create(null)];case"debug":return[e];case"input_line_number":return[1];default:{let b=`${t}/${n.length}`,y=r.funcs?.get(b);if(y){let w=y.closure??r.funcs??new Map,x=new Map(w);x.set(b,y);for(let E=0;E<y.params.length;E++){let A=y.params[E],I=n[E];if(I){let R=ne(e,I,r),N;if(R.length===0)N={type:"Call",name:"empty",args:[]};else if(R.length===1)N={type:"Literal",value:R[0]};else{N={type:"Literal",value:R[R.length-1]};for(let $=R.length-2;$>=0;$--)N={type:"Comma",left:{type:"Literal",value:R[$]},right:N}}x.set(`${A}/0`,{params:[],body:N})}}let S={...r,funcs:x};return ne(e,y.body,S)}throw new Error(`Unknown function: ${t}`)}}}function ul(e,t,n,r,s){if(Sn(n),r.length>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");let i=l=>{if(l.length>n.limits.maxDepth)throw js(`query depth limit exceeded (${n.limits.maxDepth})`,"recursion");Ft(n,s.length),s.push(l)};if(t.type==="Comma"){let l=t;ul(e,l.left,n,r,s),ul(e,l.right,n,r,s);return}let o=is(t);if(o!==null){i([...r,...o]);return}if(t.type==="Iterate"){if(Array.isArray(e))for(let l=0;l<e.length;l++)Sn(n),i([...r,l]);else if(e&&typeof e=="object")for(let l of Object.keys(e))Sn(n),i([...r,l]);return}if(t.type==="Recurse"){let l=[{value:e,path:[]}];for(;l.length>0;){let c=l.pop();if(!c)break;if(Sn(n),i([...r,...c.path]),c.value&&typeof c.value=="object"){let u=Array.isArray(c.value)?c.value.map((f,d)=>[d,f]):Object.keys(c.value).map(f=>[f,c.value[f]]);Ft(n,0,l.length+u.length);for(let f=u.length-1;f>=0;f--){let[d,p]=u[f];l.push({value:p,path:[...c.path,d]})}}}return}if(t.type==="Pipe"){let l=is(t.left);if(l!==null){let c=ne(e,t.left,n);for(let u of c)ul(u,t.right,n,[...r,...l],s);return}}ne(e,t,n).length>0&&i(r)}var _i,fl,NC,z2,H2,IC,Bf=F(()=>{"use strict";St();jr();G();vr();kt();B2();U2();ar();Fo();_i=class e extends Error{label;partialResults;constructor(t,n=[]){super(`break ${t}`),this.label=t,this.partialResults=n,this.name="BreakError"}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},fl=class extends Error{value;constructor(t){super(typeof t=="string"?t:JSON.stringify(t)),this.value=t,this.name="JqError"}},NC=1e4,z2=10*1024*1024,H2=2e3,IC=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 G2(e){let t=[],n=0,r=(c=0)=>e[n+c],s=()=>e[n++],i=()=>n>=e.length,o=c=>c>="0"&&c<="9",a=c=>c>="a"&&c<="z"||c>="A"&&c<="Z"||c==="_",l=c=>a(c)||o(c);for(;!i();){let c=n,u=s();if(!(u===" "||u===" "||u===`
590
590
  `||u==="\r")){if(u==="#"){for(;!i()&&r()!==`
591
591
  `;)s();continue}if(u==="."&&r()==="."){s(),t.push({type:"DOTDOT",pos:c});continue}if(u==="="&&r()==="="){s(),t.push({type:"EQ",pos:c});continue}if(u==="!"&&r()==="="){s(),t.push({type:"NE",pos:c});continue}if(u==="<"&&r()==="="){s(),t.push({type:"LE",pos:c});continue}if(u===">"&&r()==="="){s(),t.push({type:"GE",pos:c});continue}if(u==="/"&&r()==="/"){s(),r()==="="?(s(),t.push({type:"UPDATE_ALT",pos:c})):t.push({type:"ALT",pos:c});continue}if(u==="+"&&r()==="="){s(),t.push({type:"UPDATE_ADD",pos:c});continue}if(u==="-"&&r()==="="){s(),t.push({type:"UPDATE_SUB",pos:c});continue}if(u==="*"&&r()==="="){s(),t.push({type:"UPDATE_MUL",pos:c});continue}if(u==="/"&&r()==="="){s(),t.push({type:"UPDATE_DIV",pos:c});continue}if(u==="%"&&r()==="="){s(),t.push({type:"UPDATE_MOD",pos:c});continue}if(u==="="&&r()!=="="){t.push({type:"ASSIGN",pos:c});continue}if(u==="."){t.push({type:"DOT",pos:c});continue}if(u==="|"){r()==="="?(s(),t.push({type:"UPDATE_PIPE",pos:c})):t.push({type:"PIPE",pos:c});continue}if(u===","){t.push({type:"COMMA",pos:c});continue}if(u===":"){t.push({type:"COLON",pos:c});continue}if(u===";"){t.push({type:"SEMICOLON",pos:c});continue}if(u==="("){t.push({type:"LPAREN",pos:c});continue}if(u===")"){t.push({type:"RPAREN",pos:c});continue}if(u==="["){t.push({type:"LBRACKET",pos:c});continue}if(u==="]"){t.push({type:"RBRACKET",pos:c});continue}if(u==="{"){t.push({type:"LBRACE",pos:c});continue}if(u==="}"){t.push({type:"RBRACE",pos:c});continue}if(u==="?"){t.push({type:"QUESTION",pos:c});continue}if(u==="+"){t.push({type:"PLUS",pos:c});continue}if(u==="-"){t.push({type:"MINUS",pos:c});continue}if(u==="*"){t.push({type:"STAR",pos:c});continue}if(u==="/"){t.push({type:"SLASH",pos:c});continue}if(u==="%"){t.push({type:"PERCENT",pos:c});continue}if(u==="<"){t.push({type:"LT",pos:c});continue}if(u===">"){t.push({type:"GT",pos:c});continue}if(o(u)){let f=u;for(;!i()&&(o(r())||r()==="."||r()==="e"||r()==="E");)(r()==="e"||r()==="E")&&(e[n+1]==="+"||e[n+1]==="-")&&(f+=s()),f+=s();t.push({type:"NUMBER",value:Number(f),pos:c});continue}if(u==='"'){let f="",d=0;for(;!i();){let p=r();if(d===0&&p==='"')break;if(d===0&&p==="\\"){if(s(),i())break;let h=s();switch(h){case"n":f+=`
592
592
  `;break;case"r":f+="\r";break;case"t":f+=" ";break;case"\\":f+="\\";break;case'"':f+='"';break;case"(":f+="\\(",d=1;break;default:f+=h}continue}if(d>0){if(p==='"'){for(f+=s();!i();){let h=r();if(h==="\\"){f+=s(),i()||(f+=s());continue}if(f+=s(),h==='"')break}continue}p==="("?d++:p===")"&&d--,f+=s();continue}f+=s()}i()||s(),t.push({type:"STRING",value:f,pos:c});continue}if(a(u)||u==="$"||u==="@"){let f=u;for(;!i()&&l(r());)f+=s();let d=q2.get(f);d?t.push({type:d,value:f,pos:c}):t.push({type:"IDENT",value:f,pos:c});continue}throw new Error(`Unexpected character '${u}' at position ${c}`)}}return t.push({type:"EOF",pos:n}),t}function Z2(e,t={}){let n=t.maxDepth??256,r=t.maxTokens??1e5,s=t.maxSourceLength??1048576;if(e.length>s)throw new Error(`query source length limit exceeded (${s} characters)`);if(e.length+1>r)throw new Error(`query token limit exceeded (${r})`);let i=G2(e);return new Hf(i,n).parse()}var q2,pl,Hf,K2=F(()=>{"use strict";q2=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"]]),pl=new Set(q2.values());Hf=class e{maxDepth;tokens;pos=0;depth;constructor(t,n,r=0){this.maxDepth=n,this.tokens=t,this.depth=r}peek(t=0){return this.tokens[this.pos+t]??{type:"EOF",pos:-1}}advance(){return this.tokens[this.pos++]}check(t){return this.peek().type===t}match(...t){for(let n of t)if(this.check(n))return this.advance();return null}expect(t,n){if(!this.check(t))throw new Error(`${n} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}withDepth(t){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return t()}finally{this.depth--}}isFieldNameAfterDot(t=0){let n=this.peek(t),r=this.peek(t+1);return r.type==="STRING"?!0:r.type==="IDENT"||pl.has(r.type)?r.pos===n.pos+1:!1}isIdentLike(){let t=this.peek().type;return t==="IDENT"||pl.has(t)}consumeFieldNameAfterDot(t){let n=this.peek();return n.type==="STRING"?this.advance().value:(n.type==="IDENT"||pl.has(n.type))&&n.pos===t.pos+1?this.advance().value:null}parse(){let t=this.parseExpr();if(!this.check("EOF"))throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return t}parseExpr(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePipe()}finally{this.depth--}}parsePattern(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parsePatternInner()}finally{this.depth--}}parsePatternInner(){if(this.match("LBRACKET")){let r=[];if(!this.check("RBRACKET"))for(r.push(this.parsePattern());this.match("COMMA")&&!this.check("RBRACKET");)r.push(this.parsePattern());return this.expect("RBRACKET","Expected ']' after array pattern"),{type:"array",elements:r}}if(this.match("LBRACE")){let r=[];if(!this.check("RBRACE"))for(r.push(this.parsePatternField());this.match("COMMA")&&!this.check("RBRACE");)r.push(this.parsePatternField());return this.expect("RBRACE","Expected '}' after object pattern"),{type:"object",fields:r}}let t=this.expect("IDENT","Expected variable name in pattern"),n=t.value;if(!n.startsWith("$"))throw new Error(`Variable name must start with $ at position ${t.pos}`);return{type:"var",name:n}}parsePatternField(){if(this.match("LPAREN")){let n=this.parseExpr();this.expect("RPAREN","Expected ')' after computed key"),this.expect("COLON","Expected ':' after computed key");let r=this.parsePattern();return{key:n,pattern:r}}let t=this.peek();if(t.type==="IDENT"||pl.has(t.type)){let n=t.value;if(n.startsWith("$")){if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n.slice(1),pattern:r,keyVar:n}}return{key:n.slice(1),pattern:{type:"var",name:n}}}if(this.advance(),this.match("COLON")){let r=this.parsePattern();return{key:n,pattern:r}}return{key:n,pattern:{type:"var",name:`$${n}`}}}throw new Error(`Expected field name in object pattern at position ${t.pos}`)}parsePipe(){let t=this.parseComma();for(;this.match("PIPE");){let n=this.parseComma();t={type:"Pipe",left:t,right:n}}return t}parseComma(){let t=this.parseVarBind();for(;this.match("COMMA");){let n=this.parseVarBind();t={type:"Comma",left:t,right:n}}return t}parseVarBind(){let t=this.parseUpdate();if(this.match("AS")){let n=this.parsePattern(),r=[];for(;this.check("QUESTION")&&this.peekAhead(1)?.type==="ALT";)this.advance(),this.advance(),r.push(this.parsePattern());this.expect("PIPE","Expected '|' after variable binding");let s=this.parseExpr();return n.type==="var"&&r.length===0?{type:"VarBind",name:n.name,value:t,body:s}:{type:"VarBind",name:n.type==="var"?n.name:"",value:t,body:s,pattern:n.type!=="var"?n:void 0,alternatives:r.length>0?r:void 0}}return t}peekAhead(t){let n=this.pos+t;return n<this.tokens.length?this.tokens[n]:void 0}parseUpdate(){let t=this.parseAlt(),n=new Map([["ASSIGN","="],["UPDATE_ADD","+="],["UPDATE_SUB","-="],["UPDATE_MUL","*="],["UPDATE_DIV","/="],["UPDATE_MOD","%="],["UPDATE_ALT","//="],["UPDATE_PIPE","|="]]),r=this.match("ASSIGN","UPDATE_ADD","UPDATE_SUB","UPDATE_MUL","UPDATE_DIV","UPDATE_MOD","UPDATE_ALT","UPDATE_PIPE");if(r){let s=this.withDepth(()=>this.parseVarBind()),i=n.get(r.type);if(i)return{type:"UpdateOp",op:i,path:t,value:s}}return t}parseAlt(){let t=this.parseOr();for(;this.match("ALT");){let n=this.parseOr();t={type:"BinaryOp",op:"//",left:t,right:n}}return t}parseOr(){let t=this.parseAnd();for(;this.match("OR");){let n=this.parseAnd();t={type:"BinaryOp",op:"or",left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.match("AND");){let n=this.parseNot();t={type:"BinaryOp",op:"and",left:t,right:n}}return t}parseNot(){return this.parseComparison()}parseComparison(){let t=this.parseAddSub(),n=new Map([["EQ","=="],["NE","!="],["LT","<"],["LE","<="],["GT",">"],["GE",">="]]),r=this.match("EQ","NE","LT","LE","GT","GE");if(r){let s=n.get(r.type);if(s){let i=this.parseAddSub();t={type:"BinaryOp",op:s,left:t,right:i}}}return t}parseAddSub(){let t=this.parseMulDiv();for(;;)if(this.match("PLUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"+",left:t,right:n}}else if(this.match("MINUS")){let n=this.parseMulDiv();t={type:"BinaryOp",op:"-",left:t,right:n}}else break;return t}parseMulDiv(){let t=this.parseUnary();for(;;)if(this.match("STAR")){let n=this.parseUnary();t={type:"BinaryOp",op:"*",left:t,right:n}}else if(this.match("SLASH")){let n=this.parseUnary();t={type:"BinaryOp",op:"/",left:t,right:n}}else if(this.match("PERCENT")){let n=this.parseUnary();t={type:"BinaryOp",op:"%",left:t,right:n}}else break;return t}parseUnary(){let t=0;for(;this.match("MINUS");)if(t++,this.depth+t>this.maxDepth)throw new Error(`query parse depth limit exceeded (${this.maxDepth})`);let n=this.parsePostfix();for(;t-- >0;)n={type:"UnaryOp",op:"-",operand:n};return n}parsePostfix(){let t=this.parsePrimary();for(;;)if(this.match("QUESTION"))t={type:"Optional",expr:t};else if(this.check("DOT")&&this.isFieldNameAfterDot())this.advance(),t={type:"Field",name:this.advance().value,base:t};else if(this.check("LBRACKET"))if(this.advance(),this.match("RBRACKET"))t={type:"Iterate",base:t};else if(this.check("COLON")){this.advance();let n=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",end:n,base:t}}else{let n=this.parseExpr();if(this.match("COLON")){let r=this.check("RBRACKET")?void 0:this.parseExpr();this.expect("RBRACKET","Expected ']'"),t={type:"Slice",start:n,end:r,base:t}}else this.expect("RBRACKET","Expected ']'"),t={type:"Index",index:n,base:t}}else break;return t}parsePrimary(){if(this.match("DOTDOT"))return{type:"Recurse"};if(this.check("DOT")){let t=this.advance();if(this.check("LBRACKET")){if(this.advance(),this.match("RBRACKET"))return{type:"Iterate"};if(this.check("COLON")){this.advance();let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",end:s}}let r=this.parseExpr();if(this.match("COLON")){let s=this.check("RBRACKET")?void 0:this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Slice",start:r,end:s}}return this.expect("RBRACKET","Expected ']'"),{type:"Index",index:r}}let n=this.consumeFieldNameAfterDot(t);return n!==null?{type:"Field",name:n}:{type:"Identity"}}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 n=this.advance().value;return n.includes("\\(")?this.parseStringInterpolation(n):{type:"Literal",value:n}}if(this.match("LBRACKET")){if(this.match("RBRACKET"))return{type:"Array"};let t=this.parseExpr();return this.expect("RBRACKET","Expected ']'"),{type:"Array",elements:t}}if(this.match("LBRACE"))return this.parseObjectConstruction();if(this.match("LPAREN")){let t=this.parseExpr();return this.expect("RPAREN","Expected ')'"),{type:"Paren",expr:t}}if(this.match("IF"))return this.parseIf();if(this.match("TRY")){let t=this.withDepth(()=>this.parsePostfix()),n;return this.match("CATCH")&&(n=this.withDepth(()=>this.parsePostfix())),{type:"Try",body:t,catch:n}}if(this.match("REDUCE")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after reduce expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr();this.expect("RPAREN","Expected ')' after update expression");let i=n.type==="var"?n.name:"";return{type:"Reduce",expr:t,varName:i,init:r,update:s,pattern:n.type!=="var"?n:void 0}}if(this.match("FOREACH")){let t=this.parseAddSub();this.expect("AS","Expected 'as' after foreach expression");let n=this.parsePattern();this.expect("LPAREN","Expected '(' after variable");let r=this.parseExpr();this.expect("SEMICOLON","Expected ';' after init expression");let s=this.parseExpr(),i;this.match("SEMICOLON")&&(i=this.parseExpr()),this.expect("RPAREN","Expected ')' after expressions");let o=n.type==="var"?n.name:"";return{type:"Foreach",expr:t,varName:o,init:r,update:s,extract:i,pattern:n.type!=="var"?n:void 0}}if(this.match("LABEL")){let t=this.expect("IDENT","Expected label name (e.g., $out)"),n=t.value;if(!n.startsWith("$"))throw new Error(`Label name must start with $ at position ${t.pos}`);this.expect("PIPE","Expected '|' after label name");let r=this.parseExpr();return{type:"Label",name:n,body:r}}if(this.match("BREAK")){let t=this.expect("IDENT","Expected label name to break to"),n=t.value;if(!n.startsWith("$"))throw new Error(`Break label must start with $ at position ${t.pos}`);return{type:"Break",name:n}}if(this.match("DEF")){let n=this.expect("IDENT","Expected function name after def").value,r=[];if(this.match("LPAREN")){if(!this.check("RPAREN")){let o=this.expect("IDENT","Expected parameter name");for(r.push(o.value);this.match("SEMICOLON");){let a=this.expect("IDENT","Expected parameter name");r.push(a.value)}}this.expect("RPAREN","Expected ')' after parameters")}this.expect("COLON","Expected ':' after function name");let s=this.parseExpr();this.expect("SEMICOLON","Expected ';' after function body");let i=this.parseExpr();return{type:"Def",name:n,params:r,funcBody:s,body:i}}if(this.match("NOT"))return{type:"Call",name:"not",args:[]};if(this.check("IDENT")){let n=this.advance().value;if(n.startsWith("$"))return{type:"VarRef",name:n};if(this.match("LPAREN")){let r=[];if(!this.check("RPAREN"))for(r.push(this.parseExpr());this.match("SEMICOLON");)r.push(this.parseExpr());return this.expect("RPAREN","Expected ')'"),{type:"Call",name:n,args:r}}return{type:"Call",name:n,args:[]}}throw new Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){if(this.depth++,this.depth>this.maxDepth)throw this.depth--,new Error(`query parse depth limit exceeded (${this.maxDepth})`);try{return this.parseObjectConstructionInner()}finally{this.depth--}}parseObjectConstructionInner(){let t=[];if(!this.check("RBRACE"))do{let n,r;if(this.match("LPAREN"))n=this.parseExpr(),this.expect("RPAREN","Expected ')'"),this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else if(this.isIdentLike()){let s=this.advance().value;this.match("COLON")?(n=s,r=this.parseObjectValue()):(n=s,r={type:"Field",name:s})}else if(this.check("STRING"))n=this.advance().value,this.expect("COLON","Expected ':'"),r=this.parseObjectValue();else throw new Error(`Expected object key at position ${this.peek().pos}`);t.push({key:n,value:r})}while(this.match("COMMA"));return this.expect("RBRACE","Expected '}'"),{type:"Object",entries:t}}parseObjectValue(){let t=this.parseVarBind();for(;this.match("PIPE");){let n=this.parseVarBind();t={type:"Pipe",left:t,right:n}}return t}parseIf(){let t=this.parseExpr();this.expect("THEN","Expected 'then'");let n=this.parseExpr(),r=[];for(;this.match("ELIF");){let i=this.parseExpr();this.expect("THEN","Expected 'then' after elif");let o=this.parseExpr();r.push({cond:i,then:o})}let s;return this.match("ELSE")&&(s=this.parseExpr()),this.expect("END","Expected 'end'"),{type:"Cond",cond:t,then:n,elifs:r,else:s}}parseStringInterpolation(t){let n=[],r="",s=0;for(;s<t.length;)if(t[s]==="\\"&&t[s+1]==="("){r&&(n.push(r),r=""),s+=2;let i=1,o="";for(;s<t.length&&i>0;){let c=t[s];if(c==='"'){for(o+=c,s++;s<t.length;){let u=t[s];if(u==="\\"){o+=u,s++,s<t.length&&(o+=t[s],s++);continue}if(o+=u,s++,u==='"')break}continue}c==="("?i++:c===")"&&i--,i>0&&(o+=c),s++}let a=G2(o),l=new e(a,this.maxDepth,this.depth);n.push(l.parse())}else r+=t[s],s++;return r&&n.push(r),{type:"StringInterp",parts:n}}}});var X2=F(()=>{"use strict";Bf();K2()});function Y2(e,t,n={}){let r=new $e(t,"query JSON output",()=>new C(`output size limit exceeded (${t} bytes)`,n.limitKind??"output_size"));return Vf(r,e,n,0),r.build()}function Vf(e,t,n,r){if(t==null){e.append("null");return}if(typeof t=="boolean"){e.append(String(t));return}if(typeof t=="number"){e.append(Number.isFinite(t)?String(t):"null");return}if(typeof t=="string"){n.raw&&r===0?e.append(t):Q2(e,t);return}let s=n.compact??!1,i=n.indent??2,o=n.useTab?" ":" ".repeat(i);if(Array.isArray(t)){e.append("[");for(let l=0;l<t.length;l++)e.append(s?l===0?"":",":l===0?`
@@ -601,8 +601,8 @@ ${a} director${a===1?"y":"ies"}`,r.directoriesOnly||(i+=`, ${l} file${l===1?"":"
601
601
  `,W);for(;D!==-1;)I(E,ne(L.slice(W,D),S,A)),W=D+1,D=L.indexOf(`
602
602
  `,W);B=L.slice(W)}B!==""&&I(E,ne(B,S,A))}else if(a){let B=[];for(let{content:U}of x){let L=U.trim();L&&I(B,_o(L,w))}E=ne(B,S,A)}else for(let{content:B}of x){let U=B.trim();if(!U)continue;let L=_o(U,w);for(let W of L)I(E,ne(W,S,A))}let R=c?"":`
603
603
  `,N=Math.min(t.limits.maxStringLength,t.limits.maxOutputSize),$=[],T=0;for(let B of E){let U=$.length>0?R.length:0,L=c?0:1,W=N-T-U-L;if(W<0)throw new C(`output size limit exceeded (${N} bytes)`,"string_length");if(Vr(B,t.limits.maxQueryDepth+1)>t.limits.maxQueryDepth)throw new C(`query depth limit exceeded (${t.limits.maxQueryDepth})`,"recursion");let D=Y2(B,W,{compact:i,raw:r,sortKeys:u,useTab:f,limitKind:"string_length"}),Q=M(D);if(T+U+Q+L>N)throw new C(`output size limit exceeded (${N} bytes)`,"string_length");T+=U+Q,$.push(D)}let _=$.join(R),z=o&&(E.length===0||E.every(B=>B==null||B===!1))?1:0;return{stdout:_?c?_:`${_}
604
- `:"",stderr:"",exitCode:z}}catch(S){if(S instanceof Ce)throw S;if(S instanceof C)return{stdout:"",stderr:`jq: ${Ge(S.message)}
605
- `,exitCode:C.EXIT_CODE};let E=Ge(S.message);return E.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${E}
604
+ `:"",stderr:"",exitCode:z}}catch(S){if(S instanceof Ce)throw S;if(S instanceof C)return{stdout:"",stderr:`jq: ${Ze(S.message)}
605
+ `,exitCode:C.EXIT_CODE};let E=Ze(S.message);return E.includes("Unknown function")?{stdout:"",stderr:`jq: error: ${E}
606
606
  `,exitCode:3}:{stdout:"",stderr:`jq: parse error: ${E}
607
607
  `,exitCode:5}}}},BC={name:"jq",flags:[{flag:"-R",type:"boolean"},{flag:"-r",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-e",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"--tab",type:"boolean"}],stdinType:"json",needsArgs:!0}});var iy={};ae(iy,{base64Command:()=>WC,flagsForFuzzing:()=>jC});function Kn(e,t,n,r){if(e>t)throw new C(`base64: ${n} limit exceeded (${t} bytes)`,r)}function ny(e){let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return t.join("")}function ry(e){if(e.length===0)return 0;let t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.max(0,Math.ceil(e.length/4)*3-t)}async function sy(e,t,n){let r=Math.min(e.limits.maxInputBytes,e.limits.maxStringLength),s=e.stdin;if(t.length===0||t.length===1&&t[0]==="-")return Kn(s.length,r,"input size","string_length"),{ok:!0,data:Uint8Array.from(s,c=>c.charCodeAt(0))};let i=[],o=0;for(let c of t){if(c==="-"){Kn(o+s.length,r,"input size","string_length"),i.push(Uint8Array.from(s,u=>u.charCodeAt(0))),o+=s.length;continue}try{let u=e.fs.resolvePath(e.cwd,c),f=await e.fs.stat(u);Kn(o+f.size,r,"input size","string_length");let d=await e.fs.readFileBuffer(u);Kn(o+d.length,r,"input size","string_length"),ka(e,d.length,n),i.push(d),o+=d.length}catch(u){return ge(u),{ok:!1,error:{stdout:"",stderr:`${n}: ${c}: No such file or directory
608
608
  `,exitCode:1}}}}let a=new Uint8Array(o),l=0;for(let c of i)a.set(c,l),l+=c.length;return{ok:!0,data:a}}var UC,zC,WC,jC,oy=F(()=>{"use strict";ue();vt();G();Nt();ts();de();UC={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},zC={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};WC={name:"base64",async execute(e,t){if(Z(e))return q(UC);let n=Pe("base64",e,zC);if(!n.ok)return n.error;let r=n.result.flags.decode,s=n.result.flags.wrap,i=n.result.positional;if(!Number.isSafeInteger(s)||s<0)return{stdout:"",stderr:`base64: invalid wrap size
@@ -675,13 +675,13 @@ DURATION is a number with optional suffix:
675
675
  `,exitCode:1};r=e[o],o++}else if(h==="-a"||h==="--append")s=!0,o++;else if(h==="-v"||h==="--verbose")n=`Command being timed: %C
676
676
  Elapsed (wall clock) time: %e seconds
677
677
  Maximum resident set size (kbytes): %M`,o++;else if(h==="-p"||h==="--portability")i=!0,o++;else if(h==="--"){o++;break}else if(h.startsWith("-"))o++;else break}let a=e.slice(o);if(a.length===0)return{stdout:"",stderr:"",exitCode:0};let l=Bi(),c=a.join(" "),u;try{if(!t.exec)return{stdout:"",stderr:`time: exec not available
678
- `,exitCode:1};u=await t.exec($n([a[0]]),{env:Vt(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a.slice(1)})}catch(h){u={stdout:"",stderr:`time: ${Ge(h.message)}
678
+ `,exitCode:1};u=await t.exec($n([a[0]]),{env:Vt(t.env),cwd:t.cwd,stdin:t.stdin,stdinKind:"bytes",signal:t.signal,args:a.slice(1)})}catch(h){u={stdout:"",stderr:`time: ${Ze(h.message)}
679
679
  `,exitCode:127}}let d=(Bi()-l)/1e3,p;if(i?p=`real ${d.toFixed(2)}
680
680
  user 0.00
681
681
  sys 0.00
682
682
  `:(p=n.replace(/%e/g,d.toFixed(2)).replace(/%E/g,ck(d)).replace(/%M/g,"0").replace(/%S/g,"0.00").replace(/%U/g,"0.00").replace(/%P/g,"0%").replace(/%C/g,c),p.endsWith(`
683
683
  `)||(p+=`
684
- `)),r)try{let h=t.fs.resolvePath(t.cwd,r);if(s&&await t.fs.exists(h)){let m=await t.fs.readFile(h);await t.fs.writeFile(h,m+p)}else await t.fs.writeFile(h,p)}catch(h){let m=Ge(h.message);return{stdout:u.stdout,stderr:u.stderr+`time: cannot write to '${r}': ${m}
684
+ `)),r)try{let h=t.fs.resolvePath(t.cwd,r);if(s&&await t.fs.exists(h)){let m=await t.fs.readFile(h);await t.fs.writeFile(h,m+p)}else await t.fs.writeFile(h,p)}catch(h){let m=Ze(h.message);return{stdout:u.stdout,stderr:u.stderr+`time: cannot write to '${r}': ${m}
685
685
  `,exitCode:u.exitCode}}else u={...u,stderr:u.stderr+p};return u}};uk={name:"time",flags:[{flag:"-p",type:"boolean"}],needsArgs:!0}});var Fy={};ae(Fy,{flagsForFuzzing:()=>dk,seqCommand:()=>fk});var fk,dk,My=F(()=>{"use strict";St();ue();G();fk={name:"seq",async execute(e,t){let n=`
686
686
  `,r=!1,s=[],i=0;for(;i<e.length;){let w=e[i];if(w==="-s"&&i+1<e.length){n=e[i+1],i+=2;continue}if(w==="-w"){r=!0,i++;continue}if(w==="--"){i++;break}if(w.startsWith("-")&&w!=="-"){if(w.startsWith("-s")&&w.length>2){n=w.slice(2),i++;continue}if((w==="-ws"||w==="-sw")&&(r=!0,i+1<e.length)){n=e[i+1],i+=2;continue}}s.push(w),i++}for(;i<e.length;)s.push(e[i]),i++;if(s.length===0)return{stdout:"",stderr:`seq: missing operand
687
687
  `,exitCode:1};let o=1,a=1,l;if(s.length===1?l=parseFloat(s[0]):s.length===2?(o=parseFloat(s[0]),l=parseFloat(s[1])):(o=parseFloat(s[0]),a=parseFloat(s[1]),l=parseFloat(s[2])),!Number.isFinite(o)||!Number.isFinite(a)||!Number.isFinite(l))return{stdout:"",stderr:`seq: invalid floating point argument: '${s.find(x=>!Number.isFinite(parseFloat(x)))}'
@@ -689,7 +689,7 @@ sys 0.00
689
689
  `,exitCode:1};let c=[],u=w=>{let x=String(w),S=x.indexOf(".");return S===-1?0:x.length-S-1},f=Math.max(u(o),u(a),u(l)),d=Math.min(t.limits.maxLoopIterations,t.limits.maxArrayElements),p=Math.min(t.limits.maxOutputSize,t.limits.maxStringLength),h=M(n),m=0,g=0,b=w=>{if(g>=d)throw new C(`seq: iteration limit exceeded (${d})`,"iterations");let x=Rs(Rs(m,c.length>0?h:0,"seq"),Rs(M(w),1,"seq"),"seq");if(x>p)throw new C(`seq: output size limit exceeded (${p} bytes)`,"output_size");m=x-1,c.push(w),g++};if(a>0)for(let w=o;w<=l+1e-10;w+=a)b(f>0?w.toFixed(f):String(Math.round(w)));else for(let w=o;w>=l-1e-10;w+=a)b(f>0?w.toFixed(f):String(Math.round(w)));if(r&&c.length>0){let w=0;for(let E of c)w=Math.max(w,E.startsWith("-")?E.length-1:E.length);let x=c.reduce((E,A)=>Rs(E,w+(A.startsWith("-")?1:0),"seq"),0);if(Rs(Rs(x,u1(h,Math.max(0,c.length-1),"seq"),"seq"),1,"seq")>p)throw new C(`seq: output size limit exceeded (${p} bytes)`,"output_size");for(let E=0;E<c.length;E++){let A=c[E].startsWith("-"),R=(A?c[E].slice(1):c[E]).padStart(w,"0");c[E]=A?`-${R}`:R}}let y=Bn(c,n,p-1,"seq");return{stdout:y?`${y}
690
690
  `:"",stderr:"",exitCode:0}}},dk={name:"seq",flags:[{flag:"-s",type:"value",valueHint:"string"},{flag:"-w",type:"boolean"}],needsArgs:!0}});var _y={};ae(_y,{exprCommand:()=>pk,flagsForFuzzing:()=>mk});function hk(e,t){if(e.length===1)return e[0];let n=0;function r(){let f=s();for(;n<e.length&&e[n]==="|";){n++;let d=s();if(f!=="0"&&f!=="")return f;f=d}return f}function s(){let f=i();for(;n<e.length&&e[n]==="&";){n++;let d=i();(f==="0"||f===""||d==="0"||d==="")&&(f="0")}return f}function i(){let f=o();for(;n<e.length;){let d=e[n];if(["=","!=","<",">","<=",">="].includes(d)){n++;let p=o(),h=parseInt(f,10),m=parseInt(p,10),g=!Number.isNaN(h)&&!Number.isNaN(m),b;d==="="?b=g?h===m:f===p:d==="!="?b=g?h!==m:f!==p:d==="<"?b=g?h<m:f<p:d===">"?b=g?h>m:f>p:d==="<="?b=g?h<=m:f<=p:b=g?h>=m:f>=p,f=b?"1":"0"}else break}return f}function o(){let f=a();for(;n<e.length;){let d=e[n];if(d==="+"||d==="-"){n++;let p=a(),h=parseInt(f,10),m=parseInt(p,10);if(Number.isNaN(h)||Number.isNaN(m))throw new Error("non-integer argument");f=String(d==="+"?h+m:h-m)}else break}return f}function a(){let f=l();for(;n<e.length;){let d=e[n];if(d==="*"||d==="/"||d==="%"){n++;let p=l(),h=parseInt(f,10),m=parseInt(p,10);if(Number.isNaN(h)||Number.isNaN(m))throw new Error("non-integer argument");if((d==="/"||d==="%")&&m===0)throw new Error("division by zero");d==="*"?f=String(h*m):d==="/"?f=String(Math.trunc(h/m)):f=String(h%m)}else break}return f}function l(){let f=c();for(;n<e.length&&e[n]===":";){n++;let d=c(),h=oe(`^${d}`).match(f);h?f=h[1]!==void 0?h[1]:String(h[0].length):f="0"}return f}function c(){if(n>=e.length)throw new Error("syntax error");let f=e[n];if(f==="match"){n++;let d=c(),p=c(),m=oe(p).match(d);return m?m[1]!==void 0?m[1]:String(m[0].length):"0"}if(f==="substr"){n++;let d=c(),p=parseInt(c(),10),h=parseInt(c(),10);if(Number.isNaN(p)||Number.isNaN(h))throw new Error("non-integer argument");return d.substring(p-1,p-1+h)}if(f==="index"){n++;let d=c(),p=c();t(p.length+d.length);let h=new Set;for(let m=0;m<p.length;m++)h.add(p[m]);for(let m=0;m<d.length;m++)if(h.has(d[m]))return String(m+1);return"0"}if(f==="length"){n++;let d=c();return String(d.length)}if(f==="("){n++;let d=r();if(n>=e.length||e[n]!==")")throw new Error("syntax error");return n++,d}return n++,f}let u=r();if(n!==e.length)throw new Error("syntax error");return u}var pk,mk,By=F(()=>{"use strict";vt();Tn();mt();pk={name:"expr",async execute(e,t){if(e.length===0)return{stdout:"",stderr:`expr: missing operand
691
691
  `,exitCode:2};try{let n=hk(e,s=>t.executionScope?.consumeWork(s,"expr index")),r=n==="0"||n===""?1:0;return{stdout:`${n}
692
- `,stderr:"",exitCode:r}}catch(n){return ge(n),{stdout:"",stderr:`expr: ${Ge(n.message)}
692
+ `,stderr:"",exitCode:r}}catch(n){return ge(n),{stdout:"",stderr:`expr: ${Ze(n.message)}
693
693
  `,exitCode:2}}}};mk={name:"expr",flags:[],needsArgs:!0}});function yk(e){function t(p,h){return p<<h|p>>>32-h}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],s=e.length*8,i=(e.length%64<56?56:120)-e.length%64,o=new Uint8Array(e.length+i+8);o.set(e),o[e.length]=128;let a=new DataView(o.buffer);a.setUint32(o.length-8,s>>>0,!0),a.setUint32(o.length-4,Math.floor(s/4294967296),!0);let l=1732584193,c=4023233417,u=2562383102,f=271733878;for(let p=0;p<o.length;p+=64){let h=new Uint32Array(16);for(let w=0;w<16;w++)h[w]=a.getUint32(p+w*4,!0);let m=l,g=c,b=u,y=f;for(let w=0;w<64;w++){let x,S;w<16?(x=g&b|~g&y,S=w):w<32?(x=y&g|~y&b,S=(5*w+1)%16):w<48?(x=g^b^y,S=(3*w+5)%16):(x=b^(g|~y),S=7*w%16),x=x+m+n[w]+h[S]>>>0,m=y,y=b,b=g,g=g+t(x,r[w])>>>0}l=l+m>>>0,c=c+g>>>0,u=u+b>>>0,f=f+y>>>0}let d=new Uint8Array(16);return new DataView(d.buffer).setUint32(0,l,!0),new DataView(d.buffer).setUint32(4,c,!0),new DataView(d.buffer).setUint32(8,u,!0),new DataView(d.buffer).setUint32(12,f,!0),Array.from(d).map(p=>p.toString(16).padStart(2,"0")).join("")}async function Uy(e,t){if(e==="md5")return yk(t);let n=gk.get(e);if(!n)throw new Error(`Unknown algorithm: ${e}`);let r=await globalThis.crypto.subtle.digest(n,new Uint8Array(t).buffer);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}function Ui(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(s,i){if(Z(s))return q(r);let o=!1,a=[];for(let f of s)if(f==="-c"||f==="--check")o=!0;else if(!(f==="-b"||f==="-t"||f==="--binary"||f==="--text")){if(f.startsWith("-")&&f!=="-")return se(e,f);a.push(f)}a.length===0&&a.push("-");let l=async f=>{if(f==="-")return Uint8Array.from(i.stdin,d=>d.charCodeAt(0));try{return await i.fs.readFileBuffer(i.fs.resolvePath(i.cwd,f))}catch{return null}};if(o){let f=0,d="";for(let p of a){let h=p==="-"?fe(i.stdin):await i.fs.readFile(i.fs.resolvePath(i.cwd,p)).catch(()=>null);if(h===null)return{stdout:"",stderr:`${e}: ${p}: No such file or directory
694
694
  `,exitCode:1};for(let m of h.split(`
695
695
  `)){let g=m.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!g)continue;let[,b,y]=g,w=await l(y);if(w===null){d+=`${y}: FAILED open or read
@@ -806,8 +806,8 @@ ${ON(n)}\r
806
806
  `:"",g=r.dumpHeader==="-"?f:"";return{stdout:g,stderr:m,exitCode:22,stdoutKind:g?"bytes":void 0}}let d=!!(r.outputFile||r.useRemoteName),h=d&&!r.verbose?"":_N(r,c,s);if(d){let m=r.outputFile||Ow(s),g=t.fs.resolvePath(t.cwd,m);if(await t.fs.writeFile(g,r.headOnly?"":c.body),r.verbose?h=(r.dumpHeader==="-"?f:"")+h:r.dumpHeader==="-"?h=f:h="",r.writeOut){let b=Sd(r.writeOut,{status:c.status,headers:c.headers,url:c.url,bodyLength:c.body.byteLength});r.verbose?h+=b:r.dumpHeader==="-"?h=f+b:h=b}}else r.dumpHeader==="-"&&(h=f+h);return{stdout:h,stderr:"",exitCode:0,stdoutKind:"bytes"}}catch(i){let o=dt(i),a=1;return o.includes("Network access denied")?a=7:o.includes("HTTP method")&&o.includes("not allowed")?a=3:o.includes("Redirect target not in allow-list")||o.includes("Too many redirects")?a=47:o.includes("aborted")&&(a=28),{stdout:"",stderr:!r.silent||r.showError?`curl: (${a}) ${o}
807
807
  `:"",exitCode:a}}}}});Os();mi();kt();mi();mn();var Ad=[{name:"echo",load:async()=>(await Promise.resolve().then(()=>(e1(),Jh))).echoCommand},{name:"cat",load:async()=>(await Promise.resolve().then(()=>(n1(),t1))).catCommand},{name:"printf",load:async()=>(await Promise.resolve().then(()=>(l1(),a1))).printfCommand},{name:"ls",load:async()=>(await Promise.resolve().then(()=>(b1(),w1))).lsCommand},{name:"mkdir",load:async()=>(await Promise.resolve().then(()=>(E1(),x1))).mkdirCommand},{name:"mktemp",load:async()=>(await Promise.resolve().then(()=>(N1(),v1))).mktempCommand,handlesOwnVersion:!0},{name:"rmdir",load:async()=>(await Promise.resolve().then(()=>($1(),T1))).rmdirCommand},{name:"touch",load:async()=>(await Promise.resolve().then(()=>(P1(),R1))).touchCommand},{name:"rm",load:async()=>(await Promise.resolve().then(()=>(L1(),D1))).rmCommand},{name:"cp",load:async()=>(await Promise.resolve().then(()=>(M1(),F1))).cpCommand},{name:"mv",load:async()=>(await Promise.resolve().then(()=>(B1(),_1))).mvCommand},{name:"ln",load:async()=>(await Promise.resolve().then(()=>(z1(),U1))).lnCommand},{name:"chmod",load:async()=>(await Promise.resolve().then(()=>(j1(),W1))).chmodCommand},{name:"pwd",load:async()=>(await Promise.resolve().then(()=>(V1(),H1))).pwdCommand},{name:"readlink",load:async()=>(await Promise.resolve().then(()=>(G1(),q1))).readlinkCommand},{name:"head",load:async()=>(await Promise.resolve().then(()=>(Q1(),X1))).headCommand},{name:"tail",load:async()=>(await Promise.resolve().then(()=>(J1(),Y1))).tailCommand},{name:"wc",load:async()=>(await Promise.resolve().then(()=>(nm(),tm))).wcCommand},{name:"stat",load:async()=>(await Promise.resolve().then(()=>(sm(),rm))).statCommand},{name:"grep",load:async()=>(await Promise.resolve().then(()=>(Ba(),_a))).grepCommand},{name:"fgrep",load:async()=>(await Promise.resolve().then(()=>(Ba(),_a))).fgrepCommand},{name:"egrep",load:async()=>(await Promise.resolve().then(()=>(Ba(),_a))).egrepCommand},{name:"rg",load:async()=>(await Promise.resolve().then(()=>(t0(),e0))).rgCommand,handlesOwnVersion:!0},{name:"sed",load:async()=>(await Promise.resolve().then(()=>(p0(),d0))).sedCommand},{name:"awk",load:async()=>(await Promise.resolve().then(()=>(G0(),q0))).awkCommand2},{name:"sort",load:async()=>(await Promise.resolve().then(()=>(rg(),ng))).sortCommand},{name:"uniq",load:async()=>(await Promise.resolve().then(()=>(ig(),sg))).uniqCommand},{name:"comm",load:async()=>(await Promise.resolve().then(()=>(ag(),og))).commCommand},{name:"cut",load:async()=>(await Promise.resolve().then(()=>(cg(),lg))).cutCommand},{name:"paste",load:async()=>(await Promise.resolve().then(()=>(dg(),fg))).pasteCommand},{name:"tr",load:async()=>(await Promise.resolve().then(()=>(mg(),hg))).trCommand},{name:"rev",load:async()=>(await Promise.resolve().then(()=>(yg(),gg))).rev},{name:"nl",load:async()=>(await Promise.resolve().then(()=>(xg(),bg))).nl},{name:"fold",load:async()=>(await Promise.resolve().then(()=>(Ag(),Sg))).fold},{name:"expand",load:async()=>(await Promise.resolve().then(()=>(vg(),kg))).expand},{name:"unexpand",load:async()=>(await Promise.resolve().then(()=>(Tg(),Og))).unexpand},{name:"strings",load:async()=>(await Promise.resolve().then(()=>(Dg(),Pg))).strings},{name:"split",load:async()=>(await Promise.resolve().then(()=>(_g(),Mg))).split},{name:"column",load:async()=>(await Promise.resolve().then(()=>(zg(),Ug))).column},{name:"join",load:async()=>(await Promise.resolve().then(()=>(jg(),Wg))).join},{name:"tee",load:async()=>(await Promise.resolve().then(()=>(Vg(),Hg))).teeCommand},{name:"find",load:async()=>(await Promise.resolve().then(()=>(Jg(),Yg))).findCommand},{name:"basename",load:async()=>(await Promise.resolve().then(()=>(t2(),e2))).basenameCommand},{name:"dirname",load:async()=>(await Promise.resolve().then(()=>(r2(),n2))).dirnameCommand},{name:"tree",load:async()=>(await Promise.resolve().then(()=>(o2(),i2))).treeCommand},{name:"du",load:async()=>(await Promise.resolve().then(()=>(l2(),a2))).duCommand},{name:"env",load:async()=>(await Promise.resolve().then(()=>(bf(),wf))).envCommand},{name:"printenv",load:async()=>(await Promise.resolve().then(()=>(bf(),wf))).printenvCommand},{name:"alias",load:async()=>(await Promise.resolve().then(()=>(Ef(),xf))).aliasCommand},{name:"unalias",load:async()=>(await Promise.resolve().then(()=>(Ef(),xf))).unaliasCommand},{name:"history",load:async()=>(await Promise.resolve().then(()=>(f2(),u2))).historyCommand},{name:"xargs",load:async()=>(await Promise.resolve().then(()=>(h2(),p2))).xargsCommand},{name:"true",load:async()=>(await Promise.resolve().then(()=>(Af(),Sf))).trueCommand},{name:"false",load:async()=>(await Promise.resolve().then(()=>(Af(),Sf))).falseCommand},{name:"yes",load:async()=>(await Promise.resolve().then(()=>(g2(),m2))).yesCommand},{name:"clear",load:async()=>(await Promise.resolve().then(()=>(w2(),y2))).clearCommand},{name:"bash",load:async()=>(await Promise.resolve().then(()=>(kf(),Cf))).bashCommand},{name:"sh",load:async()=>(await Promise.resolve().then(()=>(kf(),Cf))).shCommand},{name:"jq",load:async()=>(await Promise.resolve().then(()=>(ty(),ey))).jqCommand},{name:"base64",load:async()=>(await Promise.resolve().then(()=>(oy(),iy))).base64Command},{name:"diff",load:async()=>(await Promise.resolve().then(()=>(Cy(),Ay))).diffCommand,handlesOwnVersion:!0},{name:"date",load:async()=>(await Promise.resolve().then(()=>(vy(),ky))).dateCommand},{name:"sleep",load:async()=>(await Promise.resolve().then(()=>(Oy(),Iy))).sleepCommand},{name:"timeout",load:async()=>(await Promise.resolve().then(()=>($y(),Ty))).timeoutCommand},{name:"time",load:async()=>(await Promise.resolve().then(()=>(Ly(),Dy))).timeCommand},{name:"seq",load:async()=>(await Promise.resolve().then(()=>(My(),Fy))).seqCommand},{name:"expr",load:async()=>(await Promise.resolve().then(()=>(By(),_y))).exprCommand},{name:"md5sum",load:async()=>(await Promise.resolve().then(()=>(Wy(),zy))).md5sumCommand},{name:"sha1sum",load:async()=>(await Promise.resolve().then(()=>(Hy(),jy))).sha1sumCommand},{name:"sha256sum",load:async()=>(await Promise.resolve().then(()=>(qy(),Vy))).sha256sumCommand},{name:"file",load:async()=>(await Promise.resolve().then(()=>(Q6(),X6))).fileCommand},{name:"html-to-markdown",load:async()=>(await Promise.resolve().then(()=>(J6(),Y6))).htmlToMarkdownCommand},{name:"help",load:async()=>(await Promise.resolve().then(()=>(tw(),ew))).helpCommand},{name:"which",load:async()=>(await Promise.resolve().then(()=>(sw(),rw))).whichCommand},{name:"tac",load:async()=>(await Promise.resolve().then(()=>(ow(),iw))).tac},{name:"hostname",load:async()=>(await Promise.resolve().then(()=>(lw(),aw))).hostname},{name:"whoami",load:async()=>(await Promise.resolve().then(()=>(uw(),cw))).whoami},{name:"od",load:async()=>(await Promise.resolve().then(()=>(dw(),fw))).od},{name:"gzip",load:async()=>(await Promise.resolve().then(()=>(Ll(),Dl))).gzipCommand},{name:"gunzip",load:async()=>(await Promise.resolve().then(()=>(Ll(),Dl))).gunzipCommand},{name:"zcat",load:async()=>(await Promise.resolve().then(()=>(Ll(),Dl))).zcatCommand}],UN=[],zN=[],Dw=[{name:"curl",load:async()=>(await Promise.resolve().then(()=>(Rw(),$w))).curlCommand}],Pw=new Map;function _l(e){return{name:e.name,handlesOwnVersion:e.handlesOwnVersion,async execute(t,n){let r=Pw.get(e.name);return r||(r=await Ct.runTrustedAsync(()=>Aa(e.load(),n.signal,`bash: ${e.name} was cancelled before it started
808
808
  `)),Pw.set(e.name,r)),n.coverage,r.execute(t,n)}}}function WN(){return Ad.map(e=>e.name)}function jN(){return Dw.map(e=>e.name)}function Lw(e){return(e?Ad.filter(n=>e.includes(n.name)):Ad).map(_l)}function Fw(){return Dw.map(_l)}function Mw(){return UN.map(_l)}function _w(){return zN.map(_l)}mi();ue();var Bw=new WeakMap,Uw=new WeakSet;function Bl(e){let t=Bw.get(e);return t===void 0&&(t=Object.freeze(Object.create(null)),Bw.set(e,t),Uw.add(t)),t}function zw(e){return Uw.has(e)}var Ww={maxSourceBytes:67108864,maxExecDepth:64,maxCallDepth:100,maxCommandCount:1e5,maxLoopIterations:1e5,maxAwkIterations:1e5,maxSedIterations:1e5,maxJqIterations:1e7,maxQueryTokens:1e5,maxQueryDepth:1e3,maxQueryElements:1e6,maxAwkParserTokens:1e5,maxAwkParserDepth:256,maxAwkParserOperations:1e6,maxCsvRows:1e6,maxCsvCells:1e7,maxWorkUnits:1e8,maxTraversalEntries:1e6,maxTraversalDepth:1e3,maxTraversalWork:1e6,maxLiveBytes:536870912,maxInputBytes:536870912,maxFileSystemBytes:1073741824,maxDatabaseBytes:1073741824,maxDatabaseResultBytes:268435456,maxArchiveBytes:1073741824,maxArchiveCompressedBytes:536870912,maxArchiveEntryBytes:536870912,maxArchiveEntries:1e6,maxWorkerMessageBytes:67108864,maxExecutionTimeMs:36e5,maxExtensionCleanupTimeMs:100,maxSqliteTimeoutMs:3e4,maxPythonTimeoutMs:3e4,maxJsTimeoutMs:3e4,maxJsMemoryBytes:67108864,maxGlobOperations:1e6,maxStringLength:67108864,maxArrayElements:1e6,maxHeredocSize:67108864,maxSubstitutionDepth:50,maxBraceExpansionResults:1e5,maxOutputSize:268435456,maxFileDescriptors:4096,maxSourceDepth:100},HN={...Ww,maxSourceBytes:8*1024*1024,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxExtensionCleanupTimeMs:25,maxGlobOperations:1e5,maxStringLength:10*1024*1024,maxArrayElements:1e5,maxHeredocSize:10*1024*1024,maxBraceExpansionResults:1e4,maxOutputSize:10*1024*1024,maxFileDescriptors:1024,maxQueryTokens:25e3,maxQueryDepth:256,maxQueryElements:1e5,maxAwkParserTokens:25e3,maxAwkParserDepth:128,maxAwkParserOperations:1e5,maxCsvRows:1e5,maxCsvCells:1e6,maxWorkUnits:1e5,maxTraversalEntries:1e5,maxTraversalDepth:256,maxTraversalWork:1e5,maxLiveBytes:64*1024*1024,maxInputBytes:32*1024*1024,maxFileSystemBytes:128*1024*1024,maxDatabaseBytes:64*1024*1024,maxDatabaseResultBytes:16*1024*1024,maxArchiveBytes:128*1024*1024,maxArchiveCompressedBytes:64*1024*1024,maxArchiveEntryBytes:64*1024*1024,maxArchiveEntries:1e5,maxWorkerMessageBytes:16*1024*1024,maxExecutionTimeMs:3e4};function VN(e){return Number.isFinite(e)?Math.min(Math.max(0,Math.floor(e)),4294967295):4294967295}function Ul(e,t="normal"){if(t!=="normal"&&t!=="hardened")throw new RangeError('executionLimitProfile must be "normal" or "hardened"');let n=t==="hardened"?HN:Ww;if(!e)return{...n};let r={maxSourceBytes:e.maxSourceBytes??n.maxSourceBytes,maxExecDepth:e.maxExecDepth??n.maxExecDepth,maxCallDepth:e.maxCallDepth??n.maxCallDepth,maxCommandCount:e.maxCommandCount??n.maxCommandCount,maxLoopIterations:e.maxLoopIterations??n.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??n.maxAwkIterations,maxSedIterations:e.maxSedIterations??n.maxSedIterations,maxJqIterations:e.maxJqIterations??n.maxJqIterations,maxQueryTokens:e.maxQueryTokens??n.maxQueryTokens,maxQueryDepth:e.maxQueryDepth??n.maxQueryDepth,maxQueryElements:e.maxQueryElements??n.maxQueryElements,maxAwkParserTokens:e.maxAwkParserTokens??n.maxAwkParserTokens,maxAwkParserDepth:e.maxAwkParserDepth??n.maxAwkParserDepth,maxAwkParserOperations:e.maxAwkParserOperations??n.maxAwkParserOperations,maxCsvRows:e.maxCsvRows??n.maxCsvRows,maxCsvCells:e.maxCsvCells??n.maxCsvCells,maxWorkUnits:e.maxWorkUnits??n.maxWorkUnits,maxTraversalEntries:e.maxTraversalEntries??n.maxTraversalEntries,maxTraversalDepth:e.maxTraversalDepth??n.maxTraversalDepth,maxTraversalWork:e.maxTraversalWork??n.maxTraversalWork,maxLiveBytes:e.maxLiveBytes??n.maxLiveBytes,maxInputBytes:e.maxInputBytes??n.maxInputBytes,maxFileSystemBytes:e.maxFileSystemBytes??n.maxFileSystemBytes,maxDatabaseBytes:e.maxDatabaseBytes??n.maxDatabaseBytes,maxDatabaseResultBytes:e.maxDatabaseResultBytes??n.maxDatabaseResultBytes,maxArchiveBytes:e.maxArchiveBytes??n.maxArchiveBytes,maxArchiveCompressedBytes:e.maxArchiveCompressedBytes??n.maxArchiveCompressedBytes,maxArchiveEntryBytes:e.maxArchiveEntryBytes??n.maxArchiveEntryBytes,maxArchiveEntries:e.maxArchiveEntries??n.maxArchiveEntries,maxWorkerMessageBytes:e.maxWorkerMessageBytes??n.maxWorkerMessageBytes,maxExecutionTimeMs:e.maxExecutionTimeMs??n.maxExecutionTimeMs,maxExtensionCleanupTimeMs:e.maxExtensionCleanupTimeMs??n.maxExtensionCleanupTimeMs,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??n.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??n.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??n.maxJsTimeoutMs,maxJsMemoryBytes:VN(e.maxJsMemoryBytes??n.maxJsMemoryBytes),maxGlobOperations:e.maxGlobOperations??n.maxGlobOperations,maxStringLength:e.maxStringLength??n.maxStringLength,maxArrayElements:e.maxArrayElements??n.maxArrayElements,maxHeredocSize:e.maxHeredocSize??n.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??n.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??n.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??n.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??n.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??n.maxSourceDepth};for(let s of Object.keys(r)){let i=r[s];if(i!==Number.POSITIVE_INFINITY&&(!Number.isSafeInteger(i)||i<0))throw new RangeError(`${s} must be a non-negative safe integer or positive Infinity`)}return r}Vs();function qN(e){let{executionLimits:t,executionLimitProfile:n,fs:r,stdin:s=Ts,...i}=e;return{fs:r,fsIdentity:i.fsIdentity??Bl(r),cwd:"/",env:new Map,stdin:s,limits:Ul(t,n),...i}}function jw(e){return"load"in e&&typeof e.load=="function"}function GN(e,t,n={}){return{name:e,trusted:n.trusted!==!1,execute:t}}function Hw(e){let t=null,n=!1,r=new Set,s=a=>{t=a;for(let l of r)l.resolve(a);r.clear()},i=a=>{n=!1;for(let l of r)l.reject(a);r.clear()},o=()=>{n=!0;let a;try{a=Promise.resolve(e.load())}catch(l){i(l);return}Py.call(a,s,i)};return{name:e.name,trusted:e.trusted!==!1,handlesOwnVersion:e.handlesOwnVersion,async execute(a,l){if(!t){let u,f=new Promise((d,p)=>{u={resolve:d,reject:p},r.add(u)});n||o();try{t=await Aa(f,l.signal,`bash: ${e.name} was cancelled before it started
809
- `)}finally{u&&r.delete(u)}}let c=t;if(!c)throw new Error(`Failed to load command: ${e.name}`);return c.execute(a,l)}}}ue();ue();G();Os();var Vw=Object.freeze(Object.create(null)),zl=class{limits;signal;abortOnUnresolvedCommands;commandCount=0;workUnits=0;liveBytes=0;inputBytes=0;outputBytes=0;countersByKind=new Map;bytesByKind=new Map;depthByKind=new Map;cleanupCallbacks=[];poisoned;closed=!1;startedAt=Date.now();unresolvedCommands=new Set;get remainingLiveBytes(){return Math.max(0,this.limits.maxLiveBytes-this.liveBytes)}get outputBytesUsed(){return this.outputBytes}constructor(t,n=void 0,r=!1){this.limits=t,this.signal=n,this.abortOnUnresolvedCommands=r}recordUnresolvedCommand(t){this.unresolvedCommands.add(t)}get unresolvedCommandNames(){return[...this.unresolvedCommands]}fail(t){throw this.poisoned??=t,this.poisoned}poisonAfterAbort(t){this.poisoned??=t}assertUsable(){if(this.poisoned)throw this.poisoned;if(this.closed)throw new Error("execution budget is already closed");this.throwIfAborted()}chargeCommand(){return this.consume("commands",1,"execution")}consumeWork(t=1,n="execution"){return this.consume("work",t,n)}consumeLimited(t,n,r,s=t){this.assertUsable();let i=this.countersByKind.get(t)??0;return(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(r)||r<0||n>r-i)&&this.fail(new C(`${s}: ${t} work limit exceeded (${r})`,"iterations")),n>this.limits.maxWorkUnits-this.workUnits&&this.fail(new C(`${s}: aggregate work limit exceeded (${this.limits.maxWorkUnits})`,"iterations")),this.countersByKind.set(t,i+n),this.workUnits+=n,i+n}consumeInput(t,n="execution"){return this.assertUsable(),(!Number.isSafeInteger(t)||t<0||t>this.limits.maxInputBytes-this.inputBytes)&&this.fail(new C(`${n}: aggregate input size limit exceeded (${this.limits.maxInputBytes} bytes)`,"string_length")),this.inputBytes+=t,this.inputBytes}consume(t,n=1,r=t){this.assertUsable();let s=this.countersByKind.get(t)??0,i=t==="commands"?this.commandCount:this.workUnits,o=t==="commands"?this.limits.maxCommandCount:this.limits.maxWorkUnits;(!Number.isSafeInteger(n)||n<0||n>o-i)&&this.fail(new C(t==="commands"?`too many commands executed (>${o}), increase executionLimits.maxCommandCount`:`${r}: ${t} work limit exceeded (${o})`,t==="commands"?"commands":"iterations"));let a=i+n;return t==="commands"?this.commandCount=a:this.workUnits=a,this.countersByKind.set(t,s+n),a}reserveBytes(t,n,r){this.assertUsable();let s=typeof t=="string"?t:"live",i=typeof t=="string"?n:t,o=typeof t=="string"?r??s:n??"execution";(!Number.isSafeInteger(i)||i<0||i>this.limits.maxLiveBytes-this.liveBytes)&&this.fail(new C(`${o}: live byte limit exceeded (${this.limits.maxLiveBytes} bytes)`,"string_length")),this.liveBytes+=i,this.bytesByKind.set(s,(this.bytesByKind.get(s)??0)+i);let a=!1;return{release:()=>{if(a)return;a=!0,this.liveBytes-=i;let l=(this.bytesByKind.get(s)??i)-i;l<=0?this.bytesByKind.delete(s):this.bytesByKind.set(s,l)}}}appendOutput(t,n,r="execution",s=0,i="text"){this.assertUsable();let o=i==="bytes"?n.length:M(n);(!Number.isSafeInteger(s)||s<0||s>o)&&this.fail(new C(`${r}: invalid ${t} accounting`,"output_size"));let a=o-s;return a>this.limits.maxOutputSize-this.outputBytes&&this.fail(new C(`${r}: total output size exceeded (>${this.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size")),this.outputBytes+=a,o}accountResult(t,n="execution",r=Number.POSITIVE_INFINITY){let s=t.internalOutputAccounting,i=Math.min(s?.stdout??0,r),o=Math.min(s?.stderr??0,Math.max(0,r-i)),a=this.appendOutput("stdout",t.stdout,n,i,t.stdoutKind==="bytes"||t.stdoutEncoding==="binary"?"bytes":"text"),l=this.appendOutput("stderr",t.stderr,n,o);return Object.isExtensible(t)?(t.internalOutputAccounting={stdout:a,stderr:l},t):a===0&&l===0?t:{...t,internalOutputAccounting:{stdout:a,stderr:l}}}relinquishOutput(t,n,r){this.assertUsable(),r!==Vw&&this.fail(new C(`${n}: unauthorized output accounting release`,"output_size")),(!Number.isSafeInteger(t)||t<0||t>this.outputBytes)&&this.fail(new C(`${n}: invalid output accounting release`,"output_size")),this.outputBytes-=t}enterDepth(t,n=this.limits.maxCallDepth,r){this.assertUsable();let s=typeof n=="number"?n:this.limits.maxCallDepth,i=typeof n=="string"?n:r??t,o=this.depthByKind.get(t)??0;o>=s&&this.fail(new C(`${i}: maximum depth (${s}) exceeded`,"recursion")),this.depthByKind.set(t,o+1);let a=!1;return{release:()=>{if(a)return;a=!0;let l=(this.depthByKind.get(t)??1)-1;l<=0?this.depthByKind.delete(t):this.depthByKind.set(t,l)}}}throwIfAborted(t="execution"){this.signal?.aborted&&this.fail(new _e("",`bash: ${t} aborted
810
- `)),Date.now()-this.startedAt>this.limits.maxExecutionTimeMs&&this.fail(new _e("",`bash: ${t} exceeded execution deadline (${this.limits.maxExecutionTimeMs}ms)
809
+ `)}finally{u&&r.delete(u)}}let c=t;if(!c)throw new Error(`Failed to load command: ${e.name}`);return c.execute(a,l)}}}ue();ue();G();Os();var Vw=Object.freeze(Object.create(null)),zl=class{limits;signal;abortOnUnresolvedCommands;commandCount=0;workUnits=0;liveBytes=0;inputBytes=0;outputBytes=0;countersByKind=new Map;bytesByKind=new Map;depthByKind=new Map;cleanupCallbacks=[];poisoned;closed=!1;startedAt=Date.now();unresolvedCommands=new Set;get remainingLiveBytes(){return Math.max(0,this.limits.maxLiveBytes-this.liveBytes)}get outputBytesUsed(){return this.outputBytes}constructor(t,n=void 0,r=!1){this.limits=t,this.signal=n,this.abortOnUnresolvedCommands=r}recordUnresolvedCommand(t){this.unresolvedCommands.add(t)}get unresolvedCommandNames(){return[...this.unresolvedCommands]}fail(t){throw this.poisoned??=t,this.poisoned}poisonAfterAbort(t){this.poisoned??=t}assertUsable(){if(this.poisoned)throw this.poisoned;if(this.closed)throw new Error("execution budget is already closed");this.throwIfAborted()}chargeCommand(){return this.consume("commands",1,"execution")}consumeWork(t=1,n="execution"){return this.consume("work",t,n)}consumeLimited(t,n,r,s=t){this.assertUsable();let i=this.countersByKind.get(t)??0;return(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(r)||r<0||n>r-i)&&this.fail(new C(`${s}: ${t} work limit exceeded (${r})`,"iterations")),n>this.limits.maxWorkUnits-this.workUnits&&this.fail(new C(`${s}: aggregate work limit exceeded (${this.limits.maxWorkUnits})`,"iterations")),this.countersByKind.set(t,i+n),this.workUnits+=n,i+n}consumeInput(t,n="execution"){return this.assertUsable(),(!Number.isSafeInteger(t)||t<0||t>this.limits.maxInputBytes-this.inputBytes)&&this.fail(new C(`${n}: aggregate input size limit exceeded (${this.limits.maxInputBytes} bytes)`,"string_length")),this.inputBytes+=t,this.inputBytes}consume(t,n=1,r=t){this.assertUsable();let s=this.countersByKind.get(t)??0,i=t==="commands"?this.commandCount:this.workUnits,o=t==="commands"?this.limits.maxCommandCount:this.limits.maxWorkUnits;(!Number.isSafeInteger(n)||n<0||n>o-i)&&this.fail(new C(t==="commands"?`too many commands executed (>${o}), increase executionLimits.maxCommandCount`:`${r}: ${t} work limit exceeded (${o})`,t==="commands"?"commands":"iterations"));let a=i+n;return t==="commands"?this.commandCount=a:this.workUnits=a,this.countersByKind.set(t,s+n),a}reserveBytes(t,n,r){this.assertUsable();let s=typeof t=="string"?t:"live",i=typeof t=="string"?n:t,o=typeof t=="string"?r??s:n??"execution";(!Number.isSafeInteger(i)||i<0||i>this.limits.maxLiveBytes-this.liveBytes)&&this.fail(new C(`${o}: live byte limit exceeded (${this.limits.maxLiveBytes} bytes)`,"string_length")),this.liveBytes+=i,this.bytesByKind.set(s,(this.bytesByKind.get(s)??0)+i);let a=!1;return{release:()=>{if(a)return;a=!0,this.liveBytes-=i;let l=(this.bytesByKind.get(s)??i)-i;l<=0?this.bytesByKind.delete(s):this.bytesByKind.set(s,l)}}}appendOutput(t,n,r="execution",s=0,i="text"){this.assertUsable();let o=i==="bytes"?n.length:M(n);(!Number.isSafeInteger(s)||s<0||s>o)&&this.fail(new C(`${r}: invalid ${t} accounting`,"output_size"));let a=o-s;return a>this.limits.maxOutputSize-this.outputBytes&&this.fail(new C(`${r}: total output size exceeded (>${this.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size")),this.outputBytes+=a,o}accountResult(t,n="execution",r=Number.POSITIVE_INFINITY){let s=t.internalOutputAccounting,i=Math.min(s?.stdout??0,r),o=Math.min(s?.stderr??0,Math.max(0,r-i)),a=this.appendOutput("stdout",t.stdout,n,i,t.stdoutKind==="bytes"||t.stdoutEncoding==="binary"?"bytes":"text"),l=this.appendOutput("stderr",t.stderr,n,o);return Object.isExtensible(t)?(t.internalOutputAccounting={stdout:a,stderr:l},t):a===0&&l===0?t:{...t,internalOutputAccounting:{stdout:a,stderr:l}}}relinquishOutput(t,n,r){this.assertUsable(),r!==Vw&&this.fail(new C(`${n}: unauthorized output accounting release`,"output_size")),(!Number.isSafeInteger(t)||t<0||t>this.outputBytes)&&this.fail(new C(`${n}: invalid output accounting release`,"output_size")),this.outputBytes-=t}enterDepth(t,n=this.limits.maxCallDepth,r){this.assertUsable();let s=typeof n=="number"?n:this.limits.maxCallDepth,i=typeof n=="string"?n:r??t,o=this.depthByKind.get(t)??0;o>=s&&this.fail(new C(`${i}: maximum depth (${s}) exceeded`,"recursion")),this.depthByKind.set(t,o+1);let a=!1;return{release:()=>{if(a)return;a=!0;let l=(this.depthByKind.get(t)??1)-1;l<=0?this.depthByKind.delete(t):this.depthByKind.set(t,l)}}}throwIfAborted(t="execution"){this.signal?.aborted&&this.fail(new Fe("",`bash: ${t} aborted
810
+ `)),Date.now()-this.startedAt>this.limits.maxExecutionTimeMs&&this.fail(new Fe("",`bash: ${t} exceeded execution deadline (${this.limits.maxExecutionTimeMs}ms)
811
811
  `))}remainingTimeMs(){return Math.max(0,this.limits.maxExecutionTimeMs-(Date.now()-this.startedAt))}registerCleanup(t){this.assertUsable(),this.cleanupCallbacks.push(t);let n=!0;return()=>{if(!n)return;n=!1;let r=this.cleanupCallbacks.indexOf(t);r>=0&&this.cleanupCallbacks.splice(r,1)}}async close(){if(this.closed)return;this.closed=!0;let t=[],n=Date.now()+this.limits.maxExtensionCleanupTimeMs;for(let r=this.cleanupCallbacks.length-1;r>=0;r--)try{let s=n-Date.now();if(s<=0){t.push(new Error("execution cleanup grace period exceeded"));break}let i,o=await Promise.race([Promise.resolve().then(this.cleanupCallbacks[r]).then(()=>({ok:!0}),a=>({ok:!1,error:a})),new Promise(a=>{i=uo(()=>a({ok:!1,error:new Error("execution cleanup grace period exceeded")}),s)})]);if(fo(i),!o.ok&&(t.push(o.error),Date.now()>=n))break}catch(s){t.push(s)}if(this.cleanupCallbacks.length=0,this.depthByKind.clear(),this.bytesByKind.clear(),this.liveBytes=0,t.length>0)throw new AggregateError(t,"execution cleanup failed")}assertExecDepth(t){this.assertUsable(),t>this.limits.maxExecDepth&&this.fail(new C(`maximum nested execution depth (${this.limits.maxExecDepth}) exceeded`,"recursion"))}};function qw(e){let t=Object.create(null);return Object.defineProperties(t,{remainingLiveBytes:{enumerable:!0,get:()=>e.remainingLiveBytes},consumeWork:{enumerable:!0,value:e.consumeWork.bind(e)},consumeLimited:{enumerable:!0,value:e.consumeLimited.bind(e)},consumeInput:{enumerable:!0,value:e.consumeInput.bind(e)},reserveBytes:{enumerable:!0,value:e.reserveBytes.bind(e)},enterDepth:{enumerable:!0,value:e.enterDepth.bind(e)},throwIfAborted:{enumerable:!0,value:e.throwIfAborted.bind(e)},remainingTimeMs:{enumerable:!0,value:e.remainingTimeMs.bind(e)},registerCleanup:{enumerable:!0,value:e.registerCleanup.bind(e)}}),Object.freeze(t)}function Gw(e,t,n="pipeline"){e.relinquishOutput(t,n,Vw)}ue();mn();bd();Un();xi();var ei=new TextEncoder;function ZN(e){return typeof e=="object"&&e!==null&&!(e instanceof Uint8Array)&&"content"in e}var pr=class{data=new Map;entryIdentities=new WeakMap;nextEntryIdentity=1;maxTotalBytes;retainedBytes=0;contentReferences=new WeakMap;materializedContent(t){return t?.type==="file"&&"content"in t?t.content:null}storedByteLength(t){return t===null?0:t instanceof Uint8Array?t.byteLength:M(t)}wouldReleaseBytes(t){let n=this.materializedContent(t);return n===null?0:n instanceof Uint8Array?this.contentReferences.get(n)===1?n.byteLength:0:this.storedByteLength(n)}assertCanAllocate(t,n){let r=this.wouldReleaseBytes(this.data.get(t));if(!Number.isSafeInteger(n)||n<0||n>this.maxTotalBytes-this.retainedBytes+r)throw new me("ENOSPC",`in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`)}setEntry(t,n){let r=this.data.get(t),s=this.materializedContent(r),i=this.materializedContent(n);if(s===i){this.data.set(t,n);return}let o=this.wouldReleaseBytes(r),a=i instanceof Uint8Array?this.contentReferences.has(i)?0:i.byteLength:this.storedByteLength(i);if(a>this.maxTotalBytes-this.retainedBytes+o)throw new me("ENOSPC",`in-memory filesystem byte limit exceeded (${this.maxTotalBytes} bytes)`);if(s instanceof Uint8Array){let l=this.contentReferences.get(s)??0;l<=1?this.contentReferences.delete(s):this.contentReferences.set(s,l-1)}i instanceof Uint8Array&&this.contentReferences.set(i,(this.contentReferences.get(i)??0)+1),this.retainedBytes+=a-o,this.data.set(t,n)}deleteEntry(t){let n=this.data.get(t);if(!n)return!1;let r=this.materializedContent(n),s=this.wouldReleaseBytes(n);if(r instanceof Uint8Array){let i=this.contentReferences.get(r)??0;i<=1?this.contentReferences.delete(r):this.contentReferences.set(r,i-1)}return this.retainedBytes-=s,this.data.delete(t)}contentByteLength(t,n){if(t instanceof Uint8Array)return t.byteLength;if(n==="hex")return Math.floor(t.length/2);if(n==="base64"){let r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-r)}return n==="binary"||n==="latin1"?t.length:M(t)}identityFor(t){let n=this.entryIdentities.get(t);return n||(n=`memfs:${this.nextEntryIdentity++}`,this.entryIdentities.set(t,n)),n}constructor(t,n={}){if(this.maxTotalBytes=n.maxTotalBytes??1024*1024*1024,!Number.isSafeInteger(this.maxTotalBytes)||this.maxTotalBytes<0)throw new Error("InMemoryFs: invalid maxTotalBytes");if(this.data.set("/",{type:"directory",mode:Ur,mtime:new Date}),t)for(let[r,s]of Object.entries(t))typeof s=="function"?this.writeFileLazy(r,s):ZN(s)?this.writeFileSync(r,s.content,void 0,{mode:s.mode,mtime:s.mtime}):this.writeFileSync(r,s)}ensureParentDirs(t){let n=Sr(t);n!=="/"&&(this.data.has(n)||(this.ensureParentDirs(n),this.data.set(n,{type:"directory",mode:Ur,mtime:new Date})))}writeFileSync(t,n,r,s){bt(t,"write");let i=ke(t);this.ensureParentDirs(i);let o=Fl(r);this.assertCanAllocate(i,this.contentByteLength(n,o));let a=Go(n,o);this.setEntry(i,{type:"file",content:a,mode:s?.mode??uu,mtime:s?.mtime??new Date})}writeFileLazy(t,n,r){bt(t,"write");let s=ke(t);this.ensureParentDirs(s),this.setEntry(s,{type:"file",lazy:n,mode:r?.mode??uu,mtime:r?.mtime??new Date})}async materializeLazy(t,n){let r=await Ct.runTrustedAsync(async()=>n.lazy()),s=typeof r=="string"?ei.encode(r):r,i={type:"file",content:s,mode:n.mode,mtime:n.mtime};return this.assertCanAllocate(t,s.byteLength),this.setEntry(t,i),i}async readFile(t,n){let r=await this.readFileBuffer(t),s=Fl(n);return Zo(r,s)}async readFileBytes(t){let n=await this.readFileBuffer(t);return Zo(n,"binary")}async readFileBuffer(t){bt(t,"open");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new me("ENOENT",`no such file or directory, open '${t}'`);if(r.type!=="file")throw new me("EISDIR",`illegal operation on a directory, read '${t}'`);if("lazy"in r){let s=await this.materializeLazy(n,r);return s.content instanceof Uint8Array?s.content:ei.encode(s.content)}return r.content instanceof Uint8Array?r.content:ei.encode(r.content)}async writeFile(t,n,r){this.writeFileSync(t,n,r)}async appendFile(t,n,r){bt(t,"append");let s=ke(t),i=this.data.get(s);if(i&&i.type==="directory")throw new me("EISDIR",`illegal operation on a directory, write '${t}'`);let o=Fl(r),a=this.contentByteLength(n,o);if(i?.type==="file"){let l=i;"lazy"in l&&(l=await this.materializeLazy(s,l));let c="content"in l&&l.content instanceof Uint8Array?l.content:ei.encode("content"in l?l.content:"");this.assertCanAllocate(s,c.byteLength+a);let u=Go(n,o),f=new Uint8Array(c.length+u.length);f.set(c),f.set(u,c.length),this.setEntry(s,{type:"file",content:f,mode:l.mode,mtime:new Date})}else this.writeFileSync(t,n,r)}async exists(t){if(t.includes("\0"))return!1;try{let n=this.resolvePathWithSymlinks(t);return this.data.has(n)}catch{return!1}}async stat(t){bt(t,"stat");let n=this.resolvePathWithSymlinks(t),r=this.data.get(n);if(!r)throw new me("ENOENT",`no such file or directory, stat '${t}'`);r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=ei.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date,identity:this.identityFor(r)}}async lstat(t){bt(t,"lstat");let n=this.resolveIntermediateSymlinks(t),r=this.data.get(n);if(!r)throw new me("ENOENT",`no such file or directory, lstat '${t}'`);if(r.type==="symlink")return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:r.mode,size:r.target.length,mtime:r.mtime||new Date};r.type==="file"&&"lazy"in r&&(r=await this.materializeLazy(n,r));let s=0;return r.type==="file"&&"content"in r&&r.content&&(r.content instanceof Uint8Array?s=r.content.length:s=ei.encode(r.content).length),{isFile:r.type==="file",isDirectory:r.type==="directory",isSymbolicLink:!1,mode:r.mode,size:s,mtime:r.mtime||new Date,identity:this.identityFor(r)}}resolveIntermediateSymlinks(t){let n=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/");if(r.length<=1)return n;let s="",i=new Set;for(let o=0;o<r.length-1;o++){let a=r[o];s=`${s}/${a}`;let l=this.data.get(s),c=0,u=cu;for(;l&&l.type==="symlink"&&c<u;){if(i.has(s))throw new me("ELOOP",`too many levels of symbolic links, lstat '${t}'`);i.add(s),s=Ia(s,l.target),l=this.data.get(s),c++}if(c>=u)throw new me("ELOOP",`too many levels of symbolic links, lstat '${t}'`)}return`${s}/${r[r.length-1]}`}resolvePathWithSymlinks(t){let n=ke(t);if(n==="/")return"/";let r=n.slice(1).split("/"),s="",i=new Set;for(let o of r){s=`${s}/${o}`;let a=this.data.get(s),l=0,c=cu;for(;a&&a.type==="symlink"&&l<c;){if(i.has(s))throw new me("ELOOP",`too many levels of symbolic links, open '${t}'`);i.add(s),s=Ia(s,a.target),a=this.data.get(s),l++}if(l>=c)throw new me("ELOOP",`too many levels of symbolic links, open '${t}'`)}return s}async mkdir(t,n){this.mkdirSync(t,n)}async createExclusive(t,n){let r=n.directory?"mkdir":"open";bt(t,n.directory?"mkdir":"write");let s=ke(t),i=Sr(s),o=i==="/"?"/":this.resolvePathWithSymlinks(i),a=wn(o,s.slice(s.lastIndexOf("/")+1));if(this.data.has(a))throw new me("EEXIST",`file already exists, ${r} '${t}'`);if(o!=="/"){let l=this.data.get(o);if(!l)throw new me("ENOENT",`no such file or directory, ${r} '${t}'`);if(l.type!=="directory")throw new me("ENOTDIR",`not a directory, ${r} '${t}'`)}if(n.directory){this.setEntry(a,{type:"directory",mode:n.mode,mtime:new Date});return}this.assertCanAllocate(a,0),this.setEntry(a,{type:"file",content:new Uint8Array(0),mode:n.mode,mtime:new Date})}mkdirSync(t,n){bt(t,"mkdir");let r=ke(t);if(this.data.has(r)){if(this.data.get(r)?.type==="file")throw new me("EEXIST",`file already exists, mkdir '${t}'`);if(!n?.recursive)throw new me("EEXIST",`directory already exists, mkdir '${t}'`);return}let s=Sr(r);if(s!=="/"&&!this.data.has(s))if(n?.recursive)this.mkdirSync(s,{recursive:!0});else throw new me("ENOENT",`no such file or directory, mkdir '${t}'`);this.data.set(r,{type:"directory",mode:Ur,mtime:new Date})}async readdir(t){return(await this.readdirWithFileTypes(t)).map(r=>r.name)}async readdirWithFileTypes(t){bt(t,"scandir");let n=ke(t),r=this.data.get(n);if(!r)throw new me("ENOENT",`no such file or directory, scandir '${t}'`);let s=new Set;for(;r&&r.type==="symlink";){if(s.has(n))throw new me("ELOOP",`too many levels of symbolic links, scandir '${t}'`);s.add(n),n=Ia(n,r.target),r=this.data.get(n)}if(!r)throw new me("ENOENT",`no such file or directory, scandir '${t}'`);if(r.type!=="directory")throw new me("ENOTDIR",`not a directory, scandir '${t}'`);let i=n==="/"?"/":`${n}/`,o=new Map;for(let[a,l]of this.data.entries())if(a!==n&&a.startsWith(i)){let c=a.slice(i.length),u=c.split("/")[0];u&&!c.includes("/",u.length)&&!o.has(u)&&o.set(u,{name:u,isFile:l.type==="file",isDirectory:l.type==="directory",isSymbolicLink:l.type==="symlink"})}return Array.from(o.values()).sort((a,l)=>a.name<l.name?-1:a.name>l.name?1:0)}async rm(t,n){bt(t,"rm");let r=ke(t),s=this.data.get(r);if(!s){if(n?.force)return;throw new me("ENOENT",`no such file or directory, rm '${t}'`)}if(s.type==="directory"){let i=await this.readdir(r);if(i.length>0){if(!n?.recursive)throw new me("ENOTEMPTY",`directory not empty, rm '${t}'`);for(let o of i){let a=wn(r,o);await this.rm(a,n)}}}this.deleteEntry(r)}async cp(t,n,r){bt(t,"cp"),bt(n,"cp");let s=ke(t),i=ke(n),o=this.data.get(s);if(!o)throw new me("ENOENT",`no such file or directory, cp '${t}'`);if(o.type==="file")if(this.ensureParentDirs(i),"content"in o){let a=o.content instanceof Uint8Array?o.content.byteLength:ei.encode(o.content).byteLength;this.assertCanAllocate(i,a);let l=o.content instanceof Uint8Array?new Uint8Array(o.content):o.content;this.setEntry(i,{...o,content:l})}else this.setEntry(i,{...o});else if(o.type==="symlink")this.ensureParentDirs(i),this.data.set(i,{...o});else if(o.type==="directory"){if(!r?.recursive)throw new me("EISDIR",`is a directory, cp '${t}'`);if(zn(s,i))throw new me("EINVAL",`cannot copy '${t}' into itself, '${n}'`);await this.mkdir(i,{recursive:!0});let a=await this.readdir(s);for(let l of a){let c=wn(s,l),u=wn(i,l);await this.cp(c,u,r)}}}async mv(t,n){bt(t,"mv"),bt(n,"mv");let r=ke(t),s=ke(n);if(r===s)return;let i=this.data.get(r);if(!i)throw new me("ENOENT",`no such file or directory, mv '${t}'`);if(i.type==="directory"&&zn(r,s))throw new me("EINVAL",`cannot move '${t}' into itself, '${n}'`);if(i.type==="directory"){await this.mkdir(s,{recursive:!0});let o=await this.readdir(r);for(let a of o)await this.mv(wn(r,a),wn(s,a));this.deleteEntry(r);return}this.ensureParentDirs(s),this.setEntry(s,i),this.deleteEntry(r)}getAllPaths(){return Array.from(this.data.keys())}resolvePath(t,n){return Na(t,n)}async chmod(t,n){bt(t,"chmod");let r=ke(t),s=this.data.get(r);if(!s)throw new me("ENOENT",`no such file or directory, chmod '${t}'`);s.mode=n}async symlink(t,n){bt(n,"symlink");let r=ke(n);if(this.data.has(r))throw new me("EEXIST",`file already exists, symlink '${n}'`);this.ensureParentDirs(r),this.data.set(r,{type:"symlink",target:t,mode:d1,mtime:new Date})}async link(t,n){bt(t,"link"),bt(n,"link");let r=ke(t),s=ke(n),i=this.data.get(r);if(!i)throw new me("ENOENT",`no such file or directory, link '${t}'`);if(i.type!=="file")throw new me("EPERM",`operation not permitted, link '${t}'`);if(this.data.has(s))throw new me("EEXIST",`file already exists, link '${n}'`);let o=i;"lazy"in o&&(o=await this.materializeLazy(r,o)),this.ensureParentDirs(s);let a={type:"file",content:o.content,mode:o.mode,mtime:o.mtime};this.entryIdentities.set(a,this.identityFor(o)),this.setEntry(s,a)}async readlink(t){bt(t,"readlink");let n=ke(t),r=this.data.get(n);if(!r)throw new me("ENOENT",`no such file or directory, readlink '${t}'`);if(r.type!=="symlink")throw new me("EINVAL",`invalid argument, readlink '${t}'`);return r.target}async realpath(t){bt(t,"realpath");let n=this.resolvePathWithSymlinks(t);if(!this.data.has(n))throw new me("ENOENT",`no such file or directory, realpath '${t}'`);return n}async utimes(t,n,r){bt(t,"utimes");let s=ke(t),i=this.resolvePathWithSymlinks(s),o=this.data.get(i);if(!o)throw new me("ENOENT",`no such file or directory, utimes '${t}'`);o.mtime=r}};var Zw="5.1.0(1)-release",Kw="Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT";function Cd(e){let{pid:t,ppid:n,uid:r,gid:s}=e;return`Name: bash
812
812
  State: R (running)
813
813
  Pid: ${t}
@@ -870,13 +870,13 @@ Gid: ${s} ${s} ${s} ${s}
870
870
  `);)d=!0,f++;if(d&&f<r&&n[f]===")"||l)return!0}if(i===0)return!1;s++;continue}s++}return!1}dparenClosesWithSpacedParens(t){let n=this.input,r=n.length,s=t,i=2,o=!1,a=!1;for(;s<r&&i>0;){let l=n[s];if(o){l==="'"&&(o=!1),s++;continue}if(a){if(l==="\\"){s+=2;continue}l==='"'&&(a=!1),s++;continue}if(l==="'"){o=!0,s++;continue}if(l==='"'){a=!0,s++;continue}if(l==="\\"){s+=2;continue}if(l==="("){i++,s++;continue}if(l===")"){if(i--,i===1){let c=s+1;if(c<r&&n[c]===")")return!1;let u=c,f=!1;for(;u<r&&(n[u]===" "||n[u]===" "||n[u]===`
871
871
  `);)f=!0,u++;if(f&&u<r&&n[u]===")")return!0}if(i===0)return!1;s++;continue}if(i===1&&(l==="|"&&s+1<r&&n[s+1]==="|"||l==="&"&&s+1<r&&n[s+1]==="&"||l==="|"&&s+1<r&&n[s+1]!=="|"))return!0;s++}return!1}};var Rd=1e6,ea=1e5,hI=1e6,c7=200,Zt;(function(e){e[e.Default=0]="Default",e[e.Assignment=1]="Assignment",e[e.NoBraceExpansion=2]="NoBraceExpansion",e[e.Regex=4]="Regex"})(Zt||(Zt={}));var u7=new Set([k.LESS,k.GREAT,k.DLESS,k.DGREAT,k.LESSAND,k.GREATAND,k.LESSGREAT,k.DLESSDASH,k.CLOBBER,k.TLESS,k.AND_GREAT,k.AND_DGREAT]),f7=new Set([k.LESS,k.GREAT,k.DLESS,k.DGREAT,k.LESSAND,k.GREATAND,k.LESSGREAT,k.DLESSDASH,k.CLOBBER,k.TLESS]),d7=new Set([k.LESS,k.GREAT,k.DLESS,k.DGREAT,k.LESSAND,k.GREATAND,k.LESSGREAT,k.DLESSDASH,k.CLOBBER,k.TLESS,k.AND_GREAT,k.AND_DGREAT]),jt=class extends Error{line;column;token;constructor(t,n,r,s=void 0){super(`Parse error at ${n}:${r}: ${t}`),this.line=n,this.column=r,this.token=s,this.name="ParseException"}},Zl=class{iterations=0;tokens=0;depth=0;reset(){this.iterations=0,this.tokens=0,this.depth=0}chargeIteration(t,n){if(this.iterations++,this.iterations>hI)throw new jt("Maximum parse iterations exceeded (possible infinite loop)",t,n)}chargeTokens(t,n=1,r=1){if(this.tokens+=t,this.tokens>ea)throw new jt(`Too many tokens: cumulative count exceeds limit of ${ea}`,n,r)}enter(t,n){if(this.depth++,this.depth>c7)throw this.depth--,new jt(`Maximum parser nesting depth exceeded (${c7})`,t,n);let r=!0;return()=>{r&&(r=!1,this.depth--)}}};mn();kt();G();function yt(e,t){for(;t<e.length;){if(e[t]==="\\"&&e[t+1]===`
872
872
  `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}var Kl=["=","+=","-=","*=","/=","%=","<<=",">>=","&=","|=","^="];function ta(e){if(e.includes("#")){let n=e.split("#");if(n.length!==2)return Number.NaN;let[r,s]=n;if(!/^\d+$/.test(r)||s.length===0)return Number.NaN;let i=Number.parseInt(r,10);if(i<2||i>64)return Number.NaN;let o=0;for(let a of s){let l;if(/[0-9]/.test(a))l=a.charCodeAt(0)-48;else if(/[a-z]/.test(a))l=a.charCodeAt(0)-97+10;else if(/[A-Z]/.test(a))l=a.charCodeAt(0)-65+(i<=36?10:36);else if(a==="@")l=62;else if(a==="_")l=63;else return Number.NaN;if(l>=i)return Number.NaN;if(o=o*i+l,o>Number.MAX_SAFE_INTEGER)return Number.MAX_SAFE_INTEGER}return o}if(e.startsWith("0x")||e.startsWith("0X")){let n=Number.parseInt(e.slice(2),16);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}if(e.startsWith("0")&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return Number.NaN;let n=Number.parseInt(e,8);return n>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:n}let t=Number.parseInt(e,10);return t>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t}function p7(e,t,n,r){if(n.slice(r,r+3)!=="$((")return null;let s=r+3,i=1,o=s;for(;s<n.length-1&&i>0;)n[s]==="("&&n[s+1]==="("?(i++,s+=2):n[s]===")"&&n[s+1]===")"?(i--,i>0&&(s+=2)):s++;let a=n.slice(o,s),{expr:l}=e(t,a,0);return s+=2,{expr:{type:"ArithNested",expression:l},pos:s}}function h7(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 i=e[n+1];switch(i){case"n":r+=`
873
- `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"'":r+="'";break;default:r+=i}n+=2}else r+=e[n],n++;e[n]==="'"&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function m7(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 s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function mI(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 Be(e,t){let n=mI(t),{expr:r,pos:s}=Ki(e,n,0),i=yt(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function vn(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Nn(e,t){return yt(e,t)>=e.length}function Ki(e,t,n){return gI(e,t,n)}function ri(e,t,n){return e.withDepth(()=>Ki(e,t,n))}function gI(e,t,n){let{expr:r,pos:s}=na(e,t,n);for(s=yt(t,s);t[s]===",";){if(s++,Nn(t,s))return vn(",",s);let{expr:o,pos:a}=na(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=yt(t,a)}return{expr:r,pos:s}}function na(e,t,n){let{expr:r,pos:s}=yI(e,t,n);if(s=yt(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=ri(e,t,s);if(s=yt(t,o),t[s]===":"){s++;let{expr:a,pos:l}=ri(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function yI(e,t,n){let{expr:r,pos:s}=g7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="||";){if(s+=2,Nn(t,s))return vn("||",s);let{expr:o,pos:a}=g7(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function g7(e,t,n){let{expr:r,pos:s}=y7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Nn(t,s))return vn("&&",s);let{expr:o,pos:a}=y7(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function y7(e,t,n){let{expr:r,pos:s}=w7(e,t,n);for(;s=yt(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Nn(t,s))return vn("|",s);let{expr:o,pos:a}=w7(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function w7(e,t,n){let{expr:r,pos:s}=b7(e,t,n);for(;s=yt(t,s),t[s]==="^";){if(s++,Nn(t,s))return vn("^",s);let{expr:o,pos:a}=b7(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function b7(e,t,n){let{expr:r,pos:s}=x7(e,t,n);for(;s=yt(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Nn(t,s))return vn("&",s);let{expr:o,pos:a}=x7(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function x7(e,t,n){let{expr:r,pos:s}=E7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=E7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function E7(e,t,n){let{expr:r,pos:s}=Pd(e,t,n);for(;;)if(s=yt(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Pd(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Pd(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Pd(e,t,n){let{expr:r,pos:s}=S7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=S7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function S7(e,t,n){let{expr:r,pos:s}=A7(e,t,n);for(;s=yt(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=A7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function A7(e,t,n){let{expr:r,pos:s}=Xl(e,t,n);for(;;)if(s=yt(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Nn(t,s))return vn("*",s);let{expr:o,pos:a}=Xl(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Xl(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Xl(e,t,n){let{expr:r,pos:s}=Dd(e,t,n),i=yt(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Nn(t,i))return vn("**",i);let{expr:a,pos:l}=e.withDepth(()=>Xl(e,t,i));return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Dd(e,t,n){let r=yt(t,n);if(t.slice(r,r+2)==="++"||t.slice(r,r+2)==="--"){let s=t.slice(r,r+2);r+=2;let{expr:i,pos:o}=e.withDepth(()=>Dd(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=e.withDepth(()=>Dd(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return bI(e,t,r)}function wI(e,t){let n=e[t];return n==="$"||n==="`"}function bI(e,t,n){let{expr:r,pos:s}=C7(e,t,n,!1),i=[r];for(;wI(t,s);){let{expr:a,pos:l}=C7(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=ri(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=yt(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Kl)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=e.withDepth(()=>na(e,t,s));return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function C7(e,t,n,r=!1){let s=yt(t,n),i=p7(ri,e,t,s);if(i)return i;let o=h7(t,s);if(o)return o;let a=m7(t,s);if(a)return a;if(t.slice(s,s+2)==="$("&&t[s+2]!=="("){s+=2;let c=1,u=s;for(;s<t.length&&c>0;)t[s]==="("?c++:t[s]===")"&&c--,c>0&&s++;let f=t.slice(u,s);return s++,{expr:{type:"ArithCommandSubst",command:f},pos:s}}if(t[s]==="`"){s++;let c=s;for(;s<t.length&&t[s]!=="`";)s++;let u=t.slice(c,s);return t[s]==="`"&&s++,{expr:{type:"ArithCommandSubst",command:u},pos:s}}if(t[s]==="("){s++;let{expr:c,pos:u}=ri(e,t,s);return s=yt(t,u),t[s]===")"&&s++,{expr:{type:"ArithGroup",expression:c},pos:s}}if(t[s]==="'"){s++;let c="";for(;s<t.length&&t[s]!=="'";)c+=t[s],s++;t[s]==="'"&&s++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:s}}if(t[s]==='"'){s++;let c="";for(;s<t.length&&t[s]!=='"';)t[s]==="\\"&&s+1<t.length?(c+=t[s+1],s+=2):(c+=t[s],s++);t[s]==='"'&&s++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:s};let{expr:f}=ri(e,u,0);return{expr:f,pos:s}}if(/[0-9]/.test(t[s])){let c="",u=!1,f=!1;for(;s<t.length;){let p=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(p))c+=p,s++;else break;else if(p==="#")u=!0,c+=p,s++;else if(c==="0"&&(p==="x"||p==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=p,s++;else if(f&&/[0-9a-fA-F]/.test(p))c+=p,s++;else if(!f&&/[0-9]/.test(p))c+=p,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let p=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)p+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:p,message:`${p}: value too great for base (error token is "${p}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new qe(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let p=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:p},pos:t.length}}return{expr:{type:"ArithNumber",value:ta(c)},pos:s}}if(t[s]==="$"&&t[s+1]==="{"){let c=s+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let d=t.slice(c,f),p=f+1;if(t[p]==="#"){let h=p+1;for(;h<t.length&&/[0-9a-zA-Z@_]/.test(t[h]);)h++;let m=t.slice(p+1,h);return{expr:{type:"ArithDynamicBase",baseExpr:d,value:m},pos:h}}if(/[0-9]/.test(t[p])||t[p]==="x"||t[p]==="X"){let h=p;if(t[p]==="x"||t[p]==="X")for(h++;h<t.length&&/[0-9a-fA-F]/.test(t[h]);)h++;else for(;h<t.length&&/[0-9]/.test(t[h]);)h++;let m=t.slice(p,h);return{expr:{type:"ArithDynamicNumber",prefix:d,suffix:m},pos:h}}return s=p,{expr:{type:"ArithBracedExpansion",content:d},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[0-9]/.test(t[s+1])){s++;let c="";for(;s<t.length&&/[0-9]/.test(t[s]);)c+=t[s],s++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[*@#?\-!$]/.test(t[s+1])){let c=t[s+1];return s+=2,{expr:{type:"ArithSpecialVar",name:c},pos:s}}let l=!1;if(t[s]==="$"&&s+1<t.length&&/[a-zA-Z_]/.test(t[s+1])&&(l=!0,s++),s<t.length&&/[a-zA-Z_]/.test(t[s])){let c="";for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)c+=t[s],s++;if(t[s]==="["&&!r){s++;let u;if(t[s]==="'"||t[s]==='"'){let d=t[s];for(s++,u="";s<t.length&&t[s]!==d;)u+=t[s],s++;t[s]===d&&s++,s=yt(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:d,pos:p}=ri(e,t,s);f=d,s=p,t[s]==="]"&&s++}if(s=yt(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let d of Kl)if(t.slice(s,s+d.length)===d&&t.slice(s,s+d.length+1)!=="=="){s+=d.length;let{expr:p,pos:h}=e.withDepth(()=>na(e,t,s));return{expr:{type:"ArithAssignment",operator:d,variable:c,subscript:f,stringKey:u,value:p},pos:h}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=yt(t,s),!r){for(let u of Kl)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:d}=e.withDepth(()=>na(e,t,s));return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:d}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
873
+ `;break;case"t":r+=" ";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"'":r+="'";break;default:r+=i}n+=2}else r+=e[n],n++;e[n]==="'"&&n++;let s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function m7(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 s=Number.parseInt(r,10);return{expr:{type:"ArithNumber",value:Number.isNaN(s)?0:s},pos:n}}function mI(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 Ue(e,t){let n=mI(t),{expr:r,pos:s}=Ki(e,n,0),i=yt(n,s);if(i<n.length){let o=t.slice(i).trim();if(o)return{type:"ArithmeticExpression",originalText:t,expression:{type:"ArithSyntaxError",errorToken:o,message:`${o}: syntax error: invalid arithmetic operator (error token is "${o}")`}}}return{type:"ArithmeticExpression",expression:r,originalText:t}}function vn(e,t){return{expr:{type:"ArithSyntaxError",errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function Nn(e,t){return yt(e,t)>=e.length}function Ki(e,t,n){return gI(e,t,n)}function ri(e,t,n){return e.withDepth(()=>Ki(e,t,n))}function gI(e,t,n){let{expr:r,pos:s}=na(e,t,n);for(s=yt(t,s);t[s]===",";){if(s++,Nn(t,s))return vn(",",s);let{expr:o,pos:a}=na(e,t,s);r={type:"ArithBinary",operator:",",left:r,right:o},s=yt(t,a)}return{expr:r,pos:s}}function na(e,t,n){let{expr:r,pos:s}=yI(e,t,n);if(s=yt(t,s),t[s]==="?"){s++;let{expr:i,pos:o}=ri(e,t,s);if(s=yt(t,o),t[s]===":"){s++;let{expr:a,pos:l}=ri(e,t,s);return{expr:{type:"ArithTernary",condition:r,consequent:i,alternate:a},pos:l}}}return{expr:r,pos:s}}function yI(e,t,n){let{expr:r,pos:s}=g7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="||";){if(s+=2,Nn(t,s))return vn("||",s);let{expr:o,pos:a}=g7(e,t,s);r={type:"ArithBinary",operator:"||",left:r,right:o},s=a}return{expr:r,pos:s}}function g7(e,t,n){let{expr:r,pos:s}=y7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="&&";){if(s+=2,Nn(t,s))return vn("&&",s);let{expr:o,pos:a}=y7(e,t,s);r={type:"ArithBinary",operator:"&&",left:r,right:o},s=a}return{expr:r,pos:s}}function y7(e,t,n){let{expr:r,pos:s}=w7(e,t,n);for(;s=yt(t,s),t[s]==="|"&&t[s+1]!=="|";){if(s++,Nn(t,s))return vn("|",s);let{expr:o,pos:a}=w7(e,t,s);r={type:"ArithBinary",operator:"|",left:r,right:o},s=a}return{expr:r,pos:s}}function w7(e,t,n){let{expr:r,pos:s}=b7(e,t,n);for(;s=yt(t,s),t[s]==="^";){if(s++,Nn(t,s))return vn("^",s);let{expr:o,pos:a}=b7(e,t,s);r={type:"ArithBinary",operator:"^",left:r,right:o},s=a}return{expr:r,pos:s}}function b7(e,t,n){let{expr:r,pos:s}=x7(e,t,n);for(;s=yt(t,s),t[s]==="&"&&t[s+1]!=="&";){if(s++,Nn(t,s))return vn("&",s);let{expr:o,pos:a}=x7(e,t,s);r={type:"ArithBinary",operator:"&",left:r,right:o},s=a}return{expr:r,pos:s}}function x7(e,t,n){let{expr:r,pos:s}=E7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="=="||t.slice(s,s+2)==="!=";){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=E7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function E7(e,t,n){let{expr:r,pos:s}=Pd(e,t,n);for(;;)if(s=yt(t,s),t.slice(s,s+2)==="<="||t.slice(s,s+2)===">="){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Pd(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else if(t[s]==="<"||t[s]===">"){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Pd(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Pd(e,t,n){let{expr:r,pos:s}=S7(e,t,n);for(;s=yt(t,s),t.slice(s,s+2)==="<<"||t.slice(s,s+2)===">>";){let i=t.slice(s,s+2);if(s+=2,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=S7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function S7(e,t,n){let{expr:r,pos:s}=A7(e,t,n);for(;s=yt(t,s),(t[s]==="+"||t[s]==="-")&&t[s+1]!==t[s];){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=A7(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}return{expr:r,pos:s}}function A7(e,t,n){let{expr:r,pos:s}=Xl(e,t,n);for(;;)if(s=yt(t,s),t[s]==="*"&&t[s+1]!=="*"){if(s++,Nn(t,s))return vn("*",s);let{expr:o,pos:a}=Xl(e,t,s);r={type:"ArithBinary",operator:"*",left:r,right:o},s=a}else if(t[s]==="/"||t[s]==="%"){let i=t[s];if(s++,Nn(t,s))return vn(i,s);let{expr:o,pos:a}=Xl(e,t,s);r={type:"ArithBinary",operator:i,left:r,right:o},s=a}else break;return{expr:r,pos:s}}function Xl(e,t,n){let{expr:r,pos:s}=Dd(e,t,n),i=yt(t,s);if(t.slice(i,i+2)==="**"){if(i+=2,Nn(t,i))return vn("**",i);let{expr:a,pos:l}=e.withDepth(()=>Xl(e,t,i));return{expr:{type:"ArithBinary",operator:"**",left:r,right:a},pos:l}}return{expr:r,pos:s}}function Dd(e,t,n){let r=yt(t,n);if(t.slice(r,r+2)==="++"||t.slice(r,r+2)==="--"){let s=t.slice(r,r+2);r+=2;let{expr:i,pos:o}=e.withDepth(()=>Dd(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}if(t[r]==="+"||t[r]==="-"||t[r]==="!"||t[r]==="~"){let s=t[r];r++;let{expr:i,pos:o}=e.withDepth(()=>Dd(e,t,r));return{expr:{type:"ArithUnary",operator:s,operand:i,prefix:!0},pos:o}}return bI(e,t,r)}function wI(e,t){let n=e[t];return n==="$"||n==="`"}function bI(e,t,n){let{expr:r,pos:s}=C7(e,t,n,!1),i=[r];for(;wI(t,s);){let{expr:a,pos:l}=C7(e,t,s,!0);i.push(a),s=l}i.length>1&&(r={type:"ArithConcat",parts:i});let o;if(t[s]==="["&&r.type==="ArithConcat"){s++;let{expr:a,pos:l}=ri(e,t,s);o=a,s=l,t[s]==="]"&&s++}if(o&&r.type==="ArithConcat"&&(r={type:"ArithDynamicElement",nameExpr:r,subscript:o},o=void 0),s=yt(t,s),r.type==="ArithConcat"||r.type==="ArithVariable"||r.type==="ArithDynamicElement"){for(let a of Kl)if(t.slice(s,s+a.length)===a&&t.slice(s,s+a.length+1)!=="=="){s+=a.length;let{expr:l,pos:c}=e.withDepth(()=>na(e,t,s));return r.type==="ArithDynamicElement"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r.nameExpr,subscript:r.subscript,value:l},pos:c}:r.type==="ArithConcat"?{expr:{type:"ArithDynamicAssignment",operator:a,target:r,value:l},pos:c}:{expr:{type:"ArithAssignment",operator:a,variable:r.name,value:l},pos:c}}}if(t.slice(s,s+2)==="++"||t.slice(s,s+2)==="--"){let a=t.slice(s,s+2);return s+=2,{expr:{type:"ArithUnary",operator:a,operand:r,prefix:!1},pos:s}}return{expr:r,pos:s}}function C7(e,t,n,r=!1){let s=yt(t,n),i=p7(ri,e,t,s);if(i)return i;let o=h7(t,s);if(o)return o;let a=m7(t,s);if(a)return a;if(t.slice(s,s+2)==="$("&&t[s+2]!=="("){s+=2;let c=1,u=s;for(;s<t.length&&c>0;)t[s]==="("?c++:t[s]===")"&&c--,c>0&&s++;let f=t.slice(u,s);return s++,{expr:{type:"ArithCommandSubst",command:f},pos:s}}if(t[s]==="`"){s++;let c=s;for(;s<t.length&&t[s]!=="`";)s++;let u=t.slice(c,s);return t[s]==="`"&&s++,{expr:{type:"ArithCommandSubst",command:u},pos:s}}if(t[s]==="("){s++;let{expr:c,pos:u}=ri(e,t,s);return s=yt(t,u),t[s]===")"&&s++,{expr:{type:"ArithGroup",expression:c},pos:s}}if(t[s]==="'"){s++;let c="";for(;s<t.length&&t[s]!=="'";)c+=t[s],s++;t[s]==="'"&&s++;let u=Number.parseInt(c,10);return{expr:{type:"ArithSingleQuote",content:c,value:Number.isNaN(u)?0:u},pos:s}}if(t[s]==='"'){s++;let c="";for(;s<t.length&&t[s]!=='"';)t[s]==="\\"&&s+1<t.length?(c+=t[s+1],s+=2):(c+=t[s],s++);t[s]==='"'&&s++;let u=c.trim();if(!u)return{expr:{type:"ArithNumber",value:0},pos:s};let{expr:f}=ri(e,u,0);return{expr:f,pos:s}}if(/[0-9]/.test(t[s])){let c="",u=!1,f=!1;for(;s<t.length;){let p=t[s];if(u)if(/[0-9a-zA-Z@_]/.test(p))c+=p,s++;else break;else if(p==="#")u=!0,c+=p,s++;else if(c==="0"&&(p==="x"||p==="X")&&s+1<t.length&&/[0-9a-fA-F]/.test(t[s+1]))f=!0,c+=p,s++;else if(f&&/[0-9a-fA-F]/.test(p))c+=p,s++;else if(!f&&/[0-9]/.test(p))c+=p,s++;else break}if(s<t.length&&/[a-zA-Z_]/.test(t[s])){let p=c;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)p+=t[s],s++;return{expr:{type:"ArithSyntaxError",errorToken:p,message:`${p}: value too great for base (error token is "${p}")`},pos:s}}if(t[s]==="."&&/[0-9]/.test(t[s+1]))throw new Ge(`${c}.${t[s+1]}...: syntax error: invalid arithmetic operator`);if(t[s]==="["){let p=t.slice(s).trim();return{expr:{type:"ArithNumberSubscript",number:c,errorToken:p},pos:t.length}}return{expr:{type:"ArithNumber",value:ta(c)},pos:s}}if(t[s]==="$"&&t[s+1]==="{"){let c=s+2,u=1,f=c;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;let d=t.slice(c,f),p=f+1;if(t[p]==="#"){let h=p+1;for(;h<t.length&&/[0-9a-zA-Z@_]/.test(t[h]);)h++;let m=t.slice(p+1,h);return{expr:{type:"ArithDynamicBase",baseExpr:d,value:m},pos:h}}if(/[0-9]/.test(t[p])||t[p]==="x"||t[p]==="X"){let h=p;if(t[p]==="x"||t[p]==="X")for(h++;h<t.length&&/[0-9a-fA-F]/.test(t[h]);)h++;else for(;h<t.length&&/[0-9]/.test(t[h]);)h++;let m=t.slice(p,h);return{expr:{type:"ArithDynamicNumber",prefix:d,suffix:m},pos:h}}return s=p,{expr:{type:"ArithBracedExpansion",content:d},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[0-9]/.test(t[s+1])){s++;let c="";for(;s<t.length&&/[0-9]/.test(t[s]);)c+=t[s],s++;return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:!0},pos:s}}if(t[s]==="$"&&s+1<t.length&&/[*@#?\-!$]/.test(t[s+1])){let c=t[s+1];return s+=2,{expr:{type:"ArithSpecialVar",name:c},pos:s}}let l=!1;if(t[s]==="$"&&s+1<t.length&&/[a-zA-Z_]/.test(t[s+1])&&(l=!0,s++),s<t.length&&/[a-zA-Z_]/.test(t[s])){let c="";for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)c+=t[s],s++;if(t[s]==="["&&!r){s++;let u;if(t[s]==="'"||t[s]==='"'){let d=t[s];for(s++,u="";s<t.length&&t[s]!==d;)u+=t[s],s++;t[s]===d&&s++,s=yt(t,s),t[s]==="]"&&s++}let f;if(u===void 0){let{expr:d,pos:p}=ri(e,t,s);f=d,s=p,t[s]==="]"&&s++}if(s=yt(t,s),t[s]==="["&&f)return{expr:{type:"ArithDoubleSubscript",array:c,index:f},pos:s};if(!r){for(let d of Kl)if(t.slice(s,s+d.length)===d&&t.slice(s,s+d.length+1)!=="=="){s+=d.length;let{expr:p,pos:h}=e.withDepth(()=>na(e,t,s));return{expr:{type:"ArithAssignment",operator:d,variable:c,subscript:f,stringKey:u,value:p},pos:h}}}return{expr:{type:"ArithArrayElement",array:c,index:f,stringKey:u},pos:s}}if(s=yt(t,s),!r){for(let u of Kl)if(t.slice(s,s+u.length)===u&&t.slice(s,s+u.length+1)!=="=="){s+=u.length;let{expr:f,pos:d}=e.withDepth(()=>na(e,t,s));return{expr:{type:"ArithAssignment",operator:u,variable:c,value:f},pos:d}}}return{expr:{type:"ArithVariable",name:c,hasDollarPrefix:l},pos:s}}if(t[s]==="#"){let c=s+1;for(;c<t.length&&t[c]!==`
874
874
  `;)c++;let u=t.slice(s,c).trim()||"#";return{expr:{type:"ArithSyntaxError",errorToken:u,message:`${u}: syntax error: invalid arithmetic operator (error token is "${u}")`},pos:t.length}}return{expr:{type:"ArithNumber",value:0},pos:s}}var Ql=e=>{let t,n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="\\"&&t==='"'&&r+1<e.length){n+=s+e[r+1],r+=1;continue}if(s==="'"||s==='"'){t===s?t=void 0:t||(t=s),n+=s;continue}if(s==="\\"&&!t&&r+1<e.length){let i=e[r+1];n+=i==="$"||i==="`"?`\\${i}`:i,r+=1;continue}n+=s}return n};function xI(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 s=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(s),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 s=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(s>=55296&&s<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(s),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 s=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(s>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(s),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function N7(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function Ld(e,t,n,r,s){let i=1,o=n+1;for(;o<t.length&&i>0;)t[o]===r?i++:t[o]===s&&i--,i>0&&o++;return i===0?o:-1}function si(e,t,n){let r=n,s=1;for(;r<t.length&&s>0;){let i=t[r];if(i==="\\"&&r+1<t.length){r+=2;continue}if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}i==="{"?s++:i==="}"&&s--,s>0&&r++}return r}function I7(e,t,n){let r=n,s=!1;for(;r<t.length;){let i=t[r];if(i==="/"&&s||i==="}")break;if(i==="'"){let o=t.indexOf("'",r+1);if(o!==-1){r=o+1,s=!0;continue}}if(i==='"'){for(r++;r<t.length&&t[r]!=='"';)t[r]==="\\"&&r+1<t.length?r+=2:r++;r<t.length&&r++,s=!0;continue}i==="\\"?(r+=2,s=!0):(r++,s=!0)}return r}function O7(e,t,n){let r=n,s="";for(;r<t.length;){let i=t[r];if(i==="*"||i==="?")s+=i,r++;else if(i==="["){let o=EI(t,r);o===-1?(s+=i,r++):(s+=t.slice(r,o+1),r=o+1)}else break}return{pattern:s,endIndex:r}}function EI(e,t){let n=t+1;for(n<e.length&&e[n]==="^"&&n++,n<e.length&&e[n]==="]"&&n++;n<e.length;){let r=e[n];if(r==="\\"&&n+1<e.length){let s=e[n+1];if(s==='"'||s==="'")return-1;n+=2;continue}if(r==="]")return n;if(r==='"'||r==="$"||r==="`")return-1;if(r==="'"){let s=e.indexOf("'",n+1);if(s!==-1){n=s+1;continue}}if(r==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){n=s+2;continue}}if(r==="["&&n+1<e.length&&(e[n+1]==="."||e[n+1]==="=")){let i=`${e[n+1]}]`,o=e.indexOf(i,n+2);if(o!==-1){n=o+2;continue}}n++}return-1}function T7(e,t,n){let r="",s=n;for(;s<t.length&&t[s]!=="'";){let i=t[s];if(i==="\\"&&s+1<t.length)switch(t[s+1]){case"n":r+=`
875
- `,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let a=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)a.push(u),l+=2+c.length;else break}a.length>0?(r+=xI(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:J.literal(r),endIndex:s}}function Fd(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Be(e,n)}function v7(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function $7(e,t,n,r){let s=Ld(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.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:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:v7(i).map(u=>e.withDepth(()=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))})))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:v7(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function Md(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 s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.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 s=[];for(let i of r.items)if(i.type==="Range"){let o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(Md(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function R7(e,t){return{[k.LESS]:"<",[k.GREAT]:">",[k.DGREAT]:">>",[k.LESSAND]:"<&",[k.GREATAND]:">&",[k.LESSGREAT]:"<>",[k.CLOBBER]:">|",[k.TLESS]:"<<<",[k.AND_GREAT]:"&>",[k.AND_DGREAT]:"&>>",[k.DLESS]:"<",[k.DLESSDASH]:"<"}[t]||">"}function ra(e){let t=e.current(),n=t.type;if(n===k.NUMBER){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:f7.has(r.type)}if(n===k.FD_VARIABLE){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:d7.has(r.type)}return!e.isProcessSubstitutionStart()&&u7.has(n)}function Yl(e){let t=null,n;e.check(k.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(k.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=R7(e,r.type);if(r.type===k.DLESS||r.type===k.DLESSDASH)return SI(e,t,n,r.type===k.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function SI(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.heredocDelimiter??s.value,o=s.quoted||!1,a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),t,n);return e.addPendingHeredoc(a,i,r,o),a}function Bd(e){let t=e.getSourceLine(),n=[],r=null,s=[],i=[];for(;e.check(k.ASSIGNMENT_WORD)||ra(e);)e.checkIterationLimit(),e.check(k.ASSIGNMENT_WORD)?n.push(AI(e)):i.push(Yl(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(k.DBRACK_START)||e.check(k.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(k.RBRACE))&&!e.check(k.PIPE,k.PIPE_AMP);)if(e.checkIterationLimit(),ra(e))i.push(Yl(e));else if(e.check(k.ASSIGNMENT_WORD)){let a=e.advance(),l=a.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(k.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(k.LPAREN);let d=_d(e);e.expect(k.RPAREN);let p=d.map(m=>Md(e,m)),h=`${f}=(${p.join(" ")})`;s.push(e.parseWordFromString(h,!1,!1,!0))}else{let f=e.parseWordFromString(l,a.quoted,a.singleQuoted,!0);s.push(e.parseAdjacentWordParts(f.parts,a.end,Zt.Assignment))}}else if(e.isWord())s.push(e.parseWord());else if(e.check(k.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function AI(e){let t=e.expect(k.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,o=s.length;if(n[o]==="["){let f=0,d=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=Ql(n.slice(d,o)),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=_d(e);e.expect(k.RPAREN);let d=i!==void 0?`${s}[${i}]`:s;return J.assignment(d,null,a,f)}if(l===""&&e.check(k.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let d=_d(e);e.expect(k.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,d)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null;t.end===e.current().start&&e.isProcessSubstitutionStart()&&(c=e.parseAdjacentWordParts(c?.parts??[],t.end,Zt.Assignment));let u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}var CI=new Set([k.AMP,k.PIPE,k.PIPE_AMP,k.SEMICOLON,k.AND_AND,k.OR_OR,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND]);function _d(e){let t=[];for(e.skipNewlines();!e.check(k.RPAREN,k.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):CI.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}function Ud(e,t){e.expect(k.IF);let n=[],r=e.parseCompoundList();e.expect(k.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(k.FI)?"fi":e.check(k.ELSE)?"else":e.check(k.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(k.ELIF);){e.advance();let a=e.parseCompoundList();e.expect(k.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(k.FI)?"fi":e.check(k.ELSE)?"else":e.check(k.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:a,body:l})}let i=null;e.check(k.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(k.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function zd(e,t){let n=e.expect(k.FOR);if(e.check(k.DPAREN_START))return vI(e,t,e.getSourceLine(n));e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(k.IN))for(e.advance(),i=[];!e.check(k.SEMICOLON,k.NEWLINE,k.DO,k.EOF)&&e.isWord();)i.push(e.parseWord());e.check(k.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(k.DO);let o=e.parseCompoundList();e.expect(k.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function vI(e,t,n){e.expect(k.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(k.DPAREN_END,k.EOF);){let f=e.advance();if(f.type===k.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(k.DPAREN_END),o[0].trim()&&(r=Be(e,o[0].trim())),o[1].trim()&&(s=Be(e,o[1].trim())),o[2].trim()&&(i=Be(e,o[2].trim())),e.skipNewlines(),e.check(k.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(k.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(k.RBRACE)):(e.expect(k.DO),c=e.parseCompoundList(),e.expect(k.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function Wd(e,t){e.expect(k.WHILE);let n=e.parseCompoundList();e.expect(k.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(k.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.whileNode(n,r,s)}function jd(e,t){e.expect(k.UNTIL);let n=e.parseCompoundList();e.expect(k.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(k.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.untilNode(n,r,s)}function Hd(e,t){e.expect(k.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(k.IN),e.skipNewlines();let r=[];for(;!e.check(k.ESAC,k.EOF);){e.checkIterationLimit();let i=e.getPos(),o=NI(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(k.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function NI(e){e.check(k.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(k.PIPE));)e.advance();if(t.length===0)return null;e.expect(k.RPAREN),e.skipNewlines();let n=[];for(;!e.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND,k.ESAC,k.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===k.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(k.LPAREN)&&e.peek(1).type===k.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(k.DSEMI)?(e.advance(),r=";;"):e.check(k.SEMI_AND)?(e.advance(),r=";&"):e.check(k.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),J.caseItem(t,n,r)}function Vd(e,t){e.expect(k.LPAREN);let n=e.parseCompoundList();e.expect(k.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function qd(e,t){e.expect(k.LBRACE);let n=e.parseCompoundList();e.expect(k.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var OI=["-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"],TI=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"];function D7(e){return e.isWord()||e.check(k.LBRACE)||e.check(k.RBRACE)||e.check(k.ASSIGNMENT_WORD)}function L7(e){if(e.check(k.BANG)&&e.peek(1).type===k.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(k.EOF);)if(e.check(k.LPAREN))t++,n+="(",e.advance();else if(e.check(k.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(k.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function Zd(e){return e.skipNewlines(),$I(e)}function $I(e){let t=F7(e);for(e.skipNewlines();e.check(k.OR_OR);){e.advance(),e.skipNewlines();let n=F7(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function F7(e){let t=Gd(e);for(e.skipNewlines();e.check(k.AND_AND);){e.advance(),e.skipNewlines();let n=Gd(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function Gd(e){return e.skipNewlines(),e.check(k.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:e.withDepth(()=>Gd(e))}):RI(e)}function RI(e){if(e.check(k.LPAREN)){e.advance();let t=e.withDepth(()=>Zd(e));return e.expect(k.RPAREN),{type:"CondGroup",expression:t}}if(D7(e)){let t=e.current(),n=t.value;if(OI.includes(n)&&!t.quoted){if(e.advance(),e.check(k.DBRACK_END)&&e.error(`Expected operand after ${n}`),D7(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&TI.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=PI(e):s==="=="||s==="!="?i=L7(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(k.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(k.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=L7(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function PI(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(k.DBRACK_END)||e.check(k.AND_AND)||e.check(k.OR_OR)||e.check(k.NEWLINE)||e.check(k.EOF);for(;!i();){let o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(k.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(k.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(k.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(k.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(k.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(k.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(k.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(k.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(k.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(k.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(k.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(k.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(k.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(k.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(k.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(k.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(k.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(k.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(k.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}function LI(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=e[n+1];if(r!=="\\"||s===void 0){t+=r;continue}"\\[]^-".includes(s)&&(t+="\\"),t+=s,n++}return t}function sa(e){return e.length>0?e:[J.literal("")]}function FI(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function MI(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function _I(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=Ld(e,t,s,"[","]");if(a+=`[${Ql(t.slice(s+1,u))}]`,s=u+1,t[s]==="["){let f=1,d=s;for(;d<t.length&&f>0;)t[d]==="{"?f++:t[d]==="}"&&f--,f>0&&d++;let p=t.slice(n+2,d);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:d+1}}}if(a===""&&!i&&!o&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new jt("unexpected EOF while looking for matching '}'",0,0);let d=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:d}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Kd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Kd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=Kd(e,t,s,a,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let d=t.slice(n,f+1);e.error(`\${${d.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new jt("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function Kd(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let b=si(e,t,i),y=t.slice(i,b),w=e.withDepth(()=>us(e,y,!1,!1,!0,!1,s,!1,!1,!0)),x=J.word(sa(w));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:b};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:b};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:b};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:b}}i++;let c=si(e,t,i),u=t.slice(i,c),f=-1,d=0,p=0;for(let g=0;g<u.length;g++){let b=u[g];if(b==="("||b==="[")d++;else if(b===")"||b==="]")d--;else if(b==="?"&&d===0)p++;else if(b===":"&&d===0)if(p>0)p--;else{f=g;break}}let h=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Fd(e,h),length:m!==null?Fd(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=si(e,t,i),c=t.slice(i,l),u=e.withDepth(()=>us(e,c,!1,!1,!0,!1,s,!1,!1,!0)),f=J.word(sa(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=si(e,t,i),f=t.slice(i,u),d=e.withDepth(()=>us(e,f,!1,!1,!1));return{operation:{type:"PatternRemoval",pattern:J.word(sa(d)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=I7(e,t,i);let f=t.slice(i,u),d=e.withDepth(()=>us(e,f,!1,!1,!1)),p=J.word(sa(d)),h=null,m=u;if(t[u]==="/"){let g=u+1,b=si(e,t,g),y=t.slice(g,b),w=e.withDepth(()=>us(e,y,!1,!1,!1));h=J.word(sa(w)),m=b}return{operation:{type:"PatternReplacement",pattern:p,replacement:h,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=si(e,t,i),f=t.slice(i,u),d=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:d},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function Xd(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=Be(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?_I(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?MI(e,t,n):{part:J.literal("$"),endIndex:s}}function M7(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=Xd(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function BI(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=Xd(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:J.doubleQuoted(r),endIndex:s}}function us(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!0){if(r)return[J.singleQuoted(t)];if(n){let m=M7(e,t);return[J.doubleQuoted(m)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),g=!1;for(let b=0;b<m.length;b++){if(m[b]==='"'){g=!0;break}m[b]==="\\"&&b+1<m.length&&b++}if(!g){let b=M7(e,m);return[J.doubleQuoted(b)]}}let f=[],d=0,p="",h=()=>{p&&(f.push(J.literal(p)),p="")};for(;d<t.length;){let m=t[d];if(m==="\\"&&d+1<t.length){let g=t[d+1];if(l){h(),f.push(J.escaped(g)),d+=2;continue}if(!i&&!o){g!==`
875
+ `,s+=2;break;case"t":r+=" ",s+=2;break;case"r":r+="\r",s+=2;break;case"\\":r+="\\",s+=2;break;case"'":r+="'",s+=2;break;case'"':r+='"',s+=2;break;case"a":r+="\x07",s+=2;break;case"b":r+="\b",s+=2;break;case"e":case"E":r+="\x1B",s+=2;break;case"f":r+="\f",s+=2;break;case"v":r+="\v",s+=2;break;case"x":{let a=[],l=s;for(;l+1<t.length&&t[l]==="\\"&&t[l+1]==="x";){let c=t.slice(l+2,l+4),u=parseInt(c,16);if(!Number.isNaN(u)&&c.length>0)a.push(u),l+=2+c.length;else break}a.length>0?(r+=xI(a),s=l):(r+="\\x",s+=2);break}case"u":{let a=t.slice(s+2,s+6),l=parseInt(a,16);Number.isNaN(l)?(r+="\\u",s+=2):(r+=String.fromCharCode(l),s+=6);break}case"c":{if(s+2<t.length){let l=t[s+2].charCodeAt(0)&31;r+=String.fromCharCode(l),s+=3}else r+="\\c",s+=2;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{let a="",l=s+1;for(;l<t.length&&l<s+4&&/[0-7]/.test(t[l]);)a+=t[l],l++;let c=parseInt(a,8);r+=String.fromCharCode(c),s=l;break}default:r+=i,s++}else r+=i,s++}return s<t.length&&t[s]==="'"&&s++,{part:J.literal(r),endIndex:s}}function Fd(e,t){let n=t.trim();return n===""?{type:"ArithmeticExpression",expression:{type:"ArithNumber",value:0}}:Ue(e,n)}function v7(e){let t=[],n="",r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="{"?(r++,n+=i):i==="}"?(r--,n+=i):i===","&&r===0?(t.push(n),n=""):n+=i}return t.push(n),t}function $7(e,t,n,r){let s=Ld(e,t,n,"{","}");if(s===-1)return null;let i=t.slice(n+1,s),o=i.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:s+1};let a=i.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return a?{part:{type:"BraceExpansion",items:[{type:"Range",start:a[1],end:a[2],step:a[3]?Number.parseInt(a[3],10):void 0}]},endIndex:s+1}:i.includes(",")&&r?{part:{type:"BraceExpansion",items:v7(i).map(u=>e.withDepth(()=>({type:"Word",word:J.word(r(e,u,!1,!1,!1))})))},endIndex:s+1}:i.includes(",")?{part:{type:"BraceExpansion",items:v7(i).map(u=>({type:"Word",word:J.word([J.literal(u)])}))},endIndex:s+1}:null}function Md(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 s of r.parts)s.type==="Literal"||s.type==="Escaped"?n+=s.value:s.type==="ParameterExpansion"&&(n+=`\${${s.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 s=[];for(let i of r.items)if(i.type==="Range"){let o=i.startStr??String(i.start),a=i.endStr??String(i.end);i.step!==void 0?s.push(`${o}..${a}..${i.step}`):s.push(`${o}..${a}`)}else s.push(Md(e,i.word));s.length===1&&r.items[0].type==="Range"?n+=s[0]:n+=s.join(","),n+="}";break}default:n+=r.type}return n}function R7(e,t){return{[k.LESS]:"<",[k.GREAT]:">",[k.DGREAT]:">>",[k.LESSAND]:"<&",[k.GREATAND]:">&",[k.LESSGREAT]:"<>",[k.CLOBBER]:">|",[k.TLESS]:"<<<",[k.AND_GREAT]:"&>",[k.AND_DGREAT]:"&>>",[k.DLESS]:"<",[k.DLESSDASH]:"<"}[t]||">"}function ra(e){let t=e.current(),n=t.type;if(n===k.NUMBER){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:f7.has(r.type)}if(n===k.FD_VARIABLE){let r=e.peek(1);return t.end!==r.start||e.isProcessSubstitutionStart(1)?!1:d7.has(r.type)}return!e.isProcessSubstitutionStart()&&u7.has(n)}function Yl(e){let t=null,n;e.check(k.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(k.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),s=R7(e,r.type);if(r.type===k.DLESS||r.type===k.DLESSDASH)return SI(e,t,n,r.type===k.DLESSDASH);e.isWord()||e.error("Expected redirection target");let i=e.parseWord();return J.redirection(s,i,t,n)}function SI(e,t,n,r){e.isWord()||e.error("Expected here-document delimiter");let s=e.advance(),i=s.heredocDelimiter??s.value,o=s.quoted||!1,a=J.redirection(r?"<<-":"<<",J.hereDoc(i,J.word([]),r,o),t,n);return e.addPendingHeredoc(a,i,r,o),a}function Bd(e){let t=e.getSourceLine(),n=[],r=null,s=[],i=[];for(;e.check(k.ASSIGNMENT_WORD)||ra(e);)e.checkIterationLimit(),e.check(k.ASSIGNMENT_WORD)?n.push(AI(e)):i.push(Yl(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(k.DBRACK_START)||e.check(k.DPAREN_START))){let a=e.advance();r=J.word([J.literal(a.value)])}for(;(!e.isStatementEnd()||e.check(k.RBRACE))&&!e.check(k.PIPE,k.PIPE_AMP);)if(e.checkIterationLimit(),ra(e))i.push(Yl(e));else if(e.check(k.ASSIGNMENT_WORD)){let a=e.advance(),l=a.value,c=l.endsWith("="),u=l.endsWith("=(");if((c||u)&&(u||e.check(k.LPAREN))){let f=u?l.slice(0,-2):l.slice(0,-1);u||e.expect(k.LPAREN);let d=_d(e);e.expect(k.RPAREN);let p=d.map(m=>Md(e,m)),h=`${f}=(${p.join(" ")})`;s.push(e.parseWordFromString(h,!1,!1,!0))}else{let f=e.parseWordFromString(l,a.quoted,a.singleQuoted,!0);s.push(e.parseAdjacentWordParts(f.parts,a.end,Zt.Assignment))}}else if(e.isWord())s.push(e.parseWord());else if(e.check(k.RBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.LBRACE)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.DBRACK_END)){let a=e.advance();s.push(e.parseWordFromString(a.value,!1,!1))}else if(e.check(k.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=J.simpleCommand(r,s,n,i);return o.line=t,o}function AI(e){let t=e.expect(k.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let s=r[0],i,o=s.length;if(n[o]==="["){let f=0,d=o+1;for(;o<n.length;o++)if(n[o]==="[")f++;else if(n[o]==="]"&&(f--,f===0))break;f!==0&&e.error(`Invalid assignment: ${n}`),i=Ql(n.slice(d,o)),o++}let a=n[o]==="+";a&&o++,n[o]!=="="&&e.error(`Invalid assignment: ${n}`),o++;let l=n.slice(o);if(l==="("){let f=_d(e);e.expect(k.RPAREN);let d=i!==void 0?`${s}[${i}]`:s;return J.assignment(d,null,a,f)}if(l===""&&e.check(k.LPAREN)){let f=e.current();if(t.end===f.start){e.advance();let d=_d(e);e.expect(k.RPAREN);let p=i!==void 0?`${s}[${i}]`:s;return J.assignment(p,null,a,d)}}let c=l?e.parseWordFromString(l,t.quoted,t.singleQuoted,!0):null;t.end===e.current().start&&e.isProcessSubstitutionStart()&&(c=e.parseAdjacentWordParts(c?.parts??[],t.end,Zt.Assignment));let u=i!==void 0?`${s}[${i}]`:s;return J.assignment(u,c,a,null)}var CI=new Set([k.AMP,k.PIPE,k.PIPE_AMP,k.SEMICOLON,k.AND_AND,k.OR_OR,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND]);function _d(e){let t=[];for(e.skipNewlines();!e.check(k.RPAREN,k.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):CI.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}function Ud(e,t){e.expect(k.IF);let n=[],r=e.parseCompoundList();e.expect(k.THEN);let s=e.parseCompoundList();if(s.length===0){let a=e.check(k.FI)?"fi":e.check(k.ELSE)?"else":e.check(k.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${a}'`)}for(n.push({condition:r,body:s});e.check(k.ELIF);){e.advance();let a=e.parseCompoundList();e.expect(k.THEN);let l=e.parseCompoundList();if(l.length===0){let c=e.check(k.FI)?"fi":e.check(k.ELSE)?"else":e.check(k.ELIF)?"elif":"fi";e.error(`syntax error near unexpected token \`${c}'`)}n.push({condition:a,body:l})}let i=null;e.check(k.ELSE)&&(e.advance(),i=e.parseCompoundList(),i.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(k.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.ifNode(n,i,o)}function zd(e,t){let n=e.expect(k.FOR);if(e.check(k.DPAREN_START))return vI(e,t,e.getSourceLine(n));e.isWord()||e.error("Expected variable name in for loop");let s=e.advance().value,i=null;if(e.skipNewlines(),e.check(k.IN))for(e.advance(),i=[];!e.check(k.SEMICOLON,k.NEWLINE,k.DO,k.EOF)&&e.isWord();)i.push(e.parseWord());e.check(k.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(k.DO);let o=e.parseCompoundList();e.expect(k.DONE);let a=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.forNode(s,i,o,a)}function vI(e,t,n){e.expect(k.DPAREN_START);let r=null,s=null,i=null,o=["","",""],a=0,l=0;for(;!e.check(k.DPAREN_END,k.EOF);){let f=e.advance();if(f.type===k.SEMICOLON&&l===0){if(a++,a>2)break}else f.value==="("&&l++,f.value===")"&&l--,o[a]+=f.value}e.expect(k.DPAREN_END),o[0].trim()&&(r=Ue(e,o[0].trim())),o[1].trim()&&(s=Ue(e,o[1].trim())),o[2].trim()&&(i=Ue(e,o[2].trim())),e.skipNewlines(),e.check(k.SEMICOLON)&&e.advance(),e.skipNewlines();let c;e.check(k.LBRACE)?(e.advance(),c=e.parseCompoundList(),e.expect(k.RBRACE)):(e.expect(k.DO),c=e.parseCompoundList(),e.expect(k.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:"CStyleFor",init:r,condition:s,update:i,body:c,redirections:u,line:n}}function Wd(e,t){e.expect(k.WHILE);let n=e.parseCompoundList();e.expect(k.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(k.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.whileNode(n,r,s)}function jd(e,t){e.expect(k.UNTIL);let n=e.parseCompoundList();e.expect(k.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(k.DONE);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.untilNode(n,r,s)}function Hd(e,t){e.expect(k.CASE),e.isWord()||e.error("Expected word after 'case'");let n=e.parseWord();e.skipNewlines(),e.expect(k.IN),e.skipNewlines();let r=[];for(;!e.check(k.ESAC,k.EOF);){e.checkIterationLimit();let i=e.getPos(),o=NI(e);if(o&&r.push(o),e.skipNewlines(),e.getPos()===i&&!o)break}e.expect(k.ESAC);let s=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.caseNode(n,r,s)}function NI(e){e.check(k.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(k.PIPE));)e.advance();if(t.length===0)return null;e.expect(k.RPAREN),e.skipNewlines();let n=[];for(;!e.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND,k.ESAC,k.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===k.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(k.LPAREN)&&e.peek(1).type===k.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let s=e.getPos(),i=e.parseStatement();if(i&&n.push(i),e.skipSeparators(!1),e.getPos()===s&&!i)break}let r=";;";return e.check(k.DSEMI)?(e.advance(),r=";;"):e.check(k.SEMI_AND)?(e.advance(),r=";&"):e.check(k.SEMI_SEMI_AND)&&(e.advance(),r=";;&"),J.caseItem(t,n,r)}function Vd(e,t){e.expect(k.LPAREN);let n=e.parseCompoundList();e.expect(k.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.subshell(n,r)}function qd(e,t){e.expect(k.LBRACE);let n=e.parseCompoundList();e.expect(k.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return J.group(n,r)}var OI=["-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"],TI=["==","!=","=~","<",">","-eq","-ne","-lt","-le","-gt","-ge","-nt","-ot","-ef"];function D7(e){return e.isWord()||e.check(k.LBRACE)||e.check(k.RBRACE)||e.check(k.ASSIGNMENT_WORD)}function L7(e){if(e.check(k.BANG)&&e.peek(1).type===k.LPAREN){e.advance(),e.advance();let t=1,n="!(";for(;t>0&&!e.check(k.EOF);)if(e.check(k.LPAREN))t++,n+="(",e.advance();else if(e.check(k.RPAREN))t--,t>0&&(n+=")"),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(k.PIPE))n+="|",e.advance();else break;return n+=")",e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function Zd(e){return e.skipNewlines(),$I(e)}function $I(e){let t=F7(e);for(e.skipNewlines();e.check(k.OR_OR);){e.advance(),e.skipNewlines();let n=F7(e);t={type:"CondOr",left:t,right:n},e.skipNewlines()}return t}function F7(e){let t=Gd(e);for(e.skipNewlines();e.check(k.AND_AND);){e.advance(),e.skipNewlines();let n=Gd(e);t={type:"CondAnd",left:t,right:n},e.skipNewlines()}return t}function Gd(e){return e.skipNewlines(),e.check(k.BANG)?(e.advance(),e.skipNewlines(),{type:"CondNot",operand:e.withDepth(()=>Gd(e))}):RI(e)}function RI(e){if(e.check(k.LPAREN)){e.advance();let t=e.withDepth(()=>Zd(e));return e.expect(k.RPAREN),{type:"CondGroup",expression:t}}if(D7(e)){let t=e.current(),n=t.value;if(OI.includes(n)&&!t.quoted){if(e.advance(),e.check(k.DBRACK_END)&&e.error(`Expected operand after ${n}`),D7(e)){let i=e.parseWordNoBraceExpansion();return{type:"CondUnary",operator:n,operand:i}}let s=e.current();e.error(`unexpected argument \`${s.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&TI.includes(e.current().value)){let s=e.advance().value,i;return s==="=~"?i=PI(e):s==="=="||s==="!="?i=L7(e):i=e.parseWordNoBraceExpansion(),{type:"CondBinary",operator:s,left:r,right:i}}if(e.check(k.LESS)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:"<",left:r,right:s}}if(e.check(k.GREAT)){e.advance();let s=e.parseWordNoBraceExpansion();return{type:"CondBinary",operator:">",left:r,right:s}}if(e.isWord()&&e.current().value==="="){e.advance();let s=L7(e);return{type:"CondBinary",operator:"==",left:r,right:s}}return{type:"CondWord",word:r}}e.error("Expected conditional expression")}function PI(e){let t=[],n=0,r=-1,s=e.getInput(),i=()=>e.check(k.DBRACK_END)||e.check(k.AND_AND)||e.check(k.OR_OR)||e.check(k.NEWLINE)||e.check(k.EOF);for(;!i();){let o=e.current(),a=r>=0&&o.start>r;if(n===0&&a)break;if(n>0&&a){let l=s.slice(r,o.start);t.push({type:"Literal",value:l})}if(e.isWord()||e.check(k.ASSIGNMENT_WORD)){let l=e.parseWordForRegex();t.push(...l.parts),r=e.peek(-1).end}else if(e.check(k.LPAREN)){let l=e.advance();t.push({type:"Literal",value:"("}),n++,r=l.end}else if(e.check(k.DPAREN_START)){let l=e.advance();t.push({type:"Literal",value:"(("}),n+=2,r=l.end}else if(e.check(k.DPAREN_END))if(n>=2){let l=e.advance();t.push({type:"Literal",value:"))"}),n-=2,r=l.end}else{if(n===1)break;break}else if(e.check(k.RPAREN))if(n>0){let l=e.advance();t.push({type:"Literal",value:")"}),n--,r=l.end}else break;else if(e.check(k.PIPE)){let l=e.advance();t.push({type:"Literal",value:"|"}),r=l.end}else if(e.check(k.SEMICOLON))if(n>0){let l=e.advance();t.push({type:"Literal",value:";"}),r=l.end}else break;else if(n>0&&e.check(k.LESS)){let l=e.advance();t.push({type:"Literal",value:"<"}),r=l.end}else if(n>0&&e.check(k.GREAT)){let l=e.advance();t.push({type:"Literal",value:">"}),r=l.end}else if(n>0&&e.check(k.DGREAT)){let l=e.advance();t.push({type:"Literal",value:">>"}),r=l.end}else if(n>0&&e.check(k.DLESS)){let l=e.advance();t.push({type:"Literal",value:"<<"}),r=l.end}else if(n>0&&e.check(k.LESSAND)){let l=e.advance();t.push({type:"Literal",value:"<&"}),r=l.end}else if(n>0&&e.check(k.GREATAND)){let l=e.advance();t.push({type:"Literal",value:">&"}),r=l.end}else if(n>0&&e.check(k.LESSGREAT)){let l=e.advance();t.push({type:"Literal",value:"<>"}),r=l.end}else if(n>0&&e.check(k.CLOBBER)){let l=e.advance();t.push({type:"Literal",value:">|"}),r=l.end}else if(n>0&&e.check(k.TLESS)){let l=e.advance();t.push({type:"Literal",value:"<<<"}),r=l.end}else if(n>0&&e.check(k.AMP)){let l=e.advance();t.push({type:"Literal",value:"&"}),r=l.end}else if(n>0&&e.check(k.LBRACE)){let l=e.advance();t.push({type:"Literal",value:"{"}),r=l.end}else if(n>0&&e.check(k.RBRACE)){let l=e.advance();t.push({type:"Literal",value:"}"}),r=l.end}else break}return t.length===0&&e.error("Expected regex pattern after =~"),{type:"Word",parts:t}}function LI(e){let t="";for(let n=0;n<e.length;n++){let r=e[n],s=e[n+1];if(r!=="\\"||s===void 0){t+=r;continue}"\\[]^-".includes(s)&&(t+="\\"),t+=s,n++}return t}function sa(e){return e.length>0?e:[J.literal("")]}function FI(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if("@*+?!".includes(s)&&r+1<e.length&&e[r+1]==="("){r++,n++,r++;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function MI(e,t,n){let r=n+1,s=t[r];if("@*#?$!-0123456789".includes(s))return{part:J.parameterExpansion(s),endIndex:r+1};let i="";for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)i+=t[r],r++;return{part:J.parameterExpansion(i),endIndex:r}}function _I(e,t,n,r=!1){let s=n+2,i=!1;t[s]==="!"&&(i=!0,s++);let o=!1;t[s]==="#"&&!/[}:#%/^,]/.test(t[s+1]||"}")&&(o=!0,s++);let a="",l=t[s];if(/[@*#?$!-]/.test(l)&&!/[a-zA-Z0-9_]/.test(t[s+1]||""))a=l,s++;else for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)a+=t[s],s++;if(t[s]==="["){let u=Ld(e,t,s,"[","]");if(a+=`[${Ql(t.slice(s+1,u))}]`,s=u+1,t[s]==="["){let f=1,d=s;for(;d<t.length&&f>0;)t[d]==="{"?f++:t[d]==="}"&&f--,f>0&&d++;let p=t.slice(n+2,d);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:p}),endIndex:d+1}}}if(a===""&&!i&&!o&&t[s]!=="}"){let u=1,f=s;for(;f<t.length&&u>0;)t[f]==="{"?u++:t[f]==="}"&&u--,u>0&&f++;if(u>0)throw new jt("unexpected EOF while looking for matching '}'",0,0);let d=t.slice(n+2,f);return{part:J.parameterExpansion("",{type:"BadSubstitution",text:d}),endIndex:f+1}}let c=null;if(i){let u=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(u)if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Kd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):(c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="")}else c={type:"ArrayKeys",array:u[1],star:u[2]==="*"},a="";else if(t[s]==="*"||t[s]==="@"&&!/[QPaAEKkuUL]/.test(t[s+1]||"")){let f=t[s];s++,c={type:"VarNamePrefix",prefix:a,star:f==="*"},a=""}else if(s<t.length&&t[s]!=="}"&&/[:=\-+?#%/^,@]/.test(t[s])){let f=Kd(e,t,s,a,r);f.operation?(c={type:"Indirection",innerOp:f.operation},s=f.endIndex):c={type:"Indirection"}}else c={type:"Indirection"}}else if(o)if(t[s]===":")for(c={type:"LengthSliceError"};s<t.length&&t[s]!=="}";)s++;else t[s]!=="}"&&/[-+=?]/.test(t[s])?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):t[s]==="/"?e.error(`\${#${a}${t.slice(s,t.indexOf("}",s))}}: bad substitution`):c={type:"Length"};if(!c&&s<t.length&&t[s]!=="}"){let u=Kd(e,t,s,a,r);c=u.operation,s=u.endIndex}if(s<t.length&&t[s]!=="}"){let u=t[s];if(!/[:\-+=?#%/^,@[]/.test(u)){let f=s;for(;f<t.length&&t[f]!=="}";)f++;let d=t.slice(n,f+1);e.error(`\${${d.slice(2,-1)}}: bad substitution`)}}for(;s<t.length&&t[s]!=="}";)s++;if(s>=t.length)throw new jt("unexpected EOF while looking for matching '}'",0,0);return{part:J.parameterExpansion(a,c),endIndex:s+1}}function Kd(e,t,n,r,s=!1){let i=n,o=t[i],a=t[i+1]||"";if(o===":"){let l=a;if("-=?+".includes(l)){i+=2;let b=si(e,t,i),y=t.slice(i,b),w=e.withDepth(()=>us(e,y,!1,!1,!0,!1,s,!1,!1,!0)),x=J.word(sa(w));if(l==="-")return{operation:{type:"DefaultValue",word:x,checkEmpty:!0},endIndex:b};if(l==="=")return{operation:{type:"AssignDefault",word:x,checkEmpty:!0},endIndex:b};if(l==="?")return{operation:{type:"ErrorIfUnset",word:x,checkEmpty:!0},endIndex:b};if(l==="+")return{operation:{type:"UseAlternative",word:x,checkEmpty:!0},endIndex:b}}i++;let c=si(e,t,i),u=t.slice(i,c),f=-1,d=0,p=0;for(let g=0;g<u.length;g++){let b=u[g];if(b==="("||b==="[")d++;else if(b===")"||b==="]")d--;else if(b==="?"&&d===0)p++;else if(b===":"&&d===0)if(p>0)p--;else{f=g;break}}let h=f>=0?u.slice(0,f):u,m=f>=0?u.slice(f+1):null;return{operation:{type:"Substring",offset:Fd(e,h),length:m!==null?Fd(e,m):null},endIndex:c}}if("-=?+".includes(o)){i++;let l=si(e,t,i),c=t.slice(i,l),u=e.withDepth(()=>us(e,c,!1,!1,!0,!1,s,!1,!1,!0)),f=J.word(sa(u));if(o==="-")return{operation:{type:"DefaultValue",word:f,checkEmpty:!1},endIndex:l};if(o==="=")return{operation:{type:"AssignDefault",word:f,checkEmpty:!1},endIndex:l};if(o==="?")return{operation:{type:"ErrorIfUnset",word:c?f:null,checkEmpty:!1},endIndex:l};if(o==="+")return{operation:{type:"UseAlternative",word:f,checkEmpty:!1},endIndex:l}}if(o==="#"||o==="%"){let l=a===o,c=o==="#"?"prefix":"suffix";i+=l?2:1;let u=si(e,t,i),f=t.slice(i,u),d=e.withDepth(()=>us(e,f,!1,!1,!1));return{operation:{type:"PatternRemoval",pattern:J.word(sa(d)),side:c,greedy:l},endIndex:u}}if(o==="/"){let l=a==="/";i+=l?2:1;let c=null;t[i]==="#"?(c="start",i++):t[i]==="%"&&(c="end",i++);let u;c!==null&&(t[i]==="/"||t[i]==="}")?u=i:u=I7(e,t,i);let f=t.slice(i,u),d=e.withDepth(()=>us(e,f,!1,!1,!1)),p=J.word(sa(d)),h=null,m=u;if(t[u]==="/"){let g=u+1,b=si(e,t,g),y=t.slice(g,b),w=e.withDepth(()=>us(e,y,!1,!1,!1));h=J.word(sa(w)),m=b}return{operation:{type:"PatternReplacement",pattern:p,replacement:h,all:l,anchor:c},endIndex:m}}if(o==="^"||o===","){let l=a===o,c=o==="^"?"upper":"lower";i+=l?2:1;let u=si(e,t,i),f=t.slice(i,u),d=f?J.word([J.literal(f)]):null;return{operation:{type:"CaseModification",direction:c,all:l,pattern:d},endIndex:u}}return o==="@"&&/[QPaAEKkuUL]/.test(a)?{operation:{type:"Transform",operator:a},endIndex:i+2}:{operation:null,endIndex:i}}function Xd(e,t,n,r=!1){let s=n+1;if(s>=t.length)return{part:J.literal("$"),endIndex:s};let i=t[s];if(i==="("&&t[s+1]==="(")return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(i==="["){let o=1,a=s+1;for(;a<t.length&&o>0;)t[a]==="["?o++:t[a]==="]"&&o--,o>0&&a++;if(o===0){let l=t.slice(s+1,a),c=Ue(e,l);return{part:J.arithmeticExpansion(c),endIndex:a+1}}}return i==="("?e.parseCommandSubstitution(t,n):i==="{"?_I(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(i)?MI(e,t,n):{part:J.literal("$"),endIndex:s}}function M7(e,t){let n=[],r=0,s="",i=()=>{s&&(n.push(J.literal(s)),s="")};for(;r<t.length;){let o=t[r];if(o==="\\"&&r+1<t.length){let a=t[r+1];if(a==="$"||a==="`"||a==='"'||a==="\\"){s+=a,r+=2;continue}s+=o,r++;continue}if(o==="$"){i();let{part:a,endIndex:l}=Xd(e,t,r,!0);a&&n.push(a),r=l;continue}if(o==="`"){i();let{part:a,endIndex:l}=e.parseBacktickSubstitution(t,r,!0);n.push(a),r=l;continue}s+=o,r++}return i(),n}function BI(e,t,n){let r=[],s=n,i="",o=()=>{i&&(r.push(J.literal(i)),i="")};for(;s<t.length&&t[s]!=='"';){let a=t[s];if(a==="\\"&&s+1<t.length){let l=t[s+1];if('"\\$`\n'.includes(l)){i+=l,s+=2;continue}i+=a,s++;continue}if(a==="$"){o();let{part:l,endIndex:c}=Xd(e,t,s,!0);l&&r.push(l),s=c;continue}if(a==="`"){o();let{part:l,endIndex:c}=e.parseBacktickSubstitution(t,s,!0);r.push(l),s=c;continue}i+=a,s++}return o(),{part:J.doubleQuoted(r),endIndex:s}}function us(e,t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!0){if(r)return[J.singleQuoted(t)];if(n){let m=M7(e,t);return[J.doubleQuoted(m)]}if(t.length>=2&&t[0]==='"'&&t[t.length-1]==='"'){let m=t.slice(1,-1),g=!1;for(let b=0;b<m.length;b++){if(m[b]==='"'){g=!0;break}m[b]==="\\"&&b+1<m.length&&b++}if(!g){let b=M7(e,m);return[J.doubleQuoted(b)]}}let f=[],d=0,p="",h=()=>{p&&(f.push(J.literal(p)),p="")};for(;d<t.length;){let m=t[d];if(m==="\\"&&d+1<t.length){let g=t[d+1];if(l){h(),f.push(J.escaped(g)),d+=2;continue}if(!i&&!o){g!==`
876
876
  `&&(h(),f.push(J.escaped(g))),d+=2;continue}let b=i?g==="$"||g==="`"||g===`
877
877
  `:g==="$"||g==="`"||g==='"'||g==="'"||g===`
878
878
  `||c&&g==="}",y=o?"*?[]\\".includes(g):"*?[]\\(){}.^+".includes(g);b?g!==`
879
- `&&(p+=g):y?(h(),f.push(J.escaped(g))):p+=`\\${g}`,d+=2;continue}if(m==="'"&&!o&&!i){h();let g=t.indexOf("'",d+1);if(g===-1){p+=t.slice(d);break}f.push(J.singleQuoted(t.slice(d+1,g))),d=g+1;continue}if(m==='"'&&!i){h();let{part:g,endIndex:b}=BI(e,t,d+1);f.push(g),d=b+1;continue}if(m==="$"&&t[d+1]==="'"){h();let{part:g,endIndex:b}=T7(e,t,d+2);f.push(g),d=b;continue}if(m==="$"){h();let{part:g,endIndex:b}=Xd(e,t,d);g&&f.push(g),d=b;continue}if(m==="`"){h();let{part:g,endIndex:b}=e.parseBacktickSubstitution(t,d);f.push(g),d=b;continue}if((m==="<"||m===">")&&t[d+1]==="("&&!i&&!o){h();let{part:g,endIndex:b}=e.parseProcessSubstitutionFromString(t,d);f.push(g),d=b;continue}if(m==="~"){let g=d>0?t[d-1]:"";if(d===0&&u||g==="="||s&&g===":"){let y=N7(e,t,d),w=t[y];if(w===void 0||w==="/"||w===":"){h();let x=t.slice(d+1,y)||null;f.push({type:"TildeExpansion",user:x}),d=y;continue}}}if("@*+?!".includes(m)&&d+1<t.length&&t[d+1]==="("){let g=FI(t,d+1);if(g!==-1){h();let b=t.slice(d,g+1);f.push({type:"Glob",pattern:b}),d=g+1;continue}}if(m==="*"||m==="?"||m==="["){h();let{pattern:g,endIndex:b}=O7(e,t,d);f.push({type:"Glob",pattern:l?LI(g):g}),d=b;continue}if(m==="{"&&!s&&!a&&!i){let g=$7(e,t,d,us);if(g){h(),f.push(g.part),d=g.endIndex;continue}}p+=m,d++}return h(),f}var xe=class e{tokens=[];pos=0;pendingHeredocs=[];parseBudget;ownsParseBudget;_input="";processLineState;constructor(t){this.parseBudget=t??new Zl,this.ownsParseBudget=t===void 0}getInput(){return this._input}checkIterationLimit(){let t=this.current();this.parseBudget.chargeIteration(t?.line??1,t?.column??1)}enterDepth(){let t=this.current();return this.parseBudget.enter(t?.line??1,t?.column??1)}withDepth(t){let n=this.enterDepth();try{return t()}finally{n()}}parse(t,n){this.ownsParseBudget&&this.parseBudget.reset();let r=this.ownsParseBudget?void 0:this.enterDepth();try{if(t.length>Rd)throw new jt(`Input too large: ${t.length} bytes exceeds limit of ${Rd}`,1,1);this._input=t,this.processLineState=void 0;let s=new Gl(t,n);if(this.tokens=s.tokenize(),this.tokens.length>ea)throw new jt(`Too many tokens: ${this.tokens.length} exceeds limit of ${ea}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseBudget.chargeTokens(this.tokens.length),this.parseScript()}finally{r?.()}}parseTokens(t){this.ownsParseBudget&&this.parseBudget.reset();let n=this.ownsParseBudget?void 0:this.enterDepth();try{return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.processLineState=void 0,this.parseBudget.chargeTokens(t.length),this.parseScript()}finally{n?.()}}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}getSourceLine(t=this.current()){let n=this.processLineState;return n?(n.currentPhysicalLine===void 0?n.currentPhysicalLine=t.line:t.line>n.currentPhysicalLine&&(n.currentPhysicalLine=t.line,n.currentLogicalLine+=1),n.currentLogicalLine):t.line}check(t,n,r,s,...i){let o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new jt(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new jt(t,n.line,n.column,n)}skipNewlines(){for(;this.check(k.NEWLINE,k.COMMENT);)this.check(k.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(k.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(k.SEMICOLON,k.COMMENT)){this.advance();continue}if(t&&this.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(k.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.hereDoc(t.delimiter,r,t.stripTabs,t.quoted,n.heredocTerminated??!1)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(k.EOF,k.NEWLINE,k.SEMICOLON,k.AMP,k.AND_AND,k.OR_OR,k.RPAREN,k.RBRACE,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return this.isWord()||t===k.ASSIGNMENT_WORD||t===k.FD_VARIABLE||t===k.LPAREN||t===k.LBRACE||t===k.DPAREN_START||t===k.DBRACK_START||ra(this)}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(k.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,o=this.parseStatement();o&&t.push(o),this.check(k.HEREDOC_CONTENT)&&this.processHeredocs(),this.skipSeparators(!1),this.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(k.EOF)&&this.error(`syntax error near unexpected token \`${this.current().value}'`)}return J.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if(this.currentTokenJoinsProcessSubstitution())return null;if((t===k.DO||t===k.DONE||t===k.THEN||t===k.ELSE||t===k.ELIF||t===k.FI||t===k.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===k.RBRACE||t===k.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),J.statement([J.pipeline([J.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===k.DSEMI||t===k.SEMI_AND||t===k.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===k.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===k.AMP||t===k.AND_AND||t===k.OR_OR||t===k.PIPE||t===k.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(k.AND_AND,k.OR_OR);){let l=this.advance();r.push(l.type===k.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(k.AMP)&&(this.advance(),s=!0);let o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}parseTimePrefix(){if(!this.check(k.TIME)||this.currentTokenJoinsProcessSubstitution())return;this.advance();let t=!1;return this.check(k.WORD,k.NAME)&&this.current().value==="-p"&&(this.advance(),t=!0),t}parsePipeline(){let t=!1,n=!1,r=0;for(;this.check(k.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++;if(r===0){let l=this.parseTimePrefix();if(l!==void 0)for(t=!0,n=l;this.check(k.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++}let s=r%2===1,i=[],o=[],a=this.parseCommand();for(i.push(a);this.check(k.PIPE,k.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===k.PIPE_AMP);let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){if(this.currentTokenJoinsProcessSubstitution())return Bd(this);let t=this.current();switch(t.type){case k.IF:return Ud(this);case k.FOR:return zd(this);case k.WHILE:return Wd(this);case k.UNTIL:return jd(this);case k.CASE:return Hd(this);case k.LPAREN:return Vd(this);case k.LBRACE:return qd(this);case k.DPAREN_START:return this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand();case k.DBRACK_START:return this.parseConditionalCommand();case k.FUNCTION:return this.parseFunctionDef();case k.TIME:break;case k.BANG:this.error(`syntax error near unexpected token \`${t.value}'`);break;default:$d(t.type)&&this.error(`syntax error near unexpected token \`${t.value}'`)}return this.check(k.NAME,k.WORD)&&this.peek(1).type===k.LPAREN&&this.peek(2).type===k.RPAREN?this.parseFunctionDef():Bd(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===k.EOF)return!1;if(r.type===k.DPAREN_START||r.type===k.LPAREN)t++;else if(r.type===k.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===k.RPAREN&&(t--,t===0&&this.peek(n+1).type===k.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(k.RPAREN),this.expect(k.RPAREN);let n=this.parseOptionalRedirections(),r=J.subshell(t,[]);return J.subshell([J.statement([J.pipeline([r],!1,!1,!1)])],n)}isWord(){return this.isWordToken(Zt.Default)||this.isProcessSubstitutionStart()||this.currentTokenJoinsProcessSubstitution()}isWordToken(t){let n=this.current().type;return n===k.WORD||n===k.NAME||n===k.NUMBER||$d(n)||n===k.BANG||n===k.ASSIGNMENT_WORD&&(t&Zt.Regex)!==0}isProcessSubstitutionStart(t=0){let n=this.peek(t),r=this.peek(t+1);return(n.type===k.LESS||n.type===k.GREAT)&&r.type===k.LPAREN&&n.end===r.start}currentTokenJoinsProcessSubstitution(){return this.current().type===k.COMMENT||!this.isAdjacentWordToken(Zt.Default)?!1:this.current().end===this.peek(1).start&&this.isProcessSubstitutionStart(1)}isAdjacentWordToken(t){let n=this.current().type;return this.isWordToken(t)||n===k.ASSIGNMENT_WORD||n===k.COMMENT||n===k.LBRACE||n===k.RBRACE||n===k.DBRACK_START||n===k.DBRACK_END||n===k.FD_VARIABLE}parseWord(t=Zt.Default){if(this.isProcessSubstitutionStart())return this.parseAdjacentWordParts([],this.current().start,t);let n=this.advance(),r=this.parseWordToken(n,t);return this.parseAdjacentWordParts(r.parts,n.end,t)}parseAdjacentWordParts(t,n,r=Zt.Default){for(;n===this.current().start;){if(this.isProcessSubstitutionStart()){t.push(this.parseProcessSubstitution()),n=this.tokens[this.pos-1].end;continue}if(!this.isAdjacentWordToken(r))break;let s=this.advance();t.push(...this.parseWordToken(s,r,t.length===0).parts),n=s.end}return J.word(t)}parseWordNoBraceExpansion(){return this.parseWord(Zt.NoBraceExpansion)}parseWordForRegex(){return this.parseWord(Zt.NoBraceExpansion|Zt.Regex)}parseWordToken(t,n,r=!0){return t.type===k.LBRACE||t.type===k.RBRACE||t.type===k.DBRACK_START||t.type===k.DBRACK_END||t.type===k.FD_VARIABLE?J.word([J.literal(t.type===k.FD_VARIABLE?`{${t.value}}`:t.value)]):this.parseWordFromString(t.value,t.quoted,t.singleQuoted,(n&Zt.Assignment)!==0,!1,(n&Zt.NoBraceExpansion)!==0,(n&Zt.Regex)!==0,r)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!0){let c=us(this,t,n,r,s,i,!1,o,a,!1,l);return J.word(c)}parseCommandSubstitution(t,n){return r7(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitutionFromString(t,n){return s7(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitution(){let t=this.advance();this.expect(k.LPAREN);let n=this.processLineState,r=this.getSourceLine(t);this.processLineState={currentLogicalLine:r};let s;try{s=J.script(this.parseCompoundList())}finally{this.processLineState=n}return this.check(k.EOF)&&this.error("unexpected EOF while looking for matching `)'"),this.expect(k.RPAREN),J.processSubstitution(s,t.type===k.LESS?"input":"output")}parseBacktickSubstitution(t,n,r=!1){return i7(t,n,r,()=>new e(this.parseBudget),s=>this.error(s))}isDollarDparenSubshell(t,n){return t7(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(k.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(k.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(k.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(k.DPAREN_END)){r--,o=!0;continue}n+=")";continue}if(this.check(k.DPAREN_START))r++,n+="((",this.advance();else if(this.check(k.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,o=!0,r>0&&(n+="))"),this.advance());else if(this.check(k.LPAREN))s++,n+="(",this.advance();else if(this.check(k.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}o||this.expect(k.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,this.getSourceLine(t))}parseConditionalCommand(){let t=this.expect(k.DBRACK_START),n=Zd(this);this.expect(k.DBRACK_END);let r=this.parseOptionalRedirections();return J.conditionalCommand(n,r,this.getSourceLine(t))}parseFunctionDef(){let t;if(this.check(k.FUNCTION)){if(this.advance(),this.check(k.NAME)||this.check(k.WORD))t=this.advance().value;else{let s=this.current();throw new jt("Expected function name",s.line,s.column,s)}this.check(k.LPAREN)&&(this.advance(),this.expect(k.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(k.LPAREN),this.expect(k.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(k.LBRACE))return qd(this,{skipRedirections:n});if(this.check(k.LPAREN))return Vd(this,{skipRedirections:n});if(this.check(k.IF))return Ud(this,{skipRedirections:n});if(this.check(k.FOR))return zd(this,{skipRedirections:n});if(this.check(k.WHILE))return Wd(this,{skipRedirections:n});if(this.check(k.UNTIL))return jd(this,{skipRedirections:n});if(this.check(k.CASE))return Hd(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth();try{let n=[];for(this.skipNewlines();(this.currentTokenJoinsProcessSubstitution()||!this.check(k.EOF,k.FI,k.ELSE,k.ELIF,k.THEN,k.DO,k.DONE,k.ESAC,k.RPAREN,k.RBRACE,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND))&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return n}finally{t()}}parseOptionalRedirections(){let t=[];for(;ra(this);){this.checkIterationLimit();let n=this.pos;if(t.push(Yl(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Be(this,t)}};function Yn(e,t){return new xe().parse(e,t)}function _7(e){return oi(e)}function oi(e){return e.statements.map(B7).join(`
879
+ `&&(p+=g):y?(h(),f.push(J.escaped(g))):p+=`\\${g}`,d+=2;continue}if(m==="'"&&!o&&!i){h();let g=t.indexOf("'",d+1);if(g===-1){p+=t.slice(d);break}f.push(J.singleQuoted(t.slice(d+1,g))),d=g+1;continue}if(m==='"'&&!i){h();let{part:g,endIndex:b}=BI(e,t,d+1);f.push(g),d=b+1;continue}if(m==="$"&&t[d+1]==="'"){h();let{part:g,endIndex:b}=T7(e,t,d+2);f.push(g),d=b;continue}if(m==="$"){h();let{part:g,endIndex:b}=Xd(e,t,d);g&&f.push(g),d=b;continue}if(m==="`"){h();let{part:g,endIndex:b}=e.parseBacktickSubstitution(t,d);f.push(g),d=b;continue}if((m==="<"||m===">")&&t[d+1]==="("&&!i&&!o){h();let{part:g,endIndex:b}=e.parseProcessSubstitutionFromString(t,d);f.push(g),d=b;continue}if(m==="~"){let g=d>0?t[d-1]:"";if(d===0&&u||g==="="||s&&g===":"){let y=N7(e,t,d),w=t[y];if(w===void 0||w==="/"||w===":"){h();let x=t.slice(d+1,y)||null;f.push({type:"TildeExpansion",user:x}),d=y;continue}}}if("@*+?!".includes(m)&&d+1<t.length&&t[d+1]==="("){let g=FI(t,d+1);if(g!==-1){h();let b=t.slice(d,g+1);f.push({type:"Glob",pattern:b}),d=g+1;continue}}if(m==="*"||m==="?"||m==="["){h();let{pattern:g,endIndex:b}=O7(e,t,d);f.push({type:"Glob",pattern:l?LI(g):g}),d=b;continue}if(m==="{"&&!s&&!a&&!i){let g=$7(e,t,d,us);if(g){h(),f.push(g.part),d=g.endIndex;continue}}p+=m,d++}return h(),f}var xe=class e{tokens=[];pos=0;pendingHeredocs=[];parseBudget;ownsParseBudget;_input="";processLineState;constructor(t){this.parseBudget=t??new Zl,this.ownsParseBudget=t===void 0}getInput(){return this._input}checkIterationLimit(){let t=this.current();this.parseBudget.chargeIteration(t?.line??1,t?.column??1)}enterDepth(){let t=this.current();return this.parseBudget.enter(t?.line??1,t?.column??1)}withDepth(t){let n=this.enterDepth();try{return t()}finally{n()}}parse(t,n){this.ownsParseBudget&&this.parseBudget.reset();let r=this.ownsParseBudget?void 0:this.enterDepth();try{if(t.length>Rd)throw new jt(`Input too large: ${t.length} bytes exceeds limit of ${Rd}`,1,1);this._input=t,this.processLineState=void 0;let s=new Gl(t,n);if(this.tokens=s.tokenize(),this.tokens.length>ea)throw new jt(`Too many tokens: ${this.tokens.length} exceeds limit of ${ea}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseBudget.chargeTokens(this.tokens.length),this.parseScript()}finally{r?.()}}parseTokens(t){this.ownsParseBudget&&this.parseBudget.reset();let n=this.ownsParseBudget?void 0:this.enterDepth();try{return this.tokens=t,this.pos=0,this.pendingHeredocs=[],this.processLineState=void 0,this.parseBudget.chargeTokens(t.length),this.parseScript()}finally{n?.()}}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(t=0){return this.tokens[this.pos+t]||this.tokens[this.tokens.length-1]}advance(){let t=this.current();return this.pos<this.tokens.length-1&&this.pos++,t}getPos(){return this.pos}getSourceLine(t=this.current()){let n=this.processLineState;return n?(n.currentPhysicalLine===void 0?n.currentPhysicalLine=t.line:t.line>n.currentPhysicalLine&&(n.currentPhysicalLine=t.line,n.currentLogicalLine+=1),n.currentLogicalLine):t.line}check(t,n,r,s,...i){let o=this.tokens[this.pos]?.type;return o===t||n!==void 0&&o===n||r!==void 0&&o===r||s!==void 0&&o===s?!0:i.length>0?i.includes(o):!1}expect(t,n){if(this.check(t))return this.advance();let r=this.current();throw new jt(n||`Expected ${t}, got ${r.type}`,r.line,r.column,r)}error(t){let n=this.current();throw new jt(t,n.line,n.column,n)}skipNewlines(){for(;this.check(k.NEWLINE,k.COMMENT);)this.check(k.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(t=!0){for(;;){if(this.check(k.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(k.SEMICOLON,k.COMMENT)){this.advance();continue}if(t&&this.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(t,n,r,s){this.pendingHeredocs.push({redirect:t,delimiter:n,stripTabs:r,quoted:s})}processHeredocs(){for(let t of this.pendingHeredocs)if(this.check(k.HEREDOC_CONTENT)){let n=this.advance(),r;t.quoted?r=J.word([J.literal(n.value)]):r=this.parseWordFromString(n.value,!1,!1,!1,!0),t.redirect.target=J.hereDoc(t.delimiter,r,t.stripTabs,t.quoted,n.heredocTerminated??!1)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(k.EOF,k.NEWLINE,k.SEMICOLON,k.AMP,k.AND_AND,k.OR_OR,k.RPAREN,k.RBRACE,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)}isCommandStart(){let t=this.current().type;return this.isWord()||t===k.ASSIGNMENT_WORD||t===k.FD_VARIABLE||t===k.LPAREN||t===k.LBRACE||t===k.DPAREN_START||t===k.DBRACK_START||ra(this)}parseScript(){let t=[],r=0;for(this.skipNewlines();!this.check(k.EOF);){r++,r>1e4&&this.error("Parser stuck: too many iterations (>10000)");let s=this.checkUnexpectedToken();if(s){t.push(s),this.skipSeparators(!1);continue}let i=this.pos,o=this.parseStatement();o&&t.push(o),this.check(k.HEREDOC_CONTENT)&&this.processHeredocs(),this.skipSeparators(!1),this.check(k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===i&&!this.check(k.EOF)&&this.error(`syntax error near unexpected token \`${this.current().value}'`)}return J.script(t)}checkUnexpectedToken(){let t=this.current().type,n=this.current().value;if(this.currentTokenJoinsProcessSubstitution())return null;if((t===k.DO||t===k.DONE||t===k.THEN||t===k.ELSE||t===k.ELIF||t===k.FI||t===k.ESAC)&&this.error(`syntax error near unexpected token \`${n}'`),t===k.RBRACE||t===k.RPAREN){let r=`syntax error near unexpected token \`${n}'`;return this.advance(),J.statement([J.pipeline([J.simpleCommand(null,[],[],[])])],[],!1,{message:r,token:n})}return(t===k.DSEMI||t===k.SEMI_AND||t===k.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${n}'`),t===k.SEMICOLON&&this.error(`syntax error near unexpected token \`${n}'`),(t===k.AMP||t===k.AND_AND||t===k.OR_OR||t===k.PIPE||t===k.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${n}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let t=this.current().start,n=[],r=[],s=!1,i=this.parsePipeline();for(n.push(i);this.check(k.AND_AND,k.OR_OR);){let l=this.advance();r.push(l.type===k.AND_AND?"&&":"||"),this.skipNewlines();let c=this.parsePipeline();n.push(c)}this.check(k.AMP)&&(this.advance(),s=!0);let o=this.pos>0?this.tokens[this.pos-1].end:t,a=this._input.slice(t,o);return J.statement(n,r,s,void 0,a)}parseTimePrefix(){if(!this.check(k.TIME)||this.currentTokenJoinsProcessSubstitution())return;this.advance();let t=!1;return this.check(k.WORD,k.NAME)&&this.current().value==="-p"&&(this.advance(),t=!0),t}parsePipeline(){let t=!1,n=!1,r=0;for(;this.check(k.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++;if(r===0){let l=this.parseTimePrefix();if(l!==void 0)for(t=!0,n=l;this.check(k.BANG)&&!this.currentTokenJoinsProcessSubstitution();)this.advance(),r++}let s=r%2===1,i=[],o=[],a=this.parseCommand();for(i.push(a);this.check(k.PIPE,k.PIPE_AMP);){let l=this.advance();this.skipNewlines(),o.push(l.type===k.PIPE_AMP);let c=this.parseCommand();i.push(c)}return J.pipeline(i,s,t,n,o.length>0?o:void 0)}parseCommand(){if(this.currentTokenJoinsProcessSubstitution())return Bd(this);let t=this.current();switch(t.type){case k.IF:return Ud(this);case k.FOR:return zd(this);case k.WHILE:return Wd(this);case k.UNTIL:return jd(this);case k.CASE:return Hd(this);case k.LPAREN:return Vd(this);case k.LBRACE:return qd(this);case k.DPAREN_START:return this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand();case k.DBRACK_START:return this.parseConditionalCommand();case k.FUNCTION:return this.parseFunctionDef();case k.TIME:break;case k.BANG:this.error(`syntax error near unexpected token \`${t.value}'`);break;default:$d(t.type)&&this.error(`syntax error near unexpected token \`${t.value}'`)}return this.check(k.NAME,k.WORD)&&this.peek(1).type===k.LPAREN&&this.peek(2).type===k.RPAREN?this.parseFunctionDef():Bd(this)}dparenClosesWithSpacedParens(){let t=1,n=1;for(;n<this.tokens.length-this.pos;){let r=this.peek(n);if(r.type===k.EOF)return!1;if(r.type===k.DPAREN_START||r.type===k.LPAREN)t++;else if(r.type===k.DPAREN_END){if(t-=2,t<=0)return!1}else if(r.type===k.RPAREN&&(t--,t===0&&this.peek(n+1).type===k.RPAREN))return!0;n++}return!1}parseNestedSubshellsFromDparen(){this.advance();let t=this.parseCompoundList();this.expect(k.RPAREN),this.expect(k.RPAREN);let n=this.parseOptionalRedirections(),r=J.subshell(t,[]);return J.subshell([J.statement([J.pipeline([r],!1,!1,!1)])],n)}isWord(){return this.isWordToken(Zt.Default)||this.isProcessSubstitutionStart()||this.currentTokenJoinsProcessSubstitution()}isWordToken(t){let n=this.current().type;return n===k.WORD||n===k.NAME||n===k.NUMBER||$d(n)||n===k.BANG||n===k.ASSIGNMENT_WORD&&(t&Zt.Regex)!==0}isProcessSubstitutionStart(t=0){let n=this.peek(t),r=this.peek(t+1);return(n.type===k.LESS||n.type===k.GREAT)&&r.type===k.LPAREN&&n.end===r.start}currentTokenJoinsProcessSubstitution(){return this.current().type===k.COMMENT||!this.isAdjacentWordToken(Zt.Default)?!1:this.current().end===this.peek(1).start&&this.isProcessSubstitutionStart(1)}isAdjacentWordToken(t){let n=this.current().type;return this.isWordToken(t)||n===k.ASSIGNMENT_WORD||n===k.COMMENT||n===k.LBRACE||n===k.RBRACE||n===k.DBRACK_START||n===k.DBRACK_END||n===k.FD_VARIABLE}parseWord(t=Zt.Default){if(this.isProcessSubstitutionStart())return this.parseAdjacentWordParts([],this.current().start,t);let n=this.advance(),r=this.parseWordToken(n,t);return this.parseAdjacentWordParts(r.parts,n.end,t)}parseAdjacentWordParts(t,n,r=Zt.Default){for(;n===this.current().start;){if(this.isProcessSubstitutionStart()){t.push(this.parseProcessSubstitution()),n=this.tokens[this.pos-1].end;continue}if(!this.isAdjacentWordToken(r))break;let s=this.advance();t.push(...this.parseWordToken(s,r,t.length===0).parts),n=s.end}return J.word(t)}parseWordNoBraceExpansion(){return this.parseWord(Zt.NoBraceExpansion)}parseWordForRegex(){return this.parseWord(Zt.NoBraceExpansion|Zt.Regex)}parseWordToken(t,n,r=!0){return t.type===k.LBRACE||t.type===k.RBRACE||t.type===k.DBRACK_START||t.type===k.DBRACK_END||t.type===k.FD_VARIABLE?J.word([J.literal(t.type===k.FD_VARIABLE?`{${t.value}}`:t.value)]):this.parseWordFromString(t.value,t.quoted,t.singleQuoted,(n&Zt.Assignment)!==0,!1,(n&Zt.NoBraceExpansion)!==0,(n&Zt.Regex)!==0,r)}parseWordFromString(t,n=!1,r=!1,s=!1,i=!1,o=!1,a=!1,l=!0){let c=us(this,t,n,r,s,i,!1,o,a,!1,l);return J.word(c)}parseCommandSubstitution(t,n){return r7(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitutionFromString(t,n){return s7(t,n,()=>new e(this.parseBudget),r=>this.error(r))}parseProcessSubstitution(){let t=this.advance();this.expect(k.LPAREN);let n=this.processLineState,r=this.getSourceLine(t);this.processLineState={currentLogicalLine:r};let s;try{s=J.script(this.parseCompoundList())}finally{this.processLineState=n}return this.check(k.EOF)&&this.error("unexpected EOF while looking for matching `)'"),this.expect(k.RPAREN),J.processSubstitution(s,t.type===k.LESS?"input":"output")}parseBacktickSubstitution(t,n,r=!1){return i7(t,n,r,()=>new e(this.parseBudget),s=>this.error(s))}isDollarDparenSubshell(t,n){return t7(t,n)}parseArithmeticExpansion(t,n){let r=n+3,s=1,i=0,o=r;for(;o<t.length-1&&s>0;)t[o]==="$"&&t[o+1]==="("?t[o+2]==="("?(s++,o+=3):(i++,o+=2):t[o]==="("&&t[o+1]==="("?(s++,o+=2):t[o]===")"&&t[o+1]===")"?i>0?(i--,o++):(s--,s>0&&(o+=2)):t[o]==="("?(i++,o++):(t[o]===")"&&i>0&&i--,o++);let a=t.slice(r,o),l=this.parseArithmeticExpression(a);return{part:J.arithmeticExpansion(l),endIndex:o+2}}parseArithmeticCommand(){let t=this.expect(k.DPAREN_START),n="",r=1,s=0,i=!1,o=!1;for(;r>0&&!this.check(k.EOF);){if(i){if(i=!1,s>0){s--,n+=")";continue}if(this.check(k.RPAREN)){r--,o=!0,this.advance();continue}if(this.check(k.DPAREN_END)){r--,o=!0;continue}n+=")";continue}if(this.check(k.DPAREN_START))r++,n+="((",this.advance();else if(this.check(k.DPAREN_END))s>=2?(s-=2,n+="))",this.advance()):s===1?(s--,n+=")",i=!0,this.advance()):(r--,o=!0,r>0&&(n+="))"),this.advance());else if(this.check(k.LPAREN))s++,n+="(",this.advance();else if(this.check(k.RPAREN))s>0&&s--,n+=")",this.advance();else{let c=this.current().value,u=n.length>0?n[n.length-1]:"";n.length>0&&!n.endsWith(" ")&&!(c==="="&&/[|&^+\-*/%<>]$/.test(n))&&!(c==="<"&&u==="<")&&!(c===">"&&u===">")&&(n+=" "),n+=c,this.advance()}}o||this.expect(k.DPAREN_END);let a=this.parseArithmeticExpression(n.trim()),l=this.parseOptionalRedirections();return J.arithmeticCommand(a,l,this.getSourceLine(t))}parseConditionalCommand(){let t=this.expect(k.DBRACK_START),n=Zd(this);this.expect(k.DBRACK_END);let r=this.parseOptionalRedirections();return J.conditionalCommand(n,r,this.getSourceLine(t))}parseFunctionDef(){let t;if(this.check(k.FUNCTION)){if(this.advance(),this.check(k.NAME)||this.check(k.WORD))t=this.advance().value;else{let s=this.current();throw new jt("Expected function name",s.line,s.column,s)}this.check(k.LPAREN)&&(this.advance(),this.expect(k.RPAREN))}else t=this.advance().value,t.includes("$")&&this.error(`\`${t}': not a valid identifier`),this.expect(k.LPAREN),this.expect(k.RPAREN);this.skipNewlines();let n=this.parseCompoundCommandBody({forFunctionBody:!0}),r=this.parseOptionalRedirections();return J.functionDef(t,n,r)}parseCompoundCommandBody(t){let n=t?.forFunctionBody;if(this.check(k.LBRACE))return qd(this,{skipRedirections:n});if(this.check(k.LPAREN))return Vd(this,{skipRedirections:n});if(this.check(k.IF))return Ud(this,{skipRedirections:n});if(this.check(k.FOR))return zd(this,{skipRedirections:n});if(this.check(k.WHILE))return Wd(this,{skipRedirections:n});if(this.check(k.UNTIL))return jd(this,{skipRedirections:n});if(this.check(k.CASE))return Hd(this,{skipRedirections:n});this.error("Expected compound command for function body")}parseCompoundList(){let t=this.enterDepth();try{let n=[];for(this.skipNewlines();(this.currentTokenJoinsProcessSubstitution()||!this.check(k.EOF,k.FI,k.ELSE,k.ELIF,k.THEN,k.DO,k.DONE,k.ESAC,k.RPAREN,k.RBRACE,k.DSEMI,k.SEMI_AND,k.SEMI_SEMI_AND))&&this.isCommandStart();){this.checkIterationLimit();let r=this.pos,s=this.parseStatement();if(s&&n.push(s),this.skipSeparators(),this.pos===r&&!s)break}return n}finally{t()}}parseOptionalRedirections(){let t=[];for(;ra(this);){this.checkIterationLimit();let n=this.pos;if(t.push(Yl(this)),this.pos===n)break}return t}parseArithmeticExpression(t){return Ue(this,t)}};function Yn(e,t){return new xe().parse(e,t)}function _7(e){return oi(e)}function oi(e){return e.statements.map(B7).join(`
880
880
  `)}function B7(e){let t=[];for(let r=0;r<e.pipelines.length;r++)t.push(zI(e.pipelines[r])),r<e.operators.length&&t.push(e.operators[r]);let n=t.join(" ");return e.background&&(n+=" &"),n}function zI(e){let t=[];e.timed&&t.push(e.timePosix?"time -p":"time"),e.negated&&t.push("!");let n=[];for(let s=0;s<e.commands.length;s++)if(n.push(U7(e.commands[s])),s<e.commands.length-1){let i=e.pipeStderr?.[s];n.push(i?"|&":"|")}return(t.length>0?`${t.join(" ")} `:"")+n.join(" ")}function U7(e){switch(e.type){case"SimpleCommand":return WI(e);case"If":return QI(e);case"For":return YI(e);case"CStyleFor":return JI(e);case"While":return eO(e);case"Until":return tO(e);case"Case":return nO(e);case"Subshell":return sO(e);case"Group":return iO(e);case"ArithmeticCommand":return oO(e);case"ConditionalCommand":return aO(e);case"FunctionDef":return lO(e);default:{let t=e;throw new Error(`Unsupported command type: ${t.type}`)}}}function WI(e){let t=[];for(let n of e.assignments)t.push(jI(n));e.name&&t.push(Bt(e.name));for(let n of e.args)t.push(Bt(n));for(let n of e.redirections)t.push(j7(n));return t.join(" ")}function jI(e){let t=e.append?"+=":"=";if(e.array){let n=e.array.map(Bt).join(" ");return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${Bt(e.value)}`:`${e.name}${t}`}function Bt(e){return e.parts.map(t=>Jl(t,!1)).join("")}function fs(e){return e.parts.map(t=>Jl(t,!0)).join("")}function Jl(e,t){switch(e.type){case"Literal":return t?VI(e.value):HI(e.value);case"SingleQuoted":return`'${e.value}'`;case"DoubleQuoted":return`"${e.parts.map(n=>Jl(n,!0)).join("")}"`;case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return z7(e);case"CommandSubstitution":return e.legacy?`\`${oi(e.body)}\``:`$(${oi(e.body)})`;case"ArithmeticExpansion":return`$((${ct(e.expression.expression)}))`;case"ProcessSubstitution":return e.direction==="input"?`<(${oi(e.body)})`:`>(${oi(e.body)})`;case"BraceExpansion":return KI(e);case"TildeExpansion":return e.user!==null?`~${e.user}`:"~";case"Glob":return e.pattern;default:{let n=e;throw new Error(`Unsupported word part type: ${n.type}`)}}}function HI(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,"\\$&")}function VI(e){return e.replace(/[$`"\\]/g,"\\$&")}function qI(e,t){return e.parts.map(n=>GI(n,t)).join("")}function GI(e,t){switch(e.type){case"Literal":return t?e.value:e.value.replace(/[$`]/g,"\\$&");case"Escaped":return`\\${e.value}`;case"ParameterExpansion":return z7(e);case"CommandSubstitution":return e.legacy?`\`${oi(e.body)}\``:`$(${oi(e.body)})`;case"ArithmeticExpansion":return`$((${ct(e.expression.expression)}))`;default:return Jl(e,!1)}}function z7(e){return e.operation?`\${${W7(e.parameter,e.operation)}}`:ZI(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function ZI(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function W7(e,t){switch(t.type){case"Length":return`#${e}`;case"LengthSliceError":return`#${e}:`;case"BadSubstitution":return t.text;case"DefaultValue":return`${e}${t.checkEmpty?":":""}-${fs(t.word)}`;case"AssignDefault":return`${e}${t.checkEmpty?":":""}=${fs(t.word)}`;case"ErrorIfUnset":return`${e}${t.checkEmpty?":":""}?${t.word?fs(t.word):""}`;case"UseAlternative":return`${e}${t.checkEmpty?":":""}+${fs(t.word)}`;case"Substring":{let n=ct(t.offset.expression);return t.length?`${e}:${n}:${ct(t.length.expression)}`:`${e}:${n}`}case"PatternRemoval":{let n=t.side==="prefix"?"#":"%",r=t.greedy?`${n}${n}`:n;return`${e}${r}${fs(t.pattern)}`}case"PatternReplacement":{let n="/";t.all?n="//":t.anchor==="start"?n="/#":t.anchor==="end"&&(n="/%");let r=t.replacement?`/${fs(t.replacement)}`:"";return`${e}${n}${fs(t.pattern)}${r}`}case"CaseModification":{let n=t.direction==="upper"?"^":",",r=t.all?`${n}${n}`:n,s=t.pattern?fs(t.pattern):"";return`${e}${r}${s}`}case"Transform":return`${e}@${t.operator}`;case"Indirection":return t.innerOp?`!${W7(e,t.innerOp)}`:`!${e}`;case"ArrayKeys":return`!${t.array}[${t.star?"*":"@"}]`;case"VarNamePrefix":return`!${t.prefix}${t.star?"*":"@"}`;default:{let n=t;throw new Error(`Unsupported parameter operation type: ${n.type}`)}}}function KI(e){return`{${e.items.map(XI).join(",")}}`}function XI(e){if(e.type==="Word")return Bt(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step!==void 0?`${t}..${n}..${e.step}`:`${t}..${n}`}function j7(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd!==null?String(e.fd):"";if(e.operator==="<<"||e.operator==="<<-"){let n=e.target;if(n.terminated===!1)throw new Error("Cannot serialize an unterminated here-document");let r=n.quoted?`'${n.delimiter}'`:n.delimiter,s=qI(n.content,n.quoted);return`${t}${e.operator}${r}
881
881
  ${s}${n.delimiter}`}return e.operator==="<<<"?`${t}<<< ${Bt(e.target)}`:e.operator==="&>"||e.operator==="&>>"?`${e.operator} ${Bt(e.target)}`:`${t}${e.operator} ${Bt(e.target)}`}function hr(e){return e.length===0?"":` ${e.map(j7).join(" ")}`}function Jn(e){return e.map(B7).join(`
882
882
  `)}function QI(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],s=n===0?"if":"elif";t.push(`${s} ${Jn(r.condition)}; then
@@ -901,46 +901,46 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
901
901
  `;function ai(e,t){if(e>=t)throw new C(`array element limit exceeded (${t})`,"array_elements")}function tp(e,t,n,r,s){ai(e.length,s),ai(t.length,s),e.push(n),t.push(r)}function Ut(e){return e.get("IFS")??dO}function Kt(e){return e.get("IFS")===""}function tc(e){let t=Ut(e);if(t==="")return!0;for(let n of t)if(n!==" "&&n!==" "&&n!==`
902
902
  `)return!1;return!0}function e4(e){let t=!1,n=[];for(let r of e.split(""))r==="-"?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===" "?n.push("\\t"):r===`
903
903
  `?n.push("\\n"):n.push(r);return t&&n.push("\\-"),n.join("")}function Oe(e){let t=e.get("IFS");if(t===void 0)return" ";let n=t.codePointAt(0);return n===void 0?"":String.fromCodePoint(n)}var pO=`
904
- `;function hO(e){return pO.includes(e)}function np(e){let t=new Set,n=new Set;for(let r of e)hO(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function rp(e,t,n,r,s){if(t==="")return e===""?{words:[],wordStarts:[]}:(ai(0,n),{words:[e],wordStarts:[0]});let{whitespace:i,nonWhitespace:o}=np(t),a=[],l=[],c=0;for(;c<e.length&&i.has(e[c]);)c++;if(c>=e.length)return{words:[],wordStarts:[]};if(o.has(e[c]))for(tp(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&!(r!==void 0&&a.length>=r);){let u=c;for(;c<e.length;){let f=e[c];if(!s&&f==="\\"){c++,c<e.length&&c++;continue}if(i.has(f)||o.has(f))break;c++}if(tp(a,l,e.substring(u,c),u,n),c>=e.length)break;for(;c<e.length&&i.has(e[c]);)c++;if(c<e.length&&o.has(e[c])){for(c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&o.has(e[c])&&!(r!==void 0&&a.length>=r);)for(tp(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++}}return{words:a,wordStarts:l}}function nc(e,t,n){if(t==="")return e&&ai(0,n),{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:r,nonWhitespace:s}=np(t),i=[],o=0,a=!1,l=!1,c=o;for(;o<e.length&&r.has(e[o]);)o++;if(o>c&&(a=!0),o>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(s.has(e[o]))for(ai(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length;){let u=o;for(;o<e.length;){let d=e[o];if(r.has(d)||s.has(d))break;o++}if(ai(i.length,n),i.push(e.substring(u,o)),o>=e.length){l=!1;break}let f=o;for(;o<e.length&&r.has(e[o]);)o++;if(o<e.length&&s.has(e[o])){for(o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length&&s.has(e[o]);)for(ai(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++}o>=e.length&&o>f&&(l=!0)}return{words:i,hadLeadingDelimiter:a,hadTrailingDelimiter:l}}function at(e,t,n){return nc(e,t,n).words}function mO(e,t){for(let n of e)if(t.has(n))return!0;return!1}function t4(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=np(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let a=0,l=i-2;for(;l>=0&&e[l]==="\\";)a++,l--;if(a%2===1)break}i--}let o=e.substring(0,i);if(o.length>=1&&s.has(o[o.length-1])){if(!n&&o.length>=2){let l=0,c=o.length-2;for(;c>=0&&o[c]==="\\";)l++,c--;if(l%2===1)return o}let a=o.substring(0,o.length-1);if(!mO(a,s))return a}return o}function st(e,t){return e.state.namerefs?.has(t)??!1}function Xr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function n4(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function r4(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function s4(e,t){return e.state.invalidNamerefs?.has(t)??!1}function sp(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function rc(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Gt(e,s),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Gt(e,t)?!0:e.state.env.has(t)}function pn(e,t,n=100){if(!st(e,t)||s4(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!st(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function li(e,t){if(st(e,t))return e.state.env.get(t)}function sc(e,t,n,r=100){if(!st(e,t)||s4(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!st(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&rc(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}function i4(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function Ee(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?$r(e,t).map(i=>[i,Ye(e,t,i)??""]):_t(e,t).map(s=>[s,Ye(e,t,s)??""])}function mr(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):Gt(e,t)}async function He(e,t,n=!0){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 i="";return i+="h",e.state.options.errexit&&(i+="e"),e.state.options.noglob&&(i+="f"),e.state.options.nounset&&(i+="u"),e.state.options.verbose&&(i+="v"),e.state.options.xtrace&&(i+="x"),i+="B",e.state.options.noclobber&&(i+="C"),i+="s",i}case"*":{let i=Number.parseInt(e.state.env.get("#")||"0",10);if(i===0)return"";let o=[];for(let a=1;a<=i;a++)o.push(e.state.env.get(String(a))||"");return o.join(Oe(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 Zw;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let i=e.state.funcNameStack?.[0];if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn("FUNCNAME");return""}case"BASH_LINENO":{let i=e.state.callLineStack?.[0];if(i!==void 0)return String(i);if(n&&e.state.options.nounset)throw new tn("BASH_LINENO");return""}case"BASH_SOURCE":{let i=e.state.sourceStack?.[0];if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new sn(`\${${t}}`);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let i=r[1],o=r[2];if(st(e,i)){let u=pn(e,i);if(u&&u!==i){if(u.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";i=u}}if(o==="@"||o==="*"){let u=Ee(e,i);if(u.length>0){let d=o==="*"?Oe(e.state.env):" ",p=M(d)*(u.length-1);for(let[,h]of u)if(p+=M(h),p>e.limits.maxStringLength)throw new C(`array expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return u.map(([,h])=>h).join(d)}let f=e.state.env.get(i);return f!==void 0?f:""}if(i==="FUNCNAME"){let u=Number.parseInt(o,10);return!Number.isNaN(u)&&u>=0?e.state.funcNameStack?.[u]??"":""}if(i==="BASH_LINENO"){let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0){let f=e.state.callLineStack?.[u];return f!==void 0?String(f):""}return""}if(i==="BASH_SOURCE"){let u=Number.parseInt(o,10);return!Number.isNaN(u)&&u>=0?e.state.sourceStack?.[u]??"":""}if(e.state.associativeArrays?.has(i)){let u=Vl(o);u=i4(e,u);let f=Ye(e,i,u);if(f===void 0&&n&&e.state.options.nounset)throw new tn(`${i}[${o}]`);return f||""}let l;if(/^-?\d+$/.test(o))l=Number.parseInt(o,10);else try{let u=new xe,f=Be(u,o);l=await Re(e,f.expression)}catch{let u=e.state.env.get(o);l=u?Number.parseInt(u,10):0,Number.isNaN(l)&&(l=0)}if(l<0){let u=Ee(e,i),f=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${i}: bad array subscript
904
+ `;function hO(e){return pO.includes(e)}function np(e){let t=new Set,n=new Set;for(let r of e)hO(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function rp(e,t,n,r,s){if(t==="")return e===""?{words:[],wordStarts:[]}:(ai(0,n),{words:[e],wordStarts:[0]});let{whitespace:i,nonWhitespace:o}=np(t),a=[],l=[],c=0;for(;c<e.length&&i.has(e[c]);)c++;if(c>=e.length)return{words:[],wordStarts:[]};if(o.has(e[c]))for(tp(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&!(r!==void 0&&a.length>=r);){let u=c;for(;c<e.length;){let f=e[c];if(!s&&f==="\\"){c++,c<e.length&&c++;continue}if(i.has(f)||o.has(f))break;c++}if(tp(a,l,e.substring(u,c),u,n),c>=e.length)break;for(;c<e.length&&i.has(e[c]);)c++;if(c<e.length&&o.has(e[c])){for(c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&o.has(e[c])&&!(r!==void 0&&a.length>=r);)for(tp(a,l,"",c,n),c++;c<e.length&&i.has(e[c]);)c++}}return{words:a,wordStarts:l}}function nc(e,t,n){if(t==="")return e&&ai(0,n),{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e==="")return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:r,nonWhitespace:s}=np(t),i=[],o=0,a=!1,l=!1,c=o;for(;o<e.length&&r.has(e[o]);)o++;if(o>c&&(a=!0),o>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(s.has(e[o]))for(ai(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length;){let u=o;for(;o<e.length;){let d=e[o];if(r.has(d)||s.has(d))break;o++}if(ai(i.length,n),i.push(e.substring(u,o)),o>=e.length){l=!1;break}let f=o;for(;o<e.length&&r.has(e[o]);)o++;if(o<e.length&&s.has(e[o])){for(o++;o<e.length&&r.has(e[o]);)o++;for(;o<e.length&&s.has(e[o]);)for(ai(i.length,n),i.push(""),o++;o<e.length&&r.has(e[o]);)o++}o>=e.length&&o>f&&(l=!0)}return{words:i,hadLeadingDelimiter:a,hadTrailingDelimiter:l}}function at(e,t,n){return nc(e,t,n).words}function mO(e,t){for(let n of e)if(t.has(n))return!0;return!1}function t4(e,t,n){if(t==="")return e;let{whitespace:r,nonWhitespace:s}=np(t),i=e.length;for(;i>0&&r.has(e[i-1]);){if(!n&&i>=2){let a=0,l=i-2;for(;l>=0&&e[l]==="\\";)a++,l--;if(a%2===1)break}i--}let o=e.substring(0,i);if(o.length>=1&&s.has(o[o.length-1])){if(!n&&o.length>=2){let l=0,c=o.length-2;for(;c>=0&&o[c]==="\\";)l++,c--;if(l%2===1)return o}let a=o.substring(0,o.length-1);if(!mO(a,s))return a}return o}function st(e,t){return e.state.namerefs?.has(t)??!1}function Xr(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function n4(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function r4(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function s4(e,t){return e.state.invalidNamerefs?.has(t)??!1}function sp(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function rc(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let s=n[1],i=Gt(e,s),o=e.state.associativeArrays?.has(s)??!1;return i||o}return Gt(e,t)?!0:e.state.env.has(t)}function pn(e,t,n=100){if(!st(e,t)||s4(e,t))return t;let r=new Set,s=t;for(;n-- >0;){if(r.has(s))return;if(r.add(s),!st(e,s))return s;let i=e.state.env.get(s);if(i===void 0||i===""||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(i))return s;s=i}}function li(e,t){if(st(e,t))return e.state.env.get(t)}function sc(e,t,n,r=100){if(!st(e,t)||s4(e,t))return t;let s=new Set,i=t;for(;r-- >0;){if(s.has(i))return;if(s.add(i),!st(e,i))return i;let o=e.state.env.get(i);if(o===void 0||o==="")return n!==void 0?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&rc(e,n)?i:null:i;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o))return i;i=o}}function i4(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(r,s)=>e.state.env.get(s)??"");return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(r,s)=>e.state.env.get(s)??""),n}function Ee(e,t){return t==="FUNCNAME"?(e.state.funcNameStack??[]).map((i,o)=>[o,i]):t==="BASH_LINENO"?(e.state.callLineStack??[]).map((i,o)=>[o,String(i)]):t==="BASH_SOURCE"?(e.state.sourceStack??[]).map((i,o)=>[o,i]):e.state.associativeArrays?.has(t)?$r(e,t).map(i=>[i,Ye(e,t,i)??""]):_t(e,t).map(s=>[s,Ye(e,t,s)??""])}function mr(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):Gt(e,t)}async function Ve(e,t,n=!0){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 i="";return i+="h",e.state.options.errexit&&(i+="e"),e.state.options.noglob&&(i+="f"),e.state.options.nounset&&(i+="u"),e.state.options.verbose&&(i+="v"),e.state.options.xtrace&&(i+="x"),i+="B",e.state.options.noclobber&&(i+="C"),i+="s",i}case"*":{let i=Number.parseInt(e.state.env.get("#")||"0",10);if(i===0)return"";let o=[];for(let a=1;a<=i;a++)o.push(e.state.env.get(String(a))||"");return o.join(Oe(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 Zw;case"!":return String(e.state.lastBackgroundPid);case"BASHPID":return String(e.state.bashPid);case"LINENO":return String(e.state.currentLine);case"FUNCNAME":{let i=e.state.funcNameStack?.[0];if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn("FUNCNAME");return""}case"BASH_LINENO":{let i=e.state.callLineStack?.[0];if(i!==void 0)return String(i);if(n&&e.state.options.nounset)throw new tn("BASH_LINENO");return""}case"BASH_SOURCE":{let i=e.state.sourceStack?.[0];if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn("BASH_SOURCE");return""}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new sn(`\${${t}}`);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let i=r[1],o=r[2];if(st(e,i)){let u=pn(e,i);if(u&&u!==i){if(u.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return"";i=u}}if(o==="@"||o==="*"){let u=Ee(e,i);if(u.length>0){let d=o==="*"?Oe(e.state.env):" ",p=M(d)*(u.length-1);for(let[,h]of u)if(p+=M(h),p>e.limits.maxStringLength)throw new C(`array expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return u.map(([,h])=>h).join(d)}let f=e.state.env.get(i);return f!==void 0?f:""}if(i==="FUNCNAME"){let u=Number.parseInt(o,10);return!Number.isNaN(u)&&u>=0?e.state.funcNameStack?.[u]??"":""}if(i==="BASH_LINENO"){let u=Number.parseInt(o,10);if(!Number.isNaN(u)&&u>=0){let f=e.state.callLineStack?.[u];return f!==void 0?String(f):""}return""}if(i==="BASH_SOURCE"){let u=Number.parseInt(o,10);return!Number.isNaN(u)&&u>=0?e.state.sourceStack?.[u]??"":""}if(e.state.associativeArrays?.has(i)){let u=Vl(o);u=i4(e,u);let f=Ye(e,i,u);if(f===void 0&&n&&e.state.options.nounset)throw new tn(`${i}[${o}]`);return f||""}let l;if(/^-?\d+$/.test(o))l=Number.parseInt(o,10);else try{let u=new xe,f=Ue(u,o);l=await Re(e,f.expression)}catch{let u=e.state.env.get(o);l=u?Number.parseInt(u,10):0,Number.isNaN(l)&&(l=0)}if(l<0){let u=Ee(e,i),f=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${i}: bad array subscript
905
905
  `,"";let p=Math.max(...u.map(([m])=>typeof m=="number"?m:0))+1+l;return p<0?(e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${i}: bad array subscript
906
- `,""):Ye(e,i,p)||""}let c=Ye(e,i,l);if(c!==void 0)return c;if(l===0){let u=e.state.env.get(i);if(u!==void 0)return u}if(n&&e.state.options.nounset)throw new tn(`${i}[${l}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let i=e.state.env.get(t);if(i===void 0&&n&&e.state.options.nounset)throw new tn(t);return i||""}if(st(e,t)){let i=pn(e,t);if(i===void 0)return"";if(i!==t)return await He(e,i,n);let o=e.state.env.get(t);if((o===void 0||o==="")&&n&&e.state.options.nounset)throw new tn(t);return o||""}let s=e.state.env.get(t);if(s!==void 0)return e.state.tempEnvBindings?.some(i=>i.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),s;if(mr(e,t)){let i=Ye(e,t,0);if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn(t);return""}if(n&&e.state.options.nounset)throw new tn(t);return""}async function Rr(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 r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(st(e,s)){let l=pn(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return Ee(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=i4(e,Vl(i));return cs(e,s,l)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new xe,c=Be(l,i);a=await Re(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=Ee(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:cs(e,s,u)}return cs(e,s,a)}if(st(e,t)){let s=pn(e,t);return s===void 0||s===t?e.state.env.has(t):Rr(e,s)}return e.state.env.has(t)?!0:mr(e,t)?cs(e,t,0):!1}async function o4(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await He(e,i);n+=o,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await He(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await He(e,s);n+=i,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 s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await He(e,i);n+=o,r=s}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 ip(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await He(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await He(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}kt();G();var oa=1e4,op={maxResults:oa,maxStringBytes:10*1024*1024};function ic(e,t,n,r){if(e.length>=n.maxResults)return!1;let s=M(t);if(s>n.maxStringBytes-r.value)throw new C(`brace expansion string limit exceeded (${n.maxStringBytes} bytes)`,"string_length");return e.push(t),r.value+=s,!0}function gO(e,t,n,r,s,i=op){let o=n??1;o===0&&(o=1);let a=Math.abs(o),l=[],c=0;if(r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(c=Math.max(c,s.replace(/^-/,"").length)),c>i.maxStringBytes)throw new C(`brace expansion padding limit exceeded (${i.maxStringBytes} bytes)`,"string_length");let u={value:0},f=d=>{if(c>0){let p=d<0,h=String(Math.abs(d)).padStart(c,"0");return p?`-${h}`:h}return String(d)};if(e<=t)for(let d=e,p=0;d<=t&&p<oa&&ic(l,f(d),i,u);d+=a,p++);else for(let d=e,p=0;d>=t&&p<oa&&ic(l,f(d),i,u);d-=a,p++);return l}function yO(e,t,n,r=op){let s=n??1;s===0&&(s=1);let i=e.charCodeAt(0),o=t.charCodeAt(0),a=Math.abs(s),l=e>="A"&&e<="Z",c=e>="a"&&e<="z",u=t>="A"&&t<="Z",f=t>="a"&&t<="z";if(l&&f||c&&u){let h=n!==void 0?`..${n}`:"";throw new pi(`{${e}..${t}${h}}: invalid sequence`)}let d=[],p={value:0};if(i<=o)for(let h=i,m=0;h<=o&&m<oa&&ic(d,String.fromCharCode(h),r,p);h+=a,m++);else for(let h=i,m=0;h>=o&&m<oa&&ic(d,String.fromCharCode(h),r,p);h-=a,m++);return d}function ap(e,t,n,r,s,i=op){let o=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:gO(e,t,n,r,s,i),literal:`{${e}..${t}${o}}`}:typeof e=="string"&&typeof t=="string"?{expanded:yO(e,t,n,i),literal:`{${e}..${t}${o}}`}:{expanded:null,literal:`{${e}..${t}${o}}`}}function a4(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 s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}function Pr(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function lp(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 Pn(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Xi(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}mt();G();function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let o=wO(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=bO(a).map(f=>Ke(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=xO(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=EO(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function wO(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function bO(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function xO(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 r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function EO(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=AO(i),n=s+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}var SO=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 AO(e){return SO.get(e)??""}mt();async function ps(e,t,n,r,s){let i="",o=e.state.shoptOptions.extglob;for(let a of t.parts)if(a.type==="Glob")i+=Ke(a.pattern,n,o);else if(a.type==="Literal")i+=Ke(a.value,n,o);else if(a.type==="SingleQuoted"||a.type==="Escaped")i+=nt(a.value);else if(a.type==="DoubleQuoted"){let l=await r(e,a.parts);i+=nt(l)}else if(a.type==="ParameterExpansion"){let l=await s(e,a);i+=Ke(l,n,o)}else{let l=await s(e,a);i+=nt(l)}return i}function gr(e,t,n,r,s){if(r==="prefix")return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),oe(`^${n}`,"s").replace(t,"");let i=oe(`${n}$`,"s");if(s)return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),i.replace(t,"");e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal");let o=oe(`^(?:.*)(${n})$`,"s").exec(t);if(!o)return t;let a=o[1]??"";return t.slice(0,t.length-a.length)}function Qi(e,t){let n=new Set;for(let r of e.state.env.keys())r.startsWith(t)&&n.add(r);for(let r of e.state.arrays?.keys()??[])r.startsWith(t)&&n.add(r);return[...n].sort()}St();G();function oc(e,t,n,r,s){let i=new $e(e.limits.maxStringLength,"pattern replacement",()=>new C(`pattern replacement: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length"));n.lastIndex=0;let o=0,a=n.exec(t);for(;a!==null&&(e.executionScope.consumeLimited("pattern_operations",1,e.limits.maxGlobOperations,"pattern replacement"),!(s&&a[0].length===0&&a.index===t.length||(i.append(t.slice(o,a.index)),i.append(r),o=a.index+a[0].length,!s)));)a[0].length===0&&(o++,n.lastIndex<=a.index&&(n.lastIndex=a.index+1)),a=n.exec(t);return i.append(t.slice(o)),n.lastIndex=0,i.build()}kt();G();function l4(e){let t=[],n=0;return{append(r){let s=M(r);if(s>e-n)throw new C(`prompt expansion exceeds string length limit (${e} bytes)`,"string_length");r&&t.push(r),n+=s},build:()=>t.join("")}}function CO(e,t,n){let r=(o,a=2)=>String(o).padStart(a,"0");if(e===""){let o=r(t.getHours()),a=r(t.getMinutes()),l=r(t.getSeconds());return`${o}:${a}:${l}`}let s=l4(n),i=0;for(;i<e.length;)if(e[i]==="%"){if(i+1>=e.length){s.append("%"),i++;continue}let o=e[i+1];switch(o){case"H":s.append(r(t.getHours()));break;case"M":s.append(r(t.getMinutes()));break;case"S":s.append(r(t.getSeconds()));break;case"d":s.append(r(t.getDate()));break;case"m":s.append(r(t.getMonth()+1));break;case"Y":s.append(String(t.getFullYear()));break;case"y":s.append(r(t.getFullYear()%100));break;case"I":{let a=t.getHours()%12;a===0&&(a=12),s.append(r(a));break}case"p":s.append(t.getHours()<12?"AM":"PM");break;case"P":s.append(t.getHours()<12?"am":"pm");break;case"%":s.append("%");break;case"a":{let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];s.append(a[t.getDay()]);break}case"b":{let a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];s.append(a[t.getMonth()]);break}default:s.append(`%${o}`)}i+=2}else s.append(e[i]),i++;return s.build()}function aa(e,t){let n=l4(e.limits.maxStringLength),r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n.append("\\"),r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let b="",y=r+1;for(;y<t.length&&y<r+4&&t[y]>="0"&&t[y]<="7";)b+=t[y],y++;let w=Number.parseInt(b,8)%256;n.append(String.fromCharCode(w)),r=y;continue}switch(g){case"\\":n.append("\\"),r+=2;break;case"a":n.append("\x07"),r+=2;break;case"e":n.append("\x1B"),r+=2;break;case"n":n.append(`
906
+ `,""):Ye(e,i,p)||""}let c=Ye(e,i,l);if(c!==void 0)return c;if(l===0){let u=e.state.env.get(i);if(u!==void 0)return u}if(n&&e.state.options.nounset)throw new tn(`${i}[${l}]`);return""}if(/^[1-9][0-9]*$/.test(t)){let i=e.state.env.get(t);if(i===void 0&&n&&e.state.options.nounset)throw new tn(t);return i||""}if(st(e,t)){let i=pn(e,t);if(i===void 0)return"";if(i!==t)return await Ve(e,i,n);let o=e.state.env.get(t);if((o===void 0||o==="")&&n&&e.state.options.nounset)throw new tn(t);return o||""}let s=e.state.env.get(t);if(s!==void 0)return e.state.tempEnvBindings?.some(i=>i.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),s;if(mr(e,t)){let i=Ye(e,t,0);if(i!==void 0)return i;if(n&&e.state.options.nounset)throw new tn(t);return""}if(n&&e.state.options.nounset)throw new tn(t);return""}async function Rr(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 r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(r){let s=r[1],i=r[2];if(st(e,s)){let l=pn(e,s);if(l&&l!==s){if(l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;s=l}}if(i==="@"||i==="*")return Ee(e,s).length>0?!0:e.state.env.has(s);if(e.state.associativeArrays?.has(s)){let l=i4(e,Vl(i));return cs(e,s,l)}let a;if(/^-?\d+$/.test(i))a=Number.parseInt(i,10);else try{let l=new xe,c=Ue(l,i);a=await Re(e,c.expression)}catch{let l=e.state.env.get(i);a=l?Number.parseInt(l,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let l=Ee(e,s);if(l.length===0)return!1;let u=Math.max(...l.map(([f])=>typeof f=="number"?f:0))+1+a;return u<0?!1:cs(e,s,u)}return cs(e,s,a)}if(st(e,t)){let s=pn(e,t);return s===void 0||s===t?e.state.env.has(t):Rr(e,s)}return e.state.env.has(t)?!0:mr(e,t)?cs(e,t,0):!1}async function o4(e,t){let n="",r=0;for(;r<t.length;){if(t[r]==="$"){if(t[r+1]==="{"){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="{"?s++:t[i]==="}"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]==="("){let s=1,i=r+2;for(;i<t.length&&s>0;)t[i]==="("?s++:t[i]===")"&&s--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ve(e,i);n+=o,r=s;continue}if(/[0-9]/.test(t[r+1]||"")){let s=r+1;for(;s<t.length&&/[0-9]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ve(e,i);n+=o,r=s;continue}if(/[*@#?\-!$]/.test(t[r+1]||"")){let s=t[r+1],i=await Ve(e,s);n+=i,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 s=r+1;for(;s<t.length&&/[a-zA-Z0-9_]/.test(t[s]);)s++;let i=t.slice(r+1,s),o=await Ve(e,i);n+=o,r=s}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 ip(e,t){let n=t,r=t.startsWith('"')&&t.endsWith('"'),s=t.startsWith("'")&&t.endsWith("'");if((r||s)&&(n=t.slice(1,-1)),s)return n;let i="",o=0;for(;o<n.length;)if(n[o]==="$")if(n[o+1]==="("){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="("&&n[l-1]==="$"||n[l]==="("?a++:n[l]===")"&&a--,l++;let c=n.slice(o+2,l-1);if(e.execFn){let u=await e.execFn(c,{signal:e.state.signal});i+=u.stdout.replace(/\n+$/,""),u.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+u.stderr)}o=l}else if(n[o+1]==="{"){let a=1,l=o+2;for(;l<n.length&&a>0;)n[l]==="{"?a++:n[l]==="}"&&a--,l++;let c=n.slice(o+2,l-1),u=await Ve(e,c);i+=u,o=l}else if(/[a-zA-Z_]/.test(n[o+1]||"")){let a=o+1;for(;a<n.length&&/[a-zA-Z0-9_]/.test(n[a]);)a++;let l=n.slice(o+1,a),c=await Ve(e,l);i+=c,o=a}else i+=n[o],o++;else if(n[o]==="`"){let a=o+1;for(;a<n.length&&n[a]!=="`";)a++;let l=n.slice(o+1,a);if(e.execFn){let c=await e.execFn(l,{signal:e.state.signal});i+=c.stdout.replace(/\n+$/,""),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr)}o=a+1}else i+=n[o],o++;return i}kt();G();var oa=1e4,op={maxResults:oa,maxStringBytes:10*1024*1024};function ic(e,t,n,r){if(e.length>=n.maxResults)return!1;let s=M(t);if(s>n.maxStringBytes-r.value)throw new C(`brace expansion string limit exceeded (${n.maxStringBytes} bytes)`,"string_length");return e.push(t),r.value+=s,!0}function gO(e,t,n,r,s,i=op){let o=n??1;o===0&&(o=1);let a=Math.abs(o),l=[],c=0;if(r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,"").length)),s?.match(/^-?0\d/)&&(c=Math.max(c,s.replace(/^-/,"").length)),c>i.maxStringBytes)throw new C(`brace expansion padding limit exceeded (${i.maxStringBytes} bytes)`,"string_length");let u={value:0},f=d=>{if(c>0){let p=d<0,h=String(Math.abs(d)).padStart(c,"0");return p?`-${h}`:h}return String(d)};if(e<=t)for(let d=e,p=0;d<=t&&p<oa&&ic(l,f(d),i,u);d+=a,p++);else for(let d=e,p=0;d>=t&&p<oa&&ic(l,f(d),i,u);d-=a,p++);return l}function yO(e,t,n,r=op){let s=n??1;s===0&&(s=1);let i=e.charCodeAt(0),o=t.charCodeAt(0),a=Math.abs(s),l=e>="A"&&e<="Z",c=e>="a"&&e<="z",u=t>="A"&&t<="Z",f=t>="a"&&t<="z";if(l&&f||c&&u){let h=n!==void 0?`..${n}`:"";throw new pi(`{${e}..${t}${h}}: invalid sequence`)}let d=[],p={value:0};if(i<=o)for(let h=i,m=0;h<=o&&m<oa&&ic(d,String.fromCharCode(h),r,p);h+=a,m++);else for(let h=i,m=0;h>=o&&m<oa&&ic(d,String.fromCharCode(h),r,p);h-=a,m++);return d}function ap(e,t,n,r,s,i=op){let o=n!==void 0?`..${n}`:"";return typeof e=="number"&&typeof t=="number"?{expanded:gO(e,t,n,r,s,i),literal:`{${e}..${t}${o}}`}:typeof e=="string"&&typeof t=="string"?{expanded:yO(e,t,n,i),literal:`{${e}..${t}${o}}`}:{expanded:null,literal:`{${e}..${t}${o}}`}}function a4(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 s=r;if(s.name!==null||s.args.length!==0||s.assignments.length!==0||s.redirections.length!==1)return null;let i=s.redirections[0];return i.operator!=="<"||i.target.type!=="Word"?null:{target:i.target}}function Pr(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function lp(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 Pn(e){return e.replace(/([*?[\]\\()|])/g,"\\$1")}function Xi(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}mt();G();function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t,n=!1){let r="",s=0;for(;s<e.length;){let i=e[s];if(n&&(i==="@"||i==="*"||i==="+"||i==="?"||i==="!")&&s+1<e.length&&e[s+1]==="("){let o=wO(e,s+1);if(o!==-1){let a=e.slice(s+2,o),c=bO(a).map(f=>Xe(f,t,n)),u=c.length>0?c.join("|"):"(?:)";i==="@"?r+=`(?:${u})`:i==="*"?r+=`(?:${u})*`:i==="+"?r+=`(?:${u})+`:i==="?"?r+=`(?:${u})?`:i==="!"&&(r+=`(?!(?:${u})$).*`),s=o+1;continue}}if(i==="\\")if(s+1<e.length){let o=e[s+1];/[\\^$.|+(){}[\]*?]/.test(o)?r+=`\\${o}`:r+=o,s+=2}else r+="\\\\",s++;else if(i==="*")r+=t?".*":".*?",s++;else if(i==="?")r+=".",s++;else if(i==="["){let o=xO(e,s);if(o===-1)r+="\\[",s++;else{let a=e.slice(s+1,o);r+=EO(a),s=o+1}}else/[\^$.|+(){}]/.test(i)?(r+=`\\${i}`,s++):(r+=i,s++)}return r}function wO(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function bO(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function xO(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 r=e.indexOf("'",n+1);if(r!==-1){n=r+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let r=e.indexOf(":]",n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function EO(e){let t="[",n=0;for((e[0]==="^"||e[0]==="!")&&(t+="^",n++);n<e.length;){if(e[n]==="'"){let s=e.indexOf("'",n+1);if(s!==-1){let i=e.slice(n+1,s);for(let o of i)o==="\\"?t+="\\\\":o==="]"?t+="\\]":o==="^"&&t==="["?t+="\\^":t+=o;n=s+1;continue}}if(e[n]==="["&&n+1<e.length&&e[n+1]===":"){let s=e.indexOf(":]",n+2);if(s!==-1){let i=e.slice(n+2,s);t+=AO(i),n=s+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}var SO=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 AO(e){return SO.get(e)??""}mt();async function ps(e,t,n,r,s){let i="",o=e.state.shoptOptions.extglob;for(let a of t.parts)if(a.type==="Glob")i+=Xe(a.pattern,n,o);else if(a.type==="Literal")i+=Xe(a.value,n,o);else if(a.type==="SingleQuoted"||a.type==="Escaped")i+=nt(a.value);else if(a.type==="DoubleQuoted"){let l=await r(e,a.parts);i+=nt(l)}else if(a.type==="ParameterExpansion"){let l=await s(e,a);i+=Xe(l,n,o)}else{let l=await s(e,a);i+=nt(l)}return i}function gr(e,t,n,r,s){if(r==="prefix")return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),oe(`^${n}`,"s").replace(t,"");let i=oe(`${n}$`,"s");if(s)return e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal"),i.replace(t,"");e.executionScope.consumeLimited("pattern-removal",Math.max(1,t.length),e.limits.maxGlobOperations,"pattern removal");let o=oe(`^(?:.*)(${n})$`,"s").exec(t);if(!o)return t;let a=o[1]??"";return t.slice(0,t.length-a.length)}function Qi(e,t){let n=new Set;for(let r of e.state.env.keys())r.startsWith(t)&&n.add(r);for(let r of e.state.arrays?.keys()??[])r.startsWith(t)&&n.add(r);return[...n].sort()}St();G();function oc(e,t,n,r,s){let i=new $e(e.limits.maxStringLength,"pattern replacement",()=>new C(`pattern replacement: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length"));n.lastIndex=0;let o=0,a=n.exec(t);for(;a!==null&&(e.executionScope.consumeLimited("pattern_operations",1,e.limits.maxGlobOperations,"pattern replacement"),!(s&&a[0].length===0&&a.index===t.length||(i.append(t.slice(o,a.index)),i.append(r),o=a.index+a[0].length,!s)));)a[0].length===0&&(o++,n.lastIndex<=a.index&&(n.lastIndex=a.index+1)),a=n.exec(t);return i.append(t.slice(o)),n.lastIndex=0,i.build()}kt();G();function l4(e){let t=[],n=0;return{append(r){let s=M(r);if(s>e-n)throw new C(`prompt expansion exceeds string length limit (${e} bytes)`,"string_length");r&&t.push(r),n+=s},build:()=>t.join("")}}function CO(e,t,n){let r=(o,a=2)=>String(o).padStart(a,"0");if(e===""){let o=r(t.getHours()),a=r(t.getMinutes()),l=r(t.getSeconds());return`${o}:${a}:${l}`}let s=l4(n),i=0;for(;i<e.length;)if(e[i]==="%"){if(i+1>=e.length){s.append("%"),i++;continue}let o=e[i+1];switch(o){case"H":s.append(r(t.getHours()));break;case"M":s.append(r(t.getMinutes()));break;case"S":s.append(r(t.getSeconds()));break;case"d":s.append(r(t.getDate()));break;case"m":s.append(r(t.getMonth()+1));break;case"Y":s.append(String(t.getFullYear()));break;case"y":s.append(r(t.getFullYear()%100));break;case"I":{let a=t.getHours()%12;a===0&&(a=12),s.append(r(a));break}case"p":s.append(t.getHours()<12?"AM":"PM");break;case"P":s.append(t.getHours()<12?"am":"pm");break;case"%":s.append("%");break;case"a":{let a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];s.append(a[t.getDay()]);break}case"b":{let a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];s.append(a[t.getMonth()]);break}default:s.append(`%${o}`)}i+=2}else s.append(e[i]),i++;return s.build()}function aa(e,t){let n=l4(e.limits.maxStringLength),r=0,s=e.state.env.get("USER")||e.state.env.get("LOGNAME")||"user",i=e.state.env.get("HOSTNAME")||"localhost",o=i.split(".")[0],a=e.state.env.get("PWD")||"/",l=e.state.env.get("HOME")||"/",c=a.startsWith(l)?`~${a.slice(l.length)}`:a,u=a.split("/").pop()||a,f=new Date,d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],h=e.state.env.get("__COMMAND_NUMBER")||"1";for(;r<t.length;){let m=t[r];if(m==="\\"){if(r+1>=t.length){n.append("\\"),r++;continue}let g=t[r+1];if(g>="0"&&g<="7"){let b="",y=r+1;for(;y<t.length&&y<r+4&&t[y]>="0"&&t[y]<="7";)b+=t[y],y++;let w=Number.parseInt(b,8)%256;n.append(String.fromCharCode(w)),r=y;continue}switch(g){case"\\":n.append("\\"),r+=2;break;case"a":n.append("\x07"),r+=2;break;case"e":n.append("\x1B"),r+=2;break;case"n":n.append(`
907
907
  `),r+=2;break;case"r":n.append("\r"),r+=2;break;case"$":n.append("$"),r+=2;break;case"[":case"]":r+=2;break;case"u":n.append(s),r+=2;break;case"h":n.append(o),r+=2;break;case"H":n.append(i),r+=2;break;case"w":n.append(c),r+=2;break;case"W":n.append(u),r+=2;break;case"d":{let b=String(f.getDate()).padStart(2," ");n.append(`${d[f.getDay()]} ${p[f.getMonth()]} ${b}`),r+=2;break}case"t":{let b=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0"),w=String(f.getSeconds()).padStart(2,"0");n.append(`${b}:${y}:${w}`),r+=2;break}case"T":{let b=f.getHours()%12;b===0&&(b=12);let y=String(b).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),x=String(f.getSeconds()).padStart(2,"0");n.append(`${y}:${w}:${x}`),r+=2;break}case"@":{let b=f.getHours()%12;b===0&&(b=12);let y=String(b).padStart(2,"0"),w=String(f.getMinutes()).padStart(2,"0"),x=f.getHours()<12?"AM":"PM";n.append(`${y}:${w} ${x}`),r+=2;break}case"A":{let b=String(f.getHours()).padStart(2,"0"),y=String(f.getMinutes()).padStart(2,"0");n.append(`${b}:${y}`),r+=2;break}case"D":if(r+2<t.length&&t[r+2]==="{"){let b=t.indexOf("}",r+3);if(b!==-1){let y=t.slice(r+3,b);n.append(CO(y,f,e.limits.maxStringLength)),r=b+1}else n.append("\\D"),r+=2}else n.append("\\D"),r+=2;break;case"s":n.append("bash"),r+=2;break;case"v":n.append("5.0"),r+=2;break;case"V":n.append("5.0.0"),r+=2;break;case"j":n.append("0"),r+=2;break;case"l":n.append("tty"),r+=2;break;case"#":n.append(h),r+=2;break;case"!":n.append(h),r+=2;break;case"x":n.append("\\x"),r+=2;break;default:n.append(`\\${g}`),r+=2}}else n.append(m),r++}return n.build()}function hs(e){if(e==="")return"''";if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let n="$'";for(let r of e)switch(r){case"'":n+="\\'";break;case"\\":n+="\\\\";break;case`
908
908
  `:n+="\\n";break;case"\r":n+="\\r";break;case" ":n+="\\t";break;default:{let s=r.charCodeAt(0);s<32||s===127?n+=`\\${s.toString(8).padStart(3,"0")}`:n+=r}}return`${n}'`}return`'${e}'`}G();function In(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function hn(e,t){return e.state.readonlyVars?.has(t)??!1}function it(e,t,n="bash"){if(hn(e,t)){let r=`${n}: ${t}: readonly variable
909
909
  `;throw new we(1,"",r)}return null}function yr(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 ac(e,t){e.state.exportedVars?.delete(t)}function ms(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return"";let n="",r=Wt(e,t)?.kind==="indexed",s=e.state.associativeArrays?.has(t)??!1;return r&&!s&&(n+="a"),s&&(n+="A"),e.state.integerVars?.has(t)&&(n+="i"),st(e,t)&&(n+="n"),hn(e,t)&&(n+="r"),e.state.exportedVars?.has(t)&&(n+="x"),n}async function c4(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}function cp(e){if(/^(?:\d+|[@*#?$!-])$/.test(e))throw new we(1,"",`bash: $${e}: cannot assign in this way
910
910
  `)}async function u4(e,t,n,r,s){e.coverage?.hit("bash:expansion:assign_default");let i=r.isUnset||n.checkEmpty&&r.isEmpty;if(i&&cp(t),i&&n.word){let o=await s(e,n.word.parts,r.inDoubleQuotes),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,l,c]=a;if(c==="@"||c==="*")throw new we(1,"",`${e.state.expansionStderr||""}bash: ${t}: bad array subscript
911
- `);let u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let f=new xe,d=Be(f,c);u=await Re(e,d.expression)}catch{let f=e.state.env.get(c);u=f?Number.parseInt(f,10):0}Number.isNaN(u)&&(u=0)}be(e,l,u,o)}else e.state.env.set(t,o);return o}return r.effectiveValue}async function f4(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new we(1,"",`bash: ${o}
912
- `)}return r.effectiveValue}async function d4(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 p4(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i=n.pattern?await ps(e,n.pattern,n.greedy,r,s):"";return gr(e,t,i,n.side,n.greedy)}async function h4(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=Ke(c.pattern,!0,o);else if(c.type==="Literal")i+=Ke(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=nt(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=nt(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=Ke(u,!0,o)}else{let u=await s(e,c);i+=nt(u)}let a=n.replacement?await r(e,n.replacement.parts):"";if(n.anchor==="start"?i=`^${i}`:n.anchor==="end"&&(i=`${i}$`),i==="")return t;let l=n.all?"gs":"s";try{let c=oe(i,l);return oc(e,t,c,a,n.all)}catch(c){if(c instanceof C)throw c;return t}}function up(e,t,n){e.coverage?.hit("bash:expansion:length");let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let s=r[1],i=Ee(e,s);return i.length>0?String(i.length):e.state.env.get(s)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&mr(e,t)){if(t==="FUNCNAME"){let i=e.state.funcNameStack?.[0]||"";return String([...i].length)}if(t==="BASH_LINENO"){let i=e.state.callLineStack?.[0];return String(i!==void 0?[...String(i)].length:0)}let s=Ye(e,t,0)||"";return String([...s].length)}return String([...n].length)}async function m4(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await Re(e,r.offset.expression),i=r.length?await Re(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let h=1;h<=c;h++)u.push(e.state.env.get(String(h))||"");let f=e.state.env.get("0")||"bash",d,p;if(s<=0)if(d=[f,...u],s<0){if(p=d.length+s,p<0)return""}else p=0;else d=u,p=s-1;if(p<0||p>=d.length)return"";if(i!==void 0){let h=i<0?d.length+i:p+i;return d.slice(p,Math.max(p,h)).join(" ")}return d.slice(p).join(" ")}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let c=o[1];if(e.state.associativeArrays?.has(c))throw new we(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
913
- `);let u=Ee(e,c),f=0;if(s<0){if(u.length>0){let d=u[u.length-1][0],h=(typeof d=="number"?d:0)+1+s;if(h<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=h),f<0))return""}}else if(f=u.findIndex(([d])=>typeof d=="number"&&d>=s),f<0)return"";if(i!==void 0){if(i<0)throw new qe(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,d])=>d).join(" ")}return u.slice(f).map(([,d])=>d).join(" ")}let a=[...n],l=s;if(l<0&&(l=Math.max(0,a.length+l)),i!==void 0){if(i<0){let c=a.length+i;return a.slice(l,Math.max(l,c)).join("")}return a.slice(l,l+i).join("")}return a.slice(l).join("")}async function g4(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,o="";for(let f of n.pattern.parts)if(f.type==="Glob")o+=Ke(f.pattern,!0,i);else if(f.type==="Literal")o+=Ke(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=nt(f.value);else if(f.type==="DoubleQuoted"){let d=await r(e,f.parts);o+=nt(d)}else if(f.type==="ParameterExpansion"){let d=await s(e,f);o+=Ke(d,!0,i)}let a=oe(`^(?:${o})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:a.test(f)?(c+=l(f),u=!0):c+=f;return c}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 y4(e,t,n,r,s){e.coverage?.hit("bash:expansion:transform");let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i&&s.operator==="Q")return Ee(e,i[1]).map(([,c])=>hs(c)).join(" ");if(i&&s.operator==="a")return ms(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return ms(e,o[1]);switch(s.operator){case"Q":return r?"":hs(n);case"P":return aa(e,n);case"a":return ms(e,t);case"A":return r?"":`${t}=${hs(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(a,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
914
- `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":hs(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 w4(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),st(e,t))return li(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new sn(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new sn(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new sn(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await He(e,l)}function b4(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=Ee(e,t.array).map(([s])=>String(s));return t.star?r.join(Oe(e.state.env)):r.join(" ")}function x4(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Qi(e,t.prefix);return t.star?n.join(Oe(e.state.env)):n.join(" ")}function E4(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,o,a]=i,l=Ee(e,o);return l.length===0?{isEmpty:!0,effectiveValue:""}:a==="*"?{isEmpty:r?n==="":!1,effectiveValue:n}:{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:n}}return{isEmpty:n==="",effectiveValue:n}}vt();G();function gs(e,t){e.lastExitCode=t,e.env.set("?",String(t)),e.lastSubstitutionExitCode=t}function kO(e){switch(e.operator){case"<":case"<&":case"<<":case"<<-":case"<<<":case"<>":return e.fd===null||e.fd===0;default:return!1}}function lc(e,t){return t.some(kO)?0:e.lastSubstitutionExitCode??0}function S4(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function A4(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function cc(e,t){let n=new xe,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),o=Qn(e.state.arrays),a=e.state.cwd,l=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let c=await e.executeScript(r),u=c.exitCode;return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.suppressVerbose=l,gs(e.state,u),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr),e.state.bashPid=s,c.stdout.replace(/\n+$/,"")}catch(c){return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.bashPid=s,e.state.suppressVerbose=l,ge(c),c instanceof we?(gs(e.state,c.exitCode),c.stdout?.replace(/\n+$/,"")??""):""}}function fp(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Pn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=vO(e,a);n+=Pn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function vO(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function C4(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Pn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await NO(e,a);n+=Pn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=A4(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function NO(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=A4(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}function dp(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";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 s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}function ys(e,t){return t.split(":").map(n=>dp(e,n)).join(":")}G();G();function Xt(e,t,n,r){if(e.length>n-t.length)throw new C(`${r} element limit exceeded (${n})`,"array_elements");for(let s of t)e.push(s)}mt();async function IO(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=Ke(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=Ke(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=nt(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=nt(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=Ke(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=nt(o)}return s}async function k4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=Ee(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let d="";c.pattern&&(d=await IO(e,c.pattern,n,r));let p=c.replacement?await n(e,c.replacement.parts):"",h=d;c.anchor==="start"?h=`^${d}`:c.anchor==="end"&&(h=`${d}$`);let m=[];try{let g=oe(h,c.all?"g":"");for(let b of f)m.push(g.replace(b,p))}catch{m.push(...f)}if(l){let g=Oe(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function v4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=Ee(e,a),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(a);h!==void 0&&f.push(h)}if(f.length===0)return{values:[],quoted:!0};let d=c.pattern?await ps(e,c.pattern,c.greedy,n,r):"",p=[];for(let h of f)p.push(gr(e,h,d,c.side,c.greedy));if(l){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}mt();async function N4(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];if(r.operation?.type==="AssignDefault"&&/^(?:\d+|[@*#?$!-])$/.test(r.parameter))return null;let s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(s.type==="AssignDefault"&&(!i||i[2]==="*"))return null;let o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=Ee(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,p])=>p===""),d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=u&&!(d&&f):o=!u||d&&f,!o){if(c.length>0){let h=c.map(([,m])=>m);if(a){let m=Oe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(l);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await Rr(e,l),u=await He(e,l,!1),f=u==="",d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(d&&f):o=!c||d&&f,!o)return{values:[u],quoted:!0}}if(s.type==="AssignDefault")return null;if(o&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let d=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){c=d[1],u=d[2]==="*";break}}if(c){let f=Ee(e,c);if(f.length>0){let p=f.map(([,h])=>h);if(u||a){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}let d=e.state.env.get(c);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}}return null}async function I4(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let b=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){o=m,a=b[1],l=b[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let d=Ee(e,a),p=d.map(([,m])=>m);if(d.length===0){let m=e.state.env.get(a);if(m!==void 0)p=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g=m.pattern?await ps(e,m.pattern,m.greedy,s,r):"";p=p.map(b=>gr(e,b,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=Ke(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")g+=Ke(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=nt(w.value);else if(w.type==="DoubleQuoted"){let x=await s(e,w.parts);g+=nt(x)}else if(w.type==="ParameterExpansion"){let x=await r(e,w);g+=Ke(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,w);g+=nt(x)}let b=m.replacement?await s(e,m.replacement.parts):"",y=g;m.anchor==="start"?y=`^${g}`:m.anchor==="end"&&(y=`${g}$`);try{let w=oe(y,m.all?"g":"");p=p.map(x=>w.replace(x,b))}catch{}}if(l){let m=Oe(e.state.env);return{values:[u+p.join(m)+f],quoted:!0}}return p.length===1?{values:[u+p[0]+f],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+f],quoted:!0}}async function O4(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let p=0;p<s.parts.length;p++){let h=s.parts[p];if(h.type==="ParameterExpansion"&&!h.operation){let m=h.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=p,o=m[1],a=m[2]==="*";break}}}if(i===-1)return null;let l="";for(let p=0;p<i;p++)l+=await r(e,s.parts[p]);let c="";for(let p=i+1;p<s.parts.length;p++)c+=await r(e,s.parts[p]);let u=Ee(e,o),f=u.map(([,p])=>p);if(u.length===0){let p=e.state.env.get(o);if(p!==void 0)return{values:[l+p+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let h=l+c;return{values:h?[h]:[],quoted:!0}}if(a){let p=Oe(e.state.env);return{values:[l+f.join(p)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}kt();G();async function T4(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 s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new we(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
915
- `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Ee(e,o);if(f.length>e.limits.maxArrayElements)throw new C(`array transform element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let d=0;if(c<0){if(f.length>0){let h=f[f.length-1][0],g=(typeof h=="number"?h:0)+1+c;if(g<0)return{values:[],quoted:!0};d=f.findIndex(([b])=>typeof b=="number"&&b>=g),d<0&&(d=f.length)}}else d=f.findIndex(([h])=>typeof h=="number"&&h>=c),d<0&&(d=f.length);let p;if(u!==void 0){if(u<0)throw new qe(`${o}[@]: substring expression < 0`);p=f.slice(d,d+u).map(([,h])=>h)}else p=f.slice(d).map(([,h])=>h);if(p.length===0)return{values:[],quoted:!0};if(a){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}function $4(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],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],o=s[2]==="*",a=r.operation,l=Ee(e,i);if(l.length===0){let d=e.state.env.get(i);if(d!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=aa(e,d);break;case"Q":p=hs(d);break;default:p=d}if(M(p)>e.limits.maxStringLength)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=ms(e,i),u=[],f=0;for(let[,d]of l){let p;switch(a.operator){case"a":p=c;break;case"P":p=aa(e,d);break;case"Q":p=hs(d);break;case"u":p=d.charAt(0).toUpperCase()+d.slice(1);break;case"U":p=d.toUpperCase();break;case"L":p=d.toLowerCase();break;default:p=d}let h=M(p);if(h>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");u.push(p),f+=h}if(o){let d=Oe(e.state.env);if(Math.max(0,u.length-1)*M(d)>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u.join(d)],quoted:!0}}return{values:u,quoted:!0}}function R4(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 s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(st(e,i)){let l=li(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=Ee(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function P4(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 s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!st(e,s))return null;let i=li(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=Ee(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}G();async function D4(e,t,n,r,s){if(!n||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!=="Indirection")return null;let o=i.parts[0],a=o.operation,l=await He(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let h=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=h;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(Oe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",d=Ee(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return OO(e,d,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return TO(e,d,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=ms(e,u),g=d.map(()=>m);return f?{values:[g.join(Oe(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let h=[];for(let[,m]of d){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},b=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let y=await r(e,g,!0);h.push(y)}finally{b!==void 0?e.state.env.set("_indirect_elem_",b):e.state.env.delete("_indirect_elem_")}}return f?{values:[h.join(Oe(e.state.env))],quoted:!0}:{values:h,quoted:!0}}if(d.length>0){let h=d.map(([,m])=>m);return f?{values:[h.join(Oe(e.state.env))],quoted:!0}:{values:h,quoted:!0}}let p=e.state.env.get(u);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}async function OO(e,t,n,r,s){let i=s.offset?await Re(e,s.offset.expression):0,o=s.length?await Re(e,s.length.expression):void 0,a=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],d=(typeof u=="number"?u:0)+1+i;if(d<0)return{values:[],quoted:!0};if(a=t.findIndex(([p])=>typeof p=="number"&&p>=d),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new qe(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(Oe(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function TO(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&l)&&s.word){let f=await i(e,s.word.parts,!0);return be(e,n,0,f),{values:[f],quoted:!0}}return r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function L4(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,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],l=(await He(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Rr(e,n.parameter),u=await He(e,n.parameter)==="",f=r.checkEmpty??!1,d;if(r.type==="UseAlternative"?d=c&&!(f&&u):d=!c||f&&u,d){let p=l[1],h=l[2]==="*",m=Ee(e,p);if(m.length>0){let b=m.map(([,y])=>y);return h?{values:[b.join(Oe(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let g=e.state.env.get(p);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function F4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await He(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await He(e,n.parameter),f=await Rr(e,n.parameter),d=u==="",p=s.checkEmpty??!1,h;if(s.type==="UseAlternative"?h=f&&!(p&&d):h=!f||p&&d,h){let m=c[1],g=c[2]==="*",b=Ee(e,m);if(b.length>0){let w=b.map(([,x])=>x);return g?{values:[w.join(Oe(e.state.env))],quoted:!0}:{values:w,quoted:!0}}let y=e.state.env.get(m);return y!==void 0?{values:[y],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}kt();mt();G();function M4(e){let t=Number.parseInt(e.state.env.get("#")||"0",10);if(t>e.limits.maxArrayElements)throw new C(`positional parameter element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let n=[],r=0;for(let s=1;s<=t;s++){let i=e.state.env.get(String(s))||"",o=M(i);if(o>e.limits.maxStringLength-r)throw new C(`positional parameter string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n.push(i),r+=o}return n}function uc(e,t,n){if(M(t)>n-M(e))throw new C(`positional expansion string limit exceeded (${n} bytes)`,"string_length");return e+t}function pp(e,t,n,r){if(e.length>=r.limits.maxArrayElements)throw new C(`positional expansion element limit exceeded (${r.limits.maxArrayElements})`,"array_elements");let s=M(t);if(s>r.limits.maxStringLength-n.value)throw new C(`positional expansion string limit exceeded (${r.limits.maxStringLength} bytes)`,"string_length");e.push(t),n.value+=s}async function _4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="Substring"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),d=[];for(let y=1;y<=f;y++)d.push(e.state.env.get(String(y))||"");let p=e.state.env.get("0")||"bash",h;if(c<=0){let y=[p,...d],w=y.length+c;if(w<0)h=[];else{let x=c<0?w:0;if(u!==void 0){let S=u<0?y.length+u:x+u;h=y.slice(x,Math.max(x,S))}else h=y.slice(x)}}else{let y=c-1;if(y>=d.length)h=[];else if(u!==void 0){let w=u<0?d.length+u:y+u;h=d.slice(y,Math.max(y,w))}else h=d.slice(y)}let m="";for(let y=0;y<i;y++)m+=await r(e,s.parts[y]);let g="";for(let y=i+1;y<s.parts.length;y++)g+=await r(e,s.parts[y]);if(h.length===0){let y=m+g;return{values:y?[y]:[],quoted:!0}}if(o){let y=Oe(e.state.env);return{values:[m+h.join(y)+g],quoted:!0}}return h.length===1?{values:[m+h[0]+g],quoted:!0}:{values:[m+h[0],...h.slice(1,-1),h[h.length-1]+g],quoted:!0}}async function B4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternReplacement"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=M4(e),u="";for(let y=0;y<i;y++)u=uc(u,await n(e,s.parts[y]),e.limits.maxStringLength);let f="";for(let y=i+1;y<s.parts.length;y++)f=uc(f,await n(e,s.parts[y]),e.limits.maxStringLength);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let d="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")d+=Ke(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")d+=Ke(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")d+=nt(y.value);else if(y.type==="DoubleQuoted"){let w=await r(e,y.parts);d+=nt(w)}else if(y.type==="ParameterExpansion"){let w=await n(e,y);d+=Ke(w,!0,e.state.shoptOptions.extglob)}else{let w=await n(e,y);d+=nt(w)}let p=l.replacement?await r(e,l.replacement.parts):"",h=d;l.anchor==="start"?h=`^${d}`:l.anchor==="end"&&(h=`${d}$`);let m=[],g={value:0};try{let y=oe(h,l.all?"g":"");for(let w of c){let x=0;y.lastIndex=0;for(let N=y.exec(w);N&&(x++,!!l.all);N=y.exec(w))N[0].length===0&&y.lastIndex++;let S=M(w),E=M(p),A=0,I=/\$(?:\$|&|\d+|<[^>]+>|`|')/g;for(;I.exec(p)!==null;)A++;if(S+x*E+x*A*S>e.limits.maxStringLength-g.value)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");pp(m,y.replace(w,p),g,e)}}catch(y){if(y instanceof C)throw y;for(let w of c)pp(m,w,g,e)}if(o){let y=Oe(e.state.env);if(g.value+Math.max(0,m.length-1)*M(y)+M(u)+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+m.join(y)+f],quoted:!0}}if(M(u)+g.value+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function U4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let b=0;b<s.parts.length;b++){let y=s.parts[b];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=b,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=M4(e),u="";for(let b=0;b<i;b++)u=uc(u,await n(e,s.parts[b]),e.limits.maxStringLength);let f="";for(let b=i+1;b<s.parts.length;b++)f=uc(f,await n(e,s.parts[b]),e.limits.maxStringLength);if(c.length===0){let b=u+f;return{values:b?[b]:[],quoted:!0}}let d="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let b of l.pattern.parts)if(b.type==="Glob")d+=Ke(b.pattern,l.greedy,p);else if(b.type==="Literal")d+=Ke(b.value,l.greedy,p);else if(b.type==="SingleQuoted"||b.type==="Escaped")d+=nt(b.value);else if(b.type==="DoubleQuoted"){let y=await r(e,b.parts);d+=nt(y)}else if(b.type==="ParameterExpansion"){let y=await n(e,b);d+=Ke(y,l.greedy,p)}else{let y=await n(e,b);d+=nt(y)}let h=[],m={value:0};for(let b of c)pp(h,gr(e,b,d,l.side,l.greedy),m,e);if(o){let b=Oe(e.state.env);if(m.value+Math.max(0,h.length-1)*M(b)+M(u)+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+h.join(b)+f],quoted:!0}}if(M(u)+m.value+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function z4(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let d=0;d<r.parts.length;d++){let p=r.parts[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")){s=d,i=p.parameter==="*";break}}if(s===-1)return null;let o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let d=0;d<s;d++)l+=await n(e,r.parts[d]);let c="";for(let d=s+1;d<r.parts.length;d++)c+=await n(e,r.parts[d]);if(a===0){if(i)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}let u=[];for(let d=1;d<=a;d++)u.push(e.state.env.get(String(d))||"");if(i){let d=Oe(e.state.env);return{values:[l+u.join(d)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}ue();mt();G();function Dr(e,t,n,r){if(t.length>=e.limits.maxArrayElements)throw new C(`unquoted expansion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let s=M(n);if(s>e.limits.maxStringLength-r.value)throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");t.push(n),r.value+=s}function hp(e,t,n,r){let s=M(n),i=Math.max(0,t.length-1);if(s>0&&i>Math.floor((e.limits.maxStringLength-r)/s))throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return t.join(n)}function $O(e){return new ds(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,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")})}async function fc(e,t){if(e.state.options.noglob)return t;let n=$O(e),r=[];for(let s of t)if(Pr(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)Xt(r,i,e.limits.maxArrayElements,"unquoted glob expansion");else{if(n.hasFailglob())throw new xr(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function W4(e,t,n,r){let s=-1,i="",o=!1;for(let x=0;x<t.length;x++){let S=t[x];if(S.type==="ParameterExpansion"&&S.operation?.type==="PatternReplacement"){let E=S.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(E){s=x,i=E[1],o=E[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=Ee(e,i),u=c.map(([,x])=>x);if(c.length===0){let x=e.state.env.get(i);x!==void 0&&(u=[x])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let x of l.pattern.parts)if(x.type==="Glob")f+=Ke(x.pattern,!0,e.state.shoptOptions.extglob);else if(x.type==="Literal")f+=Ke(x.value,!0,e.state.shoptOptions.extglob);else if(x.type==="SingleQuoted"||x.type==="Escaped")f+=nt(x.value);else if(x.type==="DoubleQuoted"){let S=await n(e,x.parts);f+=nt(S)}else if(x.type==="ParameterExpansion"){let S=await r(e,x);f+=Ke(S,!0,e.state.shoptOptions.extglob)}else{let S=await r(e,x);f+=nt(S)}let d=l.replacement?await n(e,l.replacement.parts):"",p=f;l.anchor==="start"?p=`^${f}`:l.anchor==="end"&&(p=`${f}$`);let h=[],m={value:0};try{let x=oe(p,l.all?"g":"");for(let S of u)Dr(e,h,oc(e,S,x,d,l.all),m)}catch(x){if(x instanceof C)throw x;for(let S of u)Dr(e,h,S,m)}let g=Ut(e.state.env),b=Kt(e.state.env);if(o){let x=Oe(e.state.env),S=hp(e,h,x,m.value);return b?{values:S?[S]:[],quoted:!1}:{values:at(S,g,e.limits.maxArrayElements),quoted:!1}}if(b)return{values:h,quoted:!1};let y=[],w={value:0};for(let x of h)if(x==="")Dr(e,y,"",w);else for(let S of at(x,g,e.limits.maxArrayElements))Dr(e,y,S,w);return{values:y,quoted:!1}}async function j4(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternRemoval"){let x=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=y,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=Ee(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f=l.pattern?await ps(e,l.pattern,l.greedy,n,r):"",d=[],p={value:0};for(let y of u)Dr(e,d,gr(e,y,f,l.side,l.greedy),p);let h=Ut(e.state.env),m=Kt(e.state.env);if(o){let y=Oe(e.state.env),w=hp(e,d,y,p.value);return m?{values:w?[w]:[],quoted:!1}:{values:at(w,h,e.limits.maxArrayElements),quoted:!1}}if(m)return{values:d,quoted:!1};let g=[],b={value:0};for(let y of d)if(y==="")Dr(e,g,"",b);else for(let w of at(y,h,e.limits.maxArrayElements))Dr(e,g,w,b);return{values:g,quoted:!1}}async function H4(e,t,n,r){let s=-1,i=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){s=y,i=w.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let y=1;y<=l;y++)c.push(e.state.env.get(String(y))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(a.pattern)for(let y of a.pattern.parts)if(y.type==="Glob")u+=Ke(y.pattern,a.greedy,f);else if(y.type==="Literal")u+=Ke(y.value,a.greedy,f);else if(y.type==="SingleQuoted"||y.type==="Escaped")u+=nt(y.value);else if(y.type==="DoubleQuoted"){let w=await n(e,y.parts);u+=nt(w)}else if(y.type==="ParameterExpansion"){let w=await r(e,y);u+=Ke(w,a.greedy,f)}else{let w=await r(e,y);u+=nt(w)}let d=[],p={value:0};for(let y of c)Dr(e,d,gr(e,y,u,a.side,a.greedy),p);let h=Ut(e.state.env),m=Kt(e.state.env);if(i){let y=Oe(e.state.env),w=hp(e,d,y,p.value);return m?{values:w?[w]:[],quoted:!1}:{values:at(w,h,e.limits.maxArrayElements),quoted:!1}}if(m)return{values:d,quoted:!1};let g=[],b={value:0};for(let y of d)if(y==="")Dr(e,g,"",b);else for(let w of at(y,h,e.limits.maxArrayElements))Dr(e,g,w,b);return{values:g,quoted:!1}}async function V4(e,t,n,r){let s=-1,i=!1;for(let w=0;w<t.length;w++){let x=t[w];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=w,i=x.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let w=1;w<=u;w++)f.push(e.state.env.get(String(w))||"");let d=e.state.env.get("0")||"bash",p;if(l<=0){let w=[d,...f],x=w.length+l;if(x<0)p=[];else{let S=l<0?x:0;if(c!==void 0){let E=c<0?w.length+c:S+c;p=w.slice(S,Math.max(S,E))}else p=w.slice(S)}}else{let w=l-1;if(w>=f.length)p=[];else if(c!==void 0){let x=c<0?f.length+c:w+c;p=f.slice(w,Math.max(w,x))}else p=f.slice(w)}let h="";for(let w=0;w<s;w++)h+=await r(e,t[w]);let m="";for(let w=s+1;w<t.length;w++)m+=await r(e,t[w]);let g=Ut(e.state.env),b=Kt(e.state.env);if(p.length===0){let w=h+m;return w?b?{values:[w],quoted:!1}:{values:at(w,g,e.limits.maxArrayElements),quoted:!1}:{values:[],quoted:!1}}let y;if(i){let w=Oe(e.state.env),x=h+p.join(w)+m;b?y=x?[x]:[]:y=at(x,g,e.limits.maxArrayElements)}else if(b)p.length===1?y=[h+p[0]+m]:y=[h+p[0],...p.slice(1,-1),p[p.length-1]+m];else{y=[];for(let w=0;w<p.length;w++){let x=p[w];if(w===0&&(x=h+x),w===p.length-1&&(x=x+m),x==="")y.push("");else{let S=at(x,g,e.limits.maxArrayElements);Xt(y,S,e.limits.maxArrayElements,"unquoted expansion")}}}return{values:await fc(e,y),quoted:!1}}async function q4(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 s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=Ut(e.state.env),o=Kt(e.state.env),a=tc(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=Oe(e.state.env),u=s.join(c);l=at(u,i,e.limits.maxArrayElements)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=at(c,i,e.limits.maxArrayElements);Xt(l,u,e.limits.maxArrayElements,"unquoted expansion")}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=at(c,i,e.limits.maxArrayElements);Xt(l,u,e.limits.maxArrayElements,"unquoted expansion")}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fc(e,l),quoted:!1}}async function G4(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],s=n[2]==="*",i=Ee(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=Ut(e.state.env),l=Kt(e.state.env),c=tc(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=Oe(e.state.env),d=o.join(f);u=at(d,a,e.limits.maxArrayElements)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let d=at(f,a,e.limits.maxArrayElements);Xt(u,d,e.limits.maxArrayElements,"unquoted expansion")}}else{u=[];for(let f of o)if(f==="")u.push("");else{let d=at(f,a,e.limits.maxArrayElements);Xt(u,d,e.limits.maxArrayElements,"unquoted expansion")}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fc(e,u),quoted:!1}}function Z4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Qi(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=Ut(e.state.env),i=Kt(e.state.env),o;if(n.star)if(i)o=r;else{let a=Oe(e.state.env),l=r.join(a);o=at(l,s,e.limits.maxArrayElements)}else if(i)o=r;else{o=[];for(let a of r){let l=at(a,s,e.limits.maxArrayElements);Xt(o,l,e.limits.maxArrayElements,"unquoted expansion")}}return{values:o,quoted:!1}}function K4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=Ee(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=Ut(e.state.env),o=Kt(e.state.env),a;if(n.star)if(o)a=s;else{let l=Oe(e.state.env),c=s.join(l);a=at(c,i,e.limits.maxArrayElements)}else if(o)a=s;else{a=[];for(let l of s){let c=at(l,i,e.limits.maxArrayElements);Xt(a,c,e.limits.maxArrayElements,"unquoted expansion")}}return{values:a,quoted:!1}}async function X4(e,t,n){let r=-1;for(let d=0;d<t.length;d++){let p=t[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")&&!p.operation){r=d;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let d=1;d<=s;d++)i.push(e.state.env.get(String(d))||"");let o="";for(let d=0;d<r;d++)o+=await n(e,t[d]);let a="";for(let d=r+1;d<t.length;d++)a+=await n(e,t[d]);let l=Ut(e.state.env),c=Kt(e.state.env),u=tc(e.state.env);if(s===0){let d=o+a;return{values:d?[d]:[],quoted:!1}}let f;{let d=[];for(let p=0;p<i.length;p++){let h=i[p];p===0&&(h=o+h),p===i.length-1&&(h=h+a),d.push(h)}if(c)f=d.filter(p=>p!=="");else if(u){f=[];for(let p of d){if(p==="")continue;let h=at(p,l,e.limits.maxArrayElements);Xt(f,h,e.limits.maxArrayElements,"unquoted expansion")}}else{f=[];for(let p of d)if(p==="")f.push("");else{let h=at(p,l,e.limits.maxArrayElements);Xt(f,h,e.limits.maxArrayElements,"unquoted expansion")}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fc(e,f),quoted:!1}}async function J4(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=ia(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return RO(e,d,s);let p=await PO(e,r,a,c,u,n);if(p!==null)return p;let h=await LO(e,r,n);if(h!==null)return h;let m=await FO(e,r,n);if(m!==null)return m;let g=await _O(e,r,n.expandPart);if(g!==null)return Y4(e,g);if((i||o||l)&&!Kt(e.state.env)){let y=Ut(e.state.env),w=n.buildIfsCharClassPattern(y),x=await n.smartWordSplit(e,r,y,w,n.expandPart);return Y4(e,x)}let b=await n.expandWordAsync(e,t);return BO(e,t,r,b,s,n.expandWordForGlobbing)}async function RO(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&Pr(s,e.state.shoptOptions.extglob)){let i=await dc(e,s);Xt(r,i,e.limits.maxArrayElements,"brace/glob expansion")}else r.push(s);return{values:r,quoted:!1}}async function PO(e,t,n,r,s,i){if(n){let o=R4(e,t);if(o!==null)return o}{let o=P4(e,t);if(o!==null)return o}{let o=await N4(e,t);if(o!==null)return o}{let o=await I4(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await O4(e,t,n,i.expandPart);if(o!==null)return o}{let o=await T4(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=$4(e,t);if(o!==null)return o}{let o=await k4(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await v4(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=DO(e,t);if(o!==null)return o}{let o=await D4(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await L4(e,t);if(o!==null)return o}{let o=await F4(e,t);if(o!==null)return o}return null}function DO(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 r=n.parts[0].operation,s=Qi(e,r.prefix);return r.star?{values:[s.join(Oe(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=Ee(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(Oe(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function LO(e,t,n){{let r=await _4(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await B4(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await U4(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await z4(e,t,n.expandPart);if(r!==null)return r}return null}async function FO(e,t,n){{let r=await W4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await j4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await H4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await V4(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await q4(e,t);if(r!==null)return r}{let r=await G4(e,t);if(r!==null)return r}{let r=Z4(e,t);if(r!==null)return r}{let r=K4(e,t);if(r!==null)return r}{let r=await X4(e,t,n.expandPart);if(r!==null)return r}return null}function Q4(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 MO(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=Ee(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=Oe(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function _O(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(Q4(l)){r=!0;break}if(!r)return null;let s=Ut(e.state.env),i=Kt(e.state.env),o=[];for(let l of t){let c=Q4(l);if(c&&l.type==="DoubleQuoted"){let u=await MO(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=at(u,s,e.limits.maxArrayElements);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=at(u,s,e.limits.maxArrayElements);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)Xt(a,l,e.limits.maxArrayElements,"word expansion");else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function Y4(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Pr(r,e.state.shoptOptions.extglob)){let s=await dc(e,r);Xt(n,s,e.limits.maxArrayElements,"glob expansion")}else n.push(r);return{values:n,quoted:!1}}async function dc(e,t){let n=new ds(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,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new xr(t);return n.hasNullglob()?[]:[t]}async function BO(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(Pr(a,e.state.shoptOptions.extglob)){let c=await dc(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=lp(r);if(!Kt(e.state.env)){let c=Ut(e.state.env);return{values:at(l,c,e.limits.maxArrayElements),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&Pr(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(Pr(a,e.state.shoptOptions.extglob)){let l=await dc(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=lp(r);if(!Kt(e.state.env)){let l=Ut(e.state.env);return{values:at(a,l,e.limits.maxArrayElements),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}G();function rn(e,t,n){if(t.length>=e.limits.maxArrayElements)throw new C(`word splitting element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");t.push(n)}async function t3(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 s=await Rr(e,t.parameter),o=await He(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?(n.type==="AssignDefault"&&cp(t.parameter),r.parts):null}function UO(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function zO(e,t){if(t.type!=="ParameterExpansion")return null;let n=await t3(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>UO(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function WO(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?ep(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&J7(e))}async function n3(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let d=t[0],p=await t3(e,d);if(p&&p.length>0&&p.length>1&&p.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&p.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return e3(e,p,n,r,s)}let i=[],o=!1;for(let d of t){let p=WO(d),h=d.type==="DoubleQuoted"||d.type==="SingleQuoted",m=p?await zO(e,d):null,g=await s(e,d);i.push({value:g,isSplittable:p,isQuoted:h,mixedDefaultParts:m??void 0}),p&&(o=!0)}if(!o){let d=i.map(p=>p.value).join("");return d?[d]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let d of i)if(!d.isSplittable)u?d.isQuoted&&d.value===""?(l!==""&&rn(e,a,l),rn(e,a,""),c=!0,l="",u=!1,f=!0):d.value!==""?(l!==""&&rn(e,a,l),l=d.value,u=!1,f=!1):(l+=d.value,f=!1):(l+=d.value,f=d.isQuoted&&d.value==="");else if(d.mixedDefaultParts){let p=await e3(e,d.mixedDefaultParts,n,r,s);if(p.length!==0)if(p.length===1)l+=p[0],c=!0;else{l+=p[0],rn(e,a,l),c=!0;for(let h=1;h<p.length-1;h++)rn(e,a,p[h]);l=p[p.length-1]}u=!1,f=!1}else{let{words:p,hadLeadingDelimiter:h,hadTrailingDelimiter:m}=nc(d.value,n,e.limits.maxArrayElements);if(f&&h&&l===""&&(rn(e,a,""),c=!0),p.length===0)m&&(u=!0);else if(p.length===1)l+=p[0],c=!0,u=m;else{l+=p[0],rn(e,a,l),c=!0;for(let g=1;g<p.length-1;g++)rn(e,a,p[g]);l=p[p.length-1],u=m}f=!1}return l!==""?rn(e,a,l):a.length===0&&c&&rn(e,a,""),a}function jO(e,t){return e.length>0&&t.includes(e[0])}async function e3(e,t,n,r,s){let i=[];for(let u of t){let d=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),p=await s(e,u);i.push({value:p,isSplittable:d})}let o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&rn(e,o,a),a=u.value,c=!1):a+=u.value;else{jO(u.value,n)&&a!==""&&(rn(e,o,a),a="",l=!0);let{words:d,hadTrailingDelimiter:p}=nc(u.value,n,e.limits.maxArrayElements);if(d.length===0)p&&(c=!0);else if(d.length===1)a+=d[0],l=!0,c=p;else{a+=d[0],rn(e,o,a),l=!0;for(let h=1;h<d.length-1;h++)rn(e,o,d[h]);a=d[d.length-1],c=p}}return a!==""?rn(e,o,a):o.length===0&&l&&rn(e,o,""),o}function r3(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function s3(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}ue();Un();G();var pc="/dev/fd",o3=63,HO=10,i3=o3-HO+1,mp=class extends pr{isLiveDescriptor;constructor(t){super(),this.isLiveDescriptor=t}assertLiveDescriptor(t,n){this.isLiveDescriptor(t)||this.refuse(t,n)}refuse(t,n){throw new me("EROFS",`read-only file system, ${n} '${pc}${t}'`)}async writeFile(t,n,r){return this.assertLiveDescriptor(t,"write"),super.writeFile(t,n,r)}async appendFile(t,n,r){return this.assertLiveDescriptor(t,"append"),super.appendFile(t,n,r)}async rm(t,n){return this.assertLiveDescriptor(t,"rm"),super.rm(t,n)}async mkdir(t,n){this.refuse(t,"mkdir")}async cp(t,n){this.refuse(n,"cp")}async mv(t,n){this.refuse(n,"mv")}async symlink(t,n){this.refuse(n,"symlink")}async link(t,n){this.refuse(n,"link")}async chmod(t,n){this.refuse(t,"chmod")}async utimes(t,n,r){this.refuse(t,"utimes")}};function VO(e){let t=new mp(n=>a3(e).some(r=>r.path===`${pc}${n}`));e.fs=new as({base:e.fs,mounts:[{mountPoint:pc,filesystem:t}]}),e.state.processSubstitutionFsMounted=!0}async function qO(e,t,n){try{await e.fs.writeFile(t,n,"binary");return}catch(r){if(e.state.processSubstitutionFsMounted)throw r;VO(e)}await e.fs.writeFile(t,n,"binary")}async function GO(e,t){try{await e.fs.rm(t,{force:!0})}catch{}}function a3(e){let t=e.state.processSubstitutions;if(t)return t;let n=[];return e.state.processSubstitutions=n,n}async function l3(e,t,n){let r=e.substitutionDepth??0,s=e.limits.maxSubstitutionDepth;if(r>=s)throw new C(`Process substitution nesting limit exceeded (${s})`,"substitution_depth");let i=e.substitutionDepth,o=new Map(e.state.env),a=Qn(e.state.arrays),l=e.state.cwd,c=e.state.bashPid,u=e.state.suppressVerbose,f=e.state.groupStdin,d=e.state.lastExitCode,p=e.state.env.get("?"),h=e.state.lastSubstitutionExitCode;e.substitutionDepth=r+1,e.state.bashPid=e.state.nextVirtualPid++,e.state.suppressVerbose=!0,n!==void 0&&(e.state.groupStdin=n);let m;try{m=await e.executeScript(t)}catch(g){if(g instanceof C)throw g;if(g instanceof we)return{stdout:g.stdout,stderr:g.stderr,exitCode:g.exitCode};throw g}finally{e.substitutionDepth=i,e.state.env=o,e.state.arrays=a,e.state.cwd=l,e.state.bashPid=c,e.state.suppressVerbose=u,e.state.groupStdin=f,e.state.lastExitCode=d,e.state.lastSubstitutionExitCode=h,p!==void 0?e.state.env.set("?",p):e.state.env.delete("?")}return m}async function c3(e,t){let n=a3(e);if(n.length>=i3)throw new C(`Process substitution limit exceeded (${i3} concurrent)`,"file_descriptors");let r="";if(t.direction==="input"){let o=await l3(e,t.body,void 0);if(o.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+o.stderr),r=es(o),r.length>e.limits.maxStringLength)throw new C(`process substitution: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")}let s=o3-n.length,i=`${pc}/${s}`;n.push({fd:s,path:i,direction:t.direction,body:t.body});try{await qO(e,i,r)}catch(o){throw n.pop(),o}return i}function u3(e){return e.state.processSubstitutions?.length??0}var ZO={stdout:"",stderr:""};async function gp(e,t){let n=e.state.processSubstitutions;if(!n||n.length<=t)return ZO;let r="",s="";for(;n.length>t;){let i=n[n.length-1],o="";if(i.direction==="output")try{o=await Ht(e.fs,i.path)}catch{}if(await GO(e,i.path),n.pop(),i.direction==="output"){let a=await l3(e,i.body,o);r+=es(a),s+=a.stderr}}return{stdout:r,stderr:s}}function ws(e,t,n){if(e.length>t)throw new C(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function wr(e,t,n=!1){let r=[],s=0;for(let i of t){let o=await Dn(e,i,n);if(s+=M(o),s>e.limits.maxStringLength)throw new C(`parameter word string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");r.push(o)}return r.join("")}function KO(e){return s3(e)}function d3(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!KO(t))return!1;return!0}function XO(e,t,n=!1){let r=r3(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 fp(e,t.pattern);default:return null}}async function Ue(e,t){return wp(e,t)}async function p3(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(Xi(r.value));else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await Dn(e,r);n.push(Xi(s))}else n.push(await Dn(e,r));return n.join("")}async function h3(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Pn(r.value));else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(Pn(s))}else n.push(await Dn(e,r));return n.join("")}async function m3(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Pn(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(Pn(s))}else r.type==="Glob"?S4(r.pattern)?n.push(await C4(e,r.pattern)):n.push(fp(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await Dn(e,r));return n.join("")}function mc(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&mc(t.parts))return!0;return!1}var f3=1e5;async function g3(e,t,n={count:0}){let r=()=>{n.count++,e.executionScope.consumeLimited("brace_operations",1,Math.min(f3,e.limits.maxBraceExpansionResults),"brace expansion")},s=(o,a)=>{if(o.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),o.push(a)},i=[[]];for(let o of t)if(o.type==="BraceExpansion"){let a=[],l=!1,c="";for(let d of o.items)if(d.type==="Range"){let p=ap(d.start,d.end,d.step,d.startStr,d.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(p.expanded)for(let h of p.expanded)s(a,h);else{l=!0,c=p.literal;break}}else{let p=await g3(e,d.word.parts,n);for(let h of p){let m=[];for(let g of h)typeof g=="string"?m.push(g):m.push(await Dn(e,g));s(a,m.join(""))}}if(l){for(let d of i)r(),d.push(c);continue}if(i.length*a.length>e.limits.maxBraceExpansionResults||n.count>f3)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");let f=[];for(let d of i)for(let p of a){if(f.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),f.push([...d,p])}i=f}else for(let a of i)r(),a.push(o);return i}async function y3(e,t){let n=t.parts;if(!mc(n))return[await Ue(e,t)];let r=await g3(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await Dn(e,a));s.push(dp(e,o.join("")))}return s}function QO(){return{expandWordAsync:wp,expandWordForGlobbing:m3,expandWordWithBracesAsync:y3,expandWordPartsAsync:wr,expandPart:Dn,expandParameterAsync:hc,hasBraceExpansion:mc,evaluateArithmetic:Re,buildIfsCharClassPattern:e4,smartWordSplit:n3}}async function br(e,t){return J4(e,t,QO())}function YO(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function yp(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function w3(e,t){if(yp(e,t))return{error:`bash: $@: ambiguous redirect
911
+ `);let u;if(/^\d+$/.test(c))u=Number.parseInt(c,10);else{try{let f=new xe,d=Ue(f,c);u=await Re(e,d.expression)}catch{let f=e.state.env.get(c);u=f?Number.parseInt(f,10):0}Number.isNaN(u)&&(u=0)}be(e,l,u,o)}else e.state.env.set(t,o);return o}return r.effectiveValue}async function f4(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:error_if_unset"),r.isUnset||n.checkEmpty&&r.isEmpty){let o=n.word?await s(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new we(1,"",`bash: ${o}
912
+ `)}return r.effectiveValue}async function d4(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 p4(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_removal");let i=n.pattern?await ps(e,n.pattern,n.greedy,r,s):"";return gr(e,t,i,n.side,n.greedy)}async function h4(e,t,n,r,s){e.coverage?.hit("bash:expansion:pattern_replacement");let i="",o=e.state.shoptOptions.extglob;if(n.pattern)for(let c of n.pattern.parts)if(c.type==="Glob")i+=Xe(c.pattern,!0,o);else if(c.type==="Literal")i+=Xe(c.value,!0,o);else if(c.type==="SingleQuoted"||c.type==="Escaped")i+=nt(c.value);else if(c.type==="DoubleQuoted"){let u=await r(e,c.parts);i+=nt(u)}else if(c.type==="ParameterExpansion"){let u=await s(e,c);i+=Xe(u,!0,o)}else{let u=await s(e,c);i+=nt(u)}let a=n.replacement?await r(e,n.replacement.parts):"";if(n.anchor==="start"?i=`^${i}`:n.anchor==="end"&&(i=`${i}$`),i==="")return t;let l=n.all?"gs":"s";try{let c=oe(i,l);return oc(e,t,c,a,n.all)}catch(c){if(c instanceof C)throw c;return t}}function up(e,t,n){e.coverage?.hit("bash:expansion:length");let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let s=r[1],i=Ee(e,s);return i.length>0?String(i.length):e.state.env.get(s)!==void 0?"1":"0"}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&mr(e,t)){if(t==="FUNCNAME"){let i=e.state.funcNameStack?.[0]||"";return String([...i].length)}if(t==="BASH_LINENO"){let i=e.state.callLineStack?.[0];return String(i!==void 0?[...String(i)].length:0)}let s=Ye(e,t,0)||"";return String([...s].length)}return String([...n].length)}async function m4(e,t,n,r){e.coverage?.hit("bash:expansion:substring");let s=await Re(e,r.offset.expression),i=r.length?await Re(e,r.length.expression):void 0;if(t==="@"||t==="*"){let c=Number.parseInt(e.state.env.get("#")||"0",10),u=[];for(let h=1;h<=c;h++)u.push(e.state.env.get(String(h))||"");let f=e.state.env.get("0")||"bash",d,p;if(s<=0)if(d=[f,...u],s<0){if(p=d.length+s,p<0)return""}else p=0;else d=u,p=s-1;if(p<0||p>=d.length)return"";if(i!==void 0){let h=i<0?d.length+i:p+i;return d.slice(p,Math.max(p,h)).join(" ")}return d.slice(p).join(" ")}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let c=o[1];if(e.state.associativeArrays?.has(c))throw new we(1,"",`bash: \${${c}[@]: 0: 3}: bad substitution
913
+ `);let u=Ee(e,c),f=0;if(s<0){if(u.length>0){let d=u[u.length-1][0],h=(typeof d=="number"?d:0)+1+s;if(h<0||(f=u.findIndex(([m])=>typeof m=="number"&&m>=h),f<0))return""}}else if(f=u.findIndex(([d])=>typeof d=="number"&&d>=s),f<0)return"";if(i!==void 0){if(i<0)throw new Ge(`${o[1]}[@]: substring expression < 0`);return u.slice(f,f+i).map(([,d])=>d).join(" ")}return u.slice(f).map(([,d])=>d).join(" ")}let a=[...n],l=s;if(l<0&&(l=Math.max(0,a.length+l)),i!==void 0){if(i<0){let c=a.length+i;return a.slice(l,Math.max(l,c)).join("")}return a.slice(l,l+i).join("")}return a.slice(l).join("")}async function g4(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:case_modification"),n.pattern){let i=e.state.shoptOptions.extglob,o="";for(let f of n.pattern.parts)if(f.type==="Glob")o+=Xe(f.pattern,!0,i);else if(f.type==="Literal")o+=Xe(f.value,!0,i);else if(f.type==="SingleQuoted"||f.type==="Escaped")o+=nt(f.value);else if(f.type==="DoubleQuoted"){let d=await r(e,f.parts);o+=nt(d)}else if(f.type==="ParameterExpansion"){let d=await s(e,f);o+=Xe(d,!0,i)}let a=oe(`^(?:${o})$`),l=n.direction==="upper"?f=>f.toUpperCase():f=>f.toLowerCase(),c="",u=!1;for(let f of t)!n.all&&u?c+=f:a.test(f)?(c+=l(f),u=!0):c+=f;return c}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 y4(e,t,n,r,s){e.coverage?.hit("bash:expansion:transform");let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(i&&s.operator==="Q")return Ee(e,i[1]).map(([,c])=>hs(c)).join(" ");if(i&&s.operator==="a")return ms(e,i[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&s.operator==="a")return ms(e,o[1]);switch(s.operator){case"Q":return r?"":hs(n);case"P":return aa(e,n);case"a":return ms(e,t);case"A":return r?"":`${t}=${hs(n)}`;case"E":return n.replace(/\\([\\abefnrtv'"?])/g,(a,l)=>{switch(l){case"\\":return"\\";case"a":return"\x07";case"b":return"\b";case"e":return"\x1B";case"f":return"\f";case"n":return`
914
+ `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";default:return l}});case"K":case"k":return r?"":hs(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 w4(e,t,n,r,s,i,o=!1){if(e.coverage?.hit("bash:expansion:indirection"),st(e,t))return li(e,t)||"";let a=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(s.innerOp?.type==="UseAlternative")return"";throw new sn(`\${!${t}}`)}let l=n;if(a&&(l===""||l.includes(" ")))throw new sn(`\${!${t}}`);let c=l.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(c&&c[1].includes("~"))throw new sn(`\${!${t}}`);if(s.innerOp){let u={type:"ParameterExpansion",parameter:l,operation:s.innerOp};return i(e,u,o)}return await Ve(e,l)}function b4(e,t){e.coverage?.hit("bash:expansion:array_keys");let r=Ee(e,t.array).map(([s])=>String(s));return t.star?r.join(Oe(e.state.env)):r.join(" ")}function x4(e,t){e.coverage?.hit("bash:expansion:var_name_prefix");let n=Qi(e,t.prefix);return t.star?n.join(Oe(e.state.env)):n.join(" ")}function E4(e,t,n,r){let s=Number.parseInt(e.state.env.get("#")||"0",10),i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t==="*")return{isEmpty:s===0,effectiveValue:n};if(t==="@")return{isEmpty:s===0||s===1&&e.state.env.get("1")==="",effectiveValue:n};if(i){let[,o,a]=i,l=Ee(e,o);return l.length===0?{isEmpty:!0,effectiveValue:""}:a==="*"?{isEmpty:r?n==="":!1,effectiveValue:n}:{isEmpty:l.length===1&&l.every(([,c])=>c===""),effectiveValue:n}}return{isEmpty:n==="",effectiveValue:n}}vt();G();function gs(e,t){e.lastExitCode=t,e.env.set("?",String(t)),e.lastSubstitutionExitCode=t}function kO(e){switch(e.operator){case"<":case"<&":case"<<":case"<<-":case"<<<":case"<>":return e.fd===null||e.fd===0;default:return!1}}function lc(e,t){return t.some(kO)?0:e.lastSubstitutionExitCode??0}function S4(e){let t=0;for(;t<e.length;){let n=e[t];if(n==="\\"&&t+1<e.length){t+=2;continue}if(n==="'"){let r=e.indexOf("'",t+1);if(r!==-1){t=r+1;continue}}if(n==="$"&&t+1<e.length&&e[t+1]==="("||n==="`")return!0;t++}return!1}function A4(e,t){let n=1,r=t,s=!1,i=!1;for(;r<e.length&&n>0;){let o=e[r];if(o==="\\"&&!s&&r+1<e.length){r+=2;continue}if(o==="'"&&!i){s=!s,r++;continue}if(o==='"'&&!s){i=!i,r++;continue}if(!s&&!i){if(o==="(")n++;else if(o===")"&&(n--,n===0))return r}r++}return-1}async function cc(e,t){let n=new xe,r;try{r=n.parse(t)}catch{return""}let s=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let i=new Map(e.state.env),o=Qn(e.state.arrays),a=e.state.cwd,l=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let c=await e.executeScript(r),u=c.exitCode;return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.suppressVerbose=l,gs(e.state,u),c.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+c.stderr),e.state.bashPid=s,c.stdout.replace(/\n+$/,"")}catch(c){return e.state.env=i,e.state.arrays=o,e.state.cwd=a,e.state.bashPid=s,e.state.suppressVerbose=l,ge(c),c instanceof we?(gs(e.state,c.exitCode),c.stdout?.replace(/\n+$/,"")??""):""}}function fp(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Pn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=vO(e,a);n+=Pn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}function vO(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}async function C4(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="'"){let i=t.indexOf("'",r+1);if(i!==-1){let o=t.slice(r+1,i);n+=Pn(o),r=i+1;continue}}if(s==='"'){let i=-1,o=r+1;for(;o<t.length;){if(t[o]==="\\"){o+=2;continue}if(t[o]==='"'){i=o;break}o++}if(i!==-1){let a=t.slice(r+1,i),l=await NO(e,a);n+=Pn(l),r=i+1;continue}}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=A4(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}if(s==="\\"&&r+1<t.length){n+=s+t[r+1],r+=2;continue}n+=s,r++}return n}async function NO(e,t){let n="",r=0;for(;r<t.length;){let s=t[r];if(s==="\\"&&r+1<t.length){let i=t[r+1];if(i==="$"||i==="`"||i==="\\"||i==='"'){n+=i,r+=2;continue}n+=s,r++;continue}if(s==="$"&&r+1<t.length&&t[r+1]==="("){let i=A4(t,r+2);if(i!==-1){let o=t.slice(r+2,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let o=t.slice(r+1,i),a=await cc(e,o);n+=a,r=i+1;continue}}if(s==="$"&&r+1<t.length){let i=t[r+1];if(i==="{"){let o=t.indexOf("}",r+2);if(o!==-1){let a=t.slice(r+2,o);n+=e.state.env.get(a)??"",r=o+1;continue}}else if(/[a-zA-Z_]/.test(i)){let o=r+1;for(;o<t.length&&/[a-zA-Z0-9_]/.test(t[o]);)o++;let a=t.slice(r+1,o);n+=e.state.env.get(a)??"",r=o;continue}}n+=s,r++}return n}function dp(e,t){if(!t.startsWith("~"))return t;e.coverage?.hit("bash:expansion:tilde");let n=e.state.env.get("HOME")!==void 0?e.state.env.get("HOME"):"/home/user";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 s=t.slice(1,r),i=t.slice(r);return i!==""&&!i.startsWith("/")?t:s==="root"?`/root${i}`:t}function ys(e,t){return t.split(":").map(n=>dp(e,n)).join(":")}G();G();function Xt(e,t,n,r){if(e.length>n-t.length)throw new C(`${r} element limit exceeded (${n})`,"array_elements");for(let s of t)e.push(s)}mt();async function IO(e,t,n,r){let s="";for(let i of t.parts)if(i.type==="Glob")s+=Xe(i.pattern,!0,e.state.shoptOptions.extglob);else if(i.type==="Literal")s+=Xe(i.value,!0,e.state.shoptOptions.extglob);else if(i.type==="SingleQuoted"||i.type==="Escaped")s+=nt(i.value);else if(i.type==="DoubleQuoted"){let o=await n(e,i.parts);s+=nt(o)}else if(i.type==="ParameterExpansion"){let o=await r(e,i);s+=Xe(o,!0,e.state.shoptOptions.extglob)}else{let o=await r(e,i);s+=nt(o)}return s}async function k4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternReplacement")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=Ee(e,a),f=u.map(([,g])=>g);if(u.length===0){let g=e.state.env.get(a);g!==void 0&&f.push(g)}if(f.length===0)return{values:[],quoted:!0};let d="";c.pattern&&(d=await IO(e,c.pattern,n,r));let p=c.replacement?await n(e,c.replacement.parts):"",h=d;c.anchor==="start"?h=`^${d}`:c.anchor==="end"&&(h=`${d}$`);let m=[];try{let g=oe(h,c.all?"g":"");for(let b of f)m.push(g.replace(b,p))}catch{m.push(...f)}if(l){let g=Oe(e.state.env);return{values:[m.join(g)],quoted:!0}}return{values:m,quoted:!0}}async function v4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0];if(s.parts.length!==1||s.parts[0].type!=="ParameterExpansion"||s.parts[0].operation?.type!=="PatternRemoval")return null;let i=s.parts[0],o=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let a=o[1],l=o[2]==="*",c=i.operation,u=Ee(e,a),f=u.map(([,h])=>h);if(u.length===0){let h=e.state.env.get(a);h!==void 0&&f.push(h)}if(f.length===0)return{values:[],quoted:!0};let d=c.pattern?await ps(e,c.pattern,c.greedy,n,r):"",p=[];for(let h of f)p.push(gr(e,h,d,c.side,c.greedy));if(l){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}mt();async function N4(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];if(r.operation?.type==="AssignDefault"&&/^(?:\d+|[@*#?$!-])$/.test(r.parameter))return null;let s=r.operation,i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(s.type==="AssignDefault"&&(!i||i[2]==="*"))return null;let o,a=!1;if(i){let l=i[1];a=i[2]==="*";let c=Ee(e,l),u=c.length>0||e.state.env.has(l),f=c.length===0||c.length===1&&c.every(([,p])=>p===""),d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=u&&!(d&&f):o=!u||d&&f,!o){if(c.length>0){let h=c.map(([,m])=>m);if(a){let m=Oe(e.state.env);return{values:[h.join(m)],quoted:!0}}return{values:h,quoted:!0}}let p=e.state.env.get(l);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}}else{let l=r.parameter,c=await Rr(e,l),u=await Ve(e,l,!1),f=u==="",d=s.checkEmpty??!1;if(s.type==="UseAlternative"?o=c&&!(d&&f):o=!c||d&&f,!o)return{values:[u],quoted:!0}}if(s.type==="AssignDefault")return null;if(o&&s.word){let l=s.word.parts,c=null,u=!1;for(let f of l)if(f.type==="ParameterExpansion"&&!f.operation){let d=f.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(d){c=d[1],u=d[2]==="*";break}}if(c){let f=Ee(e,c);if(f.length>0){let p=f.map(([,h])=>h);if(u||a){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}let d=e.state.env.get(c);return d!==void 0?{values:[d],quoted:!0}:{values:[],quoted:!0}}}return null}async function I4(e,t,n,r,s){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let i=t[0],o=-1,a="",l=!1,c=null;for(let m=0;m<i.parts.length;m++){let g=i.parts[m];if(g.type==="ParameterExpansion"&&(g.operation?.type==="PatternRemoval"||g.operation?.type==="PatternReplacement")){let b=g.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(b){o=m,a=b[1],l=b[2]==="*",c=g.operation;break}}}if(o===-1||o===0&&o===i.parts.length-1)return null;let u="";for(let m=0;m<o;m++)u+=await r(e,i.parts[m]);let f="";for(let m=o+1;m<i.parts.length;m++)f+=await r(e,i.parts[m]);let d=Ee(e,a),p=d.map(([,m])=>m);if(d.length===0){let m=e.state.env.get(a);if(m!==void 0)p=[m];else{if(l)return{values:[u+f],quoted:!0};let g=u+f;return{values:g?[g]:[],quoted:!0}}}if(c?.type==="PatternRemoval"){let m=c,g=m.pattern?await ps(e,m.pattern,m.greedy,s,r):"";p=p.map(b=>gr(e,b,g,m.side,m.greedy))}else if(c?.type==="PatternReplacement"){let m=c,g="";if(m.pattern)for(let w of m.pattern.parts)if(w.type==="Glob")g+=Xe(w.pattern,!0,e.state.shoptOptions.extglob);else if(w.type==="Literal")g+=Xe(w.value,!0,e.state.shoptOptions.extglob);else if(w.type==="SingleQuoted"||w.type==="Escaped")g+=nt(w.value);else if(w.type==="DoubleQuoted"){let x=await s(e,w.parts);g+=nt(x)}else if(w.type==="ParameterExpansion"){let x=await r(e,w);g+=Xe(x,!0,e.state.shoptOptions.extglob)}else{let x=await r(e,w);g+=nt(x)}let b=m.replacement?await s(e,m.replacement.parts):"",y=g;m.anchor==="start"?y=`^${g}`:m.anchor==="end"&&(y=`${g}$`);try{let w=oe(y,m.all?"g":"");p=p.map(x=>w.replace(x,b))}catch{}}if(l){let m=Oe(e.state.env);return{values:[u+p.join(m)+f],quoted:!0}}return p.length===1?{values:[u+p[0]+f],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+f],quoted:!0}}async function O4(e,t,n,r){if(!n||t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o="",a=!1;for(let p=0;p<s.parts.length;p++){let h=s.parts[p];if(h.type==="ParameterExpansion"&&!h.operation){let m=h.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(m){i=p,o=m[1],a=m[2]==="*";break}}}if(i===-1)return null;let l="";for(let p=0;p<i;p++)l+=await r(e,s.parts[p]);let c="";for(let p=i+1;p<s.parts.length;p++)c+=await r(e,s.parts[p]);let u=Ee(e,o),f=u.map(([,p])=>p);if(u.length===0){let p=e.state.env.get(o);if(p!==void 0)return{values:[l+p+c],quoted:!0};if(a)return{values:[l+c],quoted:!0};let h=l+c;return{values:h?[h]:[],quoted:!0}}if(a){let p=Oe(e.state.env);return{values:[l+f.join(p)+c],quoted:!0}}return f.length===1?{values:[l+f[0]+c],quoted:!0}:{values:[l+f[0],...f.slice(1,-1),f[f.length-1]+c],quoted:!0}}kt();G();async function T4(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 s=r.parts[0],i=s.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let o=i[1],a=i[2]==="*",l=s.operation;if(e.state.associativeArrays?.has(o))throw new we(1,"",`bash: \${${o}[@]: 0: 3}: bad substitution
915
+ `);let c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Ee(e,o);if(f.length>e.limits.maxArrayElements)throw new C(`array transform element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let d=0;if(c<0){if(f.length>0){let h=f[f.length-1][0],g=(typeof h=="number"?h:0)+1+c;if(g<0)return{values:[],quoted:!0};d=f.findIndex(([b])=>typeof b=="number"&&b>=g),d<0&&(d=f.length)}}else d=f.findIndex(([h])=>typeof h=="number"&&h>=c),d<0&&(d=f.length);let p;if(u!==void 0){if(u<0)throw new Ge(`${o}[@]: substring expression < 0`);p=f.slice(d,d+u).map(([,h])=>h)}else p=f.slice(d).map(([,h])=>h);if(p.length===0)return{values:[],quoted:!0};if(a){let h=Oe(e.state.env);return{values:[p.join(h)],quoted:!0}}return{values:p,quoted:!0}}function $4(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],s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let i=s[1],o=s[2]==="*",a=r.operation,l=Ee(e,i);if(l.length===0){let d=e.state.env.get(i);if(d!==void 0){let p;switch(a.operator){case"a":p="";break;case"P":p=aa(e,d);break;case"Q":p=hs(d);break;default:p=d}if(M(p)>e.limits.maxStringLength)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[p],quoted:!0}}return o?{values:[""],quoted:!0}:{values:[],quoted:!0}}let c=ms(e,i),u=[],f=0;for(let[,d]of l){let p;switch(a.operator){case"a":p=c;break;case"P":p=aa(e,d);break;case"Q":p=hs(d);break;case"u":p=d.charAt(0).toUpperCase()+d.slice(1);break;case"U":p=d.toUpperCase();break;case"L":p=d.toLowerCase();break;default:p=d}let h=M(p);if(h>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");u.push(p),f+=h}if(o){let d=Oe(e.state.env);if(Math.max(0,u.length-1)*M(d)>e.limits.maxStringLength-f)throw new C(`array transform string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u.join(d)],quoted:!0}}return{values:u,quoted:!0}}function R4(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 s=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!s)return null;let i=s[1];if(st(e,i)){let l=li(e,i);if(l?.endsWith("[@]")||l?.endsWith("[*]"))return{values:[],quoted:!0}}let o=Ee(e,i);if(o.length>0)return{values:o.map(([,l])=>l),quoted:!0};let a=e.state.env.get(i);return a!==void 0?{values:[a],quoted:!0}:{values:[],quoted:!0}}function P4(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 s=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)||!st(e,s))return null;let i=li(e,s);if(!i)return null;let o=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!o)return null;let a=o[1],l=Ee(e,a);if(l.length>0)return{values:l.map(([,u])=>u),quoted:!0};let c=e.state.env.get(a);return c!==void 0?{values:[c],quoted:!0}:{values:[],quoted:!0}}G();async function D4(e,t,n,r,s){if(!n||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!=="Indirection")return null;let o=i.parts[0],a=o.operation,l=await Ve(e,o.parameter),c=l.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c){if(!a.innerOp&&(l==="@"||l==="*")){let h=Number.parseInt(e.state.env.get("#")||"0",10),m=[];for(let g=1;g<=h;g++)m.push(e.state.env.get(String(g))||"");return l==="*"?{values:[m.join(Oe(e.state.env))],quoted:!0}:{values:m,quoted:!0}}return null}let u=c[1],f=c[2]==="*",d=Ee(e,u);if(a.innerOp){if(a.innerOp.type==="Substring")return OO(e,d,u,f,a.innerOp);if(a.innerOp.type==="DefaultValue"||a.innerOp.type==="UseAlternative"||a.innerOp.type==="AssignDefault"||a.innerOp.type==="ErrorIfUnset")return TO(e,d,u,f,a.innerOp,s);if(a.innerOp.type==="Transform"&&a.innerOp.operator==="a"){let m=ms(e,u),g=d.map(()=>m);return f?{values:[g.join(Oe(e.state.env))],quoted:!0}:{values:g,quoted:!0}}let h=[];for(let[,m]of d){let g={type:"ParameterExpansion",parameter:"_indirect_elem_",operation:a.innerOp},b=e.state.env.get("_indirect_elem_");e.state.env.set("_indirect_elem_",m);try{let y=await r(e,g,!0);h.push(y)}finally{b!==void 0?e.state.env.set("_indirect_elem_",b):e.state.env.delete("_indirect_elem_")}}return f?{values:[h.join(Oe(e.state.env))],quoted:!0}:{values:h,quoted:!0}}if(d.length>0){let h=d.map(([,m])=>m);return f?{values:[h.join(Oe(e.state.env))],quoted:!0}:{values:h,quoted:!0}}let p=e.state.env.get(u);return p!==void 0?{values:[p],quoted:!0}:{values:[],quoted:!0}}async function OO(e,t,n,r,s){let i=s.offset?await Re(e,s.offset.expression):0,o=s.length?await Re(e,s.length.expression):void 0,a=0;if(i<0){if(t.length>0){let u=t[t.length-1][0],d=(typeof u=="number"?u:0)+1+i;if(d<0)return{values:[],quoted:!0};if(a=t.findIndex(([p])=>typeof p=="number"&&p>=d),a<0)return{values:[],quoted:!0}}}else if(a=t.findIndex(([u])=>typeof u=="number"&&u>=i),a<0)return{values:[],quoted:!0};let l;if(o!==void 0){if(o<0)throw new Ge(`${n}[@]: substring expression < 0`);l=t.slice(a,a+o)}else l=t.slice(a);let c=l.map(([,u])=>u);return r?{values:[c.join(Oe(e.state.env))],quoted:!0}:{values:c,quoted:!0}}async function TO(e,t,n,r,s,i){let o=s.checkEmpty??!1,a=t.map(([,u])=>u),l=t.length===0,c=t.length===0;if(s.type==="UseAlternative")return!c&&!(o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(s.type==="DefaultValue")return(c||o&&l)&&s.word?{values:[await i(e,s.word.parts,!0)],quoted:!0}:r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0};if(s.type==="AssignDefault"){if((c||o&&l)&&s.word){let f=await i(e,s.word.parts,!0);return be(e,n,0,f),{values:[f],quoted:!0}}return r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0}}return r?{values:[a.join(Oe(e.state.env))],quoted:!0}:{values:a,quoted:!0}}async function L4(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,s=r?.word;if(!s||s.parts.length!==1||s.parts[0].type!=="DoubleQuoted")return null;let i=s.parts[0];if(i.parts.length!==1||i.parts[0].type!=="ParameterExpansion"||i.parts[0].operation?.type!=="Indirection")return null;let o=i.parts[0],l=(await Ve(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l)return null;let c=await Rr(e,n.parameter),u=await Ve(e,n.parameter)==="",f=r.checkEmpty??!1,d;if(r.type==="UseAlternative"?d=c&&!(f&&u):d=!c||f&&u,d){let p=l[1],h=l[2]==="*",m=Ee(e,p);if(m.length>0){let b=m.map(([,y])=>y);return h?{values:[b.join(Oe(e.state.env))],quoted:!0}:{values:b,quoted:!0}}let g=e.state.env.get(p);return g!==void 0?{values:[g],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}async function F4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="Indirection")return null;let n=t[0],s=n.operation.innerOp;if(!s||s.type!=="UseAlternative"&&s.type!=="DefaultValue")return null;let i=s.word;if(!i||i.parts.length!==1||i.parts[0].type!=="DoubleQuoted")return null;let o=i.parts[0];if(o.parts.length!==1||o.parts[0].type!=="ParameterExpansion"||o.parts[0].operation?.type!=="Indirection")return null;let a=o.parts[0],c=(await Ve(e,a.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!c)return null;let u=await Ve(e,n.parameter),f=await Rr(e,n.parameter),d=u==="",p=s.checkEmpty??!1,h;if(s.type==="UseAlternative"?h=f&&!(p&&d):h=!f||p&&d,h){let m=c[1],g=c[2]==="*",b=Ee(e,m);if(b.length>0){let w=b.map(([,x])=>x);return g?{values:[w.join(Oe(e.state.env))],quoted:!0}:{values:w,quoted:!0}}let y=e.state.env.get(m);return y!==void 0?{values:[y],quoted:!0}:{values:[],quoted:!0}}return{values:[],quoted:!1}}kt();mt();G();function M4(e){let t=Number.parseInt(e.state.env.get("#")||"0",10);if(t>e.limits.maxArrayElements)throw new C(`positional parameter element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let n=[],r=0;for(let s=1;s<=t;s++){let i=e.state.env.get(String(s))||"",o=M(i);if(o>e.limits.maxStringLength-r)throw new C(`positional parameter string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n.push(i),r+=o}return n}function uc(e,t,n){if(M(t)>n-M(e))throw new C(`positional expansion string limit exceeded (${n} bytes)`,"string_length");return e+t}function pp(e,t,n,r){if(e.length>=r.limits.maxArrayElements)throw new C(`positional expansion element limit exceeded (${r.limits.maxArrayElements})`,"array_elements");let s=M(t);if(s>r.limits.maxStringLength-n.value)throw new C(`positional expansion string limit exceeded (${r.limits.maxStringLength} bytes)`,"string_length");e.push(t),n.value+=s}async function _4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="Substring"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=l.offset?await n(e,l.offset.expression):0,u=l.length?await n(e,l.length.expression):void 0,f=Number.parseInt(e.state.env.get("#")||"0",10),d=[];for(let y=1;y<=f;y++)d.push(e.state.env.get(String(y))||"");let p=e.state.env.get("0")||"bash",h;if(c<=0){let y=[p,...d],w=y.length+c;if(w<0)h=[];else{let x=c<0?w:0;if(u!==void 0){let S=u<0?y.length+u:x+u;h=y.slice(x,Math.max(x,S))}else h=y.slice(x)}}else{let y=c-1;if(y>=d.length)h=[];else if(u!==void 0){let w=u<0?d.length+u:y+u;h=d.slice(y,Math.max(y,w))}else h=d.slice(y)}let m="";for(let y=0;y<i;y++)m+=await r(e,s.parts[y]);let g="";for(let y=i+1;y<s.parts.length;y++)g+=await r(e,s.parts[y]);if(h.length===0){let y=m+g;return{values:y?[y]:[],quoted:!0}}if(o){let y=Oe(e.state.env);return{values:[m+h.join(y)+g],quoted:!0}}return h.length===1?{values:[m+h[0]+g],quoted:!0}:{values:[m+h[0],...h.slice(1,-1),h[h.length-1]+g],quoted:!0}}async function B4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let y=0;y<s.parts.length;y++){let w=s.parts[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternReplacement"){i=y,o=w.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=M4(e),u="";for(let y=0;y<i;y++)u=uc(u,await n(e,s.parts[y]),e.limits.maxStringLength);let f="";for(let y=i+1;y<s.parts.length;y++)f=uc(f,await n(e,s.parts[y]),e.limits.maxStringLength);if(c.length===0){let y=u+f;return{values:y?[y]:[],quoted:!0}}let d="";if(l.pattern)for(let y of l.pattern.parts)if(y.type==="Glob")d+=Xe(y.pattern,!0,e.state.shoptOptions.extglob);else if(y.type==="Literal")d+=Xe(y.value,!0,e.state.shoptOptions.extglob);else if(y.type==="SingleQuoted"||y.type==="Escaped")d+=nt(y.value);else if(y.type==="DoubleQuoted"){let w=await r(e,y.parts);d+=nt(w)}else if(y.type==="ParameterExpansion"){let w=await n(e,y);d+=Xe(w,!0,e.state.shoptOptions.extglob)}else{let w=await n(e,y);d+=nt(w)}let p=l.replacement?await r(e,l.replacement.parts):"",h=d;l.anchor==="start"?h=`^${d}`:l.anchor==="end"&&(h=`${d}$`);let m=[],g={value:0};try{let y=oe(h,l.all?"g":"");for(let w of c){let x=0;y.lastIndex=0;for(let N=y.exec(w);N&&(x++,!!l.all);N=y.exec(w))N[0].length===0&&y.lastIndex++;let S=M(w),E=M(p),A=0,I=/\$(?:\$|&|\d+|<[^>]+>|`|')/g;for(;I.exec(p)!==null;)A++;if(S+x*E+x*A*S>e.limits.maxStringLength-g.value)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");pp(m,y.replace(w,p),g,e)}}catch(y){if(y instanceof C)throw y;for(let w of c)pp(m,w,g,e)}if(o){let y=Oe(e.state.env);if(g.value+Math.max(0,m.length-1)*M(y)+M(u)+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+m.join(y)+f],quoted:!0}}if(M(u)+g.value+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return m.length===1?{values:[u+m[0]+f],quoted:!0}:{values:[u+m[0],...m.slice(1,-1),m[m.length-1]+f],quoted:!0}}async function U4(e,t,n,r){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let s=t[0],i=-1,o=!1;for(let b=0;b<s.parts.length;b++){let y=s.parts[b];if(y.type==="ParameterExpansion"&&(y.parameter==="@"||y.parameter==="*")&&y.operation?.type==="PatternRemoval"){i=b,o=y.parameter==="*";break}}if(i===-1)return null;let l=s.parts[i].operation,c=M4(e),u="";for(let b=0;b<i;b++)u=uc(u,await n(e,s.parts[b]),e.limits.maxStringLength);let f="";for(let b=i+1;b<s.parts.length;b++)f=uc(f,await n(e,s.parts[b]),e.limits.maxStringLength);if(c.length===0){let b=u+f;return{values:b?[b]:[],quoted:!0}}let d="",p=e.state.shoptOptions.extglob;if(l.pattern)for(let b of l.pattern.parts)if(b.type==="Glob")d+=Xe(b.pattern,l.greedy,p);else if(b.type==="Literal")d+=Xe(b.value,l.greedy,p);else if(b.type==="SingleQuoted"||b.type==="Escaped")d+=nt(b.value);else if(b.type==="DoubleQuoted"){let y=await r(e,b.parts);d+=nt(y)}else if(b.type==="ParameterExpansion"){let y=await n(e,b);d+=Xe(y,l.greedy,p)}else{let y=await n(e,b);d+=nt(y)}let h=[],m={value:0};for(let b of c)pp(h,gr(e,b,d,l.side,l.greedy),m,e);if(o){let b=Oe(e.state.env);if(m.value+Math.max(0,h.length-1)*M(b)+M(u)+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return{values:[u+h.join(b)+f],quoted:!0}}if(M(u)+m.value+M(f)>e.limits.maxStringLength)throw new C(`positional expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return h.length===1?{values:[u+h[0]+f],quoted:!0}:{values:[u+h[0],...h.slice(1,-1),h[h.length-1]+f],quoted:!0}}async function z4(e,t,n){if(t.length!==1||t[0].type!=="DoubleQuoted")return null;let r=t[0],s=-1,i=!1;for(let d=0;d<r.parts.length;d++){let p=r.parts[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")){s=d,i=p.parameter==="*";break}}if(s===-1)return null;let o=r.parts[s];if(o.type==="ParameterExpansion"&&o.operation)return null;let a=Number.parseInt(e.state.env.get("#")||"0",10),l="";for(let d=0;d<s;d++)l+=await n(e,r.parts[d]);let c="";for(let d=s+1;d<r.parts.length;d++)c+=await n(e,r.parts[d]);if(a===0){if(i)return{values:[l+c],quoted:!0};let d=l+c;return{values:d?[d]:[],quoted:!0}}let u=[];for(let d=1;d<=a;d++)u.push(e.state.env.get(String(d))||"");if(i){let d=Oe(e.state.env);return{values:[l+u.join(d)+c],quoted:!0}}return u.length===1?{values:[l+u[0]+c],quoted:!0}:{values:[l+u[0],...u.slice(1,-1),u[u.length-1]+c],quoted:!0}}ue();mt();G();function Dr(e,t,n,r){if(t.length>=e.limits.maxArrayElements)throw new C(`unquoted expansion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let s=M(n);if(s>e.limits.maxStringLength-r.value)throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");t.push(n),r.value+=s}function hp(e,t,n,r){let s=M(n),i=Math.max(0,t.length-1);if(s>0&&i>Math.floor((e.limits.maxStringLength-r)/s))throw new C(`unquoted expansion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");return t.join(n)}function $O(e){return new ds(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,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")})}async function fc(e,t){if(e.state.options.noglob)return t;let n=$O(e),r=[];for(let s of t)if(Pr(s,e.state.shoptOptions.extglob)){let i=await n.expand(s);if(i.length>0)Xt(r,i,e.limits.maxArrayElements,"unquoted glob expansion");else{if(n.hasFailglob())throw new xr(s);n.hasNullglob()||r.push(s)}}else r.push(s);return r}async function W4(e,t,n,r){let s=-1,i="",o=!1;for(let x=0;x<t.length;x++){let S=t[x];if(S.type==="ParameterExpansion"&&S.operation?.type==="PatternReplacement"){let E=S.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(E){s=x,i=E[1],o=E[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=Ee(e,i),u=c.map(([,x])=>x);if(c.length===0){let x=e.state.env.get(i);x!==void 0&&(u=[x])}if(u.length===0)return{values:[],quoted:!1};let f="";if(l.pattern)for(let x of l.pattern.parts)if(x.type==="Glob")f+=Xe(x.pattern,!0,e.state.shoptOptions.extglob);else if(x.type==="Literal")f+=Xe(x.value,!0,e.state.shoptOptions.extglob);else if(x.type==="SingleQuoted"||x.type==="Escaped")f+=nt(x.value);else if(x.type==="DoubleQuoted"){let S=await n(e,x.parts);f+=nt(S)}else if(x.type==="ParameterExpansion"){let S=await r(e,x);f+=Xe(S,!0,e.state.shoptOptions.extglob)}else{let S=await r(e,x);f+=nt(S)}let d=l.replacement?await n(e,l.replacement.parts):"",p=f;l.anchor==="start"?p=`^${f}`:l.anchor==="end"&&(p=`${f}$`);let h=[],m={value:0};try{let x=oe(p,l.all?"g":"");for(let S of u)Dr(e,h,oc(e,S,x,d,l.all),m)}catch(x){if(x instanceof C)throw x;for(let S of u)Dr(e,h,S,m)}let g=Ut(e.state.env),b=Kt(e.state.env);if(o){let x=Oe(e.state.env),S=hp(e,h,x,m.value);return b?{values:S?[S]:[],quoted:!1}:{values:at(S,g,e.limits.maxArrayElements),quoted:!1}}if(b)return{values:h,quoted:!1};let y=[],w={value:0};for(let x of h)if(x==="")Dr(e,y,"",w);else for(let S of at(x,g,e.limits.maxArrayElements))Dr(e,y,S,w);return{values:y,quoted:!1}}async function j4(e,t,n,r){let s=-1,i="",o=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&w.operation?.type==="PatternRemoval"){let x=w.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(x){s=y,i=x[1],o=x[2]==="*";break}}}if(s===-1)return null;let l=t[s].operation,c=Ee(e,i),u=c.map(([,y])=>y);if(c.length===0){let y=e.state.env.get(i);y!==void 0&&(u=[y])}if(u.length===0)return{values:[],quoted:!1};let f=l.pattern?await ps(e,l.pattern,l.greedy,n,r):"",d=[],p={value:0};for(let y of u)Dr(e,d,gr(e,y,f,l.side,l.greedy),p);let h=Ut(e.state.env),m=Kt(e.state.env);if(o){let y=Oe(e.state.env),w=hp(e,d,y,p.value);return m?{values:w?[w]:[],quoted:!1}:{values:at(w,h,e.limits.maxArrayElements),quoted:!1}}if(m)return{values:d,quoted:!1};let g=[],b={value:0};for(let y of d)if(y==="")Dr(e,g,"",b);else for(let w of at(y,h,e.limits.maxArrayElements))Dr(e,g,w,b);return{values:g,quoted:!1}}async function H4(e,t,n,r){let s=-1,i=!1;for(let y=0;y<t.length;y++){let w=t[y];if(w.type==="ParameterExpansion"&&(w.parameter==="@"||w.parameter==="*")&&w.operation?.type==="PatternRemoval"){s=y,i=w.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=Number.parseInt(e.state.env.get("#")||"0",10),c=[];for(let y=1;y<=l;y++)c.push(e.state.env.get(String(y))||"");if(c.length===0)return{values:[],quoted:!1};let u="",f=e.state.shoptOptions.extglob;if(a.pattern)for(let y of a.pattern.parts)if(y.type==="Glob")u+=Xe(y.pattern,a.greedy,f);else if(y.type==="Literal")u+=Xe(y.value,a.greedy,f);else if(y.type==="SingleQuoted"||y.type==="Escaped")u+=nt(y.value);else if(y.type==="DoubleQuoted"){let w=await n(e,y.parts);u+=nt(w)}else if(y.type==="ParameterExpansion"){let w=await r(e,y);u+=Xe(w,a.greedy,f)}else{let w=await r(e,y);u+=nt(w)}let d=[],p={value:0};for(let y of c)Dr(e,d,gr(e,y,u,a.side,a.greedy),p);let h=Ut(e.state.env),m=Kt(e.state.env);if(i){let y=Oe(e.state.env),w=hp(e,d,y,p.value);return m?{values:w?[w]:[],quoted:!1}:{values:at(w,h,e.limits.maxArrayElements),quoted:!1}}if(m)return{values:d,quoted:!1};let g=[],b={value:0};for(let y of d)if(y==="")Dr(e,g,"",b);else for(let w of at(y,h,e.limits.maxArrayElements))Dr(e,g,w,b);return{values:g,quoted:!1}}async function V4(e,t,n,r){let s=-1,i=!1;for(let w=0;w<t.length;w++){let x=t[w];if(x.type==="ParameterExpansion"&&(x.parameter==="@"||x.parameter==="*")&&x.operation?.type==="Substring"){s=w,i=x.parameter==="*";break}}if(s===-1)return null;let a=t[s].operation,l=a.offset?await n(e,a.offset.expression):0,c=a.length?await n(e,a.length.expression):void 0,u=Number.parseInt(e.state.env.get("#")||"0",10),f=[];for(let w=1;w<=u;w++)f.push(e.state.env.get(String(w))||"");let d=e.state.env.get("0")||"bash",p;if(l<=0){let w=[d,...f],x=w.length+l;if(x<0)p=[];else{let S=l<0?x:0;if(c!==void 0){let E=c<0?w.length+c:S+c;p=w.slice(S,Math.max(S,E))}else p=w.slice(S)}}else{let w=l-1;if(w>=f.length)p=[];else if(c!==void 0){let x=c<0?f.length+c:w+c;p=f.slice(w,Math.max(w,x))}else p=f.slice(w)}let h="";for(let w=0;w<s;w++)h+=await r(e,t[w]);let m="";for(let w=s+1;w<t.length;w++)m+=await r(e,t[w]);let g=Ut(e.state.env),b=Kt(e.state.env);if(p.length===0){let w=h+m;return w?b?{values:[w],quoted:!1}:{values:at(w,g,e.limits.maxArrayElements),quoted:!1}:{values:[],quoted:!1}}let y;if(i){let w=Oe(e.state.env),x=h+p.join(w)+m;b?y=x?[x]:[]:y=at(x,g,e.limits.maxArrayElements)}else if(b)p.length===1?y=[h+p[0]+m]:y=[h+p[0],...p.slice(1,-1),p[p.length-1]+m];else{y=[];for(let w=0;w<p.length;w++){let x=p[w];if(w===0&&(x=h+x),w===p.length-1&&(x=x+m),x==="")y.push("");else{let S=at(x,g,e.limits.maxArrayElements);Xt(y,S,e.limits.maxArrayElements,"unquoted expansion")}}}return{values:await fc(e,y),quoted:!1}}async function q4(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 s=[];for(let c=1;c<=r;c++)s.push(e.state.env.get(String(c))||"");let i=Ut(e.state.env),o=Kt(e.state.env),a=tc(e.state.env),l;if(n)if(o)l=s.filter(c=>c!=="");else{let c=Oe(e.state.env),u=s.join(c);l=at(u,i,e.limits.maxArrayElements)}else if(o)l=s.filter(c=>c!=="");else if(a){l=[];for(let c of s){if(c==="")continue;let u=at(c,i,e.limits.maxArrayElements);Xt(l,u,e.limits.maxArrayElements,"unquoted expansion")}}else{l=[];for(let c of s)if(c==="")l.push("");else{let u=at(c,i,e.limits.maxArrayElements);Xt(l,u,e.limits.maxArrayElements,"unquoted expansion")}for(;l.length>0&&l[l.length-1]==="";)l.pop()}return{values:await fc(e,l),quoted:!1}}async function G4(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],s=n[2]==="*",i=Ee(e,r),o;if(i.length===0){let f=e.state.env.get(r);if(f!==void 0)o=[f];else return{values:[],quoted:!1}}else o=i.map(([,f])=>f);let a=Ut(e.state.env),l=Kt(e.state.env),c=tc(e.state.env),u;if(s)if(l)u=o.filter(f=>f!=="");else{let f=Oe(e.state.env),d=o.join(f);u=at(d,a,e.limits.maxArrayElements)}else if(l)u=o.filter(f=>f!=="");else if(c){u=[];for(let f of o){if(f==="")continue;let d=at(f,a,e.limits.maxArrayElements);Xt(u,d,e.limits.maxArrayElements,"unquoted expansion")}}else{u=[];for(let f of o)if(f==="")u.push("");else{let d=at(f,a,e.limits.maxArrayElements);Xt(u,d,e.limits.maxArrayElements,"unquoted expansion")}for(;u.length>0&&u[u.length-1]==="";)u.pop()}return{values:await fc(e,u),quoted:!1}}function Z4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="VarNamePrefix")return null;let n=t[0].operation,r=Qi(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let s=Ut(e.state.env),i=Kt(e.state.env),o;if(n.star)if(i)o=r;else{let a=Oe(e.state.env),l=r.join(a);o=at(l,s,e.limits.maxArrayElements)}else if(i)o=r;else{o=[];for(let a of r){let l=at(a,s,e.limits.maxArrayElements);Xt(o,l,e.limits.maxArrayElements,"unquoted expansion")}}return{values:o,quoted:!1}}function K4(e,t){if(t.length!==1||t[0].type!=="ParameterExpansion"||t[0].operation?.type!=="ArrayKeys")return null;let n=t[0].operation,s=Ee(e,n.array).map(([l])=>String(l));if(s.length===0)return{values:[],quoted:!1};let i=Ut(e.state.env),o=Kt(e.state.env),a;if(n.star)if(o)a=s;else{let l=Oe(e.state.env),c=s.join(l);a=at(c,i,e.limits.maxArrayElements)}else if(o)a=s;else{a=[];for(let l of s){let c=at(l,i,e.limits.maxArrayElements);Xt(a,c,e.limits.maxArrayElements,"unquoted expansion")}}return{values:a,quoted:!1}}async function X4(e,t,n){let r=-1;for(let d=0;d<t.length;d++){let p=t[d];if(p.type==="ParameterExpansion"&&(p.parameter==="@"||p.parameter==="*")&&!p.operation){r=d;break}}if(r===-1||t.length<=1)return null;let s=Number.parseInt(e.state.env.get("#")||"0",10),i=[];for(let d=1;d<=s;d++)i.push(e.state.env.get(String(d))||"");let o="";for(let d=0;d<r;d++)o+=await n(e,t[d]);let a="";for(let d=r+1;d<t.length;d++)a+=await n(e,t[d]);let l=Ut(e.state.env),c=Kt(e.state.env),u=tc(e.state.env);if(s===0){let d=o+a;return{values:d?[d]:[],quoted:!1}}let f;{let d=[];for(let p=0;p<i.length;p++){let h=i[p];p===0&&(h=o+h),p===i.length-1&&(h=h+a),d.push(h)}if(c)f=d.filter(p=>p!=="");else if(u){f=[];for(let p of d){if(p==="")continue;let h=at(p,l,e.limits.maxArrayElements);Xt(f,h,e.limits.maxArrayElements,"unquoted expansion")}}else{f=[];for(let p of d)if(p==="")f.push("");else{let h=at(p,l,e.limits.maxArrayElements);Xt(f,h,e.limits.maxArrayElements,"unquoted expansion")}for(;f.length>0&&f[f.length-1]==="";)f.pop()}}return f.length===0?{values:[],quoted:!1}:{values:await fc(e,f),quoted:!1}}async function J4(e,t,n){e.coverage?.hit("bash:expansion:word_glob");let r=t.parts,{hasQuoted:s,hasCommandSub:i,hasArrayVar:o,hasArrayAtExpansion:a,hasParamExpansion:l,hasVarNamePrefixExpansion:c,hasIndirection:u}=ia(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return RO(e,d,s);let p=await PO(e,r,a,c,u,n);if(p!==null)return p;let h=await LO(e,r,n);if(h!==null)return h;let m=await FO(e,r,n);if(m!==null)return m;let g=await _O(e,r,n.expandPart);if(g!==null)return Y4(e,g);if((i||o||l)&&!Kt(e.state.env)){let y=Ut(e.state.env),w=n.buildIfsCharClassPattern(y),x=await n.smartWordSplit(e,r,y,w,n.expandPart);return Y4(e,x)}let b=await n.expandWordAsync(e,t);return BO(e,t,r,b,s,n.expandWordForGlobbing)}async function RO(e,t,n){let r=[];for(let s of t)if(!(!n&&s===""))if(!n&&!e.state.options.noglob&&Pr(s,e.state.shoptOptions.extglob)){let i=await dc(e,s);Xt(r,i,e.limits.maxArrayElements,"brace/glob expansion")}else r.push(s);return{values:r,quoted:!1}}async function PO(e,t,n,r,s,i){if(n){let o=R4(e,t);if(o!==null)return o}{let o=P4(e,t);if(o!==null)return o}{let o=await N4(e,t);if(o!==null)return o}{let o=await I4(e,t,n,i.expandPart,i.expandWordPartsAsync);if(o!==null)return o}{let o=await O4(e,t,n,i.expandPart);if(o!==null)return o}{let o=await T4(e,t,i.evaluateArithmetic);if(o!==null)return o}{let o=$4(e,t);if(o!==null)return o}{let o=await k4(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}{let o=await v4(e,t,i.expandWordPartsAsync,i.expandPart);if(o!==null)return o}if(r&&t.length===1&&t[0].type==="DoubleQuoted"){let o=DO(e,t);if(o!==null)return o}{let o=await D4(e,t,s,i.expandParameterAsync,i.expandWordPartsAsync);if(o!==null)return o}{let o=await L4(e,t);if(o!==null)return o}{let o=await F4(e,t);if(o!==null)return o}return null}function DO(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 r=n.parts[0].operation,s=Qi(e,r.prefix);return r.star?{values:[s.join(Oe(e.state.env))],quoted:!0}:{values:s,quoted:!0}}if(n.parts.length===1&&n.parts[0].type==="ParameterExpansion"&&n.parts[0].operation?.type==="ArrayKeys"){let r=n.parts[0].operation,i=Ee(e,r.array).map(([o])=>String(o));return r.star?{values:[i.join(Oe(e.state.env))],quoted:!0}:{values:i,quoted:!0}}return null}async function LO(e,t,n){{let r=await _4(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await B4(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await U4(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await z4(e,t,n.expandPart);if(r!==null)return r}return null}async function FO(e,t,n){{let r=await W4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await j4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await H4(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await V4(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await q4(e,t);if(r!==null)return r}{let r=await G4(e,t);if(r!==null)return r}{let r=Z4(e,t);if(r!==null)return r}{let r=K4(e,t);if(r!==null)return r}{let r=await X4(e,t,n.expandPart);if(r!==null)return r}return null}function Q4(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 MO(e,t,n,r){let s="";for(let a=0;a<n.atIndex;a++)s+=await r(e,t.parts[a]);let i="";for(let a=n.atIndex+1;a<t.parts.length;a++)i+=await r(e,t.parts[a]);let o;if(n.type==="array"){if(o=Ee(e,n.name).map(([,l])=>l),o.length===0){let l=e.state.env.get(n.name);l!==void 0&&(o=[l])}}else{let a=Number.parseInt(e.state.env.get("#")||"0",10);o=[];for(let l=1;l<=a;l++)o.push(e.state.env.get(String(l))||"")}if(n.isStar){let a=Oe(e.state.env),l=o.join(a);return[s+l+i]}if(o.length===0){let a=s+i;return a?[a]:[]}return o.length===1?[s+o[0]+i]:[s+o[0],...o.slice(1,-1),o[o.length-1]+i]}async function _O(e,t,n){if(t.length<2)return null;let r=!1;for(let l of t)if(Q4(l)){r=!0;break}if(!r)return null;let s=Ut(e.state.env),i=Kt(e.state.env),o=[];for(let l of t){let c=Q4(l);if(c&&l.type==="DoubleQuoted"){let u=await MO(e,l,c,n);o.push(u)}else if(l.type==="DoubleQuoted"||l.type==="SingleQuoted"){let u=await n(e,l);o.push([u])}else if(l.type==="Literal")o.push([l.value]);else if(l.type==="ParameterExpansion"){let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=at(u,s,e.limits.maxArrayElements);o.push(f)}}else{let u=await n(e,l);if(i)o.push(u?[u]:[]);else{let f=at(u,s,e.limits.maxArrayElements);o.push(f)}}}let a=[];for(let l of o)if(l.length!==0)if(a.length===0)Xt(a,l,e.limits.maxArrayElements,"word expansion");else{let c=a.length-1;a[c]=a[c]+l[0];for(let u=1;u<l.length;u++)a.push(l[u])}return a}async function Y4(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(Pr(r,e.state.shoptOptions.extglob)){let s=await dc(e,r);Xt(n,s,e.limits.maxArrayElements,"glob expansion")}else n.push(r);return{values:n,quoted:!1}}async function dc(e,t){let n=new ds(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,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new xr(t);return n.hasNullglob()?[]:[t]}async function BO(e,t,n,r,s,i){let o=n.some(a=>a.type==="Glob");if(!e.state.options.noglob&&o){let a=await i(e,t);if(Pr(a,e.state.shoptOptions.extglob)){let c=await dc(e,a);if(c.length>0&&c[0]!==a)return{values:c,quoted:!1};if(c.length===0)return{values:[],quoted:!1}}let l=lp(r);if(!Kt(e.state.env)){let c=Ut(e.state.env);return{values:at(l,c,e.limits.maxArrayElements),quoted:!1}}return{values:[l],quoted:!1}}if(!s&&!e.state.options.noglob&&Pr(r,e.state.shoptOptions.extglob)){let a=await i(e,t);if(Pr(a,e.state.shoptOptions.extglob)){let l=await dc(e,a);if(l.length>0&&l[0]!==a)return{values:l,quoted:!1}}}if(r===""&&!s)return{values:[],quoted:!1};if(o&&!s){let a=lp(r);if(!Kt(e.state.env)){let l=Ut(e.state.env);return{values:at(a,l,e.limits.maxArrayElements),quoted:!1}}return{values:[a],quoted:!1}}return{values:[r],quoted:s}}G();function rn(e,t,n){if(t.length>=e.limits.maxArrayElements)throw new C(`word splitting element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");t.push(n)}async function t3(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 s=await Rr(e,t.parameter),o=await Ve(e,t.parameter,!1)==="",a=n.checkEmpty??!1,l;return n.type==="UseAlternative"?l=s&&!(a&&o):l=!s||a&&o,l?(n.type==="AssignDefault"&&cp(t.parameter),r.parts):null}function UO(e){return e.type==="SingleQuoted"?!0:e.type==="DoubleQuoted"?e.parts.every(n=>n.type==="Literal"):!1}async function zO(e,t){if(t.type!=="ParameterExpansion")return null;let n=await t3(e,t);if(!n||n.length<=1)return null;let r=n.some(i=>UO(i)),s=n.some(i=>i.type==="Literal"||i.type==="ParameterExpansion"||i.type==="CommandSubstitution"||i.type==="ArithmeticExpansion");return r&&s?n:null}function WO(e){return e.type==="DoubleQuoted"||e.type==="SingleQuoted"||e.type==="Literal"?!1:e.type==="Glob"?ep(e.pattern):!(!(e.type==="ParameterExpansion"||e.type==="CommandSubstitution"||e.type==="ArithmeticExpansion")||e.type==="ParameterExpansion"&&J7(e))}async function n3(e,t,n,r,s){if(e.coverage?.hit("bash:expansion:word_split"),t.length===1&&t[0].type==="ParameterExpansion"){let d=t[0],p=await t3(e,d);if(p&&p.length>0&&p.length>1&&p.some(m=>m.type==="DoubleQuoted"||m.type==="SingleQuoted")&&p.some(m=>m.type==="Literal"||m.type==="ParameterExpansion"||m.type==="CommandSubstitution"||m.type==="ArithmeticExpansion"))return e3(e,p,n,r,s)}let i=[],o=!1;for(let d of t){let p=WO(d),h=d.type==="DoubleQuoted"||d.type==="SingleQuoted",m=p?await zO(e,d):null,g=await s(e,d);i.push({value:g,isSplittable:p,isQuoted:h,mixedDefaultParts:m??void 0}),p&&(o=!0)}if(!o){let d=i.map(p=>p.value).join("");return d?[d]:[]}let a=[],l="",c=!1,u=!1,f=!1;for(let d of i)if(!d.isSplittable)u?d.isQuoted&&d.value===""?(l!==""&&rn(e,a,l),rn(e,a,""),c=!0,l="",u=!1,f=!0):d.value!==""?(l!==""&&rn(e,a,l),l=d.value,u=!1,f=!1):(l+=d.value,f=!1):(l+=d.value,f=d.isQuoted&&d.value==="");else if(d.mixedDefaultParts){let p=await e3(e,d.mixedDefaultParts,n,r,s);if(p.length!==0)if(p.length===1)l+=p[0],c=!0;else{l+=p[0],rn(e,a,l),c=!0;for(let h=1;h<p.length-1;h++)rn(e,a,p[h]);l=p[p.length-1]}u=!1,f=!1}else{let{words:p,hadLeadingDelimiter:h,hadTrailingDelimiter:m}=nc(d.value,n,e.limits.maxArrayElements);if(f&&h&&l===""&&(rn(e,a,""),c=!0),p.length===0)m&&(u=!0);else if(p.length===1)l+=p[0],c=!0,u=m;else{l+=p[0],rn(e,a,l),c=!0;for(let g=1;g<p.length-1;g++)rn(e,a,p[g]);l=p[p.length-1],u=m}f=!1}return l!==""?rn(e,a,l):a.length===0&&c&&rn(e,a,""),a}function jO(e,t){return e.length>0&&t.includes(e[0])}async function e3(e,t,n,r,s){let i=[];for(let u of t){let d=!(u.type==="DoubleQuoted"||u.type==="SingleQuoted"),p=await s(e,u);i.push({value:p,isSplittable:d})}let o=[],a="",l=!1,c=!1;for(let u of i)if(!u.isSplittable)c&&u.value!==""?(a!==""&&rn(e,o,a),a=u.value,c=!1):a+=u.value;else{jO(u.value,n)&&a!==""&&(rn(e,o,a),a="",l=!0);let{words:d,hadTrailingDelimiter:p}=nc(u.value,n,e.limits.maxArrayElements);if(d.length===0)p&&(c=!0);else if(d.length===1)a+=d[0],l=!0,c=p;else{a+=d[0],rn(e,o,a),l=!0;for(let h=1;h<d.length-1;h++)rn(e,o,d[h]);a=d[d.length-1],c=p}}return a!==""?rn(e,o,a):o.length===0&&l&&rn(e,o,""),o}function r3(e){switch(e.type){case"Literal":return e.value;case"SingleQuoted":return e.value;case"Escaped":return e.value;default:return null}}function s3(e){switch(e.type){case"SingleQuoted":case"Escaped":case"DoubleQuoted":return!0;case"Literal":return e.value==="";default:return!1}}ue();Un();G();var pc="/dev/fd",o3=63,HO=10,i3=o3-HO+1,mp=class extends pr{isLiveDescriptor;constructor(t){super(),this.isLiveDescriptor=t}assertLiveDescriptor(t,n){this.isLiveDescriptor(t)||this.refuse(t,n)}refuse(t,n){throw new me("EROFS",`read-only file system, ${n} '${pc}${t}'`)}async writeFile(t,n,r){return this.assertLiveDescriptor(t,"write"),super.writeFile(t,n,r)}async appendFile(t,n,r){return this.assertLiveDescriptor(t,"append"),super.appendFile(t,n,r)}async rm(t,n){return this.assertLiveDescriptor(t,"rm"),super.rm(t,n)}async mkdir(t,n){this.refuse(t,"mkdir")}async cp(t,n){this.refuse(n,"cp")}async mv(t,n){this.refuse(n,"mv")}async symlink(t,n){this.refuse(n,"symlink")}async link(t,n){this.refuse(n,"link")}async chmod(t,n){this.refuse(t,"chmod")}async utimes(t,n,r){this.refuse(t,"utimes")}};function VO(e){let t=new mp(n=>a3(e).some(r=>r.path===`${pc}${n}`));e.fs=new as({base:e.fs,mounts:[{mountPoint:pc,filesystem:t}]}),e.state.processSubstitutionFsMounted=!0}async function qO(e,t,n){try{await e.fs.writeFile(t,n,"binary");return}catch(r){if(e.state.processSubstitutionFsMounted)throw r;VO(e)}await e.fs.writeFile(t,n,"binary")}async function GO(e,t){try{await e.fs.rm(t,{force:!0})}catch{}}function a3(e){let t=e.state.processSubstitutions;if(t)return t;let n=[];return e.state.processSubstitutions=n,n}async function l3(e,t,n){let r=e.substitutionDepth??0,s=e.limits.maxSubstitutionDepth;if(r>=s)throw new C(`Process substitution nesting limit exceeded (${s})`,"substitution_depth");let i=e.substitutionDepth,o=new Map(e.state.env),a=Qn(e.state.arrays),l=e.state.cwd,c=e.state.bashPid,u=e.state.suppressVerbose,f=e.state.groupStdin,d=e.state.lastExitCode,p=e.state.env.get("?"),h=e.state.lastSubstitutionExitCode;e.substitutionDepth=r+1,e.state.bashPid=e.state.nextVirtualPid++,e.state.suppressVerbose=!0,n!==void 0&&(e.state.groupStdin=n);let m;try{m=await e.executeScript(t)}catch(g){if(g instanceof C)throw g;if(g instanceof we)return{stdout:g.stdout,stderr:g.stderr,exitCode:g.exitCode};throw g}finally{e.substitutionDepth=i,e.state.env=o,e.state.arrays=a,e.state.cwd=l,e.state.bashPid=c,e.state.suppressVerbose=u,e.state.groupStdin=f,e.state.lastExitCode=d,e.state.lastSubstitutionExitCode=h,p!==void 0?e.state.env.set("?",p):e.state.env.delete("?")}return m}async function c3(e,t){let n=a3(e);if(n.length>=i3)throw new C(`Process substitution limit exceeded (${i3} concurrent)`,"file_descriptors");let r="";if(t.direction==="input"){let o=await l3(e,t.body,void 0);if(o.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+o.stderr),r=es(o),r.length>e.limits.maxStringLength)throw new C(`process substitution: string length limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length")}let s=o3-n.length,i=`${pc}/${s}`;n.push({fd:s,path:i,direction:t.direction,body:t.body});try{await qO(e,i,r)}catch(o){throw n.pop(),o}return i}function u3(e){return e.state.processSubstitutions?.length??0}var ZO={stdout:"",stderr:""};async function gp(e,t){let n=e.state.processSubstitutions;if(!n||n.length<=t)return ZO;let r="",s="";for(;n.length>t;){let i=n[n.length-1],o="";if(i.direction==="output")try{o=await Ht(e.fs,i.path)}catch{}if(await GO(e,i.path),n.pop(),i.direction==="output"){let a=await l3(e,i.body,o);r+=es(a),s+=a.stderr}}return{stdout:r,stderr:s}}function ws(e,t,n){if(e.length>t)throw new C(`${n}: string length limit exceeded (${t} bytes)`,"string_length")}async function wr(e,t,n=!1){let r=[],s=0;for(let i of t){let o=await Dn(e,i,n);if(s+=M(o),s>e.limits.maxStringLength)throw new C(`parameter word string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");r.push(o)}return r.join("")}function KO(e){return s3(e)}function d3(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!KO(t))return!1;return!0}function XO(e,t,n=!1){let r=r3(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 fp(e,t.pattern);default:return null}}async function ze(e,t){return wp(e,t)}async function p3(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped")n.push(Xi(r.value));else if(r.type==="SingleQuoted")n.push(r.value);else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(s)}else if(r.type==="TildeExpansion"){let s=await Dn(e,r);n.push(Xi(s))}else n.push(await Dn(e,r));return n.join("")}async function h3(e,t){let n=[];for(let r of t.parts)if(r.type==="Escaped"){let s=r.value;"()|*?[]".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="SingleQuoted")n.push(Pn(r.value));else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(Pn(s))}else n.push(await Dn(e,r));return n.join("")}async function m3(e,t){let n=[];for(let r of t.parts)if(r.type==="SingleQuoted")n.push(Pn(r.value));else if(r.type==="Escaped"){let s=r.value;"*?[]\\()|".includes(s)?n.push(`\\${s}`):n.push(s)}else if(r.type==="DoubleQuoted"){let s=await wr(e,r.parts);n.push(Pn(s))}else r.type==="Glob"?S4(r.pattern)?n.push(await C4(e,r.pattern)):n.push(fp(e,r.pattern)):r.type==="Literal"?n.push(r.value):n.push(await Dn(e,r));return n.join("")}function mc(e){for(let t of e)if(t.type==="BraceExpansion"||t.type==="DoubleQuoted"&&mc(t.parts))return!0;return!1}var f3=1e5;async function g3(e,t,n={count:0}){let r=()=>{n.count++,e.executionScope.consumeLimited("brace_operations",1,Math.min(f3,e.limits.maxBraceExpansionResults),"brace expansion")},s=(o,a)=>{if(o.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),o.push(a)},i=[[]];for(let o of t)if(o.type==="BraceExpansion"){let a=[],l=!1,c="";for(let d of o.items)if(d.type==="Range"){let p=ap(d.start,d.end,d.step,d.startStr,d.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(p.expanded)for(let h of p.expanded)s(a,h);else{l=!0,c=p.literal;break}}else{let p=await g3(e,d.word.parts,n);for(let h of p){let m=[];for(let g of h)typeof g=="string"?m.push(g):m.push(await Dn(e,g));s(a,m.join(""))}}if(l){for(let d of i)r(),d.push(c);continue}if(i.length*a.length>e.limits.maxBraceExpansionResults||n.count>f3)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");let f=[];for(let d of i)for(let p of a){if(f.length>=e.limits.maxBraceExpansionResults)throw new C(`brace expansion result limit exceeded (${e.limits.maxBraceExpansionResults})`,"array_elements");r(),f.push([...d,p])}i=f}else for(let a of i)r(),a.push(o);return i}async function y3(e,t){let n=t.parts;if(!mc(n))return[await ze(e,t)];let r=await g3(e,n),s=[];for(let i of r){let o=[];for(let a of i)typeof a=="string"?o.push(a):o.push(await Dn(e,a));s.push(dp(e,o.join("")))}return s}function QO(){return{expandWordAsync:wp,expandWordForGlobbing:m3,expandWordWithBracesAsync:y3,expandWordPartsAsync:wr,expandPart:Dn,expandParameterAsync:hc,hasBraceExpansion:mc,evaluateArithmetic:Re,buildIfsCharClassPattern:e4,smartWordSplit:n3}}async function br(e,t){return J4(e,t,QO())}function YO(e){for(let t of e){if(t.type==="ParameterExpansion")return t.parameter;if(t.type==="Literal")return t.value}return""}function yp(e,t){if(Number.parseInt(e.state.env.get("#")||"0",10)<2)return!1;function r(s){for(let i of s)if(i.type==="DoubleQuoted"){for(let o of i.parts)if(o.type==="ParameterExpansion"&&o.parameter==="@"&&!o.operation)return!0}return!1}return r(t.parts)}async function w3(e,t){if(yp(e,t))return{error:`bash: $@: ambiguous redirect
916
916
  `};let n=t.parts,{hasQuoted:r}=ia(n);if(mc(n)&&(await y3(e,t)).length>1)return{error:`bash: ${n.map(p=>p.type==="Literal"?p.value:p.type==="BraceExpansion"?`{${p.items.map(m=>{if(m.type==="Range"){let g=m.step?`..${m.step}`:"";return`${m.startStr??m.start}..${m.endStr??m.end}${g}`}return m.word.parts.map(g=>g.type==="Literal"?g.value:"").join("")}).join(",")}}`:"").join("")}: ambiguous redirect
917
917
  `};let s=await wp(e,t),{hasParamExpansion:i,hasCommandSub:o}=ia(n);if((i||o)&&!r&&!Kt(e.state.env)){let f=Ut(e.state.env);if(at(s,f,e.limits.maxArrayElements).length>1)return{error:`bash: $${YO(n)}: ambiguous redirect
918
918
  `}}if(r||e.state.options.noglob||n.some(f=>f.type==="ProcessSubstitution"))return{target:s};let l=await m3(e,t);if(!Pr(l,e.state.shoptOptions.extglob))return{target:s};let c=new ds(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,consumeOperation:()=>e.executionScope.consumeLimited("glob_operations",1,e.limits.maxGlobOperations,"glob expansion")}),u=await c.expand(l);return u.length===0?c.hasFailglob()?{error:`bash: no match: ${s}
919
919
  `}:{target:s}:u.length===1?{target:u[0]}:{error:`bash: ${s}: ambiguous redirect
920
- `}}async function wp(e,t){let n=t.parts,r=n.length;if(r===1){let o=await Dn(e,n[0]);return ws(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await Dn(e,n[o]));let i=s.join("");return ws(i,e.limits.maxStringLength,"word expansion"),i}async function Dn(e,t,n=!1){if(t.type==="ParameterExpansion")return hc(e,t,n);let r=XO(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await Dn(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=a4(t.body);if(s)try{let p=await Ue(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,m=await e.fs.readFile(h);gs(e.state,0);let g=m.replace(/\n+$/,"");return ws(g,e.limits.maxStringLength,"command substitution"),g}catch(p){if(p instanceof C)throw p;return gs(e.state,1),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new C(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=e.substitutionDepth;e.substitutionDepth=i+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=Qn(e.state.arrays),f=e.state.cwd,d=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.suppressVerbose=d,gs(e.state,h),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr),e.state.bashPid=l,e.substitutionDepth=a;let m=p.stdout.replace(/\n+$/,"");return ws(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=d,p instanceof C)throw p;if(p instanceof we){gs(e.state,p.exitCode),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=p.stdout.replace(/\n+$/,"");return ws(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ProcessSubstitution":return c3(e,t);case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let o=await o4(e,s),a=new xe,l=Be(a,o);return String(await Re(e,l.expression,!0))}return String(await Re(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=ap(i.start,i.end,i.step,i.startStr,i.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await Ue(e,i.word));return s.join(" ")}default:return""}}async function hc(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,d,p]=i;if(e.state.associativeArrays?.has(d)||p.includes("$(")||p.includes("`")||p.includes("${")){let m=await ip(e,p);r=`${d}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&st(e,r)){let d=pn(e,r);if(d&&d!==r){let p=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(p){let[,h,m]=p;if(e.state.associativeArrays?.has(h)||m.includes("$(")||m.includes("`")||m.includes("${")){let b=await ip(e,m);r=`${h}[${b}]`}}}}if(s?.type==="Length"&&/^[a-zA-Z_][a-zA-Z0-9_]*\[[@*]\]$/.test(r))return up(e,r,"");let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await He(e,r,!o);if(!s)return a;let l=!await Rr(e,r),{isEmpty:c,effectiveValue:u}=E4(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return c4(e,s,f,wr);case"AssignDefault":return u4(e,r,s,f,wr);case"ErrorIfUnset":return f4(e,r,s,f,wr);case"UseAlternative":return d4(e,s,f,wr);case"PatternRemoval":{let d=await p4(e,a,s,wr,Dn);return ws(d,e.limits.maxStringLength,"pattern removal"),d}case"PatternReplacement":{let d=await h4(e,a,s,wr,Dn);return ws(d,e.limits.maxStringLength,"pattern replacement"),d}case"Length":return up(e,r,a);case"LengthSliceError":throw new sn(r);case"BadSubstitution":throw new sn(s.text);case"Substring":return m4(e,r,a,s);case"CaseModification":{let d=await g4(e,a,s,wr,hc);return ws(d,e.limits.maxStringLength,"case modification"),d}case"Transform":return y4(e,r,a,l,s);case"Indirection":return w4(e,r,a,l,s,hc,n);case"ArrayKeys":return b4(e,s);case"VarNamePrefix":return x4(e,s);default:return a}}function x3(){return{visited:new Set,depth:0}}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 qe("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new qe("division by 0");return e%t;case"**":if(t<0)throw new qe("exponent less than 0");return e**t;case"<<":return e<<t;case">>":return e>>t;case"<":return e<t?1:0;case"<=":return e<=t?1:0;case">":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function b3(e,t,n){switch(n){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<<t;case">>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function eT(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function tT(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=Ye(e,t,0);return r!==void 0?r:await He(e,t)}async function nT(e,t,n){if(!t)return 0;let r=Number.parseInt(t,10);if(!Number.isNaN(r)&&/^-?\d+$/.test(t.trim()))return r;let s=t.trim();if(!s)return 0;let i=new xe,{expr:o,pos:a}=Ki(i,s,0);if(a<s.length){let l=s.slice(a).trim(),c=l.split(/\s+/)[0]||l;throw new qe(`syntax error in expression (error token is "${c}")`,"","")}return await Ji(e,o,!1,n)}async function gc(e,t,n,r){if(r.depth>100)throw new qe("maximum variable indirection depth exceeded");if(r.visited.has(t))throw new qe(`arithmetic variable cycle detected at ${t}`);r.visited.add(t),r.depth++;try{return await nT(e,n,r)}finally{r.depth--,r.visited.delete(t)}}async function bp(e,t,n){if(n.depth>100)throw new qe("maximum variable indirection depth exceeded");if(n.visited.has(t))throw new qe(`arithmetic variable cycle detected at ${t}`);n.visited.add(t),n.depth++;try{let r=await tT(e,t);if(!r)return 0;let s=Number.parseInt(r,10);if(!Number.isNaN(s)&&/^-?\d+$/.test(r.trim()))return s;let i=r.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return await bp(e,i,n);let o=new xe,{expr:a,pos:l}=Ki(o,i,0);if(l<i.length){let c=i.slice(l).trim(),u=c.split(/\s+/)[0]||c;throw new qe(`${i}: syntax error in expression (error token is "${u}")`)}return await Ji(e,a,!1,n)}finally{n.depth--,n.visited.delete(t)}}async function yc(e,t){if(t.startsWith("#")){let f=t.slice(1),d=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(d){let h=d[1],m=Ee(e,h);return String(m.length)}let p=e.state.env.get(f)||"";return String(p.length)}if(t.startsWith("!")){let f=t.slice(1),d=e.state.env.get(f)||"";return e.state.env.get(d)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let d=t.indexOf(f);d>0&&(r===-1||d<r)&&(r=d,s=f)}if(r===-1)return await He(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function Re(e,t,n=!1){return Ji(e,t,n,x3())}async function Ji(e,t,n,r){let s=(i,o=n)=>Ji(e,i,o,r);switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new qe("value too great for base");return t.value;case"ArithVariable":return await bp(e,t.name,r);case"ArithSpecialVar":{let o=(await He(e,t.name)).trim();if(!o)return 0;let a=Number.parseInt(o,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(o))return a;let l=new xe,{expr:c}=Ki(l,o,0);return await s(c)}case"ArithNested":return await s(t.expression);case"ArithCommandSubst":{if(e.execFn){let i=await e.execFn(t.command,{signal:e.state.signal});i.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+i.stderr);let o=i.stdout.trim();return Number.parseInt(o,10)||0}return 0}case"ArithBracedExpansion":{let i=await yc(e,t.content);return Number.parseInt(i,10)||0}case"ArithDynamicBase":{let i=await yc(e,t.baseExpr),o=Number.parseInt(i,10);if(o<2||o>64)return 0;let a=`${o}#${t.value}`;return ta(a)}case"ArithDynamicNumber":{let o=await yc(e,t.prefix)+t.suffix;return ta(o)}case"ArithArrayElement":{let i=e.state.associativeArrays?.has(t.array),o=async a=>{let l=Ye(e,t.array,a);return l!==void 0?await gc(e,`${t.array}[${a}]`,l,r):0};if(t.stringKey!==void 0)return await o(t.stringKey);if(i&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await o(t.index.name);if(i&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let a=await He(e,t.index.name);return await o(a)}if(t.index){let a=await s(t.index);if(a<0){let u=Ee(e,t.array),f=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${t.array}: bad array subscript
920
+ `}}async function wp(e,t){let n=t.parts,r=n.length;if(r===1){let o=await Dn(e,n[0]);return ws(o,e.limits.maxStringLength,"word expansion"),o}let s=[];for(let o=0;o<r;o++)s.push(await Dn(e,n[o]));let i=s.join("");return ws(i,e.limits.maxStringLength,"word expansion"),i}async function Dn(e,t,n=!1){if(t.type==="ParameterExpansion")return hc(e,t,n);let r=XO(e,t,n);if(r!==null)return r;switch(t.type){case"DoubleQuoted":{let s=[];for(let i of t.parts)s.push(await Dn(e,i,!0));return s.join("")}case"CommandSubstitution":{let s=a4(t.body);if(s)try{let p=await ze(e,s.target),h=p.startsWith("/")?p:`${e.state.cwd}/${p}`,m=await e.fs.readFile(h);gs(e.state,0);let g=m.replace(/\n+$/,"");return ws(g,e.limits.maxStringLength,"command substitution"),g}catch(p){if(p instanceof C)throw p;return gs(e.state,1),""}let i=e.substitutionDepth??0,o=e.limits.maxSubstitutionDepth;if(i>=o)throw new C(`Command substitution nesting limit exceeded (${o})`,"substitution_depth");let a=e.substitutionDepth;e.substitutionDepth=i+1;let l=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let c=new Map(e.state.env),u=Qn(e.state.arrays),f=e.state.cwd,d=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let p=await e.executeScript(t.body),h=p.exitCode;e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.suppressVerbose=d,gs(e.state,h),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr),e.state.bashPid=l,e.substitutionDepth=a;let m=p.stdout.replace(/\n+$/,"");return ws(m,e.limits.maxStringLength,"command substitution"),m}catch(p){if(e.state.env=c,e.state.arrays=u,e.state.cwd=f,e.state.bashPid=l,e.substitutionDepth=a,e.state.suppressVerbose=d,p instanceof C)throw p;if(p instanceof we){gs(e.state,p.exitCode),p.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+p.stderr);let h=p.stdout.replace(/\n+$/,"");return ws(h,e.limits.maxStringLength,"command substitution"),h}throw p}}case"ProcessSubstitution":return c3(e,t);case"ArithmeticExpansion":{let s=t.expression.originalText;if(s&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(s)){let o=await o4(e,s),a=new xe,l=Ue(a,o);return String(await Re(e,l.expression,!0))}return String(await Re(e,t.expression.expression,!0))}case"BraceExpansion":{let s=[];for(let i of t.items)if(i.type==="Range"){let o=ap(i.start,i.end,i.step,i.startStr,i.endStr,{maxResults:e.limits.maxBraceExpansionResults,maxStringBytes:e.limits.maxStringLength});if(o.expanded)s.push(...o.expanded);else return o.literal}else s.push(await ze(e,i.word));return s.join(" ")}default:return""}}async function hc(e,t,n=!1){let{parameter:r}=t,{operation:s}=t,i=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let[,d,p]=i;if(e.state.associativeArrays?.has(d)||p.includes("$(")||p.includes("`")||p.includes("${")){let m=await ip(e,p);r=`${d}[${m}]`}}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&st(e,r)){let d=pn(e,r);if(d&&d!==r){let p=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(p){let[,h,m]=p;if(e.state.associativeArrays?.has(h)||m.includes("$(")||m.includes("`")||m.includes("${")){let b=await ip(e,m);r=`${h}[${b}]`}}}}if(s?.type==="Length"&&/^[a-zA-Z_][a-zA-Z0-9_]*\[[@*]\]$/.test(r))return up(e,r,"");let o=s&&(s.type==="DefaultValue"||s.type==="AssignDefault"||s.type==="UseAlternative"||s.type==="ErrorIfUnset"),a=await Ve(e,r,!o);if(!s)return a;let l=!await Rr(e,r),{isEmpty:c,effectiveValue:u}=E4(e,r,a,n),f={value:a,isUnset:l,isEmpty:c,effectiveValue:u,inDoubleQuotes:n};switch(s.type){case"DefaultValue":return c4(e,s,f,wr);case"AssignDefault":return u4(e,r,s,f,wr);case"ErrorIfUnset":return f4(e,r,s,f,wr);case"UseAlternative":return d4(e,s,f,wr);case"PatternRemoval":{let d=await p4(e,a,s,wr,Dn);return ws(d,e.limits.maxStringLength,"pattern removal"),d}case"PatternReplacement":{let d=await h4(e,a,s,wr,Dn);return ws(d,e.limits.maxStringLength,"pattern replacement"),d}case"Length":return up(e,r,a);case"LengthSliceError":throw new sn(r);case"BadSubstitution":throw new sn(s.text);case"Substring":return m4(e,r,a,s);case"CaseModification":{let d=await g4(e,a,s,wr,hc);return ws(d,e.limits.maxStringLength,"case modification"),d}case"Transform":return y4(e,r,a,l,s);case"Indirection":return w4(e,r,a,l,s,hc,n);case"ArrayKeys":return b4(e,s);case"VarNamePrefix":return x4(e,s);default:return a}}function x3(){return{visited:new Set,depth:0}}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 Ge("division by 0");return Math.trunc(e/t);case"%":if(t===0)throw new Ge("division by 0");return e%t;case"**":if(t<0)throw new Ge("exponent less than 0");return e**t;case"<<":return e<<t;case">>":return e>>t;case"<":return e<t?1:0;case"<=":return e<=t?1:0;case">":return e>t?1:0;case">=":return e>=t?1:0;case"==":return e===t?1:0;case"!=":return e!==t?1:0;case"&":return e&t;case"|":return e|t;case"^":return e^t;case",":return t;default:return 0}}function b3(e,t,n){switch(n){case"=":return t;case"+=":return e+t;case"-=":return e-t;case"*=":return e*t;case"/=":return t!==0?Math.trunc(e/t):0;case"%=":return t!==0?e%t:0;case"<<=":return e<<t;case">>=":return e>>t;case"&=":return e&t;case"|=":return e|t;case"^=":return e^t;default:return t}}function eT(e,t){switch(t){case"-":return-e;case"+":return+e;case"!":return e===0?1:0;case"~":return~e;default:return e}}async function tT(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=Ye(e,t,0);return r!==void 0?r:await Ve(e,t)}async function nT(e,t,n){if(!t)return 0;let r=Number.parseInt(t,10);if(!Number.isNaN(r)&&/^-?\d+$/.test(t.trim()))return r;let s=t.trim();if(!s)return 0;let i=new xe,{expr:o,pos:a}=Ki(i,s,0);if(a<s.length){let l=s.slice(a).trim(),c=l.split(/\s+/)[0]||l;throw new Ge(`syntax error in expression (error token is "${c}")`,"","")}return await Ji(e,o,!1,n)}async function gc(e,t,n,r){if(r.depth>100)throw new Ge("maximum variable indirection depth exceeded");if(r.visited.has(t))throw new Ge(`arithmetic variable cycle detected at ${t}`);r.visited.add(t),r.depth++;try{return await nT(e,n,r)}finally{r.depth--,r.visited.delete(t)}}async function bp(e,t,n){if(n.depth>100)throw new Ge("maximum variable indirection depth exceeded");if(n.visited.has(t))throw new Ge(`arithmetic variable cycle detected at ${t}`);n.visited.add(t),n.depth++;try{let r=await tT(e,t);if(!r)return 0;let s=Number.parseInt(r,10);if(!Number.isNaN(s)&&/^-?\d+$/.test(r.trim()))return s;let i=r.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return await bp(e,i,n);let o=new xe,{expr:a,pos:l}=Ki(o,i,0);if(l<i.length){let c=i.slice(l).trim(),u=c.split(/\s+/)[0]||c;throw new Ge(`${i}: syntax error in expression (error token is "${u}")`)}return await Ji(e,a,!1,n)}finally{n.depth--,n.visited.delete(t)}}async function yc(e,t){if(t.startsWith("#")){let f=t.slice(1),d=f.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(d){let h=d[1],m=Ee(e,h);return String(m.length)}let p=e.state.env.get(f)||"";return String(p.length)}if(t.startsWith("!")){let f=t.slice(1),d=e.state.env.get(f)||"";return e.state.env.get(d)||""}let n=[":-",":=",":?",":+","-","=","?","+"],r=-1,s="";for(let f of n){let d=t.indexOf(f);d>0&&(r===-1||d<r)&&(r=d,s=f)}if(r===-1)return await Ve(e,t);let i=t.slice(0,r),o=t.slice(r+s.length),a=e.state.env.get(i),l=a===void 0,c=a==="",u=s.startsWith(":");switch(s){case":-":case"-":return l||u&&c?o:a||"";case":=":case"=":return l||u&&c?(e.state.env.set(i,o),o):a||"";case":+":case"+":return!(l||u&&c)?o:"";case":?":case"?":{if(l||u&&c)throw new Error(o||`${i}: parameter null or not set`);return a||""}default:return a||""}}async function Re(e,t,n=!1){return Ji(e,t,n,x3())}async function Ji(e,t,n,r){let s=(i,o=n)=>Ji(e,i,o,r);switch(t.type){case"ArithNumber":if(Number.isNaN(t.value))throw new Ge("value too great for base");return t.value;case"ArithVariable":return await bp(e,t.name,r);case"ArithSpecialVar":{let o=(await Ve(e,t.name)).trim();if(!o)return 0;let a=Number.parseInt(o,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(o))return a;let l=new xe,{expr:c}=Ki(l,o,0);return await s(c)}case"ArithNested":return await s(t.expression);case"ArithCommandSubst":{if(e.execFn){let i=await e.execFn(t.command,{signal:e.state.signal});i.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||"")+i.stderr);let o=i.stdout.trim();return Number.parseInt(o,10)||0}return 0}case"ArithBracedExpansion":{let i=await yc(e,t.content);return Number.parseInt(i,10)||0}case"ArithDynamicBase":{let i=await yc(e,t.baseExpr),o=Number.parseInt(i,10);if(o<2||o>64)return 0;let a=`${o}#${t.value}`;return ta(a)}case"ArithDynamicNumber":{let o=await yc(e,t.prefix)+t.suffix;return ta(o)}case"ArithArrayElement":{let i=e.state.associativeArrays?.has(t.array),o=async a=>{let l=Ye(e,t.array,a);return l!==void 0?await gc(e,`${t.array}[${a}]`,l,r):0};if(t.stringKey!==void 0)return await o(t.stringKey);if(i&&t.index?.type==="ArithVariable"&&!t.index.hasDollarPrefix)return await o(t.index.name);if(i&&t.index?.type==="ArithVariable"&&t.index.hasDollarPrefix){let a=await Ve(e,t.index.name);return await o(a)}if(t.index){let a=await s(t.index);if(a<0){let u=Ee(e,t.array),f=e.state.currentLine;if(u.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${t.array}: bad array subscript
921
921
  `,0;let p=Math.max(...u.map(([h])=>typeof h=="number"?h:0))+1+a;if(p<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${f}: ${t.array}: bad array subscript
922
- `,0;a=p}let l=`${t.array}[${a}]`,c=Ye(e,t.array,a);if(c!==void 0)return gc(e,l,c,r);if(a===0){let u=e.state.env.get(t.array);if(u!==void 0)return gc(e,t.array,u,r)}if(e.state.options.nounset&&!(e.state.env.has(t.array)||Gt(e,t.array)))throw new tn(`${t.array}[${a}]`);return 0}return 0}case"ArithDoubleSubscript":throw new qe("double subscript","","");case"ArithNumberSubscript":throw new qe(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new qe(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new qe(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await s(t.left)||await s(t.right)?1:0;if(t.operator==="&&")return await s(t.left)&&await s(t.right)?1:0;let i=await s(t.left),o=await s(t.right);return JO(i,o,t.operator)}case"ArithUnary":{let i=await s(t.operand);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let o=t.operand.name,a=Number.parseInt(await He(e,o),10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithArrayElement"){let o=t.operand.array,a=e.state.associativeArrays?.has(o),l;if(t.operand.stringKey!==void 0)l=t.operand.stringKey;else if(a&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)l=t.operand.index.name;else if(a&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix)l=await He(e,t.operand.index.name);else if(t.operand.index){let f=await s(t.operand.index);l=String(f)}else return i;let c=Number.parseInt(Ye(e,o,l)||"0",10)||0,u=t.operator==="++"?c+1:c-1;return be(e,o,l,String(u),a?"associative":"indexed"),t.prefix?u:c}if(t.operand.type==="ArithConcat"){let o="";for(let a of t.operand.parts)o+=await Yi(e,a,n,r);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}if(t.operand.type==="ArithDynamicElement"){let o="";if(t.operand.nameExpr.type==="ArithConcat")for(let a of t.operand.nameExpr.parts)o+=await Yi(e,a,n,r);else t.operand.nameExpr.type==="ArithVariable"&&(o=t.operand.nameExpr.hasDollarPrefix?await He(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=await s(t.operand.subscript),l=Number.parseInt(Ye(e,o,a)||"0",10)||0,c=t.operator==="++"?l+1:l-1;return be(e,o,a,String(c)),t.prefix?c:l}}return i}return eT(i,t.operator)}case"ArithTernary":return await s(t.condition)?await s(t.consequent):await s(t.alternate);case"ArithAssignment":{let i=t.variable,o=i,a;if(t.stringKey!==void 0)a=t.stringKey;else if(t.subscript){let d=e.state.associativeArrays?.has(i);if(d&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)a=t.subscript.name;else if(d&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix)a=await He(e,t.subscript.name)||"\\";else if(d){let p=await s(t.subscript);a=String(p)}else{let p=await s(t.subscript);if(p<0){let h=Ee(e,i);h.length>0&&(p=Math.max(...h.map(([g])=>typeof g=="number"?g:0))+1+p)}a=String(p)}}let l=a===void 0?e.state.env.get(o):Ye(e,i,a),c=Number.parseInt(l||"0",10)||0,u=await s(t.value),f=b3(c,u,t.operator);return a===void 0?e.state.env.set(o,String(f)):be(e,i,a,String(f),e.state.associativeArrays?.has(i)?"associative":"indexed"),f}case"ArithGroup":return await s(t.expression);case"ArithConcat":{let i="";for(let o of t.parts)i+=await Yi(e,o,n,r);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?await bp(e,i,r):Number.parseInt(i,10)||0}case"ArithDynamicAssignment":{let i="";if(t.target.type==="ArithConcat")for(let u of t.target.parts)i+=await Yi(e,u,n,r);else t.target.type==="ArithVariable"&&(i=t.target.hasDollarPrefix?await He(e,t.target.name):t.target.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=i;if(t.subscript){let u=await s(t.subscript);o=`${i}_${u}`}let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=await s(t.value),c=b3(a,l,t.operator);return e.state.env.set(o,String(c)),c}case"ArithDynamicElement":{let i="";if(t.nameExpr.type==="ArithConcat")for(let c of t.nameExpr.parts)i+=await Yi(e,c,n,r);else t.nameExpr.type==="ArithVariable"&&(i=t.nameExpr.hasDollarPrefix?await He(e,t.nameExpr.name):t.nameExpr.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=await s(t.subscript),a=`${i}_${o}`,l=e.state.env.get(a);return l!==void 0?gc(e,a,l,r):0}default:return 0}}async function Yi(e,t,n=!1,r=x3()){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await Ji(e,t,n,r));case"ArithVariable":return t.hasDollarPrefix?await He(e,t.name):t.name;case"ArithSpecialVar":return await He(e,t.name);case"ArithBracedExpansion":return await yc(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let s="";for(let i of t.parts)s+=await Yi(e,i,n,r);return s}default:return String(await Ji(e,t,n,r))}}kt();G();async function E3(e,t){let n="",r=0;for(let E of t.parts){let A=E.type==="Literal"?E.value:"\0",I=M(A);if(I>e.limits.maxStringLength-r)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n+=A,r+=I}let s=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\+?=)\(/);if(!s||!n.endsWith(")"))return null;let i=s[1],o=s[2],a=[],l=[],c=!1,u="",f=0,d=0,p=!1,h=!0,m=E=>{let A=M(E);if(A>e.limits.maxStringLength-d-f)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");u+=E,f+=A},g=(E,A=!1)=>{if(a.length>=e.limits.maxArrayElements)throw new C(`array assignment element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let I=M(E);if(I>e.limits.maxStringLength-d)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");a.push(E),l.push(A),d+=I},b=()=>{g(u,h),u="",f=0,p=!1,h=!0};for(let E of t.parts)if(E.type==="Literal"){let A=E.value;if(!c){let I=A.indexOf("=(");I!==-1&&(c=!0,A=A.slice(I+2))}if(c){A.endsWith(")")&&(A=A.slice(0,-1));for(let I of A)/\s/.test(I)?(u||p)&&b():m(I)}}else if(c)if(E.type==="BraceExpansion")if(/^\[.+\]=/.test(u))m(Gi({type:"Word",parts:[E]}));else{(u||p)&&b();let I=await br(e,{type:"Word",parts:[E]});for(let R of I.values)g(R)}else{(E.type==="SingleQuoted"||E.type==="DoubleQuoted"||E.type==="Escaped")&&(p=!0),h=!1;let A=await Ue(e,{type:"Word",parts:[E]});m(A)}(u||p)&&b();let y=a.splice(0),w=l.splice(0);d=0;for(let E=0;E<y.length;E++){let A=y[E];if(!w[E]){g(A);continue}let I=A.match(/^(\[[^\]]+\]=)(.*)$/s);if(I){let R=ys(e,I[2]);A=I[1]+R}if(A.includes("{")&&A.includes("}")){let R=new xe().parseWordFromString(A,!1,!1);if(R.parts.some(N=>N.type==="BraceExpansion")){let N=await br(e,R);for(let $ of N.values)g($);continue}}g(A)}let x=[`${i}${o}(`],S=M(x[0]);for(let E=0;E<a.length;E++){let A=a[E],I,R=A.match(/^(\[[^\]]+\]=)(.*)$/s);if(R){let T=R[2].replace(/\\/g,"\\\\").replace(/"/g,'\\"');I=`${R[1]}"${T}"`}else A===""?I="''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(A)&&!A.startsWith("'")&&!A.startsWith('"')?I=`'${A.replace(/'/g,"'\\''")}'`:I=A;let N=`${E>0?" ":""}${I}`,$=M(N);if($+1>e.limits.maxStringLength-S)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");x.push(N),S+=$}return x.push(")"),x.join("")}async function S3(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let b=g.value.indexOf("+=");if(b!==-1){let w=g.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)){n=m,r=b,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=b,s=!0;break}}let y=g.value.indexOf("=");if(y!==-1&&(y===0||g.value[y-1]!=="+")){let w=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=y;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await Ue(e,{type:"Word",parts:[m]});f+=l;let d={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},p=d.parts.length>0?await Ue(e,d):"";return`${f}${s?"+=":"="}${p}`}var rT=["tar","yq","xan","sqlite3","python3","python"];function A3(e){return rT.includes(e)}ue();vt();Tn();vr();mn();Vs();Os();qi();G();G();var Fe=Object.freeze({stdout:"",stderr:"",exitCode:0,internalStdinConsumed:0});function De(e=""){return{stdout:e,stderr:"",exitCode:0}}function K(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function X(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function $t(e){return{stdout:"",stderr:"",exitCode:e?0:1,internalStdinConsumed:0}}function bs(e,t,n="",r=""){throw new C(e,t,n,r)}function C3(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new C(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function xp(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Er;return Fe}if(t.length>1)throw new we(1,"",`bash: break: too many arguments
922
+ `,0;a=p}let l=`${t.array}[${a}]`,c=Ye(e,t.array,a);if(c!==void 0)return gc(e,l,c,r);if(a===0){let u=e.state.env.get(t.array);if(u!==void 0)return gc(e,t.array,u,r)}if(e.state.options.nounset&&!(e.state.env.has(t.array)||Gt(e,t.array)))throw new tn(`${t.array}[${a}]`);return 0}return 0}case"ArithDoubleSubscript":throw new Ge("double subscript","","");case"ArithNumberSubscript":throw new Ge(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case"ArithSyntaxError":throw new Ge(t.message,"","",!0);case"ArithSingleQuote":{if(n)throw new Ge(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value}case"ArithBinary":{if(t.operator==="||")return await s(t.left)||await s(t.right)?1:0;if(t.operator==="&&")return await s(t.left)&&await s(t.right)?1:0;let i=await s(t.left),o=await s(t.right);return JO(i,o,t.operator)}case"ArithUnary":{let i=await s(t.operand);if(t.operator==="++"||t.operator==="--"){if(t.operand.type==="ArithVariable"){let o=t.operand.name,a=Number.parseInt(await Ve(e,o),10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}if(t.operand.type==="ArithArrayElement"){let o=t.operand.array,a=e.state.associativeArrays?.has(o),l;if(t.operand.stringKey!==void 0)l=t.operand.stringKey;else if(a&&t.operand.index?.type==="ArithVariable"&&!t.operand.index.hasDollarPrefix)l=t.operand.index.name;else if(a&&t.operand.index?.type==="ArithVariable"&&t.operand.index.hasDollarPrefix)l=await Ve(e,t.operand.index.name);else if(t.operand.index){let f=await s(t.operand.index);l=String(f)}else return i;let c=Number.parseInt(Ye(e,o,l)||"0",10)||0,u=t.operator==="++"?c+1:c-1;return be(e,o,l,String(u),a?"associative":"indexed"),t.prefix?u:c}if(t.operand.type==="ArithConcat"){let o="";for(let a of t.operand.parts)o+=await Yi(e,a,n,r);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=t.operator==="++"?a+1:a-1;return e.state.env.set(o,String(l)),t.prefix?l:a}}if(t.operand.type==="ArithDynamicElement"){let o="";if(t.operand.nameExpr.type==="ArithConcat")for(let a of t.operand.nameExpr.parts)o+=await Yi(e,a,n,r);else t.operand.nameExpr.type==="ArithVariable"&&(o=t.operand.nameExpr.hasDollarPrefix?await Ve(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(o&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){let a=await s(t.operand.subscript),l=Number.parseInt(Ye(e,o,a)||"0",10)||0,c=t.operator==="++"?l+1:l-1;return be(e,o,a,String(c)),t.prefix?c:l}}return i}return eT(i,t.operator)}case"ArithTernary":return await s(t.condition)?await s(t.consequent):await s(t.alternate);case"ArithAssignment":{let i=t.variable,o=i,a;if(t.stringKey!==void 0)a=t.stringKey;else if(t.subscript){let d=e.state.associativeArrays?.has(i);if(d&&t.subscript.type==="ArithVariable"&&!t.subscript.hasDollarPrefix)a=t.subscript.name;else if(d&&t.subscript.type==="ArithVariable"&&t.subscript.hasDollarPrefix)a=await Ve(e,t.subscript.name)||"\\";else if(d){let p=await s(t.subscript);a=String(p)}else{let p=await s(t.subscript);if(p<0){let h=Ee(e,i);h.length>0&&(p=Math.max(...h.map(([g])=>typeof g=="number"?g:0))+1+p)}a=String(p)}}let l=a===void 0?e.state.env.get(o):Ye(e,i,a),c=Number.parseInt(l||"0",10)||0,u=await s(t.value),f=b3(c,u,t.operator);return a===void 0?e.state.env.set(o,String(f)):be(e,i,a,String(f),e.state.associativeArrays?.has(i)?"associative":"indexed"),f}case"ArithGroup":return await s(t.expression);case"ArithConcat":{let i="";for(let o of t.parts)i+=await Yi(e,o,n,r);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?await bp(e,i,r):Number.parseInt(i,10)||0}case"ArithDynamicAssignment":{let i="";if(t.target.type==="ArithConcat")for(let u of t.target.parts)i+=await Yi(e,u,n,r);else t.target.type==="ArithVariable"&&(i=t.target.hasDollarPrefix?await Ve(e,t.target.name):t.target.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=i;if(t.subscript){let u=await s(t.subscript);o=`${i}_${u}`}let a=Number.parseInt(e.state.env.get(o)||"0",10)||0,l=await s(t.value),c=b3(a,l,t.operator);return e.state.env.set(o,String(c)),c}case"ArithDynamicElement":{let i="";if(t.nameExpr.type==="ArithConcat")for(let c of t.nameExpr.parts)i+=await Yi(e,c,n,r);else t.nameExpr.type==="ArithVariable"&&(i=t.nameExpr.hasDollarPrefix?await Ve(e,t.nameExpr.name):t.nameExpr.name);if(!i||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i))return 0;let o=await s(t.subscript),a=`${i}_${o}`,l=e.state.env.get(a);return l!==void 0?gc(e,a,l,r):0}default:return 0}}async function Yi(e,t,n=!1,r=x3()){switch(t.type){case"ArithNumber":return String(t.value);case"ArithSingleQuote":return String(await Ji(e,t,n,r));case"ArithVariable":return t.hasDollarPrefix?await Ve(e,t.name):t.name;case"ArithSpecialVar":return await Ve(e,t.name);case"ArithBracedExpansion":return await yc(e,t.content);case"ArithCommandSubst":return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():"0";case"ArithConcat":{let s="";for(let i of t.parts)s+=await Yi(e,i,n,r);return s}default:return String(await Ji(e,t,n,r))}}kt();G();async function E3(e,t){let n="",r=0;for(let E of t.parts){let A=E.type==="Literal"?E.value:"\0",I=M(A);if(I>e.limits.maxStringLength-r)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");n+=A,r+=I}let s=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(\+?=)\(/);if(!s||!n.endsWith(")"))return null;let i=s[1],o=s[2],a=[],l=[],c=!1,u="",f=0,d=0,p=!1,h=!0,m=E=>{let A=M(E);if(A>e.limits.maxStringLength-d-f)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");u+=E,f+=A},g=(E,A=!1)=>{if(a.length>=e.limits.maxArrayElements)throw new C(`array assignment element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let I=M(E);if(I>e.limits.maxStringLength-d)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");a.push(E),l.push(A),d+=I},b=()=>{g(u,h),u="",f=0,p=!1,h=!0};for(let E of t.parts)if(E.type==="Literal"){let A=E.value;if(!c){let I=A.indexOf("=(");I!==-1&&(c=!0,A=A.slice(I+2))}if(c){A.endsWith(")")&&(A=A.slice(0,-1));for(let I of A)/\s/.test(I)?(u||p)&&b():m(I)}}else if(c)if(E.type==="BraceExpansion")if(/^\[.+\]=/.test(u))m(Gi({type:"Word",parts:[E]}));else{(u||p)&&b();let I=await br(e,{type:"Word",parts:[E]});for(let R of I.values)g(R)}else{(E.type==="SingleQuoted"||E.type==="DoubleQuoted"||E.type==="Escaped")&&(p=!0),h=!1;let A=await ze(e,{type:"Word",parts:[E]});m(A)}(u||p)&&b();let y=a.splice(0),w=l.splice(0);d=0;for(let E=0;E<y.length;E++){let A=y[E];if(!w[E]){g(A);continue}let I=A.match(/^(\[[^\]]+\]=)(.*)$/s);if(I){let R=ys(e,I[2]);A=I[1]+R}if(A.includes("{")&&A.includes("}")){let R=new xe().parseWordFromString(A,!1,!1);if(R.parts.some(N=>N.type==="BraceExpansion")){let N=await br(e,R);for(let $ of N.values)g($);continue}}g(A)}let x=[`${i}${o}(`],S=M(x[0]);for(let E=0;E<a.length;E++){let A=a[E],I,R=A.match(/^(\[[^\]]+\]=)(.*)$/s);if(R){let T=R[2].replace(/\\/g,"\\\\").replace(/"/g,'\\"');I=`${R[1]}"${T}"`}else A===""?I="''":/[\s"'\\$`!*?[\]{}|&;<>()]/.test(A)&&!A.startsWith("'")&&!A.startsWith('"')?I=`'${A.replace(/'/g,"'\\''")}'`:I=A;let N=`${E>0?" ":""}${I}`,$=M(N);if($+1>e.limits.maxStringLength-S)throw new C(`array assignment string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");x.push(N),S+=$}return x.push(")"),x.join("")}async function S3(e,t){let n=-1,r=-1,s=!1;for(let m=0;m<t.parts.length;m++){let g=t.parts[m];if(g.type==="Literal"){let b=g.value.indexOf("+=");if(b!==-1){let w=g.value.slice(0,b);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)){n=m,r=b,s=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=b,s=!0;break}}let y=g.value.indexOf("=");if(y!==-1&&(y===0||g.value[y-1]!=="+")){let w=g.value.slice(0,y);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(w)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(w)){n=m,r=y;break}}}}if(n===-1)return null;let i=t.parts.slice(0,n),o=t.parts[n];if(o.type!=="Literal")return null;let a=s?2:1,l=o.value.slice(0,r),c=o.value.slice(r+a),u=t.parts.slice(n+1),f="";for(let m of i)f+=await ze(e,{type:"Word",parts:[m]});f+=l;let d={type:"Word",parts:c!==""?[{type:"Literal",value:c},...u]:u},p=d.parts.length>0?await ze(e,d):"";return`${f}${s?"+=":"="}${p}`}var rT=["tar","yq","xan","sqlite3","python3","python"];function A3(e){return rT.includes(e)}ue();vt();Tn();vr();mn();Vs();Os();qi();G();G();var Me=Object.freeze({stdout:"",stderr:"",exitCode:0,internalStdinConsumed:0});function De(e=""){return{stdout:e,stderr:"",exitCode:0}}function K(e,t=1){return{stdout:"",stderr:e,exitCode:t}}function X(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function $t(e){return{stdout:"",stderr:"",exitCode:e?0:1,internalStdinConsumed:0}}function bs(e,t,n="",r=""){throw new C(e,t,n,r)}function C3(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new C(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors")}function xp(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Er;return Me}if(t.length>1)throw new we(1,"",`bash: break: too many arguments
923
923
  `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(128,"",`bash: break: ${t[0]}: numeric argument required
924
924
  `);n=r}throw new Yt(n)}async function Ep(e,t){let n,r=!1,s=!1,i=0;for(;i<t.length;)if(t[i]==="--"){i++;break}else if(t[i]==="-L")s=!1,i++;else if(t[i]==="-P")s=!0,i++;else if(t[i].startsWith("-")&&t[i]!=="-")i++;else break;let o=t.slice(i);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 f=e.state.env.get("CDPATH");if(f){let d=f.split(":").filter(p=>p);for(let p of d){let h=p.startsWith("/")?`${p}/${n}`:`${e.state.cwd}/${p}/${n}`;try{if((await e.fs.stat(h)).isDirectory){n=h,r=!0;break}}catch{}}}}let l=(n.startsWith("/")?n:`${e.state.cwd}/${n}`).split("/").filter(f=>f&&f!=="."),c="";for(let f of l)if(f==="..")c=c.split("/").slice(0,-1).join("/")||"/";else{c=c?`${c}/${f}`:`/${f}`;try{if(!(await e.fs.stat(c)).isDirectory)return K(`bash: cd: ${n}: Not a directory
925
925
  `)}catch{return K(`bash: cd: ${n}: No such file or directory
926
926
  `)}}let u=c||"/";if(s)try{u=await e.fs.realpath(u)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=u,e.state.env.set("PWD",e.state.cwd),e.state.env.set("OLDPWD",e.state.previousDir),De(r?`${u}
927
- `:"")}St();ue();qi();mt();G();function Sp(e,t){return e.fs.resolvePath(e.state.cwd,t)}var sT=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function wc(e){return sT.includes(e)}async function bc(e,t,n){let r=Sp(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 iT=["-nt","-ot","-ef"];function xc(e){return iT.includes(e)}async function Ec(e,t,n,r){let s=Sp(e,n),i=Sp(e,r);switch(t){case"-nt":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return o!==null&&(a===null||o.mtime>a.mtime)}case"-ot":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return a!==null&&(o===null||o.mtime<a.mtime)}case"-ef":try{let[o,a]=await Promise.all([e.fs.realpath(s),e.fs.realpath(i)]);if(o===a)return!0;let[l,c]=await Promise.all([e.fs.stat(s),e.fs.stat(i)]);return l.dev!==void 0&&l.ino!==void 0&&c.dev!==void 0&&c.ino!==void 0?l.dev===c.dev&&l.ino===c.ino:l.identity&&c.identity?l.identity===c.identity:!1}catch{return!1}default:return!1}}var oT=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function Sc(e){return oT.has(e)}function Ac(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 la(e){return e==="="||e==="=="||e==="!="}function Cc(e,t,n,r=!1,s=!1,i=!1,o=256){if(r){let l=eo(t,n,s,i,o);return e==="!="?!l:l}if(s){let l=t.toLowerCase()===n.toLowerCase();return e==="!="?!l:l}let a=t===n;return e==="!="?!a:a}var aT=new Set(["-z","-n"]);function kc(e){return aT.has(e)}function vc(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}async function Nc(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let r=n[1],s=n[2];if(e.state.associativeArrays?.has(r)){let a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),cs(e,r,a)}let o;try{let a=new xe,l=Be(a,s);o=await Re(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=_t(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
927
+ `:"")}St();ue();qi();mt();G();function Sp(e,t){return e.fs.resolvePath(e.state.cwd,t)}var sT=["-e","-a","-f","-d","-r","-w","-x","-s","-L","-h","-k","-g","-u","-G","-O","-b","-c","-p","-S","-t","-N"];function wc(e){return sT.includes(e)}async function bc(e,t,n){let r=Sp(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 iT=["-nt","-ot","-ef"];function xc(e){return iT.includes(e)}async function Ec(e,t,n,r){let s=Sp(e,n),i=Sp(e,r);switch(t){case"-nt":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return o!==null&&(a===null||o.mtime>a.mtime)}case"-ot":{let[o,a]=await Promise.all([e.fs.stat(s).catch(()=>null),e.fs.stat(i).catch(()=>null)]);return a!==null&&(o===null||o.mtime<a.mtime)}case"-ef":try{let[o,a]=await Promise.all([e.fs.realpath(s),e.fs.realpath(i)]);if(o===a)return!0;let[l,c]=await Promise.all([e.fs.stat(s),e.fs.stat(i)]);return l.dev!==void 0&&l.ino!==void 0&&c.dev!==void 0&&c.ino!==void 0?l.dev===c.dev&&l.ino===c.ino:l.identity&&c.identity?l.identity===c.identity:!1}catch{return!1}default:return!1}}var oT=new Set(["-eq","-ne","-lt","-le","-gt","-ge"]);function Sc(e){return oT.has(e)}function Ac(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 la(e){return e==="="||e==="=="||e==="!="}function Cc(e,t,n,r=!1,s=!1,i=!1,o=256){if(r){let l=eo(t,n,s,i,o);return e==="!="?!l:l}if(s){let l=t.toLowerCase()===n.toLowerCase();return e==="!="?!l:l}let a=t===n;return e==="!="?!a:a}var aT=new Set(["-z","-n"]);function kc(e){return aT.has(e)}function vc(e,t){switch(e){case"-z":return t==="";case"-n":return t!==""}}async function Nc(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let r=n[1],s=n[2];if(e.state.associativeArrays?.has(r)){let a=s;return(a.startsWith("'")&&a.endsWith("'")||a.startsWith('"')&&a.endsWith('"'))&&(a=a.slice(1,-1)),a=a.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(l,c)=>e.state.env.get(c)||""),cs(e,r,a)}let o;try{let a=new xe,l=Ue(a,s);o=await Re(e,l.expression)}catch{if(/^-?\d+$/.test(s))o=Number.parseInt(s,10);else{let a=e.state.env.get(s);o=a?Number.parseInt(a,10):0}}if(o<0){let a=_t(e,r),l=e.state.currentLine;if(a.length===0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
928
928
  `,!1;if(o=Math.max(...a)+1+o,o<0)return e.state.expansionStderr=(e.state.expansionStderr||"")+`bash: line ${l}: ${r}: bad array subscript
929
- `,!1}return cs(e,r,o)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?$r(e,t).length>0:_t(e,t).length>0}async function xs(e,t){switch(t.type){case"CondBinary":{let n=await Ue(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await Ue(e,t.right);s=Xi(i)}else s=await p3(e,t.right);else la(t.operator)&&!r?s=await h3(e,t.right):s=await Ue(e,t.right);if(la(t.operator)){let i=e.state.shoptOptions.nocasematch;return Cc(t.operator,n,s,!r,i,!0,e.limits.maxCallDepth)}if(Sc(t.operator))return Ac(t.operator,await v3(e,n),await v3(e,s));if(xc(t.operator))return Ec(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=dT(s),l=oe(o,i?"i":"").match(n);if(Ot(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)be(e,"BASH_REMATCH",c,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await Ue(e,t.operand);return wc(t.operator)?bc(e,t.operator,n):kc(t.operator)?vc(t.operator,n):t.operator==="-v"?await Nc(e,n):t.operator==="-o"?Cp(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await Ue(e,t.operand.expression.word)})`!=="":!await xs(e,t.operand);case"CondAnd":return await xs(e,t.left)?await xs(e,t.right):!1;case"CondOr":return await xs(e,t.left)?!0:await xs(e,t.right);case"CondGroup":return await xs(e,t.expression);case"CondWord":return await Ue(e,t.word)!=="";default:return!1}}async function to(e,t){if(t.length===0)return X("","",1);if(t.length===1)return $t(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?K(`test: '(' without matching ')'
929
+ `,!1}return cs(e,r,o)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?$r(e,t).length>0:_t(e,t).length>0}async function xs(e,t){switch(t.type){case"CondBinary":{let n=await ze(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(i=>i.type==="SingleQuoted"||i.type==="DoubleQuoted"||i.type==="Escaped"&&t.operator!=="=~"),s;if(t.operator==="=~")if(r){let i=await ze(e,t.right);s=Xi(i)}else s=await p3(e,t.right);else la(t.operator)&&!r?s=await h3(e,t.right):s=await ze(e,t.right);if(la(t.operator)){let i=e.state.shoptOptions.nocasematch;return Cc(t.operator,n,s,!r,i,!0,e.limits.maxCallDepth)}if(Sc(t.operator))return Ac(t.operator,await v3(e,n),await v3(e,s));if(xc(t.operator))return Ec(e,t.operator,n,s);switch(t.operator){case"=~":try{let i=e.state.shoptOptions.nocasematch,o=dT(s),l=oe(o,i?"i":"").match(n);if(Ot(e,"BASH_REMATCH"),l)for(let c=0;c<l.length;c++)be(e,"BASH_REMATCH",c,l[c]||"");return l!==null}catch{throw new Error("syntax error in regular expression")}case"<":return n<s;case">":return n>s;default:return!1}}case"CondUnary":{let n=await ze(e,t.operand);return wc(t.operator)?bc(e,t.operator,n):kc(t.operator)?vc(t.operator,n):t.operator==="-v"?await Nc(e,n):t.operator==="-o"?Cp(e,n):!1}case"CondNot":return e.state.shoptOptions.extglob&&t.operand.type==="CondGroup"&&t.operand.expression.type==="CondWord"?`!(${await ze(e,t.operand.expression.word)})`!=="":!await xs(e,t.operand);case"CondAnd":return await xs(e,t.left)?await xs(e,t.right):!1;case"CondOr":return await xs(e,t.left)?!0:await xs(e,t.right);case"CondGroup":return await xs(e,t.expression);case"CondWord":return await ze(e,t.word)!=="";default:return!1}}async function to(e,t){if(t.length===0)return X("","",1);if(t.length===1)return $t(!!t[0]);if(t.length===2){let r=t[0],s=t[1];return r==="("?K(`test: '(' without matching ')'
930
930
  `,2):wc(r)?$t(await bc(e,r,s)):kc(r)?$t(vc(r,s)):r==="!"?$t(!s):r==="-v"?$t(await Nc(e,s)):r==="-o"?$t(Cp(e,s)):r==="="||r==="=="||r==="!="||r==="<"||r===">"||r==="-eq"||r==="-ne"||r==="-lt"||r==="-le"||r==="-gt"||r==="-ge"||r==="-nt"||r==="-ot"||r==="-ef"?K(`test: ${r}: unary operator expected
931
931
  `,2):X("","",1)}if(t.length===3){let r=t[0],s=t[1],i=t[2];if(la(s))return $t(Cc(s,r,i));if(Sc(s)){let o=Ic(r),a=Ic(i);return!o.valid||!a.valid?X("","",2):$t(Ac(s,o.value,a.value))}if(xc(s))return $t(await Ec(e,s,r,i));switch(s){case"-a":return $t(r!==""&&i!=="");case"-o":return $t(r!==""||i!=="");case">":return $t(r>i);case"<":return $t(r<i)}if(r==="!"){let o=await to(e,[s,i]);return X("",o.stderr,o.exitCode===0?1:o.exitCode===1?0:o.exitCode)}if(r==="("&&i===")")return $t(s!=="")}if(t.length===4){if(t[0]==="!"){let r=await to(e,t.slice(1));return X("",r.stderr,r.exitCode===0?1:r.exitCode===1?0:r.exitCode)}if(t[0]==="("&&t[3]===")")return to(e,[t[1],t[2]])}let n=await I3(e,t,0);return n.pos<t.length?K(`test: too many arguments
932
- `,2):$t(n.value)}async function I3(e,t,n){return lT(e,t,n)}async function lT(e,t,n){let{value:r,pos:s}=await k3(e,t,n);for(;t[s]==="-o";){let i=await k3(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function k3(e,t,n){let{value:r,pos:s}=await Ap(e,t,n);for(;t[s]==="-a";){let i=await Ap(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Ap(e,t,n){let r=e.executionScope.enterDepth("test_expression",e.limits.maxCallDepth,"test expression");try{if(t[n]==="!"){let{value:s,pos:i}=await Ap(e,t,n+1);return{value:!s,pos:i}}return cT(e,t,n)}finally{r.release()}}async function cT(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await I3(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if(la(s)){let i=r,o=t[n+2]??"";return{value:Cc(s,i,o),pos:n+3}}if(Sc(s)){let i=Ic(r),o=Ic(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ac(s,i.value,o.value),pos:n+3}}if(xc(s)){let i=r,o=t[n+2]??"";return{value:await Ec(e,s,i,o),pos:n+3}}if(wc(r)){let i=t[n+1]??"";return{value:await bc(e,r,i),pos:n+2}}if(kc(r)){let i=t[n+1]??"";return{value:vc(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await Nc(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:Cp(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function eo(e,t,n=!1,r=!1,s=256){r&&uT(t,s);let i=`^${O3(t,r)}$`;return oe(i,n?"is":"s").test(e)}function uT(e,t){let n=0,r=[];for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++;continue}if(e[s]==="("){let i=s>0&&"@*+?!".includes(e[s-1]);if(r.push(i),i&&n++,n>t)throw new C(`extglob maximum depth (${t}) exceeded`,"recursion")}else e[s]===")"&&r.length>0&&r.pop()&&n--}}function O3(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=T3(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=$3(o),l=a.map(u=>O3(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=a.map(p=>R3(p,t));if(f.every(p=>p!==null)&&f.every(p=>p===f[0])&&f[0]!==null){let p=f[0];if(p===0)n+="(?:.+)";else{let h=[];p>0&&h.push(`.{0,${p-1}}`),h.push(`.{${p+1},}`),h.push(`(?!(?:${c})).{${p}}`),n+=`(?:${h.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);i!==-1?(n+=e.slice(r,i+1),r=i):n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function T3(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function $3(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function R3(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=T3(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=$3(o).map(c=>R3(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function Cp(e,t){let r=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 r?r():!1}async function v3(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 N3(t);try{let n=new xe,r=Be(n,t);return await Re(e,r.expression)}catch{return N3(t)}}function fT(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function N3(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 s=Number.parseInt(r[1],10);s>=2&&s<=64?n=fT(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function Ic(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 dT(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=pT(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function pT(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);o+=hT(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let d=e.slice(n+2,f);o+=d,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function hT(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)??""}G();ue();G();function kp(e,t,n){if(n&&e.length>=n.maxElements)throw new C(`array element limit exceeded (${n.maxElements})`,"array_elements");e.push(t)}function Qr(e,t){if(t&&M(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r="",s=!1,i=!1,o=!1,a=!1;for(let l of e){if(o){r+=l,o=!1,a=!0;continue}if(l==="\\"){o=!0;continue}if(l==="'"&&!i){s||(a=!0),s=!s;continue}if(l==='"'&&!s){i||(a=!0),i=!i;continue}if((l===" "||l===" "||l===`
933
- `)&&!s&&!i){a&&(kp(n,r,t),r="",a=!1);continue}r+=l,a=!0}return a&&kp(n,r,t),n}function Oc(e,t){if(t&&M(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;if(e[r]!=="["){r++;continue}r++;let s="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&e[r]!=="]"&&e[r]!=="=";)s+=e[r],r++;for(;r<e.length&&e[r]!=="]";)r++;if(e[r]==="]"&&r++,e[r]!=="=")continue;r++;let i="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)e[r]==="\\"&&r+1<e.length&&r++,i+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&!/\s/.test(e[r]);)i+=e[r],r++;kp(n,[s,i],t)}return n}function P3(e,t){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(n)return{name:n[1],isArray:!0,arrayElements:Qr(n[2],t)};let r=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(r)return{name:r[1],isArray:!1,arrayIndex:r[2],value:r[3]};if(e.includes("=")){let s=e.indexOf("=");return{name:e.slice(0,s),isArray:!1,value:e.slice(s+1)}}return{name:e,isArray:!1}}async function mT(e,t){try{let n=new xe,r=Be(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function D3(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=it(e,r);if(u)return u}if(s&&i){e.executionScope.consumeWork(i.length,"array assignment");let u=Wt(e,r),f=u?dn(u):void 0,d=e.state.env.get(r);try{Ot(e,r);for(let p=0;p<i.length;p++)be(e,r,p,i[p]);e.state.env.delete(r)}catch(p){throw e.state.arrays??=new Map,f?e.state.arrays.set(r,f):e.state.arrays.delete(r),d===void 0?e.state.env.delete(r):e.state.env.set(r,d),p}}else if(a!==void 0&&o!==void 0){let u=await mT(e,a);be(e,r,u,o)}else o!==void 0&&e.state.env.set(r,o);return l&&In(e,r),null}function Es(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function vp(e,t){return e.state.localVarDepth?.get(t)}function Tc(e,t){e.state.localVarDepth?.delete(t)}function L3(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 $c(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function F3(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)}}G();ue();Un();G();var Np="__file__:",Ip="__file_append__:",$p="__rw__:",Op="__dupout__:",Tp="__dupin__:",Rt=3;function gT(e){let t=e.slice($p.length),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 s=n+1,i=t.slice(s,s+r),o=t.slice(s+r+1),a=o.indexOf(":");if(a===-1)return null;let l=Number.parseInt(o.slice(0,a),10);return Number.isNaN(l)||l<0?null:{path:i,position:l,content:o.slice(a+1)}}function M3(e,t){let n=Number.parseInt(e.slice(t.length),10);return Number.isNaN(n)?null:n}function yT(e){if(e.startsWith(Np))return{kind:"output",path:e.slice(Np.length),append:!1};if(e.startsWith(Ip))return{kind:"output",path:e.slice(Ip.length),append:!0};if(e.startsWith($p)){let t=gT(e);if(t)return{kind:"readwrite",...t}}if(e.startsWith(Op)){let t=M3(e,Op);if(t!==null)return{kind:"dup-out",sourceFd:t}}if(e.startsWith(Tp)){let t=M3(e,Tp);if(t!==null)return{kind:"dup-in",sourceFd:t}}return{kind:"input",content:e}}function Rp(e){switch(e.kind){case"input":return e.content;case"output":return`${e.append?Ip:Np}${e.path}`;case"readwrite":return`${$p}${e.path.length}:${e.path}:${e.position}:${e.content}`;case"dup-out":return`${Op}${e.sourceFd}`;case"dup-in":return`${Tp}${e.sourceFd}`;case"closed":throw new Error("Closed descriptors have no table encoding")}}function wT(e){return e.state.fileDescriptors??=new Map,e.state.fileDescriptors}function bT(e,t,n){n?(e.state.inputFds??=new Set,e.state.inputFds.add(t)):e.state.inputFds?.delete(t)}function no(e,t){return e.state.fdAliases?.get(t)}function Ss(e,t){return[...no(e,t)??[t]]}function _3(e,t){let n=no(e,t);if(n&&(n.delete(t),e.state.fdAliases?.delete(t),n.size<2))for(let r of n)e.state.fdAliases?.delete(r)}function Pp(e,t,n){if(t===n)return;e.state.fdAliases??=new Map;let r=no(e,n)??new Set([n]);r.add(t);for(let s of r)e.state.fdAliases.set(s,r)}function Rc(e,t){return e.state.fileDescriptors?.get(t)}function Ln(e,t){let n=Rc(e,t);if(n!==void 0)return e.state.inputFds?.has(t)?{kind:"input",content:n}:yT(n)}function ci(e,t){return e.state.fileDescriptors?.has(t)===!0}function Dp(e,t,n,r){let s=wT(e);s.has(t)||C3(e),s.set(t,n),bT(e,t,r)}function Pc(e,t,n,r=!1){_3(e,t),Dp(e,t,n,r)}function er(e,t,n){Pc(e,t,Rp(n),n.kind==="input")}function Lr(e,t){e.state.fileDescriptors?.delete(t),e.state.inputFds?.delete(t),_3(e,t)}function Dc(e,t,n){let r=Rc(e,n);return r===void 0?!1:(Pc(e,t,r,e.state.inputFds?.has(n)===!0),Pp(e,t,n),!0)}function Lp(e,t,n){let r=Rc(e,n);if(r===void 0)return!1;if(t===n)return!0;let s=e.state.inputFds?.has(n)===!0,i=[...no(e,n)??[]].filter(a=>a!==n);Lr(e,n),Pc(e,t,r,s);let o=i.find(a=>ci(e,a));return o!==void 0&&Pp(e,t,o),!0}function Lc(e,t){let n=Ln(e,t);if(n===void 0)return{error:"not-open"};switch(n.kind){case"input":return{content:n.content};case"readwrite":return{content:n.content.slice(n.position)};case"output":case"dup-out":return{error:"write-only"};case"dup-in":return{error:"not-open"};case"closed":return{error:"not-open"}}}function As(e,t,n){let r=Ln(e,t);if(r===void 0)return;let s;if(r.kind==="input")s={kind:"input",content:r.content.slice(n)};else if(r.kind==="readwrite")s={...r,position:r.position+n};else return;let i=Rp(s),o=s.kind==="input";for(let a of no(e,t)??[t])Dp(e,a,i,o)}async function Fp(e,t,n,r,s){if(t.kind==="output")return await e.fs.appendFile(t.path,r,s),!0;let o=n.map(u=>Ln(e,u)).find(u=>u?.kind==="readwrite")??t;if(o.kind!=="readwrite")return!1;let a=o.content.slice(0,o.position)+r+o.content.slice(o.position+r.length),l={...o,position:o.position+r.length,content:a};await e.fs.writeFile(o.path,a,s);let c=Rp(l);for(let u of n)ci(e,u)&&Dp(e,u,c,!1);return!0}function Cs(e,t,n){if(t.has(n))return;let r=no(e,n);t.set(n,{raw:Rc(e,n),isInput:e.state.inputFds?.has(n)===!0,aliases:r?[...r].filter(s=>s!==n):[]})}function Fc(e,t){let n=e.state.fileDescriptors;if(n)for(let[r,{raw:s,isInput:i,aliases:o}]of t){if(s===void 0){Lr(e,r);continue}Pc(e,r,s,i);let a=o.find(l=>n.has(l));a!==void 0&&Pp(e,r,a)}}function Mp(e){switch(e.operator){case"<":case"<>":case"<<":case"<<-":case"<<<":case"<&":return e.fd??0;case">":case">>":case">|":case">&":return e.fd??1;default:return null}}function B3(e){if(e.fdVariable)return!1;let t=Mp(e);return t!==null&&t>=Rt}async function xT(e,t,n,r){try{if(!await e.fs.exists(t))return null;if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
932
+ `,2):$t(n.value)}async function I3(e,t,n){return lT(e,t,n)}async function lT(e,t,n){let{value:r,pos:s}=await k3(e,t,n);for(;t[s]==="-o";){let i=await k3(e,t,s+1);r=r||i.value,s=i.pos}return{value:r,pos:s}}async function k3(e,t,n){let{value:r,pos:s}=await Ap(e,t,n);for(;t[s]==="-a";){let i=await Ap(e,t,s+1);r=r&&i.value,s=i.pos}return{value:r,pos:s}}async function Ap(e,t,n){let r=e.executionScope.enterDepth("test_expression",e.limits.maxCallDepth,"test expression");try{if(t[n]==="!"){let{value:s,pos:i}=await Ap(e,t,n+1);return{value:!s,pos:i}}return cT(e,t,n)}finally{r.release()}}async function cT(e,t,n){let r=t[n];if(r==="("){let{value:i,pos:o}=await I3(e,t,n+1);return{value:i,pos:t[o]===")"?o+1:o}}let s=t[n+1];if(la(s)){let i=r,o=t[n+2]??"";return{value:Cc(s,i,o),pos:n+3}}if(Sc(s)){let i=Ic(r),o=Ic(t[n+2]??"0");return!i.valid||!o.valid?{value:!1,pos:n+3}:{value:Ac(s,i.value,o.value),pos:n+3}}if(xc(s)){let i=r,o=t[n+2]??"";return{value:await Ec(e,s,i,o),pos:n+3}}if(wc(r)){let i=t[n+1]??"";return{value:await bc(e,r,i),pos:n+2}}if(kc(r)){let i=t[n+1]??"";return{value:vc(r,i),pos:n+2}}if(r==="-v"){let i=t[n+1]??"";return{value:await Nc(e,i),pos:n+2}}if(r==="-o"){let i=t[n+1]??"";return{value:Cp(e,i),pos:n+2}}return{value:r!==void 0&&r!=="",pos:n+1}}function eo(e,t,n=!1,r=!1,s=256){r&&uT(t,s);let i=`^${O3(t,r)}$`;return oe(i,n?"is":"s").test(e)}function uT(e,t){let n=0,r=[];for(let s=0;s<e.length;s++){if(e[s]==="\\"){s++;continue}if(e[s]==="("){let i=s>0&&"@*+?!".includes(e[s-1]);if(r.push(i),i&&n++,n>t)throw new C(`extglob maximum depth (${t}) exceeded`,"recursion")}else e[s]===")"&&r.length>0&&r.pop()&&n--}}function O3(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=T3(e,r+1);if(i!==-1){let o=e.slice(r+2,i),a=$3(o),l=a.map(u=>O3(u,t)),c=l.length>0?l.join("|"):"(?:)";if(s==="@")n+=`(?:${c})`;else if(s==="*")n+=`(?:${c})*`;else if(s==="+")n+=`(?:${c})+`;else if(s==="?")n+=`(?:${c})?`;else if(s==="!")if(i<e.length-1){let f=a.map(p=>R3(p,t));if(f.every(p=>p!==null)&&f.every(p=>p===f[0])&&f[0]!==null){let p=f[0];if(p===0)n+="(?:.+)";else{let h=[];p>0&&h.push(`.{0,${p-1}}`),h.push(`.{${p+1},}`),h.push(`(?!(?:${c})).{${p}}`),n+=`(?:${h.join("|")})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=i;continue}}if(s==="\\")if(r+1<e.length){let i=e[r+1];/[\\^$.|+(){}[\]*?]/.test(i)?n+=`\\${i}`:n+=i,r++}else n+="\\\\";else if(s==="*")n+=".*";else if(s==="?")n+=".";else if(s==="["){let i=e.indexOf("]",r+1);i!==-1?(n+=e.slice(r,i+1),r=i):n+="\\["}else/[\\^$.|+(){}]/.test(s)?n+=`\\${s}`:n+=s}return n}function T3(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let s=e[r];if(s==="\\"){r+=2;continue}if(s==="(")n++;else if(s===")"&&(n--,n===0))return r;r++}return-1}function $3(e){let t=[],n="",r=0,s=0;for(;s<e.length;){let i=e[s];if(i==="\\"){n+=i,s+1<e.length?(n+=e[s+1],s+=2):s++;continue}i==="("?(r++,n+=i):i===")"?(r--,n+=i):i==="|"&&r===0?(t.push(n),n=""):n+=i,s++}return t.push(n),t}function R3(e,t){let n=0,r=0;for(;r<e.length;){let s=e[r];if(t&&(s==="@"||s==="*"||s==="+"||s==="?"||s==="!")&&r+1<e.length&&e[r+1]==="("){let i=T3(e,r+1);if(i!==-1){if(s==="@"){let o=e.slice(r+2,i),l=$3(o).map(c=>R3(c,t));if(l.every(c=>c!==null)&&l.every(c=>c===l[0])){n+=l[0],r=i+1;continue}return null}return null}}if(s==="*")return null;if(s==="?"){n+=1,r++;continue}if(s==="["){let i=e.indexOf("]",r+1);if(i!==-1){n+=1,r=i+1;continue}n+=1,r++;continue}if(s==="\\"){n+=1,r+=2;continue}n+=1,r++}return n}function Cp(e,t){let r=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 r?r():!1}async function v3(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 N3(t);try{let n=new xe,r=Ue(n,t);return await Re(e,r.expression)}catch{return N3(t)}}function fT(e,t){let n=0;for(let r of e){let s;if(r>="0"&&r<="9")s=r.charCodeAt(0)-48;else if(r>="a"&&r<="z")s=r.charCodeAt(0)-97+10;else if(r>="A"&&r<="Z")s=r.charCodeAt(0)-65+36;else if(r==="@")s=62;else if(r==="_")s=63;else return Number.NaN;if(s>=t)return Number.NaN;n=n*t+s}return n}function N3(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 s=Number.parseInt(r[1],10);s>=2&&s<=64?n=fT(r[2],s):n=0}else/^0[xX][0-9a-fA-F]+$/.test(e)?n=Number.parseInt(e,16):/^0[0-7]+$/.test(e)?n=Number.parseInt(e,8):n=Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function Ic(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 dT(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=pT(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function pT(e,t){let n=t+1,r="[";n<e.length&&(e[n]==="^"||e[n]==="!")&&(r+="^",n++);let s=!1;n<e.length&&e[n]==="]"&&(s=!0,n++);let i=!1;n<e.length&&e[n]==="["&&n+1<e.length&&e[n+1]!==":"&&(i=!0,n++);let o="",a=!1;for(;n<e.length;){let l=e[n];if(l==="]"){a=!0,n++;break}if(l==="["&&n+1<e.length&&e[n+1]===":"){let c=e.indexOf(":]",n+2);if(c!==-1){let u=e.slice(n+2,c);o+=hT(u),n=c+2;continue}}if(l==="["&&n+1<e.length){let c=e[n+1];if(c==="."||c==="="){let u=`${c}]`,f=e.indexOf(u,n+2);if(f!==-1){let d=e.slice(n+2,f);o+=d,n=f+2;continue}}}if(l==="\\"&&n+1<e.length){o+=l+e[n+1],n+=2;continue}o+=l,n++}return a?(s&&(r+="\\]"),i&&(r+="\\["),r+=o,r+="]",{converted:r,endIndex:n}):{converted:"\\[",endIndex:t+1}}function hT(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)??""}G();ue();G();function kp(e,t,n){if(n&&e.length>=n.maxElements)throw new C(`array element limit exceeded (${n.maxElements})`,"array_elements");e.push(t)}function Qr(e,t){if(t&&M(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r="",s=!1,i=!1,o=!1,a=!1;for(let l of e){if(o){r+=l,o=!1,a=!0;continue}if(l==="\\"){o=!0;continue}if(l==="'"&&!i){s||(a=!0),s=!s;continue}if(l==='"'&&!s){i||(a=!0),i=!i;continue}if((l===" "||l===" "||l===`
933
+ `)&&!s&&!i){a&&(kp(n,r,t),r="",a=!1);continue}r+=l,a=!0}return a&&kp(n,r,t),n}function Oc(e,t){if(t&&M(e)>t.maxStringBytes)throw new C(`array assignment string limit exceeded (${t.maxStringBytes} bytes)`,"string_length");let n=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;if(e[r]!=="["){r++;continue}r++;let s="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&e[r]!=="]"&&e[r]!=="=";)s+=e[r],r++;for(;r<e.length&&e[r]!=="]";)r++;if(e[r]==="]"&&r++,e[r]!=="=")continue;r++;let i="";if(e[r]==="'"||e[r]==='"'){let o=e[r];for(r++;r<e.length&&e[r]!==o;)e[r]==="\\"&&r+1<e.length&&r++,i+=e[r],r++;e[r]===o&&r++}else for(;r<e.length&&!/\s/.test(e[r]);)i+=e[r],r++;kp(n,[s,i],t)}return n}function P3(e,t){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(n)return{name:n[1],isArray:!0,arrayElements:Qr(n[2],t)};let r=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(r)return{name:r[1],isArray:!1,arrayIndex:r[2],value:r[3]};if(e.includes("=")){let s=e.indexOf("=");return{name:e.slice(0,s),isArray:!1,value:e.slice(s+1)}}return{name:e,isArray:!1}}async function mT(e,t){try{let n=new xe,r=Ue(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}async function D3(e,t,n={}){let{name:r,isArray:s,arrayElements:i,value:o,arrayIndex:a}=t,{makeReadonly:l=!1,checkReadonly:c=!0}=n;if(c){let u=it(e,r);if(u)return u}if(s&&i){e.executionScope.consumeWork(i.length,"array assignment");let u=Wt(e,r),f=u?dn(u):void 0,d=e.state.env.get(r);try{Ot(e,r);for(let p=0;p<i.length;p++)be(e,r,p,i[p]);e.state.env.delete(r)}catch(p){throw e.state.arrays??=new Map,f?e.state.arrays.set(r,f):e.state.arrays.delete(r),d===void 0?e.state.env.delete(r):e.state.env.set(r,d),p}}else if(a!==void 0&&o!==void 0){let u=await mT(e,a);be(e,r,u,o)}else o!==void 0&&e.state.env.set(r,o);return l&&In(e,r),null}function Es(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function vp(e,t){return e.state.localVarDepth?.get(t)}function Tc(e,t){e.state.localVarDepth?.delete(t)}function L3(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 $c(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function F3(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)}}G();ue();Un();G();var Np="__file__:",Ip="__file_append__:",$p="__rw__:",Op="__dupout__:",Tp="__dupin__:",Rt=3;function gT(e){let t=e.slice($p.length),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 s=n+1,i=t.slice(s,s+r),o=t.slice(s+r+1),a=o.indexOf(":");if(a===-1)return null;let l=Number.parseInt(o.slice(0,a),10);return Number.isNaN(l)||l<0?null:{path:i,position:l,content:o.slice(a+1)}}function M3(e,t){let n=Number.parseInt(e.slice(t.length),10);return Number.isNaN(n)?null:n}function yT(e){if(e.startsWith(Np))return{kind:"output",path:e.slice(Np.length),append:!1};if(e.startsWith(Ip))return{kind:"output",path:e.slice(Ip.length),append:!0};if(e.startsWith($p)){let t=gT(e);if(t)return{kind:"readwrite",...t}}if(e.startsWith(Op)){let t=M3(e,Op);if(t!==null)return{kind:"dup-out",sourceFd:t}}if(e.startsWith(Tp)){let t=M3(e,Tp);if(t!==null)return{kind:"dup-in",sourceFd:t}}return{kind:"input",content:e}}function Rp(e){switch(e.kind){case"input":return e.content;case"output":return`${e.append?Ip:Np}${e.path}`;case"readwrite":return`${$p}${e.path.length}:${e.path}:${e.position}:${e.content}`;case"dup-out":return`${Op}${e.sourceFd}`;case"dup-in":return`${Tp}${e.sourceFd}`;case"closed":throw new Error("Closed descriptors have no table encoding")}}function wT(e){return e.state.fileDescriptors??=new Map,e.state.fileDescriptors}function bT(e,t,n){n?(e.state.inputFds??=new Set,e.state.inputFds.add(t)):e.state.inputFds?.delete(t)}function no(e,t){return e.state.fdAliases?.get(t)}function Ss(e,t){return[...no(e,t)??[t]]}function _3(e,t){let n=no(e,t);if(n&&(n.delete(t),e.state.fdAliases?.delete(t),n.size<2))for(let r of n)e.state.fdAliases?.delete(r)}function Pp(e,t,n){if(t===n)return;e.state.fdAliases??=new Map;let r=no(e,n)??new Set([n]);r.add(t);for(let s of r)e.state.fdAliases.set(s,r)}function Rc(e,t){return e.state.fileDescriptors?.get(t)}function Ln(e,t){let n=Rc(e,t);if(n!==void 0)return e.state.inputFds?.has(t)?{kind:"input",content:n}:yT(n)}function ci(e,t){return e.state.fileDescriptors?.has(t)===!0}function Dp(e,t,n,r){let s=wT(e);s.has(t)||C3(e),s.set(t,n),bT(e,t,r)}function Pc(e,t,n,r=!1){_3(e,t),Dp(e,t,n,r)}function er(e,t,n){Pc(e,t,Rp(n),n.kind==="input")}function Lr(e,t){e.state.fileDescriptors?.delete(t),e.state.inputFds?.delete(t),_3(e,t)}function Dc(e,t,n){let r=Rc(e,n);return r===void 0?!1:(Pc(e,t,r,e.state.inputFds?.has(n)===!0),Pp(e,t,n),!0)}function Lp(e,t,n){let r=Rc(e,n);if(r===void 0)return!1;if(t===n)return!0;let s=e.state.inputFds?.has(n)===!0,i=[...no(e,n)??[]].filter(a=>a!==n);Lr(e,n),Pc(e,t,r,s);let o=i.find(a=>ci(e,a));return o!==void 0&&Pp(e,t,o),!0}function Lc(e,t){let n=Ln(e,t);if(n===void 0)return{error:"not-open"};switch(n.kind){case"input":return{content:n.content};case"readwrite":return{content:n.content.slice(n.position)};case"output":case"dup-out":return{error:"write-only"};case"dup-in":return{error:"not-open"};case"closed":return{error:"not-open"}}}function As(e,t,n){let r=Ln(e,t);if(r===void 0)return;let s;if(r.kind==="input")s={kind:"input",content:r.content.slice(n)};else if(r.kind==="readwrite")s={...r,position:r.position+n};else return;let i=Rp(s),o=s.kind==="input";for(let a of no(e,t)??[t])Dp(e,a,i,o)}async function Fp(e,t,n,r,s){if(t.kind==="output")return await e.fs.appendFile(t.path,r,s),!0;let o=n.map(u=>Ln(e,u)).find(u=>u?.kind==="readwrite")??t;if(o.kind!=="readwrite")return!1;let a=o.content.slice(0,o.position)+r+o.content.slice(o.position+r.length),l={...o,position:o.position+r.length,content:a};await e.fs.writeFile(o.path,a,s);let c=Rp(l);for(let u of n)ci(e,u)&&Dp(e,u,c,!1);return!0}function Cs(e,t,n){if(t.has(n))return;let r=no(e,n);t.set(n,{raw:Rc(e,n),isInput:e.state.inputFds?.has(n)===!0,aliases:r?[...r].filter(s=>s!==n):[]})}function Fc(e,t){let n=e.state.fileDescriptors;if(n)for(let[r,{raw:s,isInput:i,aliases:o}]of t){if(s===void 0){Lr(e,r);continue}Pc(e,r,s,i);let a=o.find(l=>n.has(l));a!==void 0&&Pp(e,r,a)}}function Mp(e){switch(e.operator){case"<":case"<>":case"<<":case"<<-":case"<<<":case"<&":return e.fd??0;case">":case">>":case">|":case">&":return e.fd??1;default:return null}}function B3(e){if(e.fdVariable)return!1;let t=Mp(e);return t!==null&&t>=Rt}async function xT(e,t,n,r){try{if(!await e.fs.exists(t))return null;if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
934
934
  `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!=="/dev/null")return`bash: ${n}: cannot overwrite existing file
935
935
  `}catch{return`bash: ${n}: cannot open redirect target
936
936
  `}return null}function U3(e){let n=Math.min(e.length,8192);for(let r=0;r<n;r++)if(e.charCodeAt(r)>127)return"utf8";return"binary"}var ca="scoped",W3="bare",j3="persistent",ET=e=>new C(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,"file_descriptors"),ST=(e,t)=>ci(e,t)||(e.state.fileDescriptors?.size??0)<e.limits.maxFileDescriptors,z3=e=>{let t=Math.max(e.state.nextFd??10,10);for(;ci(e,t);)t+=1;return t},Mc=e=>{let t=e.endsWith("-"),n=t?e.slice(0,-1):e;return/^\d+$/.test(n)?{sourceFd:Number.parseInt(n,10),move:t}:null},AT=(e,t,n)=>{let r=Ln(e,t);return t<Rt?r?{kind:"entry",entry:r,descriptors:Ss(e,t)}:{kind:"standard",fd:t}:r?n?r.kind==="input"||r.kind==="readwrite"||r.kind==="dup-in"?{kind:"entry",entry:r,descriptors:Ss(e,t)}:null:r.kind==="output"||r.kind==="readwrite"||r.kind==="dup-out"?{kind:"entry",entry:r,descriptors:Ss(e,t)}:null:null};async function ro(e,t,n,r){let s=e.fs.resolvePath(e.state.cwd,t),i=await xT(e,s,t,{checkNoclobber:!n,isClobber:r});if(i)return{error:X("",i,1)};if(t==="/dev/full")return{error:X("",`bash: /dev/full: No space left on device
937
937
  `,1)};if(t==="/dev/stdout")return{entry:{kind:"dup-out",sourceFd:1}};if(t==="/dev/stderr")return{entry:{kind:"dup-out",sourceFd:2}};try{n?await e.fs.appendFile(s,"","binary"):await e.fs.writeFile(s,"","binary")}catch(o){let a="cannot open redirect target";return ht(o,"EROFS")?a="Read-only file system":ht(o,"EACCES")?a="Permission denied":ht(o,"ENOENT")?a="No such file or directory":ht(o,"EISDIR")&&(a="Is a directory"),{error:X("",`bash: ${t}: ${a}
938
938
  `,1)}}return{entry:{kind:"output",path:s,append:n}}}async function _p(e,t,n){let r=e.fs.resolvePath(e.state.cwd,t);try{let s=await e.fs.readFile(r);return n?{entry:{kind:"readwrite",path:r,position:0,content:s}}:{entry:{kind:"input",content:s}}}catch{if(!n)return{error:X("",`bash: ${t}: No such file or directory
939
939
  `,1)};try{return await e.fs.writeFile(r,"","binary"),{entry:{kind:"readwrite",path:r,position:0,content:""}}}catch{return{error:X("",`bash: ${t}: No such file or directory
940
- `,1)}}}}var CT=async(e,t)=>{let n=await Ue(e,t.content);return t.stripTabs?n.split(`
940
+ `,1)}}}}var CT=async(e,t)=>{let n=await ze(e,t.content);return t.stripTabs?n.split(`
941
941
  `).map(r=>r.replace(/^\t+/,"")).join(`
942
942
  `):n};async function kT(e,t,n,r){let s=new Map,i=new Map,o=(y,w)=>e.state.closedStandardFds?.has(y)?{kind:"closed"}:Ln(e,y)??w,a=new Map([[0,o(0,{kind:"dup-in",sourceFd:0})],[1,o(1,{kind:"dup-out",sourceFd:1})],[2,o(2,{kind:"dup-out",sourceFd:2})]]),l=r.numericSnapshot,c,u=-1,f=a.get(0);f?.kind==="input"?(c=f.content,u=0):f?.kind==="readwrite"&&(c=f.content.slice(f.position),u=0);let d=()=>({targets:s,dupSources:i,standardRoutes:a,stdin:c,stdinSourceFd:u,error:null}),p=async(y,w,x)=>{let S={...d(),error:await ks(e,y,t.slice(0,w),s,i,a)};return x?{...S,errorCause:x}:S},h=async(y,w)=>{if(ST(e,y))return null;let x=ET(e);return p(X("",x.stderr,C.EXIT_CODE),w,x)},m=(y,w)=>{y!==null&&y<Rt&&a.set(y,w),r.policy==="persistent"&&y!==null&&y<Rt&&(e.state.closedStandardFds?.delete(y),er(e,y,w))},g=(y,w)=>{a.set(y,w),Cs(e,r.standardSnapshot,y),r.standardClosedSnapshot.has(y)||r.standardClosedSnapshot.set(y,e.state.closedStandardFds?.has(y)===!0),e.state.closedStandardFds?.delete(y),er(e,y,w)},b=(y,w)=>{if(y<Rt){let x=a.get(y);return x?.kind==="closed"?null:x?{kind:"entry",entry:x,descriptors:Ss(e,y)}:{kind:"standard",fd:y}}return AT(e,y,w)};for(let y=0;y<t.length;y++){let w=t[y],x=Mp(w);if(w.target.type==="HereDoc"){let A=await CT(e,w.target);if(w.fdVariable){try{it(e,w.fdVariable)}catch(N){if(!(N instanceof we))throw N;return p(X(N.stdout,N.stderr,N.exitCode),y,N)}let I=z3(e),R=await h(I,y);if(R)return R;Cs(e,r.fdVariableSnapshot,I),r.fdVariableEnv.has(w.fdVariable)||r.fdVariableEnv.set(w.fdVariable,e.state.env.get(w.fdVariable)),er(e,I,{kind:"input",content:A}),e.state.env.set(w.fdVariable,String(I)),e.state.nextFd=I+1}else if(x!==null&&x>=Rt){let I=await h(x,y);if(I)return I;Cs(e,l,x),er(e,x,{kind:"input",content:A})}else if(x===0||x===null)c=Mn(A),u=-1,m(x,{kind:"input",content:c});else{let I={kind:"input",content:A};r.policy==="persistent"?m(x,I):g(x,I)}continue}let S,E=w.operator===">&"||w.operator==="<&";if(E){if(yp(e,w.target))return p(X("",`bash: $@: ambiguous redirect
943
- `,1),y);S=await Ue(e,w.target)}else if(w.operator==="<<<")S=await Ue(e,w.target);else{let A=await w3(e,w.target);if("error"in A)return p(X("",A.error,1),y);S=A.target}if(s.set(y,S),S.includes("\0"))return p(X("",`bash: ${S.replace(/\0/g,"")}: No such file or directory
943
+ `,1),y);S=await ze(e,w.target)}else if(w.operator==="<<<")S=await ze(e,w.target);else{let A=await w3(e,w.target);if("error"in A)return p(X("",A.error,1),y);S=A.target}if(s.set(y,S),S.includes("\0"))return p(X("",`bash: ${S.replace(/\0/g,"")}: No such file or directory
944
944
  `,1),y);if(w.fdVariable){try{it(e,w.fdVariable)}catch(T){if(!(T instanceof we))throw T;return p(X(T.stdout,T.stderr,T.exitCode),y,T)}if(E&&S==="-"){let T=Number.parseInt(e.state.env.get(w.fdVariable)??"",10);Number.isNaN(T)||(Cs(e,r.fdVariableSnapshot,T),Lr(e,T));continue}let A=z3(e),I=E?Mc(S):null;if(I&&!b(I.sourceFd,w.operator==="<&"))return p(X("",`bash: ${I.sourceFd}: Bad file descriptor
945
945
  `,1),y);if(!(I?.move===!0&&I.sourceFd>=Rt)){let T=await h(A,y);if(T)return T}Cs(e,r.fdVariableSnapshot,A),r.fdVariableEnv.has(w.fdVariable)||r.fdVariableEnv.set(w.fdVariable,e.state.env.get(w.fdVariable));let N,$;if(E){let T=I;if(T){let _=b(T.sourceFd,w.operator==="<&");if(!_)return p(X("",`bash: ${T.sourceFd}: Bad file descriptor
946
946
  `,1),y);$=T,_.kind==="standard"?N={kind:w.operator==="<&"?"dup-in":"dup-out",sourceFd:_.fd}:T.sourceFd<Rt&&(N=_.entry)}else{if(w.operator==="<&")return p(X("",`bash: ${S}: ambiguous redirect
@@ -960,7 +960,7 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
960
960
  `,1),y)}}else if(w.operator==="<>"){let A=await _p(e,S,!0);if(A.error)return p(A.error,y);let I=A.entry;m(x,I),x===0&&I.kind==="readwrite"&&(c=I.content,u=-1)}}return d()}function so(e,t,n){let r={numericSnapshot:new Map,fdVariableSnapshot:new Map,standardSnapshot:new Map,standardClosedSnapshot:new Map,fdVariableEnv:new Map,nextFd:e.state.nextFd,policy:n},s=!1;return{prepare:(i="")=>kT(e,t,i,r),finish:()=>{if(!s){if(s=!0,n!=="persistent"&&Fc(e,r.numericSnapshot),n!=="persistent"){Fc(e,r.standardSnapshot);for(let[i,o]of r.standardClosedSnapshot)o?(e.state.closedStandardFds??=new Set,e.state.closedStandardFds.add(i)):e.state.closedStandardFds?.delete(i)}if(n==="bare"){Fc(e,r.fdVariableSnapshot);for(let[i,o]of r.fdVariableEnv)o===void 0?e.state.env.delete(i):e.state.env.set(i,o);e.state.nextFd=r.nextFd}}}}}function io(e){if(!e.error)throw new Error("Expected a redirection error");if(e.errorCause)throw e.errorCause.stdout=e.error.stdout,e.errorCause.stderr=e.error.stderr,e.errorCause;return e.error}async function Bp(e,t,n,r){let s=t instanceof we||t instanceof zt||t instanceof en?t.exitCode:t instanceof C?C.EXIT_CODE:0,i=await ks(e,X(t.stdout,t.stderr,s),n,r.targets,r.dupSources,r.standardRoutes);t.stdout=i.stdout,t.stderr=i.stderr,t.internalOutputAccounting=i.internalOutputAccounting??{stdout:M(i.stdout),stderr:M(i.stderr)}}async function Fn(e,t,n,r){let s=so(e,t,ca),i;try{if(i=await s.prepare(n),i.error)return io(i);let o=e.state.groupStdin,a=e.state.groupStdinSourceFd;i.stdin!==void 0&&(e.state.groupStdin=i.stdin,e.state.groupStdinSourceFd=i.stdinSourceFd);try{let l=await r(i);return await ks(e,l,t,i.targets,i.dupSources,i.standardRoutes)}finally{i.stdin!==void 0&&(e.state.groupStdin=o,e.state.groupStdinSourceFd=a)}}catch(o){throw!(o instanceof ft)||!i||await Bp(e,o,t,i),o}finally{s.finish()}}async function ks(e,t,n,r,s=new Map,i=new Map,o="bash",a=!1){n.length>0&&(t=e.executionScope.accountResult(t,"redirection"));let{stdout:l,stderr:c,exitCode:u}=t,d=t.stdoutKind==="bytes"||t.stdoutKind===void 0&&t.stdoutEncoding==="binary"?"binary":"utf8",p=x=>d,h={kind:"live-stdout"},m={kind:"live-stderr"},g=x=>{if(!x)return null;if(x.kind==="entry"){if(x.entry.kind==="dup-out"){if(x.entry.sourceFd===1)return{kind:"live-stdout"};if(x.entry.sourceFd===2)return{kind:"live-stderr"}}return x.entry.kind==="output"||x.entry.kind==="readwrite"?{kind:"descriptor",source:x}:null}return x.fd===1?h:x.fd===2?m:null},b=x=>{let S=i.get(x)??Ln(e,x);return S?S.kind==="closed"?{kind:"invalid-output",fd:x}:S.kind==="input"||S.kind==="dup-in"?{kind:"invalid-output",fd:x}:S.kind==="dup-out"?S.sourceFd===1?{kind:"live-stdout"}:S.sourceFd===2?{kind:"live-stderr"}:null:S.kind==="output"||S.kind==="readwrite"?{kind:"descriptor",source:{kind:"entry",entry:S,descriptors:Ss(e,x)}}:null:null};h=b(1)??h,m=b(2)??m;for(let x=0;x<n.length;x++){let S=n[x];if(S.target.type==="HereDoc"||S.fdVariable)continue;let E=r.get(x);if(E!==void 0)switch(S.operator){case">":case">|":case">>":{let A=S.fd??1;if(A!==1&&A!==2)break;let I=S.operator===">>";if(E==="/dev/stdout"){A===2&&(m=h);break}if(E==="/dev/stderr"){A===1&&(h=m);break}if(E==="/dev/full"){c+=`bash: echo: write error: No space left on device
961
961
  `,u=1,A===1&&(l="");break}if(E==="/dev/null"&&A===2){m={kind:"discard"};break}let R=e.fs.resolvePath(e.state.cwd,E);A===1?h={kind:"file",path:R,append:I}:m={kind:"file",path:R,append:I};break}case">&":case"<&":{let A=S.fd??(S.operator==="<&"?0:1);if(A>=Rt||A===0)break;if(E==="-"){A===1?h={kind:"discard"}:m={kind:"discard"};break}let I=g(s.get(x));if(!I)break;S.fd==null&&Mc(E)===null?(h=I,m=I):A===1?h=I:A===2&&(m=I);break}case"&>":{h={kind:"file",path:e.fs.resolvePath(e.state.cwd,E),append:!1},m=h;break}case"&>>":{h={kind:"file",path:e.fs.resolvePath(e.state.cwd,E),append:!0},m=h;break}}}if(l!==""||c!==""){let x=l,S=c;l="",c="",h.kind==="invalid-output"&&x!==""&&(x="",S+=`${a?"":"bash: "}${o}: write error: Bad file descriptor
962
962
  `,u=1),m.kind==="invalid-output"&&(S="");let E=async(A,I,R)=>{A.append?await e.fs.appendFile(A.path,I,R):await e.fs.writeFile(A.path,I,R)};if(h===m&&(h.kind==="file"||h.kind==="descriptor")){let A=x+S;A!==""&&(h.kind==="file"?await E(h,A,p(A)):await Fp(e,h.source.entry,h.source.descriptors,A,p(A)))}else for(let[A,I,R]of[[x,h,!0],[S,m,!1]])if(A!=="")switch(I.kind){case"live-stdout":l+=A;break;case"live-stderr":c+=A;break;case"file":await E(I,A,R?p(A):U3(A));break;case"descriptor":await Fp(e,I.source.entry,I.source.descriptors,A,R?p(A):U3(A));break;case"invalid-output":break;case"discard":break}}let y=X(l,c,u);if(t.stdoutKind&&(y.stdoutKind=t.stdoutKind),t.stdoutEncoding==="binary"&&(y.stdoutEncoding="binary"),t.internalPipeStatusOverride&&(y.internalPipeStatusOverride=t.internalPipeStatusOverride),n.length>0||e.state.fileDescriptors?.has(1)===!0||e.state.fileDescriptors?.has(2)===!0){let x=(t.internalOutputAccounting?.stdout??0)+(t.internalOutputAccounting?.stderr??0),S=M(y.stdout),E=M(y.stderr),A=Math.min(S,x);y.internalOutputAccounting={stdout:A,stderr:Math.min(E,x-A)},e.executionScope.accountResult(y,"redirection")}else t.internalOutputAccounting&&(y.internalOutputAccounting=t.internalOutputAccounting);return y}function H3(e,t){if(e.state.options.posix&&Yo.has(t.name)){let r=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
963
- `;throw new we(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),Fe}async function _c(e,t,n,r="",s,i=!1){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,bs(`${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(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localArrayScopes??=[],e.state.localArrayScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let o=new Map,a=Number.parseInt(e.state.env.get("#")??"0",10),l=Math.max(n.length,a);for(let p=0;p<l;p++){let h=String(p+1);o.set(h,e.state.env.get(h)),p<n.length?e.state.env.set(h,n[p]):e.state.env.delete(h)}o.set("@",e.state.env.get("@")),o.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let c=!1,u=()=>{if(c)return;c=!0;let p=e.state.localScopes.length-1,h=e.state.localScopes.pop(),m=e.state.localArrayScopes?.pop();if(h)for(let[g,b]of h)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);if(m){e.state.arrays??=new Map;for(let[g,b]of m)b===void 0?(e.state.arrays.delete(g),e.state.associativeArrays?.delete(g)):(e.state.arrays.set(g,dn(b)),e.state.associativeArrays??=new Set,b.kind==="associative"?e.state.associativeArrays.add(g):e.state.associativeArrays.delete(g))}if(F3(e,p),e.state.fullyUnsetLocals)for(let[g,b]of e.state.fullyUnsetLocals.entries())b===p&&e.state.fullyUnsetLocals.delete(g);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let g=e.state.localExportedVars.pop();if(g)for(let b of g)e.state.exportedVars?.delete(b)}for(let[g,b]of o)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},f=null,d=so(e,t.redirections,ca);try{if(f=await d.prepare(r),f.error)return io(f);let p=f.stdin??r,h=i||f.stdin!==void 0||r!=="",m=await e.executeCommand(t.body,p,h);return ks(e,m,t.redirections,f.targets,f.dupSources,f.standardRoutes)}catch(p){if(p instanceof ft&&f&&(await Bp(e,p,t.redirections,f),p instanceof zt))return X(p.stdout,p.stderr,p.exitCode);throw p}finally{d.finish(),u()}}kt();G();function Fr(e,t,n,r){let s=n+M(t)+1;if(s>r)throw new C(`shopt: output size limit exceeded (${r} bytes)`,"output_size");return e.push(t),s}var Uc=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],V3=["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"],q3=[...Uc,...V3];function Bc(e){return Uc.includes(e)}function vT(e){return V3.includes(e)}function G3(e,t){let n=e.limits.maxArrayElements;if(t.length>n)throw new C(`shopt: argument limit exceeded (${n})`,"array_elements");let r=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),s=!1,i=!1,o=!1,a=!1,l=!1,c=[],u=0;for(;u<t.length;){let g=t[u];if(g==="--"){u++;break}if(g.startsWith("-")&&g.length>1){for(let b=1;b<g.length;b++){let y=g[b];switch(y){case"s":s=!0;break;case"u":i=!0;break;case"p":o=!0;break;case"q":a=!0;break;case"o":l=!0;break;default:return{exitCode:2,stdout:"",stderr:`shopt: -${y}: invalid option
963
+ `;throw new we(2,"",r)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??"main"};return e.state.functions.set(t.name,n),Me}async function _c(e,t,n,r="",s,i=!1){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,bs(`${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(s??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??"main"),e.state.localScopes.push(new Map),e.state.localArrayScopes??=[],e.state.localArrayScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let o=new Map,a=Number.parseInt(e.state.env.get("#")??"0",10),l=Math.max(n.length,a);for(let p=0;p<l;p++){let h=String(p+1);o.set(h,e.state.env.get(h)),p<n.length?e.state.env.set(h,n[p]):e.state.env.delete(h)}o.set("@",e.state.env.get("@")),o.set("#",e.state.env.get("#")),e.state.env.set("@",n.join(" ")),e.state.env.set("#",String(n.length));let c=!1,u=()=>{if(c)return;c=!0;let p=e.state.localScopes.length-1,h=e.state.localScopes.pop(),m=e.state.localArrayScopes?.pop();if(h)for(let[g,b]of h)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);if(m){e.state.arrays??=new Map;for(let[g,b]of m)b===void 0?(e.state.arrays.delete(g),e.state.associativeArrays?.delete(g)):(e.state.arrays.set(g,dn(b)),e.state.associativeArrays??=new Set,b.kind==="associative"?e.state.associativeArrays.add(g):e.state.associativeArrays.delete(g))}if(F3(e,p),e.state.fullyUnsetLocals)for(let[g,b]of e.state.fullyUnsetLocals.entries())b===p&&e.state.fullyUnsetLocals.delete(g);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let g=e.state.localExportedVars.pop();if(g)for(let b of g)e.state.exportedVars?.delete(b)}for(let[g,b]of o)b===void 0?e.state.env.delete(g):e.state.env.set(g,b);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},f=null,d=so(e,t.redirections,ca);try{if(f=await d.prepare(r),f.error)return io(f);let p=f.stdin??r,h=i||f.stdin!==void 0||r!=="",m=await e.executeCommand(t.body,p,h);return ks(e,m,t.redirections,f.targets,f.dupSources,f.standardRoutes)}catch(p){if(p instanceof ft&&f&&(await Bp(e,p,t.redirections,f),p instanceof zt))return X(p.stdout,p.stderr,p.exitCode);throw p}finally{d.finish(),u()}}kt();G();function Fr(e,t,n,r){let s=n+M(t)+1;if(s>r)throw new C(`shopt: output size limit exceeded (${r} bytes)`,"output_size");return e.push(t),s}var Uc=["extglob","dotglob","nullglob","failglob","globstar","globskipdots","nocaseglob","nocasematch","expand_aliases","lastpipe","xpg_echo"],V3=["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"],q3=[...Uc,...V3];function Bc(e){return Uc.includes(e)}function vT(e){return V3.includes(e)}function G3(e,t){let n=e.limits.maxArrayElements;if(t.length>n)throw new C(`shopt: argument limit exceeded (${n})`,"array_elements");let r=Math.min(e.limits.maxOutputSize,e.limits.maxStringLength),s=!1,i=!1,o=!1,a=!1,l=!1,c=[],u=0;for(;u<t.length;){let g=t[u];if(g==="--"){u++;break}if(g.startsWith("-")&&g.length>1){for(let b=1;b<g.length;b++){let y=g[b];switch(y){case"s":s=!0;break;case"u":i=!0;break;case"p":o=!0;break;case"q":a=!0;break;case"o":l=!0;break;default:return{exitCode:2,stdout:"",stderr:`shopt: -${y}: invalid option
964
964
  `}}}u++}else break}for(;u<t.length;)c.push(t[u]),u++;if(l)return NT(e,c,s,i,o,a);if(s&&i)return{exitCode:1,stdout:"",stderr:`shopt: cannot set and unset shell options simultaneously
965
965
  `};if(c.length===0){if(s||i){let b=[];for(let y of Uc){let w=e.state.shoptOptions[y];s&&w?b.push(o?`shopt -s ${y}`:`${y} on`):i&&!w&&b.push(o?`shopt -u ${y}`:`${y} off`)}return{exitCode:0,stdout:b.length>0?`${b.join(`
966
966
  `)}
@@ -989,7 +989,7 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
989
989
  `,2);u=t[E]}else if(A==="-G"){if(E++,E>=t.length)return K(`compgen: -G: option requires an argument
990
990
  `,2)}else if(A==="--"){p.push(...t.slice(E+1));break}else A.startsWith("-")||p.push(A)}o=p[0]??null;let m=[],g=new Set,b=()=>e.limits.maxArrayElements-m.length,y=E=>{for(let A of E){if(m.length>=e.limits.maxArrayElements)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(M(A)>e.limits.maxStringLength)throw new C(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");e.executionScope.consumeWork(1,"compgen completion"),m.push(A),g.add(A)}};if(l){let E=await Up(e,o,b());y(E)}if(c){let E=await Z3(e,o,b());y(E)}for(let E of n)if(E==="variable"){let A=TT(e,o,b());y(A)}else if(E==="export"){let A=$T(e,o,b());y(A)}else if(E==="function"){let A=RT(e,o,b());y(A)}else if(E==="builtin"){let A=PT(e,o,b());y(A)}else if(E==="keyword"){let A=DT(e,o,b());y(A)}else if(E==="alias"){let A=LT(e,o,b());y(A)}else if(E==="shopt"){let A=FT(e,o,b());y(A)}else if(E==="helptopic"){let A=MT(e,o,b());y(A)}else if(E==="directory"){let A=await Up(e,o,b());y(A)}else if(E==="file"){let A=await Z3(e,o,b());y(A)}else if(E==="user"){let A=_T(e,o,b());y(A)}else if(E==="command"){let A=await BT(e,o,b());y(A)}if(r!==null)try{let E=await UT(e,r),A=zT(e,E,b(),o);for(let I of A)y([I])}catch(E){if(E instanceof C)throw E;return X("","",1)}if(a){let E=await Up(e,o,b(),g);for(let A of E)g.has(A)||y([A])}let w="";if(f!==null){let E=e.state.functions.get(f);if(E){let A=new Map,I=Wt(e,"COMP_WORDS"),R=I?dn(I):void 0;Ot(e,"COMP_WORDS"),Xo(e,"COMP_WORDS"),A.set("COMP_CWORD",e.state.env.get("COMP_CWORD")),e.state.env.set("COMP_CWORD","-1"),A.set("COMP_LINE",e.state.env.get("COMP_LINE")),e.state.env.set("COMP_LINE",""),A.set("COMP_POINT",e.state.env.get("COMP_POINT")),e.state.env.set("COMP_POINT","0");let N=Wt(e,"COMPREPLY"),$=N?dn(N):void 0,T=e.state.env.get("COMPREPLY");Ot(e,"COMPREPLY"),e.state.env.delete("COMPREPLY");let _=["compgen",p[0]??"",""];try{let z=await _c(e,E,_,"");if(z.exitCode!==0)return zp(e,A),oo(e,"COMP_WORDS",R),oo(e,"COMPREPLY",$),T!==void 0&&e.state.env.set("COMPREPLY",T),X("",z.stderr,1);w=z.stdout;let O=WT(e,b());y(O)}catch(z){if(z instanceof C)throw z;return zp(e,A),oo(e,"COMP_WORDS",R),oo(e,"COMPREPLY",$),T!==void 0&&e.state.env.set("COMPREPLY",T),X("","",1)}zp(e,A),oo(e,"COMP_WORDS",R),oo(e,"COMPREPLY",$),T!==void 0&&e.state.env.set("COMPREPLY",T)}}if(d!==null)try{let E=Yn(d),A=await e.executeScript(E);if(A.exitCode!==0)return X("",A.stderr,A.exitCode);if(A.stdout)for(let I of jT(A.stdout))I.length>0&&y([I])}catch(E){if(E.name==="ParseException")return K(`compgen: -C: ${E.message}
991
991
  `,2);throw E}let x=m;if(u!==null){let E=u.startsWith("!"),A=E?u.slice(1):u;x=m.filter(I=>{let R=eo(I,A,!1,!0,e.limits.maxCallDepth);return E?R:!R})}if(x.length===0&&o!==null)return X(w,"",1);let S=new $e(e.limits.maxOutputSize,"compgen");S.append(w);for(let E of x)S.append(s).append(E).append(i).append(`
992
- `);return De(S.build())}function TT(e,t,n){let r=tr(e,t,n);for(let s of e.state.env.keys())/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)&&r.add(s);for(let s of e.state.arrays?.keys()??[])r.add(s);return r.build()}function $T(e,t,n){let r=tr(e,t,n),s=e.state.exportedVars??new Set;for(let i of s)e.state.env.has(i)&&r.add(i);return r.build()}function RT(e,t,n){let r=tr(e,t,n);for(let s of e.state.functions.keys())r.add(s);return r.build()}function PT(e,t,n){let r=tr(e,t,n);for(let s of Wp)r.add(s);return r.build()}function DT(e,t,n){let r=tr(e,t,n);for(let s of X3)r.add(s);return r.build()}function LT(e,t,n){let r=tr(e,t,n);for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);r.add(i)}return r.build()}function FT(e,t,n){let r=tr(e,t,n);for(let s of IT)r.add(s);return r.build()}function MT(e,t,n){let r=tr(e,t,n);for(let s of OT)r.add(s);return r.build()}async function Up(e,t,n=e.limits.maxArrayElements,r){let s=tr(e,null,n,r);try{let i=e.state.cwd,o=t??"";if(t){let l=t.lastIndexOf("/");if(l!==-1){let c=t.slice(0,l)||"/";o=t.slice(l+1),c.startsWith("/")?i=c:i=`${e.state.cwd}/${c}`}}let a=await e.fs.readdir(i);for(let l of a){e.executionScope.consumeWork(1,"compgen directory scan");let c=`${i}/${l}`;try{if((await e.fs.stat(c)).isDirectory&&(!o||l.startsWith(o)))if(t?.includes("/")){let f=t.lastIndexOf("/"),d=t.slice(0,f+1);s.add(d+l)}else s.add(l)}catch(u){if(u instanceof C)throw u}}}catch(i){if(i instanceof C)throw i}return s.build()}async function Z3(e,t,n=e.limits.maxArrayElements){let r=tr(e,null,n);try{let s=e.state.cwd,i=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let l=t.slice(0,a)||"/";i=t.slice(a+1),l.startsWith("/")?s=l:s=`${e.state.cwd}/${l}`}}let o=await e.fs.readdir(s);for(let a of o)if(e.executionScope.consumeWork(1,"compgen file scan"),!i||a.startsWith(i))if(t?.includes("/")){let l=t.lastIndexOf("/"),c=t.slice(0,l+1);r.add(c+a)}else r.add(a)}catch(s){if(s instanceof C)throw s}return r.build()}function _T(e,t,n){let r=tr(e,t,n);return r.add("root"),r.add("nobody"),r.build()}async function BT(e,t,n){let r=tr(e,t,n);for(let i of Wp)r.add(i);for(let i of e.state.functions.keys())r.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&r.add(i.slice(11));for(let i of X3)r.add(i);let s=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of s.split(":"))if(i)try{let o=await e.fs.readdir(i);for(let a of o)r.add(a)}catch(o){if(o instanceof C)throw o}return r.build()}function tr(e,t,n,r){let s=new Set;return{add(i){if(e.executionScope.consumeWork(1,"compgen candidate collection"),!(t!==null&&!i.startsWith(t))&&!r?.has(i)&&!s.has(i)){if(s.size>=n)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(M(i)>e.limits.maxStringLength)throw new C(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");s.add(i)}},build(){return Array.from(s).sort()}}}async function UT(e,t){let r=new xe().parseWordFromString(t,!1,!1);return await Ue(e,J.word(r.parts.map(K3)))}function zT(e,t,n,r){let s=e.state.env.get("IFS")??`
992
+ `);return De(S.build())}function TT(e,t,n){let r=tr(e,t,n);for(let s of e.state.env.keys())/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)&&r.add(s);for(let s of e.state.arrays?.keys()??[])r.add(s);return r.build()}function $T(e,t,n){let r=tr(e,t,n),s=e.state.exportedVars??new Set;for(let i of s)e.state.env.has(i)&&r.add(i);return r.build()}function RT(e,t,n){let r=tr(e,t,n);for(let s of e.state.functions.keys())r.add(s);return r.build()}function PT(e,t,n){let r=tr(e,t,n);for(let s of Wp)r.add(s);return r.build()}function DT(e,t,n){let r=tr(e,t,n);for(let s of X3)r.add(s);return r.build()}function LT(e,t,n){let r=tr(e,t,n);for(let s of e.state.env.keys())if(s.startsWith("BASH_ALIAS_")){let i=s.slice(11);r.add(i)}return r.build()}function FT(e,t,n){let r=tr(e,t,n);for(let s of IT)r.add(s);return r.build()}function MT(e,t,n){let r=tr(e,t,n);for(let s of OT)r.add(s);return r.build()}async function Up(e,t,n=e.limits.maxArrayElements,r){let s=tr(e,null,n,r);try{let i=e.state.cwd,o=t??"";if(t){let l=t.lastIndexOf("/");if(l!==-1){let c=t.slice(0,l)||"/";o=t.slice(l+1),c.startsWith("/")?i=c:i=`${e.state.cwd}/${c}`}}let a=await e.fs.readdir(i);for(let l of a){e.executionScope.consumeWork(1,"compgen directory scan");let c=`${i}/${l}`;try{if((await e.fs.stat(c)).isDirectory&&(!o||l.startsWith(o)))if(t?.includes("/")){let f=t.lastIndexOf("/"),d=t.slice(0,f+1);s.add(d+l)}else s.add(l)}catch(u){if(u instanceof C)throw u}}}catch(i){if(i instanceof C)throw i}return s.build()}async function Z3(e,t,n=e.limits.maxArrayElements){let r=tr(e,null,n);try{let s=e.state.cwd,i=t??"";if(t){let a=t.lastIndexOf("/");if(a!==-1){let l=t.slice(0,a)||"/";i=t.slice(a+1),l.startsWith("/")?s=l:s=`${e.state.cwd}/${l}`}}let o=await e.fs.readdir(s);for(let a of o)if(e.executionScope.consumeWork(1,"compgen file scan"),!i||a.startsWith(i))if(t?.includes("/")){let l=t.lastIndexOf("/"),c=t.slice(0,l+1);r.add(c+a)}else r.add(a)}catch(s){if(s instanceof C)throw s}return r.build()}function _T(e,t,n){let r=tr(e,t,n);return r.add("root"),r.add("nobody"),r.build()}async function BT(e,t,n){let r=tr(e,t,n);for(let i of Wp)r.add(i);for(let i of e.state.functions.keys())r.add(i);for(let i of e.state.env.keys())i.startsWith("BASH_ALIAS_")&&r.add(i.slice(11));for(let i of X3)r.add(i);let s=e.state.env.get("PATH")??"/usr/bin:/bin";for(let i of s.split(":"))if(i)try{let o=await e.fs.readdir(i);for(let a of o)r.add(a)}catch(o){if(o instanceof C)throw o}return r.build()}function tr(e,t,n,r){let s=new Set;return{add(i){if(e.executionScope.consumeWork(1,"compgen candidate collection"),!(t!==null&&!i.startsWith(t))&&!r?.has(i)&&!s.has(i)){if(s.size>=n)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(M(i)>e.limits.maxStringLength)throw new C(`compgen: completion string limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");s.add(i)}},build(){return Array.from(s).sort()}}}async function UT(e,t){let r=new xe().parseWordFromString(t,!1,!1);return await ze(e,J.word(r.parts.map(K3)))}function zT(e,t,n,r){let s=e.state.env.get("IFS")??`
993
993
  `;if(s.length===0){if(r!==null&&!t.startsWith(r))return[];if(n===0)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");return[t]}let i=new Set(s.split("")),o=[],a=u=>{if(!(r!==null&&!u.startsWith(r))){if(o.length>=n)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");o.push(u)}},l="",c=0;for(;c<t.length;){let u=t[c];if(u==="\\"&&c+1<t.length){let f=t[c+1];l+=f,c+=2}else i.has(u)?(l.length>0&&(a(l),l=""),c++):(l+=u,c++)}return l.length>0&&a(l),o}function zp(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function oo(e,t,n){e.state.arrays??=new Map,n?e.state.arrays.set(t,dn(n)):e.state.arrays.delete(t)}function WT(e,t){let n=[],r=s=>{if(n.length>=t)throw new C(`compgen: completion element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");n.push(s)};if(Gt(e,"COMPREPLY")){let s=Ee(e,"COMPREPLY");for(let[,i]of s)r(i)}else{let s=e.state.env.get("COMPREPLY");s!==void 0&&r(s)}return n}function*jT(e){let t=0;for(;t<=e.length;){let n=e.indexOf(`
994
994
  `,t),r=n===-1?e.length:n;if(r>t&&(yield e.slice(t,r)),n===-1)return;t=n+1}}ue();function ua(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function Hp(e){let t="$'";for(let n=0;n<e.length;n++){let r=e[n],s=e.charCodeAt(n);s===7?t+="\\a":s===8?t+="\\b":s===9?t+="\\t":s===10?t+="\\n":s===11?t+="\\v":s===12?t+="\\f":s===13?t+="\\r":s===27?t+="\\e":s===39?t+="\\'":s===92?t+="\\\\":s<32||s===127?t+=`\\${s.toString(8).padStart(3,"0")}`:t+=r}return t+="'",t}function Q3(e){if(ua(e))return Y3(e);if(e==="")return 2;if(/^[a-zA-Z0-9_/.:\-@%+,=]+$/.test(e))return M(e);let t=M(e)+2;for(let n of e)n==="'"&&(t+=3);return t}function Pt(e){return ua(e)?Hp(e):e===""?"''":/^[a-zA-Z0-9_/.:\-@%+,=]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}function zc(e){if(ua(e))return Y3(e);let t=M(e)+2;for(let n of e)(n==="\\"||n==='"'||n==="$"||n==="`")&&t++;return t}function vs(e){return ua(e)?Hp(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`")}"`}function Y3(e){let t=3;for(let n of e){let r=n.codePointAt(0)??0;r===7||r===8||r===9||r===10||r===11||r===12||r===13||r===27||r===39||r===92?t+=2:r<32||r===127?t+=4:t+=M(n)}return t}function fa(e){return ua(e)?Hp(e):`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`")}"`}var HT=["bashdefault","default","dirnames","filenames","noquote","nosort","nospace","plusdirs"];function qp(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,s=!1,i,o,a,l=[],c=[],u=[];for(let f=0;f<t.length;f++){let d=t[f];if(d==="-p")n=!0;else if(d==="-r")r=!0;else if(d==="-D")s=!0;else if(d==="-W"){if(f++,f>=t.length)return K(`complete: -W: option requires an argument
995
995
  `,2);i=t[f]}else if(d==="-F"){if(f++,f>=t.length)return K(`complete: -F: option requires an argument
@@ -1013,7 +1013,7 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
1013
1013
  `,2);s.push(c)}else if(l==="+o"){if(a++,a>=t.length)return K(`compopt: +o: option requires an argument
1014
1014
  `,2);let c=t[a];if(!J3.includes(c))return K(`compopt: ${c}: invalid option name
1015
1015
  `,2);i.push(c)}else if(l==="--"){o.push(...t.slice(a+1));break}else!l.startsWith("-")&&!l.startsWith("+")&&o.push(l)}if(n){let a=e.state.defaultCompletionSpec??{isDefault:!0},l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.defaultCompletionSpec=a,De("")}if(r){let a=e.state.emptyCompletionSpec??Object.create(null),l=new Set(a.options??[]);for(let c of s)l.add(c);for(let c of i)l.delete(c);return a.options=l.size>0?Array.from(l):void 0,e.state.emptyCompletionSpec=a,De("")}if(o.length>0){for(let a of o){let l=e.state.completionSpecs.get(a)??{},c=new Set(l.options??[]);for(let u of s)c.add(u);for(let u of i)c.delete(u);l.options=c.size>0?Array.from(c):void 0,e.state.completionSpecs.set(a,l)}return De("")}return K(`compopt: not currently executing completion function
1016
- `,1)}G();function Zp(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Er;return Fe}if(t.length>1)throw new we(1,"",`bash: continue: too many arguments
1016
+ `,1)}G();function Zp(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Er;return Me}if(t.length>1)throw new we(1,"",`bash: continue: too many arguments
1017
1017
  `);let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<1)throw new we(1,"",`bash: continue: ${t[0]}: numeric argument required
1018
1018
  `);n=r}throw new Jt(n)}St();function eb(e,t){let n="";return e.state.integerVars?.has(t)&&(n+="i"),e.state.lowercaseVars?.has(t)&&(n+="l"),st(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 Kp(e){return Pt(e)}function Xp(e){return`'${e.replace(/'/g,"'\\''")}'`}function tb(e,t){let n="",r="",s=!1;for(let i of t){let o=eb(e,i);if(e.state.associativeArrays?.has(i)){let u=$r(e,i);if(u.length===0)n+=`declare -A ${i}=()
1019
1019
  `;else{let f=u.map(d=>{let p=Ye(e,i,d)??"",h=Kp(p);return`[${Xp(d)}]=${h}`});n+=`declare -A ${i}=(${f.join(" ")})
@@ -1032,7 +1032,7 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
1032
1032
  `}}return De(t)}function sb(e){let t="",n=new Set(Array.from(e.state.arrays??[]).filter(([,s])=>s.kind==="indexed").map(([s])=>s)),r=Array.from(n).sort();for(let s of r){let i=_t(e,s);if(i.length===0)t+=`declare -a ${s}=()
1033
1033
  `;else{let o=i.map(a=>{let l=Ye(e,s,a)??"";return`[${a}]=${vs(l)}`});t+=`declare -a ${s}=(${o.join(" ")})
1034
1034
  `}}return De(t)}function ib(e){let t="",n=new Set;for(let s of e.state.env.keys())s.startsWith("BASH_")||n.add(s);let r=Array.from(n).sort();for(let s of r){if(e.state.associativeArrays?.has(s)||_t(e,s).length>0||Gt(e,s))continue;let a=e.state.env.get(s);a!==void 0&&(t+=`${s}=${Pt(a)}
1035
- `)}return De(t)}function Qp(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function da(e,t){return e.state.integerVars?.has(t)??!1}function Yp(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function VT(e,t){return e.state.lowercaseVars?.has(t)??!1}function Jp(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function qT(e,t){return e.state.uppercaseVars?.has(t)??!1}function ao(e,t,n){return VT(e,t)?n.toLowerCase():qT(e,t)?n.toUpperCase():n}async function ob(e,t){try{let n=new xe,r=Be(n,t),s=await Re(e,r.expression);return String(s)}catch{return"0"}}function GT(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 s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function Wc(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=!1,y=[];for(let N=0;N<t.length;N++){let $=t[N];if($==="-a")r=!0;else if($==="-A")s=!0;else if($==="-r")i=!0;else if($==="-x")o=!0;else if($==="-p")a=!0;else if($==="-n")l=!0;else if($==="+n")c=!0;else if($==="+a")u=!0;else if($==="+x")f=!0;else if($==="--"){y.push(...t.slice(N+1));break}else if($.startsWith("+")){for(let T of $.slice(1))if(T==="n")c=!0;else if(T==="a")u=!0;else if(T==="x")f=!0;else if(T!=="r"){if(T!=="i"){if(!(T==="f"||T==="F"))return X("",`bash: typeset: +${T}: invalid option
1035
+ `)}return De(t)}function Qp(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function da(e,t){return e.state.integerVars?.has(t)??!1}function Yp(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function VT(e,t){return e.state.lowercaseVars?.has(t)??!1}function Jp(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function qT(e,t){return e.state.uppercaseVars?.has(t)??!1}function ao(e,t,n){return VT(e,t)?n.toLowerCase():qT(e,t)?n.toUpperCase():n}async function ob(e,t){try{let n=new xe,r=Ue(n,t),s=await Re(e,r.expression);return String(s)}catch{return"0"}}function GT(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 s=0,i=r+1;for(;r<e.length;r++)if(e[r]==="[")s++;else if(e[r]==="]"&&(s--,s===0))break;if(s!==0)return null;let o=e.slice(i,r);if(r++,e[r]!=="=")return null;r++;let a=e.slice(r);return{name:n,indexExpr:o,value:a}}async function Wc(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},r=!1,s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1,f=!1,d=!1,p=!1,h=!1,m=!1,g=!1,b=!1,y=[];for(let N=0;N<t.length;N++){let $=t[N];if($==="-a")r=!0;else if($==="-A")s=!0;else if($==="-r")i=!0;else if($==="-x")o=!0;else if($==="-p")a=!0;else if($==="-n")l=!0;else if($==="+n")c=!0;else if($==="+a")u=!0;else if($==="+x")f=!0;else if($==="--"){y.push(...t.slice(N+1));break}else if($.startsWith("+")){for(let T of $.slice(1))if(T==="n")c=!0;else if(T==="a")u=!0;else if(T==="x")f=!0;else if(T!=="r"){if(T!=="i"){if(!(T==="f"||T==="F"))return X("",`bash: typeset: +${T}: invalid option
1036
1036
  `,2)}}}else if($==="-i")d=!0;else if($==="-l")p=!0;else if($==="-u")h=!0;else if($==="-f")m=!0;else if($==="-F")g=!0;else if($==="-g")b=!0;else if($.startsWith("-"))for(let T of $.slice(1))if(T==="a")r=!0;else if(T==="A")s=!0;else if(T==="r")i=!0;else if(T==="x")o=!0;else if(T==="p")a=!0;else if(T==="n")l=!0;else if(T==="i")d=!0;else if(T==="l")p=!0;else if(T==="u")h=!0;else if(T==="f")m=!0;else if(T==="F")g=!0;else if(T==="g")b=!0;else return X("",`bash: typeset: -${T}: invalid option
1037
1037
  `,2);else y.push($)}let x=e.state.localScopes.length>0&&!b,S=N=>{if(!x)return;let $=e.state.localScopes[e.state.localScopes.length-1];$.has(N)||$.set(N,e.state.env.get(N))},E=N=>{if(!x)return;let $=e.state.localScopes[e.state.localScopes.length-1];for($.has(N)||$.set(N,e.state.env.get(N)),e.state.localArrayScopes??=[];e.state.localArrayScopes.length<e.state.localScopes.length;)e.state.localArrayScopes.push(new Map);let T=e.state.localArrayScopes.at(-1);if(T&&!T.has(N)){let _=Wt(e,N);T.set(N,_?dn(_):void 0)}},A=N=>{x&&Es(e,N)};if(g){if(y.length===0){let T=Array.from(e.state.functions.keys()).sort(),_="";for(let z of T)_+=`declare -f ${z}
1038
1038
  `;return De(_)}let N=!0,$="";for(let T of y)e.state.functions.has(T)?$+=`${T}
@@ -1042,12 +1042,12 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
1042
1042
  }
1043
1043
  `;return De($)}let N=!0;for(let $ of y)e.state.functions.has($)||(N=!1);return X("","",N?0:1)}if(a&&y.length>0)return tb(e,y);if(a&&y.length===0)return nb(e,{filterExport:o,filterReadonly:i,filterNameref:l,filterIndexedArray:r,filterAssocArray:s});if(y.length===0&&s&&!a)return rb(e);if(y.length===0&&r&&!a)return sb(e);if(y.length===0&&!a)return ib(e);let I="",R=0;for(let N of y){let $=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if($&&!u){let O=$[1],B=$[2],U=it(e,O);if(U)return U;if(s&&_t(e,O).length>0){I+=`bash: declare: ${O}: cannot convert indexed to associative array
1044
1044
  `,R=1;continue}if((r||!s&&!r)&&e.state.associativeArrays?.has(O)){I+=`bash: declare: ${O}: cannot convert associative to indexed array
1045
- `,R=1;continue}let L=s&&B.includes("[")?Oc(B,n):void 0,W=L===void 0?Qr(B,{...n,maxElements:s?n.maxElements*2:n.maxElements}):void 0;if(e.executionScope.consumeWork(L?.length??W?.length??0,"declare array assignment"),E(O),s?(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(O),ls(e,O,"associative")):ls(e,O,"indexed"),Ot(e,O),e.state.env.delete(O),s&&B.includes("["))for(let[D,Q]of L??[])be(e,O,D,ys(e,Q),"associative");else if(s){let D=W??[];for(let Q=0;Q<D.length;Q+=2){let V=D[Q],Y=Q+1<D.length?D[Q+1]:"";be(e,O,V,Y,"associative")}}else{let D=W??[];if(D.some(V=>/^\[[^\]]+\]=/.test(V))){let V=0;for(let Y of D){let ee=Y.match(/^\[([^\]]+)\]=(.*)$/);if(ee){let Se=ee[1],Te=ee[2],Ae;if(/^-?\d+$/.test(Se))Ae=Number.parseInt(Se,10);else try{let pe=new xe,Le=Be(pe,Se);Ae=await Re(e,Le.expression)}catch{Ae=0}be(e,O,Ae,ys(e,Te)),V=Ae+1}else be(e,O,V,Y),V++}}else for(let V=0;V<D.length;V++)be(e,O,V,D[V])}A(O),i&&In(e,O),o&&yr(e,O);continue}if(c){let O=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(n4(e,O),!N.includes("="))continue}if(f){let O=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(ac(e,O),!N.includes("="))continue}let T=GT(N);if(T){let{name:O,indexExpr:B,value:U}=T,L=it(e,O);if(L)return L;E(O);let W;try{let D=new xe,Q=Be(D,B);W=await Re(e,Q.expression)}catch{let D=parseInt(B,10);W=Number.isNaN(D)?0:D}be(e,O,W,U),A(O),i&&In(e,O),o&&yr(e,O);continue}let _=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(_&&!u){let O=_[1],B=_[2],U=it(e,O);if(U)return U;E(O);let L=Qr(B,n);if(e.state.associativeArrays?.has(O)){let W=Oc(B,n);e.executionScope.consumeWork(W.length,"declare array append"),ti(e,O,W.map(([D])=>D));for(let[D,Q]of W)be(e,O,D,Q,"associative")}else{e.executionScope.consumeWork(L.length,"declare array append");let W=_t(e,O),D=0,Q=e.state.env.get(O);W.length===0&&Q!==void 0?(be(e,O,0,Q),e.state.env.delete(O),D=1):W.length>0&&(D=Math.max(...W)+1),ti(e,O,Array.from({length:L.length},(V,Y)=>D+Y));for(let V=0;V<L.length;V++)be(e,O,D+V,L[V])}A(O),i&&In(e,O),o&&yr(e,O);continue}let z=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(z){let O=z[1],B=z[2],U=it(e,O);if(U)return U;S(O),d&&Qp(e,O),p&&Yp(e,O),h&&Jp(e,O);let W=_t(e,O).length>0||e.state.associativeArrays?.has(O);if(da(e,O)){let D=e.state.env.get(O)??"0",Q=parseInt(D,10)||0,V=parseInt(await ob(e,B),10)||0;B=String(Q+V),e.state.env.set(O,B)}else if(W){B=ao(e,O,B);let D=Ye(e,O,0)??"";be(e,O,0,Bn([D,B],"",e.limits.maxStringLength,"declare append"))}else{B=ao(e,O,B);let D=e.state.env.get(O)??"";e.state.env.set(O,Bn([D,B],"",e.limits.maxStringLength,"declare append"))}A(O),i&&In(e,O),o&&yr(e,O),e.state.options.allexport&&!f&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(O));continue}if(N.includes("=")){let O=N.indexOf("="),B=N.slice(0,O),U=N.slice(O+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(B)){I+=`bash: typeset: \`${B}': not a valid identifier
1045
+ `,R=1;continue}let L=s&&B.includes("[")?Oc(B,n):void 0,W=L===void 0?Qr(B,{...n,maxElements:s?n.maxElements*2:n.maxElements}):void 0;if(e.executionScope.consumeWork(L?.length??W?.length??0,"declare array assignment"),E(O),s?(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(O),ls(e,O,"associative")):ls(e,O,"indexed"),Ot(e,O),e.state.env.delete(O),s&&B.includes("["))for(let[D,Q]of L??[])be(e,O,D,ys(e,Q),"associative");else if(s){let D=W??[];for(let Q=0;Q<D.length;Q+=2){let V=D[Q],Y=Q+1<D.length?D[Q+1]:"";be(e,O,V,Y,"associative")}}else{let D=W??[];if(D.some(V=>/^\[[^\]]+\]=/.test(V))){let V=0;for(let Y of D){let ee=Y.match(/^\[([^\]]+)\]=(.*)$/);if(ee){let Se=ee[1],Te=ee[2],Ae;if(/^-?\d+$/.test(Se))Ae=Number.parseInt(Se,10);else try{let pe=new xe,Le=Ue(pe,Se);Ae=await Re(e,Le.expression)}catch{Ae=0}be(e,O,Ae,ys(e,Te)),V=Ae+1}else be(e,O,V,Y),V++}}else for(let V=0;V<D.length;V++)be(e,O,V,D[V])}A(O),i&&In(e,O),o&&yr(e,O);continue}if(c){let O=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(n4(e,O),!N.includes("="))continue}if(f){let O=N.includes("=")?N.slice(0,N.indexOf("=")):N;if(ac(e,O),!N.includes("="))continue}let T=GT(N);if(T){let{name:O,indexExpr:B,value:U}=T,L=it(e,O);if(L)return L;E(O);let W;try{let D=new xe,Q=Ue(D,B);W=await Re(e,Q.expression)}catch{let D=parseInt(B,10);W=Number.isNaN(D)?0:D}be(e,O,W,U),A(O),i&&In(e,O),o&&yr(e,O);continue}let _=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(_&&!u){let O=_[1],B=_[2],U=it(e,O);if(U)return U;E(O);let L=Qr(B,n);if(e.state.associativeArrays?.has(O)){let W=Oc(B,n);e.executionScope.consumeWork(W.length,"declare array append"),ti(e,O,W.map(([D])=>D));for(let[D,Q]of W)be(e,O,D,Q,"associative")}else{e.executionScope.consumeWork(L.length,"declare array append");let W=_t(e,O),D=0,Q=e.state.env.get(O);W.length===0&&Q!==void 0?(be(e,O,0,Q),e.state.env.delete(O),D=1):W.length>0&&(D=Math.max(...W)+1),ti(e,O,Array.from({length:L.length},(V,Y)=>D+Y));for(let V=0;V<L.length;V++)be(e,O,D+V,L[V])}A(O),i&&In(e,O),o&&yr(e,O);continue}let z=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(z){let O=z[1],B=z[2],U=it(e,O);if(U)return U;S(O),d&&Qp(e,O),p&&Yp(e,O),h&&Jp(e,O);let W=_t(e,O).length>0||e.state.associativeArrays?.has(O);if(da(e,O)){let D=e.state.env.get(O)??"0",Q=parseInt(D,10)||0,V=parseInt(await ob(e,B),10)||0;B=String(Q+V),e.state.env.set(O,B)}else if(W){B=ao(e,O,B);let D=Ye(e,O,0)??"";be(e,O,0,Bn([D,B],"",e.limits.maxStringLength,"declare append"))}else{B=ao(e,O,B);let D=e.state.env.get(O)??"";e.state.env.set(O,Bn([D,B],"",e.limits.maxStringLength,"declare append"))}A(O),i&&In(e,O),o&&yr(e,O),e.state.options.allexport&&!f&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(O));continue}if(N.includes("=")){let O=N.indexOf("="),B=N.slice(0,O),U=N.slice(O+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(B)){I+=`bash: typeset: \`${B}': not a valid identifier
1046
1046
  `,R=1;continue}let L=it(e,B);if(L)return L;if(S(B),l){if(U!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(U)){I+=`bash: declare: \`${U}': invalid variable name for name reference
1047
1047
  `,R=1;continue}e.state.env.set(B,U),Xr(e,B),U!==""&&rc(e,U)&&sp(e,B),A(B),i&&In(e,B),o&&yr(e,B);continue}if(d&&Qp(e,B),p&&Yp(e,B),h&&Jp(e,B),da(e,B)&&(U=await ob(e,U)),U=ao(e,B,U),st(e,B)){let W=pn(e,B);W&&W!==B?e.state.env.set(W,U):e.state.env.set(B,U)}else e.state.env.set(B,U);A(B),i&&In(e,B),o&&yr(e,B),e.state.options.allexport&&!f&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(B))}else{let O=N;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(O)){I+=`bash: typeset: \`${O}': not a valid identifier
1048
1048
  `,R=1;continue}if(r||s?E(O):S(O),l){Xr(e,O);let U=e.state.env.get(O);U!==void 0&&U!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(U)?r4(e,O):U&&rc(e,U)&&sp(e,O),A(O),i&&In(e,O),o&&yr(e,O);continue}if(d&&Qp(e,O),p&&Yp(e,O),h&&Jp(e,O),s){if(_t(e,O).length>0){I+=`bash: declare: ${O}: cannot convert indexed to associative array
1049
1049
  `,R=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(O),ls(e,O,"associative")}let B=Gt(e,O);!e.state.env.has(O)&&!B&&(r||s?ls(e,O,s?"associative":"indexed"):(e.state.declaredVars??=new Set,e.state.declaredVars.add(O))),A(O),i&&In(e,O),o&&yr(e,O)}}return X("",I,R)}async function eh(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength},r=!1,s=!1,i=!1,o=[];for(let a=0;a<t.length;a++){let l=t[a];if(l==="-a")r=!0;else if(l==="-A")s=!0;else if(l==="-p")i=!0;else if(l==="--"){o.push(...t.slice(a+1));break}else l.startsWith("-")||o.push(l)}if(o.length===0){let a="",l=Array.from(e.state.readonlyVars||[]).sort();for(let c of l){let u=e.state.env.get(c);if(u!==void 0){let f=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');a+=`declare -r ${c}="${f}"
1050
- `}}return De(a)}for(let a of o){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(l){let d=l[1],p=l[2],h=it(e,d);if(h)return h;let m=Qr(p,n);if(e.state.associativeArrays?.has(d)){let g=Oc(p,n);e.executionScope.consumeWork(g.length,"readonly array append"),ti(e,d,g.map(([b])=>b));for(let[b,y]of g)be(e,d,b,y,"associative")}else{e.executionScope.consumeWork(m.length,"readonly array append");let g=_t(e,d),b=0,y=e.state.env.get(d);g.length===0&&y!==void 0?(be(e,d,0,y),e.state.env.delete(d),b=1):g.length>0&&(b=Math.max(...g)+1),ti(e,d,Array.from({length:m.length},(w,x)=>b+x));for(let w=0;w<m.length;w++)be(e,d,b+w,m[w])}In(e,d);continue}let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(c){let d=c[1],p=c[2],h=it(e,d);if(h)return h;let m=e.state.env.get(d)??"";e.state.env.set(d,Bn([m,p],"",e.limits.maxStringLength,"readonly append")),In(e,d);continue}let u=P3(a,n);if(u.value===void 0&&!u.isArray){In(e,u.name);continue}let f=await D3(e,u,{makeReadonly:!0});if(f)return f}return Fe}function th(e){return e.state.directoryStack??=[],e.state.directoryStack}function pa(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function ZT(e){let t=e.split("/").filter(r=>r&&r!=="."),n=[];for(let r of t)r===".."?n.pop():n.push(r);return`/${n.join("/")}`}async function nh(e,t){let n=th(e),r;for(let a=0;a<t.length;a++){let l=t[a];if(l==="--"){if(a+1<t.length){if(r!==void 0)return K(`bash: pushd: too many arguments
1050
+ `}}return De(a)}for(let a of o){let l=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(l){let d=l[1],p=l[2],h=it(e,d);if(h)return h;let m=Qr(p,n);if(e.state.associativeArrays?.has(d)){let g=Oc(p,n);e.executionScope.consumeWork(g.length,"readonly array append"),ti(e,d,g.map(([b])=>b));for(let[b,y]of g)be(e,d,b,y,"associative")}else{e.executionScope.consumeWork(m.length,"readonly array append");let g=_t(e,d),b=0,y=e.state.env.get(d);g.length===0&&y!==void 0?(be(e,d,0,y),e.state.env.delete(d),b=1):g.length>0&&(b=Math.max(...g)+1),ti(e,d,Array.from({length:m.length},(w,x)=>b+x));for(let w=0;w<m.length;w++)be(e,d,b+w,m[w])}In(e,d);continue}let c=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(c){let d=c[1],p=c[2],h=it(e,d);if(h)return h;let m=e.state.env.get(d)??"";e.state.env.set(d,Bn([m,p],"",e.limits.maxStringLength,"readonly append")),In(e,d);continue}let u=P3(a,n);if(u.value===void 0&&!u.isArray){In(e,u.name);continue}let f=await D3(e,u,{makeReadonly:!0});if(f)return f}return Me}function th(e){return e.state.directoryStack??=[],e.state.directoryStack}function pa(e,t){return t&&e===t?"~":t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function ZT(e){let t=e.split("/").filter(r=>r&&r!=="."),n=[];for(let r of t)r===".."?n.pop():n.push(r);return`/${n.join("/")}`}async function nh(e,t){let n=th(e),r;for(let a=0;a<t.length;a++){let l=t[a];if(l==="--"){if(a+1<t.length){if(r!==void 0)return K(`bash: pushd: too many arguments
1051
1051
  `,2);r=t[a+1],a++}}else{if(l.startsWith("-")&&l!=="-")return K(`bash: pushd: ${l}: invalid option
1052
1052
  `,2);if(r!==void 0)return K(`bash: pushd: too many arguments
1053
1053
  `,2);r=l}}if(r===void 0){if(n.length<2)return K(`bash: pushd: no other directory
@@ -1061,38 +1061,38 @@ ${e.terminator}`}function sO(e){return`(${Jn(e.body)})${hr(e.redirections)}`}fun
1061
1061
  `,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 s=e.state.env.get("HOME")||"",i=`${[r,...n].map(o=>pa(o,s)).join(" ")}
1062
1062
  `;return De(i)}function sh(e,t){let n=th(e),r=!1,s=!1,i=!1,o=!1;for(let u of t)if(u!=="--")if(u.startsWith("-"))for(let f of u.slice(1))if(f==="c")r=!0;else if(f==="l")s=!0;else if(f==="p")i=!0;else if(f==="v")i=!0,o=!0;else return K(`bash: dirs: -${f}: invalid option
1063
1063
  `,2);else return K(`bash: dirs: too many arguments
1064
- `,1);if(r)return e.state.directoryStack=[],Fe;let a=[e.state.cwd,...n],l=e.state.env.get("HOME")||"",c;return o?(c=a.map((u,f)=>{let d=s?u:pa(u,l);return` ${f} ${d}`}).join(`
1064
+ `,1);if(r)return e.state.directoryStack=[],Me;let a=[e.state.cwd,...n],l=e.state.env.get("HOME")||"",c;return o?(c=a.map((u,f)=>{let d=s?u:pa(u,l);return` ${f} ${d}`}).join(`
1065
1065
  `),c+=`
1066
1066
  `):i?c=a.map(u=>s?u:pa(u,l)).join(`
1067
1067
  `)+`
1068
1068
  `:c=a.map(u=>s?u:pa(u,l)).join(" ")+`
1069
1069
  `,De(c)}G();async function ih(e,t,n,r=!1){let s=t;if(s.length>0){let l=s[0];if(l==="--")s=s.slice(1);else if(l.startsWith("-")&&l!=="-"&&l.length>1)return K(`bash: eval: ${l}: invalid option
1070
1070
  eval: usage: eval [arg ...]
1071
- `,2)}if(s.length===0)return Fe;let i=s.join(" ");if(i.trim()==="")return Fe;let o=e.state.groupStdin,a=r||n!==void 0&&n!=="";a&&(e.state.groupStdin=n??"");try{let l=Yn(i);return await e.executeScript(l)}catch(l){if(l instanceof Yt||l instanceof Jt||l instanceof zt||l instanceof we||l instanceof Tt)throw l;if(l.name==="ParseException")return K(`bash: eval: ${l.message}
1071
+ `,2)}if(s.length===0)return Me;let i=s.join(" ");if(i.trim()==="")return Me;let o=e.state.groupStdin,a=r||n!==void 0&&n!=="";a&&(e.state.groupStdin=n??"");try{let l=Yn(i);return await e.executeScript(l)}catch(l){if(l instanceof Yt||l instanceof Jt||l instanceof zt||l instanceof we||l instanceof Tt)throw l;if(l.name==="ParseException")return K(`bash: eval: ${l.message}
1072
1072
  `);throw l}finally{(a||o!==void 0&&e.state.groupStdin===void 0)&&(e.state.groupStdin=o)}}G();function oh(e,t){let n,r="";if(t.length===0)n=e.state.lastExitCode;else{let s=t[0];if(s===""||!/^-?\d+$/.test(s))r=`bash: exit: ${s}: numeric argument required
1073
1073
  `,n=2;else{let i=BigInt(s);n=Number((i%256n+256n)%256n)}}throw new we(n,"",r)}function ah(e,t){let n=!1,r=[];for(let o of t)o==="-n"?n=!0:o==="-p"||o==="--"||r.push(o);if(r.length===0&&!n){let o="",a=e.state.exportedVars??new Set,l=Array.from(a).sort();for(let c of l){let u=e.state.env.get(c);u!==void 0&&(o+=`declare -x ${c}=${fa(u)}
1074
1074
  `)}return De(o)}if(n){for(let o of r){let a,l;if(o.includes("=")){let c=o.indexOf("=");a=o.slice(0,c),l=o.slice(c+1)}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a))return X("",`bash: export: \`${o}': not a valid identifier
1075
- `,1);l!==void 0&&(it(e,a),e.state.env.set(a,l)),ac(e,a)}return Fe}let s="",i=0;for(let o of r){let a,l,c=!1,u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(u)a=u[1],l=u[2],c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=o.slice(f+1)}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){s+=`bash: export: \`${o}': not a valid identifier
1075
+ `,1);l!==void 0&&(it(e,a),e.state.env.set(a,l)),ac(e,a)}return Me}let s="",i=0;for(let o of r){let a,l,c=!1,u=o.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(u)a=u[1],l=u[2],c=!0;else if(o.includes("=")){let f=o.indexOf("=");a=o.slice(0,f),l=o.slice(f+1)}else a=o;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){s+=`bash: export: \`${o}': not a valid identifier
1076
1076
  `,i=1;continue}if(l!==void 0)if(it(e,a),c){let f=e.state.env.get(a)??"";e.state.env.set(a,f+l)}else e.state.env.set(a,l);else e.state.env.has(a)||e.state.env.set(a,"");yr(e,a)}return X("",s,i)}function jc(e,t){if(t.length<2)return K(`bash: getopts: usage: getopts optstring name [arg ...]
1077
1077
  `);let n=t[0],r=t[1],s=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),i=n.startsWith(":"),o=i?n.slice(1):n,a;if(t.length>2)a=t.slice(2);else{let m=Number.parseInt(e.state.env.get("#")||"0",10);a=[];for(let g=1;g<=m;g++)a.push(e.state.env.get(String(g))||"")}let l=Number.parseInt(e.state.env.get("OPTIND")||"1",10);l<1&&(l=1);let c=Number.parseInt(e.state.env.get("__GETOPTS_CHARINDEX")||"0",10);if(e.state.env.set("OPTARG",""),l>a.length)return s||e.state.env.set(r,"?"),e.state.env.set("OPTIND",String(a.length+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:1,stdout:"",stderr:""};let u=a[l-1];if(!u||u==="-"||!u.startsWith("-"))return s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};if(u==="--")return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),s||e.state.env.set(r,"?"),{exitCode:s?2:1,stdout:"",stderr:""};let f=c===0?1:c,d=u[f];if(!d)return e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),jc(e,t);let p=o.indexOf(d);if(p===-1){let m="";return i?e.state.env.set("OPTARG",d):m=`bash: illegal option -- ${d}
1078
1078
  `,s||e.state.env.set(r,"?"),f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0")),{exitCode:s?2:0,stdout:"",stderr:m}}if(p+1<o.length&&o[p+1]===":")if(f+1<u.length)e.state.env.set("OPTARG",u.slice(f+1)),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0");else{if(l>=a.length){let m="";return i?(e.state.env.set("OPTARG",d),s||e.state.env.set(r,":")):(m=`bash: option requires an argument -- ${d}
1079
1079
  `,s||e.state.env.set(r,"?")),e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"),{exitCode:s?2:0,stdout:"",stderr:m}}e.state.env.set("OPTARG",a[l]),e.state.env.set("OPTIND",String(l+2)),e.state.env.set("__GETOPTS_CHARINDEX","0")}else f+1<u.length?(e.state.env.set("__GETOPTS_CHARINDEX",String(f+1)),e.state.env.set("OPTIND",String(l))):(e.state.env.set("OPTIND",String(l+1)),e.state.env.set("__GETOPTS_CHARINDEX","0"));return s||e.state.env.set(r,d),{exitCode:s?2:0,stdout:"",stderr:""}}async function lh(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,s=!1,i=!1,o=!1,a="",l=[],c=0;for(;c<t.length;){let h=t[c];if(h==="--"){c++,l.push(...t.slice(c));break}if(h==="-r")n=!0,c++;else if(h==="-d")r=!0,c++;else if(h==="-l")s=!0,c++;else if(h==="-t")o=!0,c++;else if(h==="-p"){if(i=!0,c++,c>=t.length)return K(`bash: hash: -p: option requires an argument
1080
1080
  `,1);a=t[c],c++}else if(h.startsWith("-")&&h.length>1){for(let m of h.slice(1))if(m==="r")n=!0;else if(m==="d")r=!0;else if(m==="l")s=!0;else if(m==="t")o=!0;else return m==="p"?K(`bash: hash: -p: option requires an argument
1081
1081
  `,1):K(`bash: hash: -${m}: invalid option
1082
- `,1);c++}else l.push(h),c++}if(n)return e.state.hashTable.clear(),Fe;if(r){if(l.length===0)return K(`bash: hash: -d: option requires an argument
1082
+ `,1);c++}else l.push(h),c++}if(n)return e.state.hashTable.clear(),Me;if(r){if(l.length===0)return K(`bash: hash: -d: option requires an argument
1083
1083
  `,1);let h=!1,m="";for(let g of l)e.state.hashTable.has(g)?e.state.hashTable.delete(g):(m+=`bash: hash: ${g}: not found
1084
- `,h=!0);return h?K(m,1):Fe}if(o){if(l.length===0)return K(`bash: hash: -t: option requires an argument
1084
+ `,h=!0);return h?K(m,1):Me}if(o){if(l.length===0)return K(`bash: hash: -t: option requires an argument
1085
1085
  `,1);let h="",m=!1,g="";for(let b of l){let y=e.state.hashTable.get(b);y?l.length>1?h+=`${b} ${y}
1086
1086
  `:h+=`${y}
1087
1087
  `:(g+=`bash: hash: ${b}: not found
1088
1088
  `,m=!0)}return m?{exitCode:1,stdout:h,stderr:g}:De(h)}if(i){if(l.length===0)return K(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
1089
- `,1);let h=l[0];return e.state.hashTable.set(h,a),Fe}if(l.length===0){if(e.state.hashTable.size===0)return De(`hash: hash table empty
1089
+ `,1);let h=l[0];return e.state.hashTable.set(h,a),Me}if(l.length===0){if(e.state.hashTable.size===0)return De(`hash: hash table empty
1090
1090
  `);let h="";if(s)for(let[m,g]of e.state.hashTable){let b=m.startsWith("-")?" --":"";h+=`builtin hash -p ${Pt(g)}${b} ${Pt(m)}
1091
1091
  `}else{h=`hits command
1092
1092
  `;for(let[,m]of e.state.hashTable)h+=` 1 ${m}
1093
1093
  `}return De(h)}let u=!1,f="",p=(e.state.env.get("PATH")||"/usr/bin:/bin").split(":");for(let h of l){if(h.includes("/")){f+=`bash: hash: ${h}: cannot use / in name
1094
1094
  `,u=!0;continue}let m=!1;for(let g of p){if(!g)continue;let b=`${g}/${h}`;if(await e.fs.exists(b)){e.state.hashTable.set(h,b),m=!0;break}}m||(f+=`bash: hash: ${h}: not found
1095
- `,u=!0)}return u?K(f,1):Fe}mt();var ab=new Map([[":",[": [arguments]",`Null command.
1095
+ `,u=!0)}return u?K(f,1):Me}mt();var ab=new Map([[":",[": [arguments]",`Null command.
1096
1096
  No effect; the command does nothing.
1097
1097
  Exit Status:
1098
1098
  Always succeeds.`]],[".",[". filename [arguments]",`Execute commands from a file in the current shell.
@@ -1454,7 +1454,7 @@ ${p}
1454
1454
  `)}return X("","",r===0?1:0)}St();async function fh(e,t){let n={maxElements:e.limits.maxArrayElements,maxStringBytes:e.limits.maxStringLength};if(e.state.localScopes.length===0)return K(`bash: local: can only be used in a function
1455
1455
  `);let r=e.state.localScopes[e.state.localScopes.length-1];for(e.state.localArrayScopes??=[];e.state.localArrayScopes.length<e.state.localScopes.length;)e.state.localArrayScopes.push(new Map);let s=e.state.localArrayScopes.at(-1),i=d=>{if(r.has(d)||r.set(d,e.state.env.get(d)),s&&!s.has(d)){let p=Wt(e,d);s.set(d,p?dn(p):void 0)}},o="",a=0,l=!1,c=!1,u=!1,f=[];for(let d of t)if(d==="-n")l=!0;else if(d==="-a")c=!0;else if(d==="-p")u=!0;else if(d.startsWith("-")&&!d.includes("="))for(let p of d.slice(1))p==="n"?l=!0:p==="a"?c=!0:p==="p"&&(u=!0);else f.push(d);if(f.length===0){let d="",p=Array.from(r.keys()).sort();for(let h of p){let m=e.state.env.get(h);m!==void 0&&(d+=`${h}=${m}
1456
1456
  `)}return X(d,"",0)}for(let d of f){let p,h,m=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(m){p=m[1];let x=m[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)){o+=`bash: local: \`${d}': not a valid identifier
1457
- `,a=1;continue}it(e,p,"bash");let S=Qr(x,n);e.executionScope.consumeWork(S.length,"local array assignment"),i(p),Ot(e,p),ls(e,p,"indexed");for(let E=0;E<S.length;E++)be(e,p,E,S[E]);Es(e,p),l&&Xr(e,p);continue}let g=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(g){p=g[1];let x=g[2];it(e,p,"bash"),i(p);let S=Qr(x,n);e.executionScope.consumeWork(S.length,"local array append");let E=_t(e,p),A=0,I=e.state.env.get(p);E.length===0&&I!==void 0?(be(e,p,0,I),e.state.env.delete(p),A=1):E.length>0&&(A=Math.max(...E)+1),ti(e,p,Array.from({length:S.length},(R,N)=>A+N));for(let R=0;R<S.length;R++)be(e,p,A+R,S[R]);Es(e,p),l&&Xr(e,p);continue}let b=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(b){p=b[1];let x=b[2];it(e,p,"bash"),r.has(p)||r.set(p,e.state.env.get(p));let S=e.state.env.get(p)??"";e.state.env.set(p,Bn([S,x],"",e.limits.maxStringLength,"local append")),Es(e,p),l&&Xr(e,p);continue}let y=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(y){p=y[1];let x=y[2],S=y[3];it(e,p,"bash"),i(p);let E;try{let A=new xe,I=Be(A,x);E=await Re(e,I.expression)}catch{let A=parseInt(x,10);E=Number.isNaN(A)?0:A}be(e,p,E,S),Es(e,p),l&&Xr(e,p);continue}if(d.includes("=")){let x=d.indexOf("=");p=d.slice(0,x),h=d.slice(x+1)}else p=d;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)){o+=`bash: local: \`${d}': not a valid identifier
1457
+ `,a=1;continue}it(e,p,"bash");let S=Qr(x,n);e.executionScope.consumeWork(S.length,"local array assignment"),i(p),Ot(e,p),ls(e,p,"indexed");for(let E=0;E<S.length;E++)be(e,p,E,S[E]);Es(e,p),l&&Xr(e,p);continue}let g=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(g){p=g[1];let x=g[2];it(e,p,"bash"),i(p);let S=Qr(x,n);e.executionScope.consumeWork(S.length,"local array append");let E=_t(e,p),A=0,I=e.state.env.get(p);E.length===0&&I!==void 0?(be(e,p,0,I),e.state.env.delete(p),A=1):E.length>0&&(A=Math.max(...E)+1),ti(e,p,Array.from({length:S.length},(R,N)=>A+N));for(let R=0;R<S.length;R++)be(e,p,A+R,S[R]);Es(e,p),l&&Xr(e,p);continue}let b=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(b){p=b[1];let x=b[2];it(e,p,"bash"),r.has(p)||r.set(p,e.state.env.get(p));let S=e.state.env.get(p)??"";e.state.env.set(p,Bn([S,x],"",e.limits.maxStringLength,"local append")),Es(e,p),l&&Xr(e,p);continue}let y=d.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(y){p=y[1];let x=y[2],S=y[3];it(e,p,"bash"),i(p);let E;try{let A=new xe,I=Ue(A,x);E=await Re(e,I.expression)}catch{let A=parseInt(x,10);E=Number.isNaN(A)?0:A}be(e,p,E,S),Es(e,p),l&&Xr(e,p);continue}if(d.includes("=")){let x=d.indexOf("=");p=d.slice(0,x),h=d.slice(x+1)}else p=d;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(p)){o+=`bash: local: \`${d}': not a valid identifier
1458
1458
  `,a=1;continue}let w=r.has(p);if(h!==void 0){let x=e.state.env.get(p);if(e.state.tempEnvBindings){let S=e.state.accessedTempEnvVars?.has(p),E=e.state.mutatedTempEnvVars?.has(p);if(!S&&!E)for(let A=e.state.tempEnvBindings.length-1;A>=0;A--){let I=e.state.tempEnvBindings[A];if(I.has(p)){x=I.get(p);break}}}L3(e,p,x)}if(!w){let x=e.state.env.get(p);if(e.state.tempEnvBindings)for(let S=e.state.tempEnvBindings.length-1;S>=0;S--){let E=e.state.tempEnvBindings[S];if(E.has(p)){x=E.get(p);break}}r.set(p,x),c&&i(p)}if(c&&h===void 0)Ot(e,p),ls(e,p,"indexed");else if(h!==void 0){if(it(e,p,"bash"),l&&h!==""&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(h)){o+=`bash: local: \`${h}': invalid variable name for name reference
1459
1459
  `,a=1;continue}e.state.env.set(p,h),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(p))}else{let x=e.state.tempEnvBindings?.some(S=>S.has(p));!w&&!x&&e.state.env.delete(p)}Es(e,p),l&&Xr(e,p)}return X("",o,a)}ue();G();function Hc(e,t,n){let r=`
1460
1460
  `,s=0,i=0,o=0,a=!1,l="MAPFILE",c=0;for(;c<t.length;){let y=t[c];y==="-d"&&c+1<t.length?(r=t[c+1]===""?"\0":t[c+1]||`
@@ -1493,16 +1493,16 @@ Options:
1493
1493
  `}function fb(e){let t=db.map(r=>`set ${e.state.options[r]?"-o":"+o"} ${r}`),n=pb.map(r=>`set +o ${r}`);return`${[...t,...n].sort().join(`
1494
1494
  `)}
1495
1495
  `}function gh(e,t){if(t.includes("--help"))return De(ha);if(t.length===0){let i=n$(e),o=r$(e),a=[];for(let[u,f]of e.state.env)/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)&&(i.has(u)||o.has(u)||a.push([u,f]));let l=[...a.map(([u,f])=>({kind:"scalar",name:u,value:f})),...Array.from(i,u=>({kind:"indexed",name:u})),...Array.from(o,u=>({kind:"associative",name:u}))];l.sort((u,f)=>u.name<f.name?-1:u.name>f.name?1:0);let c=new $e(e.limits.maxOutputSize,"set");for(let u of l)e.executionScope.consumeWork(1,"set variable listing"),u.kind==="scalar"?(c.append(u.name).append("="),c.reserve(Q3(u.value)),c.append(Pt(u.value))):u.kind==="indexed"?JT(e,c,u.name):t$(e,c,u.name),c.append(`
1496
- `);return De(c.build())}let n=[],r=()=>n.length>0?De(n.join("")):Fe,s=0;for(;s<t.length;){let i=t[s];if((i==="-o"||i==="+o")&&YT(t,s)){let o=t[s+1];if(!Vc.has(o)){let a=`bash: set: ${o}: invalid option name
1496
+ `);return De(c.build())}let n=[],r=()=>n.length>0?De(n.join("")):Me,s=0;for(;s<t.length;){let i=t[s];if((i==="-o"||i==="+o")&&YT(t,s)){let o=t[s+1];if(!Vc.has(o)){let a=`bash: set: ${o}: invalid option name
1497
1497
  ${ha}`;if(e.state.options.posix)throw new gn(1,"",a);return K(a)}hh(e,Vc.get(o)??null,i==="-o"),s+=2;continue}if(i==="-o"){n.push(ub(e)),s++;continue}if(i==="+o"){n.push(fb(e)),s++;continue}if(i.length>1&&(i[0]==="-"||i[0]==="+")&&i[1]!=="-"){let o=i[0]==="-",a=0;for(let l=1;l<i.length;l++){let c=i[l];if(c==="o"){let u=s+1+a;if(u<t.length&&!t[u].startsWith("-")&&!t[u].startsWith("+")){let d=t[u];if(!Vc.has(d)){let p=`bash: set: ${d}: invalid option name
1498
1498
  ${ha}`;if(e.state.options.posix)throw new gn(1,"",p);return K(p)}hh(e,Vc.get(d)??null,o),a++;continue}n.push(o?ub(e):fb(e));continue}if(!cb.has(c)){let u=`bash: set: ${i[0]}${c}: invalid option
1499
1499
  ${ha}`;if(e.state.options.posix)throw new gn(1,"",u);return K(u)}hh(e,cb.get(c)??null,o)}s+=1+a;continue}if(i==="--")return mh(e,t.slice(s+1)),r();if(i==="-"){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Zi(e),s+1<t.length)return mh(e,t.slice(s+1)),r();s++;continue}if(i==="+"){s++;continue}if(i.startsWith("-")||i.startsWith("+")){let o=`bash: set: ${i}: invalid option
1500
1500
  ${ha}`;if(e.state.options.posix)throw new gn(1,"",o);return K(o)}return mh(e,t.slice(s)),r()}return r()}function mh(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let r=0;r<t.length;r++)e.state.env.set(String(r+1),t[r]);e.state.env.set("#",String(t.length)),e.state.env.set("@",t.join(" ")),e.state.env.set("*",t.join(" "))}G();function yh(e,t){let n=1;if(t.length>0){let o=Number.parseInt(t[0],10);if(Number.isNaN(o)||o<0){let a=`bash: shift: ${t[0]}: numeric argument required
1501
1501
  `;if(e.state.options.posix)throw new gn(1,"",a);return K(a)}n=o}let r=Number.parseInt(e.state.env.get("#")||"0",10);if(n>r){let o=`bash: shift: shift count out of range
1502
- `;if(e.state.options.posix)throw new gn(1,"",o);return K(o)}if(n===0)return Fe;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),Fe}G();async function qc(e,t){let n=t;if(n.length>0&&n[0]==="--"&&(n=n.slice(1)),n.length===0)return X("",`bash: source: filename argument required
1502
+ `;if(e.state.options.posix)throw new gn(1,"",o);return K(o)}if(n===0)return Me;let s=[];for(let o=1;o<=r;o++)s.push(e.state.env.get(String(o))||"");let i=s.slice(n);for(let o=1;o<=r;o++)e.state.env.delete(String(o));for(let o=0;o<i.length;o++)e.state.env.set(String(o+1),i[o]);return e.state.env.set("#",String(i.length)),e.state.env.set("@",i.join(" ")),Me}G();async function qc(e,t){let n=t;if(n.length>0&&n[0]==="--"&&(n=n.slice(1)),n.length===0)return X("",`bash: source: filename argument required
1503
1503
  `,2);let r=n[0],s=null,i=null;if(r.includes("/")){let c=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(c),s=c}catch{}}else{let u=(e.state.env.get("PATH")||"").split(":").filter(f=>f);for(let f of u){let d=e.fs.resolvePath(e.state.cwd,`${f}/${r}`);try{if((await e.fs.stat(d)).isDirectory)continue;i=await e.fs.readFile(d),s=d;break}catch{}}if(i===null){let f=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(f),s=f}catch{}}}if(i===null)return K(`bash: ${r}: No such file or directory
1504
1504
  `);let o=new Map;if(n.length>1){for(let u=1;u<=9;u++)o.set(String(u),e.state.env.get(String(u)));o.set("#",e.state.env.get("#")),o.set("@",e.state.env.get("@"));let c=n.slice(1);e.state.env.set("#",String(c.length)),e.state.env.set("@",c.join(" "));for(let u=0;u<c.length&&u<9;u++)e.state.env.set(String(u+1),c[u]);for(let u=c.length+1;u<=9;u++)e.state.env.delete(String(u))}let a=e.state.currentSource,l=()=>{if(e.state.sourceDepth--,e.state.currentSource=a,n.length>1)for(let[c,u]of o)u===void 0?e.state.env.delete(c):e.state.env.set(c,u)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new C(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,"recursion");e.state.currentSource=r;try{let c=Yn(i),u=await e.executeScript(c);return l(),u}catch(c){if(l(),c instanceof we)throw c;if(c instanceof zt)return X(c.stdout,c.stderr,c.exitCode);if(c.name==="ParseException")return K(`bash: ${r}: ${c.message}
1505
- `);throw c}}function hb(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function s$(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function mb(e,t){if(s$(t))return null;try{let n=new xe,r=Be(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function gb(e,t){if(e.state.localVarStack?.has(t)){let r=$c(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)Tc(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),wh(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Tc(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||Tc(e,t),!0}}return!1}function wh(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 s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function yb(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new xe().parseWordFromString(n,!0,!1);return Ue(e,s)}if(t.includes("$")){let r=new xe().parseWordFromString(t,!1,!1);return Ue(e,r)}return t}async function bh(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let d=c[1],p=c[2];if(hn(e,d)){r+=`bash: unset: ${d}: cannot unset: readonly variable
1505
+ `);throw c}}function hb(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function s$(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}async function mb(e,t){if(s$(t))return null;try{let n=new xe,r=Ue(n,t);return await Re(e,r.expression)}catch{let n=parseInt(t,10);return Number.isNaN(n)?0:n}}function gb(e,t){if(e.state.localVarStack?.has(t)){let r=$c(e,t);if(r){r.value===void 0?e.state.env.delete(t):e.state.env.set(t,r.value);let s=e.state.localVarStack?.get(t);if(!s||s.length===0)Tc(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,r.scopeIndex),wh(e,t);else{let i=s[s.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,i.scopeIndex+1)}return!0}return e.state.env.delete(t),Tc(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let r=e.state.localScopes.length-1;r>=0;r--){let s=e.state.localScopes[r];if(s.has(t)){let i=s.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),s.delete(t);let o=!1;for(let a=r-1;a>=0;a--)if(e.state.localScopes[a].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,a+1),o=!0;break}return o||Tc(e,t),!0}}return!1}function wh(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 s=r.get(t);return s===void 0?e.state.env.delete(t):e.state.env.set(t,s),r.delete(t),!0}}return!1}async function yb(e,t){if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t.startsWith('"')&&t.endsWith('"')){let n=t.slice(1,-1),s=new xe().parseWordFromString(n,!0,!1);return ze(e,s)}if(t.includes("$")){let r=new xe().parseWordFromString(t,!1,!1);return ze(e,r)}return t}async function bh(e,t){let n="both",r="",s=0;for(let i of t){if(i==="-v"){n="variable";continue}if(i==="-f"){n="function";continue}if(n==="function"){e.state.functions.delete(i);continue}if(n==="variable"){let c=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(c){let d=c[1],p=c[2];if(hn(e,d)){r+=`bash: unset: ${d}: cannot unset: readonly variable
1506
1506
  `,s=1;continue}if(p==="@"||p==="*"){Qo(e,d),e.state.env.delete(d);continue}let h=e.state.associativeArrays?.has(d);if(h){let w=await yb(e,p);ni(e,d,w);continue}let m=mr(e,d),g=e.state.declaredVars?.has(d);if((e.state.env.has(d)||g)&&!m&&!h){r+=`bash: unset: ${d}: not an array variable
1507
1507
  `,s=1;continue}let y=await mb(e,p);if(y===null&&m){r+=`bash: unset: ${p}: not a valid identifier
1508
1508
  `,s=1;continue}if(y===null)continue;if(y<0){let w=Ee(e,d),x=w.length,S=e.state.currentLine;if(x===0){r+=`bash: line ${S}: unset: [${y}]: bad array subscript
@@ -1516,24 +1516,24 @@ ${ha}`;if(e.state.options.posix)throw new gn(1,"",o);return K(o)}return mh(e,t.s
1516
1516
  `,s=1;continue}let y=g+h;if(y<0){r+=`bash: line ${b}: unset: [${h}]: bad array subscript
1517
1517
  `,s=1;continue}let w=m[y][0];ni(e,c,w);continue}ni(e,c,h);continue}if(!hb(i)){r+=`bash: unset: \`${i}': not a valid identifier
1518
1518
  `,s=1;continue}let a=i;if(st(e,i)){let c=pn(e,i);c&&c!==i&&(a=c)}if(hn(e,a)){r+=`bash: unset: ${a}: cannot unset: readonly variable
1519
- `,s=1;continue}Qo(e,a);let l=vp(e,a);if(l!==void 0&&l!==e.state.callDepth)gb(e,a);else if(e.state.fullyUnsetLocals?.has(a))e.state.env.delete(a);else if(l!==void 0){let c=e.state.accessedTempEnvVars?.has(a),u=e.state.mutatedTempEnvVars?.has(a);if((c||u)&&e.state.localVarStack?.has(a)){let f=$c(e,a);f?f.value===void 0?e.state.env.delete(a):e.state.env.set(a,f.value):e.state.env.delete(a)}else e.state.env.delete(a)}else wh(e,a)||e.state.env.delete(a);e.state.exportedVars?.delete(a),e.state.functions.delete(i)}return X("",r,s)}vr();function i$(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function ut(e,t,n,r){return((...s)=>{It(t,n,`${r} call`);let i=e(...s);return i$(i)?i.then(o=>(It(t,n,`${r} post-await`),o),o=>{throw It(t,n,`${r} post-await`),o}):(It(t,n,`${r} return`),i)})}function o$(e,t,n){let r={readFile:ut(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:ut(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:ut(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:ut(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:ut(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:ut(e.exists.bind(e),t,n,"fs.exists"),stat:ut(e.stat.bind(e),t,n,"fs.stat"),mkdir:ut(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:ut(e.readdir.bind(e),t,n,"fs.readdir"),rm:ut(e.rm.bind(e),t,n,"fs.rm"),cp:ut(e.cp.bind(e),t,n,"fs.cp"),mv:ut(e.mv.bind(e),t,n,"fs.mv"),resolvePath:ut(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:ut(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:ut(e.chmod.bind(e),t,n,"fs.chmod"),symlink:ut(e.symlink.bind(e),t,n,"fs.symlink"),link:ut(e.link.bind(e),t,n,"fs.link"),readlink:ut(e.readlink.bind(e),t,n,"fs.readlink"),lstat:ut(e.lstat.bind(e),t,n,"fs.lstat"),realpath:ut(e.realpath.bind(e),t,n,"fs.realpath"),utimes:ut(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=ut(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),e.createExclusive&&(r.createExclusive=ut(e.createExclusive.bind(e),t,n,"fs.createExclusive")),r}function xh(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r=Object.getOwnPropertyDescriptors(e);r.fs={value:o$(e.fs,e.requireDefenseContext,n),enumerable:!0,configurable:!0,writable:!0};let s=Object.defineProperties(Object.create(Object.getPrototypeOf(e)),r);return e.exec&&(s.exec=ut(e.exec,e.requireDefenseContext,n,"exec")),e.origCommand&&(s.origCommand=ut(e.origCommand,e.requireDefenseContext,n,"origCommand")),e.fetch&&(s.fetch=ut(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(s.sleep=ut(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(s.getRegisteredCommands=ut(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),s}G();yn();St();G();G();var wb="+ ";async function bb(e){let t=e.state.env.get("PS4");if(t===void 0)return wb;if(t==="")return"";let n=e.state.options.xtrace;e.state.options.xtrace=!1;let r=e.state.lastExitCode,s=e.state.env.get("?"),i=e.state.lastSubstitutionExitCode;try{let a=new xe().parseWordFromString(t,!1,!1);return await Ue(e,a)}catch(o){if(o instanceof qe&&!o.fatal)return t;if(o instanceof ft||o instanceof Error&&o.name==="AbortError")throw o;return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution
1519
+ `,s=1;continue}Qo(e,a);let l=vp(e,a);if(l!==void 0&&l!==e.state.callDepth)gb(e,a);else if(e.state.fullyUnsetLocals?.has(a))e.state.env.delete(a);else if(l!==void 0){let c=e.state.accessedTempEnvVars?.has(a),u=e.state.mutatedTempEnvVars?.has(a);if((c||u)&&e.state.localVarStack?.has(a)){let f=$c(e,a);f?f.value===void 0?e.state.env.delete(a):e.state.env.set(a,f.value):e.state.env.delete(a)}else e.state.env.delete(a)}else wh(e,a)||e.state.env.delete(a);e.state.exportedVars?.delete(a),e.state.functions.delete(i)}return X("",r,s)}vr();function i$(e){return e!==null&&typeof e=="object"&&"then"in e&&typeof e.then=="function"}function ut(e,t,n,r){return((...s)=>{It(t,n,`${r} call`);let i=e(...s);return i$(i)?i.then(o=>(It(t,n,`${r} post-await`),o),o=>{throw It(t,n,`${r} post-await`),o}):(It(t,n,`${r} return`),i)})}function o$(e,t,n){let r={readFile:ut(e.readFile.bind(e),t,n,"fs.readFile"),...typeof e.readFileBytes=="function"?{readFileBytes:ut(e.readFileBytes.bind(e),t,n,"fs.readFileBytes")}:Object.create(null),readFileBuffer:ut(e.readFileBuffer.bind(e),t,n,"fs.readFileBuffer"),writeFile:ut(e.writeFile.bind(e),t,n,"fs.writeFile"),appendFile:ut(e.appendFile.bind(e),t,n,"fs.appendFile"),exists:ut(e.exists.bind(e),t,n,"fs.exists"),stat:ut(e.stat.bind(e),t,n,"fs.stat"),mkdir:ut(e.mkdir.bind(e),t,n,"fs.mkdir"),readdir:ut(e.readdir.bind(e),t,n,"fs.readdir"),rm:ut(e.rm.bind(e),t,n,"fs.rm"),cp:ut(e.cp.bind(e),t,n,"fs.cp"),mv:ut(e.mv.bind(e),t,n,"fs.mv"),resolvePath:ut(e.resolvePath.bind(e),t,n,"fs.resolvePath"),getAllPaths:ut(e.getAllPaths.bind(e),t,n,"fs.getAllPaths"),chmod:ut(e.chmod.bind(e),t,n,"fs.chmod"),symlink:ut(e.symlink.bind(e),t,n,"fs.symlink"),link:ut(e.link.bind(e),t,n,"fs.link"),readlink:ut(e.readlink.bind(e),t,n,"fs.readlink"),lstat:ut(e.lstat.bind(e),t,n,"fs.lstat"),realpath:ut(e.realpath.bind(e),t,n,"fs.realpath"),utimes:ut(e.utimes.bind(e),t,n,"fs.utimes")};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=ut(e.readdirWithFileTypes.bind(e),t,n,"fs.readdirWithFileTypes")),e.createExclusive&&(r.createExclusive=ut(e.createExclusive.bind(e),t,n,"fs.createExclusive")),r}function xh(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r=Object.getOwnPropertyDescriptors(e);r.fs={value:o$(e.fs,e.requireDefenseContext,n),enumerable:!0,configurable:!0,writable:!0};let s=Object.defineProperties(Object.create(Object.getPrototypeOf(e)),r);return e.exec&&(s.exec=ut(e.exec,e.requireDefenseContext,n,"exec")),e.origCommand&&(s.origCommand=ut(e.origCommand,e.requireDefenseContext,n,"origCommand")),e.fetch&&(s.fetch=ut(e.fetch,e.requireDefenseContext,n,"fetch")),e.sleep&&(s.sleep=ut(e.sleep,e.requireDefenseContext,n,"sleep")),e.getRegisteredCommands&&(s.getRegisteredCommands=ut(e.getRegisteredCommands,e.requireDefenseContext,n,"getRegisteredCommands")),s}G();yn();St();G();G();var wb="+ ";async function bb(e){let t=e.state.env.get("PS4");if(t===void 0)return wb;if(t==="")return"";let n=e.state.options.xtrace;e.state.options.xtrace=!1;let r=e.state.lastExitCode,s=e.state.env.get("?"),i=e.state.lastSubstitutionExitCode;try{let a=new xe().parseWordFromString(t,!1,!1);return await ze(e,a)}catch(o){if(o instanceof Ge&&!o.fatal)return t;if(o instanceof ft||o instanceof Error&&o.name==="AbortError")throw o;return e.state.expansionStderr=`${e.state.expansionStderr||""}bash: ${t}: bad substitution
1520
1520
  `,t||wb}finally{e.state.options.xtrace=n,e.state.lastExitCode=r,e.state.lastSubstitutionExitCode=i,s===void 0?e.state.env.delete("?"):e.state.env.set("?",s)}}function a$(e){return e.map(t=>l$(t)).join(" ")}function l$(e){if(e==="")return"''";if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let n=/[\x00-\x1f\x7f]/.test(e),r=e.includes(`
1521
1521
  `),s=e.includes(" "),i=e.includes("\\"),o=e.includes("'");if(n||r||s||i){let l="";for(let c of e){let u=c.charCodeAt(0);c===`
1522
1522
  `?l+="\\n":c===" "?l+="\\t":c==="\\"?l+="\\\\":c==="'"?l+="'":c==='"'?l+='"':u<32||u===127?u<256?l+=`\\x${u.toString(16).padStart(2,"0")}`:l+=`\\u${u.toString(16).padStart(4,"0")}`:l+=c}return`$'${l}'`}return o?`"${e.replace(/([\\$`"])/g,"\\$1")}"`:`'${e}'`}async function xb(e,t,n){if(!e.state.options.xtrace)return"";let r=await bb(e),s=[t,...n],i=a$(s);return`${r}${i}
1523
1523
  `}async function Eb(e,t,n){return e.state.options.xtrace?`${await bb(e)}${t}=${n}
1524
- `:""}function Gc(e,t,n){return Bn([t,n],"",e.limits.maxStringLength,"array assignment")}async function Sb(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await c$(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let o=s.value?await Ue(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:X("",`bash: ${i}: bad array subscript
1524
+ `:""}function Gc(e,t,n){return Bn([t,n],"",e.limits.maxStringLength,"array assignment")}async function Sb(e,t){let n=new Map,r="";for(let s of t.assignments){let i=s.name;if(s.array){let u=await c$(e,t,i,s.array,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(r+=u.xtraceOutput,u.continueToNext)continue}let o=s.value?await ze(e,s.value):"";if(i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:X("",`bash: ${i}: bad array subscript
1525
1525
  `,1)};let l=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(l){let u=await h$(e,t,l[1],l[2],o,s.append,n);if(u.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:u.error};if(u.continueToNext)continue}let c=await m$(e,t,i,o,s.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 c$(e,t,n,r,s,i){let o="";if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:"",error:X("",`bash: ${n}: cannot assign list to array member
1526
1526
  `,1)};if(st(e,n)){let h=li(e,n);if(h===void 0||h==="")throw new we(1,"","");let m=pn(e,n);if(m&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(m))return{continueToNext:!1,xtraceOutput:"",error:X("",`bash: ${n}: cannot assign list to array member
1527
1527
  `,1)}}if(hn(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1528
- `,{continueToNext:!0,xtraceOutput:o};let h=it(e,n);if(h)return{continueToNext:!1,xtraceOutput:"",error:h}}let a=e.state.associativeArrays?.has(n),l=Wt(e,n),c=l?dn(l):void 0,u=e.state.env.get(n),f=()=>{e.state.arrays??=new Map,c?e.state.arrays.set(n,c):e.state.arrays.delete(n),u===void 0?e.state.env.delete(n):e.state.env.set(n,u)},d=u$(r),p=()=>{Ot(e,n),e.state.env.delete(n)};try{a&&d?await f$(e,t,n,r,s,p,h=>{o+=h}):d?await d$(e,n,r,s,p):await p$(e,n,r,s,p)}catch(h){throw f(),h}if(t.name){i.set(n,e.state.env.get(n));let m=`(${r.map(g=>Gi(g)).join(" ")})`;e.state.env.set(n,m)}return{continueToNext:!0,xtraceOutput:o}}function u$(e){return e.some(t=>{if(t.parts.length>=2){let n=t.parts[0],r=t.parts[1];if(n.type!=="Glob"||!n.pattern.startsWith("["))return!1;if(n.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(t.parts.length<3)return!1;let s=t.parts[2];return s.type!=="Literal"?!1:s.value.startsWith("]=")||s.value.startsWith("]+=")}return r.type!=="Literal"?!1:r.value.startsWith("]")?r.value.startsWith("]=")||r.value.startsWith("]+="):n.pattern.endsWith("]")?r.value.startsWith("=")||r.value.startsWith("+="):!1}return!1})}async function f$(e,t,n,r,s,i,o){let a=[];for(let l of r){if(a.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let c=vd(l);if(c){let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await Ue(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ys(e,p))):p="",a.push({type:"keyed",key:u,value:p,append:d})}else{let u=await Ue(e,l);a.push({type:"invalid",expandedValue:u})}}e.executionScope.consumeWork(a.length,"associative array assignment"),s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=Ye(e,n,l.key)??"";be(e,n,l.key,Gc(e,c,l.value),"associative")}else be(e,n,l.key,l.value,"associative");else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
1529
- `)}}async function d$(e,t,n,r,s){let i=[],o=0;for(let l of n){let c=vd(l);if(c){if(o>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await Ue(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ys(e,p))):p="",i.push({type:"keyed",indexExpr:u,value:p,append:d}),o++}else{let u=await br(e,l);if(u.values.length>e.limits.maxArrayElements-o)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push({type:"non-keyed",values:u.values}),o+=u.values.length}}e.executionScope.consumeWork(o,"indexed array assignment"),r||s();let a=0;for(let l of i)if(l.type==="keyed"){let c;try{let u=new xe,f=Be(u,l.indexExpr);c=await Re(e,f.expression,!1)}catch{if(/^-?\d+$/.test(l.indexExpr))c=Number.parseInt(l.indexExpr,10);else{let u=e.state.env.get(l.indexExpr);c=u?Number.parseInt(u,10):0,Number.isNaN(c)&&(c=0)}}if(l.append){let u=Ye(e,t,c)??"";be(e,t,c,Gc(e,u,l.value))}else be(e,t,c,l.value);a=c+1}else for(let c of l.values)be(e,t,a++,c)}async function p$(e,t,n,r,s){let i=[];for(let a of n){let l=await br(e,a);for(let c of l.values){if(i.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push(c)}}let o=0;if(e.executionScope.consumeWork(i.length,"indexed array assignment"),r){let a=Ee(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(be(e,t,0,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)be(e,t,o+a,i[a])}async function h$(e,t,n,r,s,i,o){let a=n;if(st(e,n)){let f=pn(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:X("",`bash: \`${f}': not a valid identifier
1530
- `,1)};a=f}}if(hn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=it(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await Ab(e,r);else{let f=await Eh(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=String(f.index)}let u=i?Gc(e,Ye(e,a,c)||"",s):s;return t.name||be(e,a,c,u,l?"associative":"indexed"),{continueToNext:!0,xtraceOutput:""}}async function Ab(e,t){let n;if(t.startsWith("'")&&t.endsWith("'"))n=t.slice(1,-1);else if(t.startsWith('"')&&t.endsWith('"')){let r=t.slice(1,-1),i=new xe().parseWordFromString(r,!0,!1);n=await Ue(e,i)}else if(t.includes("$")){let s=new xe().parseWordFromString(t,!1,!1);n=await Ue(e,s)}else n=t;return n}async function Eh(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new xe,o=Be(i,r);s=await Re(e,o.expression,!1)}catch(i){if(i instanceof we||i instanceof Tt)throw i;if(i instanceof qe){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1528
+ `,{continueToNext:!0,xtraceOutput:o};let h=it(e,n);if(h)return{continueToNext:!1,xtraceOutput:"",error:h}}let a=e.state.associativeArrays?.has(n),l=Wt(e,n),c=l?dn(l):void 0,u=e.state.env.get(n),f=()=>{e.state.arrays??=new Map,c?e.state.arrays.set(n,c):e.state.arrays.delete(n),u===void 0?e.state.env.delete(n):e.state.env.set(n,u)},d=u$(r),p=()=>{Ot(e,n),e.state.env.delete(n)};try{a&&d?await f$(e,t,n,r,s,p,h=>{o+=h}):d?await d$(e,n,r,s,p):await p$(e,n,r,s,p)}catch(h){throw f(),h}if(t.name){i.set(n,e.state.env.get(n));let m=`(${r.map(g=>Gi(g)).join(" ")})`;e.state.env.set(n,m)}return{continueToNext:!0,xtraceOutput:o}}function u$(e){return e.some(t=>{if(t.parts.length>=2){let n=t.parts[0],r=t.parts[1];if(n.type!=="Glob"||!n.pattern.startsWith("["))return!1;if(n.pattern==="["&&(r.type==="DoubleQuoted"||r.type==="SingleQuoted")){if(t.parts.length<3)return!1;let s=t.parts[2];return s.type!=="Literal"?!1:s.value.startsWith("]=")||s.value.startsWith("]+=")}return r.type!=="Literal"?!1:r.value.startsWith("]")?r.value.startsWith("]=")||r.value.startsWith("]+="):n.pattern.endsWith("]")?r.value.startsWith("=")||r.value.startsWith("+="):!1}return!1})}async function f$(e,t,n,r,s,i,o){let a=[];for(let l of r){if(a.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let c=vd(l);if(c){let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await ze(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ys(e,p))):p="",a.push({type:"keyed",key:u,value:p,append:d})}else{let u=await ze(e,l);a.push({type:"invalid",expandedValue:u})}}e.executionScope.consumeWork(a.length,"associative array assignment"),s||i();for(let l of a)if(l.type==="keyed")if(l.append){let c=Ye(e,n,l.key)??"";be(e,n,l.key,Gc(e,c,l.value),"associative")}else be(e,n,l.key,l.value,"associative");else{let c=t.line??e.state.currentLine??1;o(`bash: line ${c}: ${n}: ${l.expandedValue}: must use subscript when assigning associative array
1529
+ `)}}async function d$(e,t,n,r,s){let i=[],o=0;for(let l of n){let c=vd(l);if(c){if(o>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");let{key:u,valueParts:f,append:d}=c,p;f.length>0?(p=await ze(e,{type:"Word",parts:f}),f.every(m=>m.type==="Literal"||m.type==="TildeExpansion")&&(p=ys(e,p))):p="",i.push({type:"keyed",indexExpr:u,value:p,append:d}),o++}else{let u=await br(e,l);if(u.values.length>e.limits.maxArrayElements-o)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push({type:"non-keyed",values:u.values}),o+=u.values.length}}e.executionScope.consumeWork(o,"indexed array assignment"),r||s();let a=0;for(let l of i)if(l.type==="keyed"){let c;try{let u=new xe,f=Ue(u,l.indexExpr);c=await Re(e,f.expression,!1)}catch{if(/^-?\d+$/.test(l.indexExpr))c=Number.parseInt(l.indexExpr,10);else{let u=e.state.env.get(l.indexExpr);c=u?Number.parseInt(u,10):0,Number.isNaN(c)&&(c=0)}}if(l.append){let u=Ye(e,t,c)??"";be(e,t,c,Gc(e,u,l.value))}else be(e,t,c,l.value);a=c+1}else for(let c of l.values)be(e,t,a++,c)}async function p$(e,t,n,r,s){let i=[];for(let a of n){let l=await br(e,a);for(let c of l.values){if(i.length>=e.limits.maxArrayElements)throw new C(`array element limit exceeded (${e.limits.maxArrayElements})`,"array_elements");i.push(c)}}let o=0;if(e.executionScope.consumeWork(i.length,"indexed array assignment"),r){let a=Ee(e,t);if(a.length>0)o=Math.max(...a.map(([c])=>typeof c=="number"?c:0))+1;else{let l=e.state.env.get(t);l!==void 0&&(be(e,t,0,l),e.state.env.delete(t),o=1)}}else s();for(let a=0;a<i.length;a++)be(e,t,o+a,i[a])}async function h$(e,t,n,r,s,i,o){let a=n;if(st(e,n)){let f=pn(e,n);if(f&&f!==n){if(f.includes("["))return{continueToNext:!1,xtraceOutput:"",error:X("",`bash: \`${f}': not a valid identifier
1530
+ `,1)};a=f}}if(hn(e,a)){if(t.name)return{continueToNext:!0,xtraceOutput:""};let f=it(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let l=e.state.associativeArrays?.has(a),c;if(l)c=await Ab(e,r);else{let f=await Eh(e,a,r);if(f.error)return{continueToNext:!1,xtraceOutput:"",error:f.error};c=String(f.index)}let u=i?Gc(e,Ye(e,a,c)||"",s):s;return t.name||be(e,a,c,u,l?"associative":"indexed"),{continueToNext:!0,xtraceOutput:""}}async function Ab(e,t){let n;if(t.startsWith("'")&&t.endsWith("'"))n=t.slice(1,-1);else if(t.startsWith('"')&&t.endsWith('"')){let r=t.slice(1,-1),i=new xe().parseWordFromString(r,!0,!1);n=await ze(e,i)}else if(t.includes("$")){let s=new xe().parseWordFromString(t,!1,!1);n=await ze(e,s)}else n=t;return n}async function Eh(e,t,n){let r=n;n.startsWith('"')&&n.endsWith('"')&&n.length>=2&&(r=n.slice(1,-1));let s;if(/^-?\d+$/.test(r))s=Number.parseInt(r,10);else{try{let i=new xe,o=Ue(i,r);s=await Re(e,o.expression,!1)}catch(i){if(i instanceof we||i instanceof Tt)throw i;if(i instanceof Ge){let l=`bash: line ${e.state.currentLine}: ${n}: ${i.message}
1531
1531
  `;if(i.fatal)throw new we(1,"",l);return{index:0,error:X("",l,1)}}let o=e.state.currentLine;return{index:0,error:X("",`bash: line ${o}: ${t}[${n}]: bad array subscript
1532
1532
  `,1)}}Number.isNaN(s)&&(s=0)}if(s<0){let i=Ee(e,t);if(i.length===0){let a=e.state.currentLine;return{index:0,error:X("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1533
1533
  `,1)}}if(s=Math.max(...i.map(([a])=>typeof a=="number"?a:0))+1+s,s<0){let a=e.state.currentLine;return{index:0,error:X("",`bash: line ${a}: ${t}[${n}]: bad array subscript
1534
1534
  `,1)}}}return{index:s}}async function m$(e,t,n,r,s,i){let o="",a=n,l=null;if(st(e,n)){let f=sc(e,n,r);if(f===void 0)return{continueToNext:!1,xtraceOutput:"",error:X("",`bash: ${n}: circular name reference
1535
1535
  `,1)};if(f===null)return{continueToNext:!0,xtraceOutput:""};a=f;let d=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);d&&(l={arrayName:d[1],subscriptExpr:d[2]},a=d[1])}if(hn(e,a)){if(t.name)return o+=`bash: ${a}: readonly variable
1536
- `,{continueToNext:!0,xtraceOutput:o};let f=it(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(da(e,a))try{let f=new xe;if(s){let p=`(${e.state.env.get(a)||"0"}) + (${r})`,h=Be(f,p);c=String(await Re(e,h.expression))}else{let d=Be(f,r);c=String(await Re(e,d.expression))}}catch{c="0"}else{let f=mr(e,a)?Ye(e,a,0):e.state.env.get(a);c=s?Gc(e,f||"",r):r}c=ao(e,a,c),o+=await Eb(e,a,c);let u;return l?u=await g$(e,l):mr(e,a)&&(u="0"),t.name?u===void 0&&(i.set(a,e.state.env.get(a)),e.state.env.set(a,c)):(u===void 0?e.state.env.set(a,c):be(e,a,u,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function g$(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return Ab(e,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new xe,a=Be(o,r);i=await Re(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=Ee(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return String(i)}qi();async function vb(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?s=!0:g==="p"?i=!0:g==="P"?o=!0:g==="a"?a=!0:g==="f"&&(l=!0);else c.push(m);let u="",f="",d=0,p=!1,h=!1;for(let m of c){let g=!1;if(o){if(a){let E=await r(m);if(E.length>0){for(let A of E)u+=`${A}
1536
+ `,{continueToNext:!0,xtraceOutput:o};let f=it(e,a);if(f)return{continueToNext:!1,xtraceOutput:"",error:f}}let c;if(da(e,a))try{let f=new xe;if(s){let p=`(${e.state.env.get(a)||"0"}) + (${r})`,h=Ue(f,p);c=String(await Re(e,h.expression))}else{let d=Ue(f,r);c=String(await Re(e,d.expression))}}catch{c="0"}else{let f=mr(e,a)?Ye(e,a,0):e.state.env.get(a);c=s?Gc(e,f||"",r):r}c=ao(e,a,c),o+=await Eb(e,a,c);let u;return l?u=await g$(e,l):mr(e,a)&&(u="0"),t.name?u===void 0&&(i.set(a,e.state.env.get(a)),e.state.env.set(a,c)):(u===void 0?e.state.env.set(a,c):be(e,a,u,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(a)),e.state.tempEnvBindings?.some(f=>f.has(a))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(a))),{continueToNext:!1,xtraceOutput:o}}async function g$(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return Ab(e,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{let o=new xe,a=Ue(o,r);i=await Re(e,a.expression,!1)}catch{let o=e.state.env.get(r);i=o?Number.parseInt(o,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let o=Ee(e,n);o.length>0&&(i=Math.max(...o.map(l=>l[0]))+1+i)}return String(i)}qi();async function vb(e,t,n,r){let s=!1,i=!1,o=!1,a=!1,l=!1,c=[];for(let m of t)if(m.startsWith("-")&&m.length>1)for(let g of m.slice(1))g==="t"?s=!0:g==="p"?i=!0:g==="P"?o=!0:g==="a"?a=!0:g==="f"&&(l=!0);else c.push(m);let u="",f="",d=0,p=!1,h=!1;for(let m of c){let g=!1;if(o){if(a){let E=await r(m);if(E.length>0){for(let A of E)u+=`${A}
1537
1537
  `;p=!0,g=!0}}else{let E=await n(m);E&&(u+=`${E}
1538
1538
  `,p=!0,g=!0)}g||(h=!0);continue}let b=!l&&e.state.functions.has(m);if(a&&b){if(!i)if(s)u+=`function
1539
1539
  `;else{let E=e.state.functions.get(m),A=E?Cb(m,E):`${m} is a function
@@ -1571,25 +1571,25 @@ ${e} ()
1571
1571
  `),o=1)}else if(e.commands.has(a)){let u=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":"),f=null;for(let d of u){if(!d)continue;let p=`${d}/${a}`;try{let h=await e.fs.stat(p);if(!h.isDirectory&&(h.mode&73)!==0){f=p;break}}catch{}}f||(f=`/usr/bin/${a}`),r?s+=`${a} is ${f}
1572
1572
  `:s+=`${f}
1573
1573
  `}else r&&(i+=`${a}: not found
1574
- `),o=1}return X(s,i,o)}async function Ob(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{let i=await e.fs.stat(s);if(i.isDirectory||!((i.mode&73)!==0))return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{let a=await e.fs.stat(o);if(a.isDirectory||(a.mode&73)===0)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}function Tb(e,t){let n=!0,r=e.signal?new AbortController:void 0,s=new WeakMap,i=()=>{if(!n)throw new _e("",`bash: ${t} used its context after cancellation
1575
- `)},o=f=>{if(f===null||typeof f!="object"&&typeof f!="function")return f;let d=s.get(f);if(d!==void 0)return d;if(typeof f=="object"&&zw(f))return f;if(f instanceof Uint8Array){let g=new Uint8Array(f);return s.set(f,g),g}if(f instanceof ArrayBuffer){let g=f.slice(0);return s.set(f,g),g}if(f instanceof Promise){let g=f.then(b=>(i(),o(b)));return s.set(f,g),g}if(typeof f=="function"){let g=function(...b){return i(),o(Reflect.apply(f,this,b))};return s.set(f,g),g}let p=Object.getPrototypeOf(f);if(Array.isArray(f)||p===Object.prototype||p===null){let g=Array.isArray(f)?[]:Object.create(p);s.set(f,g);let b=Object.getOwnPropertyDescriptors(f);for(let y of Object.values(b)){if("value"in y){let w=y.value;y.value=typeof w=="function"?(...x)=>(i(),o(Reflect.apply(w,f,x))):o(w)}if(y.get){let w=y.get;y.get=()=>(i(),o(Reflect.apply(w,f,[])))}if(y.set){let w=y.set;y.set=x=>{i(),Reflect.apply(w,f,[x])}}}return Object.defineProperties(g,b),g}let h=new Map,m=new Ry(f,{get(g,b){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);let y=Reflect.get(g,b,g);if(typeof y!="function")return o(y);if(h.has(b))return h.get(b);let w=(...x)=>(i(),o(Reflect.apply(y,g,x)));return h.set(b,w),w},set(g,b,y){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);return Reflect.set(g,b,y,g)}});return s.set(f,m),m},a=f=>o(f),l=f=>f&&((...d)=>(i(),o(f(...d)))),c=f=>({value:f,enumerable:!0,configurable:!0,writable:!0}),u=Object.getOwnPropertyDescriptors(e);return Object.assign(u,{fs:c(a(e.fs)),env:c(a(e.env)),limits:c(Object.freeze({...e.limits})),exportedEnv:c(e.exportedEnv?Object.freeze({...e.exportedEnv}):void 0),executionScope:c(e.executionScope?a(e.executionScope):void 0),fileDescriptors:c(e.fileDescriptors?a(e.fileDescriptors):void 0),coverage:c(e.coverage?a(e.coverage):void 0),assignShellVariable:c(l(e.assignShellVariable)),exec:c(l(e.exec)),origCommand:c(l(e.origCommand)),execWithInheritedStdin:c(l(e.execWithInheritedStdin)),fetch:c(l(e.fetch)),getRegisteredCommands:c(l(e.getRegisteredCommands)),sleep:c(l(e.sleep)),trace:c(l(e.trace)),invokeTool:c(l(e.invokeTool)),signal:c(r?.signal)}),{context:Object.defineProperties(Object.create(Object.getPrototypeOf(e)),u),revoke(){n=!1,r?.signal.aborted||r?.abort(new _e("",`bash: ${t} context revoked
1576
- `))}}}async function w$(e,t,n,r,s,i){let o=s.remainingTimeMs()??t.limits.maxExecutionTimeMs,a=t.limits.maxExtensionCleanupTimeMs,l,c,u,d=Promise.resolve().then(e).then(h=>({kind:"result",result:h}),h=>({kind:"error",error:h})),p=new Promise(h=>{let m=()=>{n(),h({kind:"abort"})};c=m,i?.addEventListener("abort",m,{once:!0}),i?.aborted&&m(),l=uo(()=>{n(),h({kind:"deadline"})},o)});try{let h=await Promise.race([d,p]);if(h.kind==="result")return h.result;if(h.kind==="error")throw h.error;n();let m=await Promise.race([d.then(()=>!0),new Promise(b=>{u=uo(()=>b(!1),a)})]),g=h.kind==="deadline"?new _e("",`bash: ${r} exceeded its execution deadline
1577
- `):new _e("",`bash: execution aborted
1578
- `);throw m||s.poisonAfterAbort(g),g}finally{n(),fo(l),fo(u),c&&i?.removeEventListener("abort",c)}}var $b={export:(e,t)=>ah(e.ctx,t),unset:(e,t)=>bh(e.ctx,t),exit:(e,t)=>oh(e.ctx,t),local:(e,t)=>fh(e.ctx,t),set:(e,t)=>gh(e.ctx,t),break:(e,t)=>xp(e.ctx,t),continue:(e,t)=>Zp(e.ctx,t),return:(e,t)=>ph(e.ctx,t),shift:(e,t)=>yh(e.ctx,t),getopts:(e,t)=>jc(e.ctx,t),compgen:(e,t)=>jp(e.ctx,t),complete:(e,t)=>qp(e.ctx,t),compopt:(e,t)=>Gp(e.ctx,t),pushd:(e,t)=>nh(e.ctx,t),popd:(e,t)=>rh(e.ctx,t),dirs:(e,t)=>sh(e.ctx,t),source:(e,t)=>qc(e.ctx,t),".":(e,t)=>qc(e.ctx,t),read:(e,t,n)=>dh(e.ctx,t,n.stdin,n.stdinSourceFd),mapfile:(e,t,n)=>Hc(e.ctx,t,n.stdin),readarray:(e,t,n)=>Hc(e.ctx,t,n.stdin),declare:(e,t)=>Wc(e.ctx,t),typeset:(e,t)=>Wc(e.ctx,t),readonly:(e,t)=>eh(e.ctx,t),eval:(e,t,n)=>ih(e.ctx,t,n.stdin,n.stdinRedirected),cd:(e,t)=>Ep(e.ctx,t),":":()=>Fe,true:()=>Fe,false:()=>$t(!1),let:(e,t)=>uh(e.ctx,t),command:(e,t,n)=>b$(e,t,n.stdin,n.stdinRedirected),builtin:(e,t,n)=>x$(e,t,n.stdin,n.stdinRedirected),shopt:(e,t)=>G3(e.ctx,t),exec:async(e,t,n)=>{if(t.length===0)return Fe;let[r,...s]=t;return{...await e.runCommand(r,s,[],n.stdin,!1,!1,-1,n.stdinRedirected),internalProducerOmitsShellPrefix:!0}},wait:()=>Fe,type:(e,t)=>vb(e.ctx,t,n=>Ob(e.ctx,n),n=>Hl(e.ctx,n)),hash:(e,t)=>lh(e.ctx,t),help:(e,t)=>ch(e.ctx,t),"[":(e,t)=>t[t.length-1]!=="]"?K("[: missing `]'\n",2):to(e.ctx,t.slice(0,-1)),test:(e,t)=>to(e.ctx,t)};async function Rb(e,t,n,r,s,i,o,a,l=!1){let{ctx:c}=e;c.coverage&&dr.has(t)&&c.coverage.hit(`bash:builtin:${t}`);let u={stdin:s,stdinRedirected:l,stdinSourceFd:a},f=pd(t),d=(f==="early"||f==="late")&&Object.hasOwn($b,t)?$b[t]:void 0;if(d&&(f==="early"||c.state.options.posix&&hd(t)))return d(e,n,u);if(!i){let p=c.state.functions.get(t);if(p)return _c(c,p,n,s,void 0,l)}if(t==="__just_bash_tee_restore"){if(n.length===0||n.length>c.limits.maxArrayElements)return K(`bash: invalid internal pipeline status restore
1574
+ `),o=1}return X(s,i,o)}async function Ob(e,t){if(t.includes("/")){let s=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(s)){try{let i=await e.fs.stat(s);if(i.isDirectory||!((i.mode&73)!==0))return null}catch{return null}return t}return null}let r=(e.state.env.get("PATH")??"/usr/bin:/bin").split(":");for(let s of r){if(!s)continue;let o=`${s.startsWith("/")?s:e.fs.resolvePath(e.state.cwd,s)}/${t}`;if(await e.fs.exists(o)){try{let a=await e.fs.stat(o);if(a.isDirectory||(a.mode&73)===0)continue}catch{continue}return`${s}/${t}`}}if(e.commands.has(t)){for(let s of r)if(s==="/usr/bin"||s==="/bin")return`${s}/${t}`;return`/usr/bin/${t}`}return null}function Tb(e,t){let n=!0,r=e.signal?new AbortController:void 0,s=new WeakMap,i=()=>{if(!n)throw new Fe("",`bash: ${t} used its context after cancellation
1575
+ `)},o=f=>{if(f===null||typeof f!="object"&&typeof f!="function")return f;let d=s.get(f);if(d!==void 0)return d;if(typeof f=="object"&&zw(f))return f;if(f instanceof Uint8Array){let g=new Uint8Array(f);return s.set(f,g),g}if(f instanceof ArrayBuffer){let g=f.slice(0);return s.set(f,g),g}if(f instanceof Promise){let g=f.then(b=>(i(),o(b)));return s.set(f,g),g}if(typeof f=="function"){let g=function(...b){return i(),o(Reflect.apply(f,this,b))};return s.set(f,g),g}let p=Object.getPrototypeOf(f);if(Array.isArray(f)||p===Object.prototype||p===null){let g=Array.isArray(f)?[]:Object.create(p);s.set(f,g);let b=Object.getOwnPropertyDescriptors(f);for(let y of Object.values(b)){if("value"in y){let w=y.value;y.value=typeof w=="function"?(...x)=>(i(),o(Reflect.apply(w,f,x))):o(w)}if(y.get){let w=y.get;y.get=()=>(i(),o(Reflect.apply(w,f,[])))}if(y.set){let w=y.set;y.set=x=>{i(),Reflect.apply(w,f,[x])}}}return Object.defineProperties(g,b),g}let h=new Map,m=new Ry(f,{get(g,b){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);let y=Reflect.get(g,b,g);if(typeof y!="function")return o(y);if(h.has(b))return h.get(b);let w=(...x)=>(i(),o(Reflect.apply(y,g,x)));return h.set(b,w),w},set(g,b,y){if(i(),b==="constructor"||b==="prototype"||b==="__proto__")throw new Error(`${t}: unsafe context property access`);return Reflect.set(g,b,y,g)}});return s.set(f,m),m},a=f=>o(f),l=f=>f&&((...d)=>(i(),o(f(...d)))),c=f=>({value:f,enumerable:!0,configurable:!0,writable:!0}),u=Object.getOwnPropertyDescriptors(e);return Object.assign(u,{fs:c(a(e.fs)),env:c(a(e.env)),limits:c(Object.freeze({...e.limits})),exportedEnv:c(e.exportedEnv?Object.freeze({...e.exportedEnv}):void 0),executionScope:c(e.executionScope?a(e.executionScope):void 0),fileDescriptors:c(e.fileDescriptors?a(e.fileDescriptors):void 0),coverage:c(e.coverage?a(e.coverage):void 0),assignShellVariable:c(l(e.assignShellVariable)),exec:c(l(e.exec)),origCommand:c(l(e.origCommand)),execWithInheritedStdin:c(l(e.execWithInheritedStdin)),fetch:c(l(e.fetch)),getRegisteredCommands:c(l(e.getRegisteredCommands)),sleep:c(l(e.sleep)),trace:c(l(e.trace)),invokeTool:c(l(e.invokeTool)),signal:c(r?.signal)}),{context:Object.defineProperties(Object.create(Object.getPrototypeOf(e)),u),revoke(){n=!1,r?.signal.aborted||r?.abort(new Fe("",`bash: ${t} context revoked
1576
+ `))}}}async function w$(e,t,n,r,s,i){let o=s.remainingTimeMs()??t.limits.maxExecutionTimeMs,a=t.limits.maxExtensionCleanupTimeMs,l,c,u,d=Promise.resolve().then(e).then(h=>({kind:"result",result:h}),h=>({kind:"error",error:h})),p=new Promise(h=>{let m=()=>{n(),h({kind:"abort"})};c=m,i?.addEventListener("abort",m,{once:!0}),i?.aborted&&m(),l=uo(()=>{n(),h({kind:"deadline"})},o)});try{let h=await Promise.race([d,p]);if(h.kind==="result")return h.result;if(h.kind==="error")throw h.error;n();let m=await Promise.race([d.then(()=>!0),new Promise(b=>{u=uo(()=>b(!1),a)})]),g=h.kind==="deadline"?new Fe("",`bash: ${r} exceeded its execution deadline
1577
+ `):new Fe("",`bash: execution aborted
1578
+ `);throw m||s.poisonAfterAbort(g),g}finally{n(),fo(l),fo(u),c&&i?.removeEventListener("abort",c)}}var $b={export:(e,t)=>ah(e.ctx,t),unset:(e,t)=>bh(e.ctx,t),exit:(e,t)=>oh(e.ctx,t),local:(e,t)=>fh(e.ctx,t),set:(e,t)=>gh(e.ctx,t),break:(e,t)=>xp(e.ctx,t),continue:(e,t)=>Zp(e.ctx,t),return:(e,t)=>ph(e.ctx,t),shift:(e,t)=>yh(e.ctx,t),getopts:(e,t)=>jc(e.ctx,t),compgen:(e,t)=>jp(e.ctx,t),complete:(e,t)=>qp(e.ctx,t),compopt:(e,t)=>Gp(e.ctx,t),pushd:(e,t)=>nh(e.ctx,t),popd:(e,t)=>rh(e.ctx,t),dirs:(e,t)=>sh(e.ctx,t),source:(e,t)=>qc(e.ctx,t),".":(e,t)=>qc(e.ctx,t),read:(e,t,n)=>dh(e.ctx,t,n.stdin,n.stdinSourceFd),mapfile:(e,t,n)=>Hc(e.ctx,t,n.stdin),readarray:(e,t,n)=>Hc(e.ctx,t,n.stdin),declare:(e,t)=>Wc(e.ctx,t),typeset:(e,t)=>Wc(e.ctx,t),readonly:(e,t)=>eh(e.ctx,t),eval:(e,t,n)=>ih(e.ctx,t,n.stdin,n.stdinRedirected),cd:(e,t)=>Ep(e.ctx,t),":":()=>Me,true:()=>Me,false:()=>$t(!1),let:(e,t)=>uh(e.ctx,t),command:(e,t,n)=>b$(e,t,n.stdin,n.stdinRedirected),builtin:(e,t,n)=>x$(e,t,n.stdin,n.stdinRedirected),shopt:(e,t)=>G3(e.ctx,t),exec:async(e,t,n)=>{if(t.length===0)return Me;let[r,...s]=t;return{...await e.runCommand(r,s,[],n.stdin,!1,!1,-1,n.stdinRedirected),internalProducerOmitsShellPrefix:!0}},wait:()=>Me,type:(e,t)=>vb(e.ctx,t,n=>Ob(e.ctx,n),n=>Hl(e.ctx,n)),hash:(e,t)=>lh(e.ctx,t),help:(e,t)=>ch(e.ctx,t),"[":(e,t)=>t[t.length-1]!=="]"?K("[: missing `]'\n",2):to(e.ctx,t.slice(0,-1)),test:(e,t)=>to(e.ctx,t)};async function Rb(e,t,n,r,s,i,o,a,l=!1){let{ctx:c}=e;c.coverage&&dr.has(t)&&c.coverage.hit(`bash:builtin:${t}`);let u={stdin:s,stdinRedirected:l,stdinSourceFd:a},f=pd(t),d=(f==="early"||f==="late")&&Object.hasOwn($b,t)?$b[t]:void 0;if(d&&(f==="early"||c.state.options.posix&&hd(t)))return d(e,n,u);if(!i){let p=c.state.functions.get(t);if(p)return _c(c,p,n,s,void 0,l)}if(t==="__just_bash_tee_restore"){if(n.length===0||n.length>c.limits.maxArrayElements)return K(`bash: invalid internal pipeline status restore
1579
1579
  `,2);let p=[];for(let g of n){if(!/^(?:0|[1-9][0-9]{0,2})$/.test(g))return K(`bash: invalid internal pipeline status restore
1580
1580
  `,2);let b=Number(g);if(!Number.isSafeInteger(b)||b>255)return K(`bash: invalid internal pipeline status restore
1581
- `,2);p.push(b)}let h=p[p.length-1]??0,m=[...p].reverse().find(g=>g!==0);return{stdout:"",stderr:"",exitCode:c.state.options.pipefail&&m!==void 0?m:h,internalPipeStatusOverride:p}}return d&&f==="late"?d(e,n,u):null}async function b$(e,t,n,r=!1){let{ctx:s,runCommand:i}=e;if(t.length===0)return Fe;let o=!1,a=!1,l=!1,c=t;for(;c.length>0&&c[0].startsWith("-");){let d=c[0];if(d==="--"){c=c.slice(1);break}for(let p of d.slice(1))p==="p"?o=!0:p==="V"?a=!0:p==="v"&&(l=!0);c=c.slice(1)}if(c.length===0)return Fe;if(l||a)return await Ib(s,c,l,a);let[u,...f]=c;return i(u,f,[],n,!0,o,-1,r)}async function x$(e,t,n,r=!1){let{runCommand:s}=e;if(t.length===0)return Fe;let i=t;if(i[0]==="--"&&(i=i.slice(1),i.length===0))return Fe;let o=i[0];if(o!=="__just_bash_tee_restore"&&!dr.has(o))return K(`bash: builtin: ${o}: not a shell builtin
1581
+ `,2);p.push(b)}let h=p[p.length-1]??0,m=[...p].reverse().find(g=>g!==0);return{stdout:"",stderr:"",exitCode:c.state.options.pipefail&&m!==void 0?m:h,internalPipeStatusOverride:p}}return d&&f==="late"?d(e,n,u):null}async function b$(e,t,n,r=!1){let{ctx:s,runCommand:i}=e;if(t.length===0)return Me;let o=!1,a=!1,l=!1,c=t;for(;c.length>0&&c[0].startsWith("-");){let d=c[0];if(d==="--"){c=c.slice(1);break}for(let p of d.slice(1))p==="p"?o=!0:p==="V"?a=!0:p==="v"&&(l=!0);c=c.slice(1)}if(c.length===0)return Me;if(l||a)return await Ib(s,c,l,a);let[u,...f]=c;return i(u,f,[],n,!0,o,-1,r)}async function x$(e,t,n,r=!1){let{runCommand:s}=e;if(t.length===0)return Me;let i=t;if(i[0]==="--"&&(i=i.slice(1),i.length===0))return Me;let o=i[0];if(o!=="__just_bash_tee_restore"&&!dr.has(o))return K(`bash: builtin: ${o}: not a shell builtin
1582
1582
  `);let[,...a]=i;return s(o,a,[],n,!0,!1,-1,r)}async function Pb(e,t,n,r,s){let{ctx:i,buildExportedEnv:o,executeUserScript:a}=e,c=await jl(i,t,s?"/usr/bin:/bin":void 0);if(!c){i.executionScope.recordUnresolvedCommand(t);let S=i.executionScope.abortOnUnresolvedCommands;if(A3(t)){let E=`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1583
1583
  `;if(S)throw new Tt(t,"",E);return K(E,127)}if(S)throw new Tt(t,"",`bash: ${t}: command not found
1584
1584
  `);return K(`bash: ${t}: command not found
1585
1585
  `,127)}if("error"in c)return c.error==="permission_denied"?K(`bash: ${t}: Permission denied
1586
1586
  `,126):K(`bash: ${t}: No such file or directory
1587
1587
  `,127);if("script"in c)return t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,c.path)),await a(c.path,n,r);let{cmd:u,path:f}=c;t.includes("/")||(i.state.hashTable||(i.state.hashTable=new Map),i.state.hashTable.set(t,f));let d=r||i.state.groupStdin||"",p=!1,h=o();i.state.fileDescriptors??=new Map;let m={fs:i.fs,fsIdentity:Bl(i.fs),cwd:i.state.cwd,env:i.state.env,assignShellVariable:async(S,E,A)=>{if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(S))throw new Error(`${S}: not a valid identifier`);let I=A===void 0?S:`${S}[${A}]`,R=sc(i,S,E);if(R===void 0)throw new Error(`${S}: circular name reference`);if(R===null)return;let N=R.match(/^([a-zA-Z_][a-zA-Z0-9_]*)(?:\[(.*)\])?$/);if(!N)throw new Error(`${I}: not a valid identifier`);let $=N[1],T=N[2]??A;if(hn(i,S)||hn(i,$))throw new Error(`${$}: readonly variable`);if(T===void 0)i.state.env.set($,E);else{let _=i.state.associativeArrays?.has($)?"associative":"indexed";if(_==="associative"){be(i,$,T,E,_);return}let z=await Eh(i,$,T);if(z.error)throw new we(z.error.exitCode,z.error.stdout,z.error.stderr);be(i,$,z.index,E,_)}},exportedEnv:h,get stdin(){return p=!0,d},limits:i.limits,executionScope:u.internalIsExtension?qw(i.executionScope):i.executionScope,exec:(S,E)=>i.execFn(S,E,!1),execWithInheritedStdin:(S,E)=>i.execFn(S,{...E,stdin:d,stdinKind:"bytes"},!0),fetch:i.fetch,getRegisteredCommands:()=>Array.from(i.commands.keys()),sleep:i.sleep,trace:i.trace,fileDescriptors:i.state.fileDescriptors,xpgEcho:i.state.shoptOptions.xpg_echo,coverage:i.coverage,signal:i.state.signal,requireDefenseContext:i.requireDefenseContext,jsBootstrapCode:i.jsBootstrapCode,invokeTool:i.invokeTool},g=u.internalOriginalCommand,b=()=>{};if(g){let S=Object.getOwnPropertyDescriptors(m);S.executionScope={value:i.executionScope,enumerable:!0,configurable:!0,writable:!0};let E=Object.defineProperties(Object.create(Object.getPrototypeOf(m)),S),A=Tb(E,g.name),I=xh(A.context,g.name);b=A.revoke,m.origCommand=R=>{let N=()=>g.execute(R,I);return g.trusted?Ct.runTrustedAsync(N):Ct.runUntrustedAsync(N)}}let y=Tb(m,t),w=xh(y.context,t),x=()=>{y.revoke(),b()};try{if(!u.handlesOwnVersion&&n.slice(0,n.indexOf("--")===-1?void 0:n.indexOf("--")).includes("--version"))return{stdout:`${t} (just-bash)
1588
- `,stderr:"",exitCode:0};let S=()=>an(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,w)),E=()=>w$(S,w,x,t,i.executionScope,i.state.signal),A=u.trusted?await Ct.runTrustedAsync(E):await E();return{...A,internalStdinConsumed:A.internalStdinConsumed??(p?r.length:0)}}catch(S){return ge(S),K(`${t}: ${Ge(dt(S))}
1588
+ `,stderr:"",exitCode:0};let S=()=>an(i.requireDefenseContext,"command",`${t} execution`,()=>u.execute(n,w)),E=()=>w$(S,w,x,t,i.executionScope,i.state.signal),A=u.trusted?await Ct.runTrustedAsync(E):await E();return{...A,internalStdinConsumed:A.internalStdinConsumed??(p?r.length:0)}}catch(S){return ge(S),K(`${t}: ${Ze(dt(S))}
1589
1589
  `)}}ue();G();Ri();async function Sh(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r=new En(e.executionScope,"condition"),s=0;try{for(let i of t){let o=await e.executeStatement(i);r.appendResult(o),s=o.exitCode}}catch(i){throw r.prependTo(i),i}finally{e.state.inCondition=n}return r.build(s)}yn();vt();G();yn();var Zc=0;function lo(e,t){return e.state.lastExitCode=t,e.state.env.set("?",String(t)),t}function ga(e,t,n,r){if(e instanceof Yt)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,exitCode:Zc};if(e instanceof Jt)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,exitCode:Zc};if(po(e)||e instanceof zt||e instanceof en||e instanceof we)return e instanceof ft&&e.prependOutput(t,n),{action:"rethrow",stdout:t,stderr:n,error:e};let s=dt(e);return{action:"error",stdout:t,stderr:`${n}${s}
1590
1590
  `,exitCode:1}}function Db(e,t){return e!==void 0?{owns:!0,stdin:e}:t!==""?{owns:!0,stdin:t}:{owns:!1}}var Ns=class{ctx;stdoutChunks=[];stderrChunks=[];totalBytes=0;constructor(t){this.ctx=t}append(t,n){let r=M(t)+M(n);r>this.ctx.limits.maxOutputSize-this.totalBytes&&bs(`total output size exceeded (>${this.ctx.limits.maxOutputSize} bytes), increase executionLimits.maxOutputSize`,"output_size"),t&&this.stdoutChunks.push(t),n&&this.stderrChunks.push(n),this.totalBytes+=r}appendUnaccounted(t,n){this.ctx.executionScope.appendOutput("stdout",t,"control-flow"),this.ctx.executionScope.appendOutput("stderr",n,"control-flow"),this.append(t,n)}replace(t,n){this.stdoutChunks=[],this.stderrChunks=[],this.totalBytes=0,this.append(t,n)}get stdout(){return this.stdoutChunks.join("")}get stderr(){return this.stderrChunks.join("")}build(t){let n=this.stdout,r=this.stderr;return{stdout:n,stderr:r,exitCode:t,internalOutputAccounting:{stdout:M(n),stderr:M(r)}}}};async function Ah(e,t,n){let r=0;try{for(let s of t){let i=await e.executeStatement(s);n.append(i.stdout,i.stderr),r=i.exitCode}}catch(s){if(Sa(s)||s instanceof en||s instanceof we||s instanceof Tt||s instanceof C||s instanceof Er)throw s.prependOutput(n.stdout,n.stderr),s;return n.appendUnaccounted("",`${dt(s)}
1591
1591
  `),n.build(1)}return n.build(r)}async function Lb(e,t){return Fn(e,t.redirections,"",()=>E$(e,t))}async function E$(e,t){let n=new Ns(e);for(let r of t.clauses){let s=await Sh(e,r.condition);if(n.append(s.stdout,s.stderr),s.exitCode===0)return Ah(e,r.body,n)}return t.elseBody?Ah(e,t.elseBody,n):n.build(0)}async function Fb(e,t){return Fn(e,t.redirections,"",()=>S$(e,t))}async function S$(e,t){let n=new Ns(e),r=0,s=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return K(`bash: \`${t.variable}': not a valid identifier
1592
- `);let i=[];if(t.words===null)i=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)i=[];else try{for(let o of t.words){let a=await br(e,o);Xt(i,a.values,e.limits.maxArrayElements,"for-loop expansion")}}catch(o){if(o instanceof xr)return{stdout:"",stderr:o.stderr,exitCode:1};throw o}e.state.loopDepth++;try{for(let o of i){s++,s>e.limits.maxLoopIterations&&bs(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n.stdout,n.stderr),e.state.env.set(t.variable,o);try{for(let a of t.body){let l=await e.executeStatement(a);n.append(l.stdout,l.stderr),r=l.exitCode}}catch(a){let l=ga(a,n.stdout,n.stderr,e.state.loopDepth);if(n.replace(l.stdout,l.stderr),l.exitCode!==void 0&&(r=lo(e,l.exitCode)),l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return n.build(l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return n.build(r)}async function Mb(e,t){return Fn(e,t.redirections,"",()=>A$(e,t))}async function A$(e,t){let n=t.line;n!==void 0&&(e.state.currentLine=n);let r=new Ns(e),s=0,i=0;t.init&&await Re(e,t.init.expression),e.state.loopDepth++;try{for(;i++,i>e.limits.maxLoopIterations&&bs(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r.stdout,r.stderr),!(t.condition&&(n!==void 0&&(e.state.currentLine=n),await Re(e,t.condition.expression)===0));){try{for(let o of t.body){let a=await e.executeStatement(o);r.append(a.stdout,a.stderr),s=a.exitCode}}catch(o){let a=ga(o,r.stdout,r.stderr,e.state.loopDepth);if(r.replace(a.stdout,a.stderr),a.exitCode!==void 0&&(s=lo(e,a.exitCode)),a.action==="break")break;if(a.action==="continue"){t.update&&await Re(e,t.update.expression);continue}if(a.action==="error")return r.build(a.exitCode??1);throw a.error}t.update&&await Re(e,t.update.expression)}}finally{e.state.loopDepth--}return r.build(s)}async function _b(e,t,n=""){return Fn(e,t.redirections,n,r=>C$(e,t,n,r))}async function C$(e,t,n,r){let s=new Ns(e),i=0,o=0,a=Db(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&bs(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=0,u=!1,f=!1,d=e.state.inCondition;e.state.inCondition=!0;try{for(let p of t.condition){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),c=h.exitCode}}catch(p){if(p instanceof Yt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;u=!0}else if(p instanceof Jt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;f=!0}else throw e.state.inCondition=d,p}finally{e.state.inCondition=d}if((u||f)&&(i=lo(e,Zc)),u)break;if(!f){if(c!==0)break;try{for(let p of t.body){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),i=h.exitCode}}catch(p){let h=ga(p,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(h.stdout,h.stderr),h.exitCode!==void 0&&(i=lo(e,h.exitCode)),h.action==="break")break;if(h.action==="continue")continue;if(h.action==="error")return s.build(h.exitCode??1);throw h.error}}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function Bb(e,t,n=""){return Fn(e,t.redirections,n,r=>k$(e,t,n,r))}async function k$(e,t,n,r){let s=new Ns(e),i=0,o=0,a=Db(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&bs(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=await Sh(e,t.condition);if(s.append(c.stdout,c.stderr),c.exitCode===0)break;try{for(let u of t.body){let f=await e.executeStatement(u);s.append(f.stdout,f.stderr),i=f.exitCode}}catch(u){let f=ga(u,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(f.stdout,f.stderr),f.exitCode!==void 0&&(i=lo(e,f.exitCode)),f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error")return s.build(f.exitCode??1);throw f.error}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function Ub(e,t){return Fn(e,t.redirections,"",()=>v$(e,t))}async function v$(e,t){let n=new Ns(e),r=0,s=await Ue(e,t.word),i=!1;for(let o=0;o<t.items.length;o++){let a=t.items[o],l=i;if(!i)for(let c of a.patterns){let u=await Ue(e,c);d3(c)&&(u=Pn(u));let f=e.state.shoptOptions.nocasematch,d=e.state.shoptOptions.extglob;if(eo(s,u,f,d,e.limits.maxCallDepth)){l=!0;break}}if(l){let c=await Ah(e,a.body,n);if(n.replace(c.stdout,c.stderr),r=c.exitCode,a.terminator===";;")break;a.terminator===";&"?i=!0:i=!1}else i=!1}return n.build(r)}G();function Ch(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type!=="Literal"?!1:t.includes(n.value)}ue();Vs();G();async function zb(e,t,n){let r=t.timed?Bi():0,s="",i=Fe,o=0,a=[],l="",c=0,u=t.commands.length>1,f=e.state.lastArg,d=e.state.groupStdin,p=e.state.groupStdinSourceFd;for(let y=0;y<t.commands.length;y++){let w=t.commands[y],x=y===t.commands.length-1,S=y===0;u&&(e.state.lastArg="",e.state.groupStdin=S?d:void 0,e.state.groupStdinSourceFd=S?p:void 0);let E=u&&(!x||!e.state.shoptOptions.lastpipe),A=E?new Map(e.state.env):null,I=E?Qn(e.state.arrays):null,R,N=e.executionScope.outputBytesUsed;try{e.state.commandCount=e.executionScope.chargeCommand(),R=await n(w,s)}catch($){if($ instanceof sn)R={stdout:$.stdout,stderr:$.stderr,exitCode:1};else if($ instanceof we&&t.commands.length>1)R={stdout:$.stdout,stderr:$.stderr,exitCode:$.exitCode};else if($ instanceof en&&t.commands.length>1)R={stdout:$.stdout,stderr:$.stderr,exitCode:$.exitCode};else throw A&&(e.state.env=A,e.state.arrays=I??new Map),$}finally{u&&(S&&(d=e.state.groupStdin,p=e.state.groupStdinSourceFd),e.state.groupStdin=d,e.state.groupStdinSourceFd=p)}if(A&&(e.state.env=A,e.state.arrays=I??new Map),R=e.executionScope.accountResult(R,"pipeline",e.executionScope.outputBytesUsed-N),!x){let $=t.pipeStderr?.[y]??!1,T=R.internalOutputAccounting?.stdout??0,_=$?R.internalOutputAccounting?.stderr??0:0;Gw(e.executionScope,T+_,"pipeline"),R={...R,internalOutputAccounting:{stdout:0,stderr:$?0:R.internalOutputAccounting?.stderr??0}}}a.push(R.exitCode),R.exitCode!==0&&(o=R.exitCode),x?i=R:(t.pipeStderr?.[y]??!1?s=Mn(R.stderr)+es(R):(s=es(R),l+=R.stderr,c+=R.internalOutputAccounting?.stderr??0),i={stdout:"",stderr:"",exitCode:R.exitCode})}l&&(i={...i,stderr:l+i.stderr,internalOutputAccounting:{stdout:i.internalOutputAccounting?.stdout??0,stderr:c+(i.internalOutputAccounting?.stderr??0)}});let h=t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand",m=i.internalPipeStatusOverride??a;if(h){Ot(e,"PIPESTATUS");for(let y=0;y<m.length;y++)be(e,"PIPESTATUS",y,String(m[y]))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let w=(Bi()-r)/1e3,x=Math.floor(w/60),S=w%60,E;t.timePosix?E=`real ${w.toFixed(2)}
1592
+ `);let i=[];if(t.words===null)i=(e.state.env.get("@")||"").split(" ").filter(Boolean);else if(t.words.length===0)i=[];else try{for(let o of t.words){let a=await br(e,o);Xt(i,a.values,e.limits.maxArrayElements,"for-loop expansion")}}catch(o){if(o instanceof xr)return{stdout:"",stderr:o.stderr,exitCode:1};throw o}e.state.loopDepth++;try{for(let o of i){s++,s>e.limits.maxLoopIterations&&bs(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",n.stdout,n.stderr),e.state.env.set(t.variable,o);try{for(let a of t.body){let l=await e.executeStatement(a);n.append(l.stdout,l.stderr),r=l.exitCode}}catch(a){let l=ga(a,n.stdout,n.stderr,e.state.loopDepth);if(n.replace(l.stdout,l.stderr),l.exitCode!==void 0&&(r=lo(e,l.exitCode)),l.action==="break")break;if(l.action==="continue")continue;if(l.action==="error")return n.build(l.exitCode??1);throw l.error}}}finally{e.state.loopDepth--}return n.build(r)}async function Mb(e,t){return Fn(e,t.redirections,"",()=>A$(e,t))}async function A$(e,t){let n=t.line;n!==void 0&&(e.state.currentLine=n);let r=new Ns(e),s=0,i=0;t.init&&await Re(e,t.init.expression),e.state.loopDepth++;try{for(;i++,i>e.limits.maxLoopIterations&&bs(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",r.stdout,r.stderr),!(t.condition&&(n!==void 0&&(e.state.currentLine=n),await Re(e,t.condition.expression)===0));){try{for(let o of t.body){let a=await e.executeStatement(o);r.append(a.stdout,a.stderr),s=a.exitCode}}catch(o){let a=ga(o,r.stdout,r.stderr,e.state.loopDepth);if(r.replace(a.stdout,a.stderr),a.exitCode!==void 0&&(s=lo(e,a.exitCode)),a.action==="break")break;if(a.action==="continue"){t.update&&await Re(e,t.update.expression);continue}if(a.action==="error")return r.build(a.exitCode??1);throw a.error}t.update&&await Re(e,t.update.expression)}}finally{e.state.loopDepth--}return r.build(s)}async function _b(e,t,n=""){return Fn(e,t.redirections,n,r=>C$(e,t,n,r))}async function C$(e,t,n,r){let s=new Ns(e),i=0,o=0,a=Db(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&bs(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=0,u=!1,f=!1,d=e.state.inCondition;e.state.inCondition=!0;try{for(let p of t.condition){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),c=h.exitCode}}catch(p){if(p instanceof Yt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;u=!0}else if(p instanceof Jt){if(s.append(p.stdout,p.stderr),p.levels>1&&e.state.loopDepth>1)throw p.levels--,p.stdout=s.stdout,p.stderr=s.stderr,e.state.inCondition=d,p;f=!0}else throw e.state.inCondition=d,p}finally{e.state.inCondition=d}if((u||f)&&(i=lo(e,Zc)),u)break;if(!f){if(c!==0)break;try{for(let p of t.body){let h=await e.executeStatement(p);s.append(h.stdout,h.stderr),i=h.exitCode}}catch(p){let h=ga(p,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(h.stdout,h.stderr),h.exitCode!==void 0&&(i=lo(e,h.exitCode)),h.action==="break")break;if(h.action==="continue")continue;if(h.action==="error")return s.build(h.exitCode??1);throw h.error}}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function Bb(e,t,n=""){return Fn(e,t.redirections,n,r=>k$(e,t,n,r))}async function k$(e,t,n,r){let s=new Ns(e),i=0,o=0,a=Db(r.stdin,n),l=e.state.groupStdin;a.owns&&(e.state.groupStdin=a.stdin),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&bs(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,"iterations",s.stdout,s.stderr);let c=await Sh(e,t.condition);if(s.append(c.stdout,c.stderr),c.exitCode===0)break;try{for(let u of t.body){let f=await e.executeStatement(u);s.append(f.stdout,f.stderr),i=f.exitCode}}catch(u){let f=ga(u,s.stdout,s.stderr,e.state.loopDepth);if(s.replace(f.stdout,f.stderr),f.exitCode!==void 0&&(i=lo(e,f.exitCode)),f.action==="break")break;if(f.action==="continue")continue;if(f.action==="error")return s.build(f.exitCode??1);throw f.error}}}finally{e.state.loopDepth--,a.owns&&(e.state.groupStdin=l)}return s.build(i)}async function Ub(e,t){return Fn(e,t.redirections,"",()=>v$(e,t))}async function v$(e,t){let n=new Ns(e),r=0,s=await ze(e,t.word),i=!1;for(let o=0;o<t.items.length;o++){let a=t.items[o],l=i;if(!i)for(let c of a.patterns){let u=await ze(e,c);d3(c)&&(u=Pn(u));let f=e.state.shoptOptions.nocasematch,d=e.state.shoptOptions.extglob;if(eo(s,u,f,d,e.limits.maxCallDepth)){l=!0;break}}if(l){let c=await Ah(e,a.body,n);if(n.replace(c.stdout,c.stderr),r=c.exitCode,a.terminator===";;")break;a.terminator===";&"?i=!0:i=!1}else i=!1}return n.build(r)}G();function Ch(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type!=="Literal"?!1:t.includes(n.value)}ue();Vs();G();async function zb(e,t,n){let r=t.timed?Bi():0,s="",i=Me,o=0,a=[],l="",c=0,u=t.commands.length>1,f=e.state.lastArg,d=e.state.groupStdin,p=e.state.groupStdinSourceFd;for(let y=0;y<t.commands.length;y++){let w=t.commands[y],x=y===t.commands.length-1,S=y===0;u&&(e.state.lastArg="",e.state.groupStdin=S?d:void 0,e.state.groupStdinSourceFd=S?p:void 0);let E=u&&(!x||!e.state.shoptOptions.lastpipe),A=E?new Map(e.state.env):null,I=E?Qn(e.state.arrays):null,R,N=e.executionScope.outputBytesUsed;try{e.state.commandCount=e.executionScope.chargeCommand(),R=await n(w,s)}catch($){if($ instanceof sn)R={stdout:$.stdout,stderr:$.stderr,exitCode:1};else if($ instanceof we&&t.commands.length>1)R={stdout:$.stdout,stderr:$.stderr,exitCode:$.exitCode};else if($ instanceof en&&t.commands.length>1)R={stdout:$.stdout,stderr:$.stderr,exitCode:$.exitCode};else throw A&&(e.state.env=A,e.state.arrays=I??new Map),$}finally{u&&(S&&(d=e.state.groupStdin,p=e.state.groupStdinSourceFd),e.state.groupStdin=d,e.state.groupStdinSourceFd=p)}if(A&&(e.state.env=A,e.state.arrays=I??new Map),R=e.executionScope.accountResult(R,"pipeline",e.executionScope.outputBytesUsed-N),!x){let $=t.pipeStderr?.[y]??!1,T=R.internalOutputAccounting?.stdout??0,_=$?R.internalOutputAccounting?.stderr??0:0;Gw(e.executionScope,T+_,"pipeline"),R={...R,internalOutputAccounting:{stdout:0,stderr:$?0:R.internalOutputAccounting?.stderr??0}}}a.push(R.exitCode),R.exitCode!==0&&(o=R.exitCode),x?i=R:(t.pipeStderr?.[y]??!1?s=Mn(R.stderr)+es(R):(s=es(R),l+=R.stderr,c+=R.internalOutputAccounting?.stderr??0),i={stdout:"",stderr:"",exitCode:R.exitCode})}l&&(i={...i,stderr:l+i.stderr,internalOutputAccounting:{stdout:i.internalOutputAccounting?.stdout??0,stderr:c+(i.internalOutputAccounting?.stderr??0)}});let h=t.commands.length>1||t.commands.length===1&&t.commands[0].type==="SimpleCommand",m=i.internalPipeStatusOverride??a;if(h){Ot(e,"PIPESTATUS");for(let y=0;y<m.length;y++)be(e,"PIPESTATUS",y,String(m[y]))}if(e.state.options.pipefail&&o!==0&&(i={...i,exitCode:o}),t.negated&&(i={...i,exitCode:i.exitCode===0?1:0}),t.timed){let w=(Bi()-r)/1e3,x=Math.floor(w/60),S=w%60,E;t.timePosix?E=`real ${w.toFixed(2)}
1593
1593
  user 0.00
1594
1594
  sys 0.00
1595
1595
  `:E=`
@@ -1601,21 +1601,21 @@ sys 0m0.000s
1601
1601
  `),o.build(1)}return f(),o.build(a)}async function Hb(e,t,n,r,s){let i;try{i=await e.fs.readFile(t)}catch{return K(`bash: ${t}: No such file or directory
1602
1602
  `,127)}if(i.startsWith("#!")){let l=i.indexOf(`
1603
1603
  `);l!==-1&&(i=i.slice(l+1))}let o=e.state.loopDepth,a=vh(e.state);e.state.parentHasLoopContext=o>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 l=0;l<n.length&&l<9;l++)e.state.env.set(String(l+1),n[l]);for(let l=n.length+1;l<=9;l++)e.state.env.delete(String(l));try{let c=new xe().parse(i),u=await s(c);return a(),u}catch(l){if(a(),l instanceof we)return X(l.stdout,l.stderr,l.exitCode);if(l instanceof Tt||l instanceof C)throw l;if(l.name==="ParseException")return K(`bash: ${t}: ${l.message}
1604
- `);throw l}}function P$(e){throw new TypeError(`Unsupported command node: ${JSON.stringify(e)}`)}var ya=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,executionScope:t.executionScope,execFn:t.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:t.fetch,sleep:t.sleep,trace:t.trace,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext??!1,jsBootstrapCode:t.jsBootstrapCode,invokeTool:t.invokeTool}}assertDefenseContext(t){if(!this.ctx.requireDefenseContext||Ct.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new Ce(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Ct.getCurrentExecutionId()})}buildExportedEnv(){let t=this.ctx.state.exportedVars,n=this.ctx.state.tempExportedVars,r=new Set;if(t)for(let i of t)r.add(i);if(n)for(let i of n)r.add(i);if(r.size===0)return Object.create(null);let s=Object.create(null);for(let i of r){let o=this.ctx.state.env.get(i);o!==void 0&&(s[i]=o)}return s}async executeScript(t){this.assertDefenseContext("execution");let n=0,r=new En(this.ctx.executionScope,"script");for(let s of t.statements)try{let i=await this.executeStatement(s);r.appendResult(i,ou(i)),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n))}catch(i){if(i instanceof we||i instanceof Tt)throw i.prependOutput(r.stdout,r.stderr),i;if(i instanceof gn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(po(i))throw r.prependTo(i),i;if(i instanceof en)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof tn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof sn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof qe){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof pi){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof Yt||i instanceof Jt){if(this.ctx.state.loopDepth>0)throw i.prependOutput(r.stdout,r.stderr),i;r.append("stdout",i.stdout),r.append("stderr",i.stderr);continue}throw i instanceof zt&&i.prependOutput(r.stdout,r.stderr),i}return{...r.build(n),env:Vt(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return Hb(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new _e;if(t.deferredError)throw new jt(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return Fe;this.ctx.state.errexitSafe=!1;let n=new En(this.ctx.executionScope,"statement");this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&n.append("stderr",`${t.sourceText}
1605
- `);let r=0,s=-1,i=!1;try{for(let l=0;l<t.pipelines.length;l++){let c=t.pipelines[l],u=l>0?t.operators[l-1]:null;if(u==="&&"&&r!==0||u==="||"&&r===0)continue;let f=await this.executePipeline(c);n.appendResult(f,ou(f)),r=f.exitCode,s=l,i=c.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set("?",String(r))}}catch(l){throw n.prependTo(l),l}let o=s<t.pipelines.length-1,a=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||i||a,this.ctx.state.options.errexit&&r!==0&&s===t.pipelines.length-1&&!i&&!this.ctx.state.inCondition&&!a){let l=new en(r);throw l.prependOutput(n.stdout,n.stderr),l}return n.build(r)}async executePipeline(t){return zb(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n,r=!1){let s=u3(this.ctx),i;try{i=await this.executeCommandInner(t,n,r)}catch(a){throw await gp(this.ctx,s).catch(()=>{}),a}let o=await gp(this.ctx,s);return!o.stdout&&!o.stderr?i:{...i,stdout:o.stdout?es(i)+o.stdout:i.stdout,stdoutKind:o.stdout?"bytes":i.stdoutKind,stderr:i.stderr+o.stderr}}async executeCommandInner(t,n,r){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return Lb(this.ctx,t);case"For":return Fb(this.ctx,t);case"CStyleFor":return Mb(this.ctx,t);case"While":return _b(this.ctx,t,n);case"Until":return Bb(this.ctx,t,n);case"Case":return Ub(this.ctx,t);case"Subshell":return this.executeSubshell(t,n,r);case"Group":return this.executeGroup(t,n,r);case"FunctionDef":return H3(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return P$(t)}}async executeSimpleCommand(t,n){let r;try{return await this.executeSimpleCommandInner(t,n,s=>{r=s})}catch(s){if(r?.finish(),s instanceof xr)return K(s.stderr);throw s}}async executeSimpleCommandInner(t,n,r){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let N=t,$=0;for(;;){let T=this.expandAlias(N);if(T===N)break;if($>=this.ctx.limits.maxCallDepth)throw new C(`alias expansion depth limit exceeded (${this.ctx.limits.maxCallDepth})`,"recursion");$++,N=T}this.aliasExpansionStack.clear(),N!==t&&(t=N)}this.ctx.state.expansionStderr="",this.ctx.state.lastSubstitutionExitCode=null;let s=await Sb(this.ctx,t);if(s.error)return s.error;let i=s.tempAssignments,o=s.xtraceOutput,a=()=>{for(let[N,$]of i)$===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$)};if(!t.name){if(t.redirections.length>0){let $=so(this.ctx,t.redirections,W3);r($);let T=await $.prepare(n);if(T.error){if(a(),!T.errorCause)return $.finish(),T.error;try{return io(T)}finally{$.finish()}}let _=X("",o,lc(this.ctx.state,t.redirections)),z=await ks(this.ctx,_,t.redirections,T.targets,T.dupSources,T.standardRoutes);return $.finish(),z}this.ctx.state.lastArg="";let N=(this.ctx.state.expansionStderr||"")+o;return this.ctx.state.expansionStderr="",X("",N,lc(this.ctx.state,[]))}let l=t.name&&Ch(t.name,["local","declare","typeset","export","readonly"]),c=Array.from(i.keys());if(c.length>0&&!l){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let N of c)this.ctx.state.tempExportedVars.add(N)}let u=await Ue(this.ctx,t.name),f=[],d=[],p=(N,$)=>{if(f.length>=this.ctx.limits.maxArrayElements)throw new C(`expanded argument element limit exceeded (${this.ctx.limits.maxArrayElements})`,"array_elements");f.push(N),d.push($)};if(Ch(t.name,["local","declare","typeset","export","readonly"])&&(u==="local"||u==="declare"||u==="typeset"||u==="export"||u==="readonly"))for(let N of t.args){let $=await E3(this.ctx,N);if($)p($,!0);else{let T=await S3(this.ctx,N);if(T!==null)p(T,!0);else{let _=await br(this.ctx,N);for(let z of _.values)p(z,_.quoted)}}}else for(let N of t.args){let $=await br(this.ctx,N);for(let T of $.values)p(T,$.quoted)}let m=t.name.parts.every(N=>N.type==="CommandSubstitution"||N.type==="ParameterExpansion"||N.type==="ArithmeticExpansion");!u&&m&&f.length>0&&(u=f.shift(),d.shift());let g=so(this.ctx,t.redirections,u==="exec"?j3:ca);r(g);let b=await g.prepare(n);if(b.error)return a(),b.errorCause?io(b):(g.finish(),b.error);let y=b.stdinSourceFd,w=b.stdin!==void 0;if(b.stdin!==void 0&&(n=b.stdin),!u)return m?(g.finish(),X("","",lc(this.ctx.state,t.redirections))):(g.finish(),K(`bash: : command not found
1606
- `,127));if(u==="exec"&&(f.length===0||f[0]==="--")){for(let[N,$]of i)$===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$);if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return g.finish(),Fe}if(this.ctx.state.extraArgs){let N=this.ctx.state.extraArgs;this.ctx.state.extraArgs=void 0;for(let $ of N)p($,!0)}let x=await xb(this.ctx,u,f);i.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(i)));let S,E=null;try{S=await this.runCommand(u,f,d,n,!1,!1,y,w)}catch(N){if(N instanceof Yt||N instanceof Jt)E=N,S=Fe;else throw N}y>=0&&u!=="read"&&As(this.ctx,y,S.internalStdinConsumed??0);let A=o+x;if(A&&(S={...S,stderr:A+S.stderr}),S=await ks(this.ctx,S,t.redirections,b.targets,b.dupSources,b.standardRoutes,S.internalProducerCommand??u,S.internalProducerOmitsShellPrefix),g.finish(),E)throw E;if(f.length>0){let N=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(N)){let $=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);$&&(N=$[1])}this.ctx.state.lastArg=N}else this.ctx.state.lastArg=u;let I=e7(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!I)for(let[N,$]of i)this.ctx.state.fullyUnsetLocals?.has(N)||($===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$));if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return i.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(S={...S,stderr:this.ctx.state.expansionStderr+S.stderr},this.ctx.state.expansionStderr=""),S}async runCommand(t,n,r,s,i=!1,o=!1,a=-1,l=!1){let c={ctx:this.ctx,runCommand:(d,p,h,m,g,b,y,w)=>this.runCommand(d,p,h,m,g,b,y,w),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(d,p,h)=>this.executeUserScript(d,p,h)},u=await Rb(c,t,n,r,s,i,o,a,l);return u!==null?u.internalProducerCommand===void 0?{...u,internalProducerCommand:t}:u:{...await Pb(c,t,n,s,o),internalProducerCommand:t}}aliasExpansionStack=new Set;expandAlias(t){return Z7({env:this.ctx.state.env,limits:this.ctx.limits},t,this.aliasExpansionStack)}async findCommandInPath(t){return Hl(this.ctx,t)}async executeSubshell(t,n="",r=!1){return Wb(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeGroup(t,n="",r=!1){return jb(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeArithmeticCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Fn(this.ctx,t.redirections,"",async()=>{try{let n=await Re(this.ctx,t.expression.expression),r=$t(n!==0);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){return K(`bash: arithmetic expression: ${n.message}
1607
- `)}})}async executeConditionalCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Fn(this.ctx,t.redirections,"",async()=>{try{let n=await xs(this.ctx,t.expression),r=$t(n);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){let r=n instanceof qe?1:2;return K(`bash: conditional expression: ${n.message}
1604
+ `);throw l}}function P$(e){throw new TypeError(`Unsupported command node: ${JSON.stringify(e)}`)}var ya=class{ctx;constructor(t,n){this.ctx={state:n,fs:t.fs,commands:t.commands,limits:t.limits,executionScope:t.executionScope,execFn:t.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:t.fetch,sleep:t.sleep,trace:t.trace,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext??!1,jsBootstrapCode:t.jsBootstrapCode,invokeTool:t.invokeTool}}assertDefenseContext(t){if(!this.ctx.requireDefenseContext||Ct.isInSandboxedContext())return;let n=`interpreter ${t} attempted outside defense context`;throw new Ce(n,{timestamp:Date.now(),type:"missing_defense_context",message:n,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:Ct.getCurrentExecutionId()})}buildExportedEnv(){let t=this.ctx.state.exportedVars,n=this.ctx.state.tempExportedVars,r=new Set;if(t)for(let i of t)r.add(i);if(n)for(let i of n)r.add(i);if(r.size===0)return Object.create(null);let s=Object.create(null);for(let i of r){let o=this.ctx.state.env.get(i);o!==void 0&&(s[i]=o)}return s}async executeScript(t){this.assertDefenseContext("execution");let n=0,r=new En(this.ctx.executionScope,"script");for(let s of t.statements)try{let i=await this.executeStatement(s);r.appendResult(i,ou(i)),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n))}catch(i){if(i instanceof we||i instanceof Tt)throw i.prependOutput(r.stdout,r.stderr),i;if(i instanceof gn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(po(i))throw r.prependTo(i),i;if(i instanceof en)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=i.exitCode,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof tn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof sn)return r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n)),{...r.build(n),exitCode:n,env:Vt(this.ctx.state.env)};if(i instanceof Ge){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof pi){r.append("stdout",i.stdout,i.internalOutputAccounting.stdout),r.append("stderr",i.stderr,i.internalOutputAccounting.stderr),n=1,this.ctx.state.lastExitCode=n,this.ctx.state.env.set("?",String(n));continue}if(i instanceof Yt||i instanceof Jt){if(this.ctx.state.loopDepth>0)throw i.prependOutput(r.stdout,r.stderr),i;r.append("stdout",i.stdout),r.append("stderr",i.stderr);continue}throw i instanceof zt&&i.prependOutput(r.stdout,r.stderr),i}return{...r.build(n),env:Vt(this.ctx.state.env)}}async executeUserScript(t,n,r=""){return Hb(this.ctx,t,n,r,s=>this.executeScript(s))}async executeStatement(t){if(this.assertDefenseContext("statement"),this.ctx.state.signal?.aborted)throw new Fe;if(t.deferredError)throw new jt(t.deferredError.message,t.line??1,1);if(this.ctx.state.options.noexec)return Me;this.ctx.state.errexitSafe=!1;let n=new En(this.ctx.executionScope,"statement");this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&t.sourceText&&n.append("stderr",`${t.sourceText}
1605
+ `);let r=0,s=-1,i=!1;try{for(let l=0;l<t.pipelines.length;l++){let c=t.pipelines[l],u=l>0?t.operators[l-1]:null;if(u==="&&"&&r!==0||u==="||"&&r===0)continue;let f=await this.executePipeline(c);n.appendResult(f,ou(f)),r=f.exitCode,s=l,i=c.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set("?",String(r))}}catch(l){throw n.prependTo(l),l}let o=s<t.pipelines.length-1,a=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||i||a,this.ctx.state.options.errexit&&r!==0&&s===t.pipelines.length-1&&!i&&!this.ctx.state.inCondition&&!a){let l=new en(r);throw l.prependOutput(n.stdout,n.stderr),l}return n.build(r)}async executePipeline(t){return zb(this.ctx,t,(n,r)=>this.executeCommand(n,r))}async executeCommand(t,n,r=!1){let s=u3(this.ctx),i;try{i=await this.executeCommandInner(t,n,r)}catch(a){throw await gp(this.ctx,s).catch(()=>{}),a}let o=await gp(this.ctx,s);return!o.stdout&&!o.stderr?i:{...i,stdout:o.stdout?es(i)+o.stdout:i.stdout,stdoutKind:o.stdout?"bytes":i.stdoutKind,stderr:i.stderr+o.stderr}}async executeCommandInner(t,n,r){switch(this.assertDefenseContext("command"),this.ctx.coverage?.hit(`bash:cmd:${t.type}`),t.type){case"SimpleCommand":return this.executeSimpleCommand(t,n);case"If":return Lb(this.ctx,t);case"For":return Fb(this.ctx,t);case"CStyleFor":return Mb(this.ctx,t);case"While":return _b(this.ctx,t,n);case"Until":return Bb(this.ctx,t,n);case"Case":return Ub(this.ctx,t);case"Subshell":return this.executeSubshell(t,n,r);case"Group":return this.executeGroup(t,n,r);case"FunctionDef":return H3(this.ctx,t);case"ArithmeticCommand":return this.executeArithmeticCommand(t);case"ConditionalCommand":return this.executeConditionalCommand(t);default:return P$(t)}}async executeSimpleCommand(t,n){let r;try{return await this.executeSimpleCommandInner(t,n,s=>{r=s})}catch(s){if(r?.finish(),s instanceof xr)return K(s.stderr);throw s}}async executeSimpleCommandInner(t,n,r){if(t.line!==void 0&&(this.ctx.state.currentLine=t.line),this.ctx.state.shoptOptions.expand_aliases&&t.name){let N=t,$=0;for(;;){let T=this.expandAlias(N);if(T===N)break;if($>=this.ctx.limits.maxCallDepth)throw new C(`alias expansion depth limit exceeded (${this.ctx.limits.maxCallDepth})`,"recursion");$++,N=T}this.aliasExpansionStack.clear(),N!==t&&(t=N)}this.ctx.state.expansionStderr="",this.ctx.state.lastSubstitutionExitCode=null;let s=await Sb(this.ctx,t);if(s.error)return s.error;let i=s.tempAssignments,o=s.xtraceOutput,a=()=>{for(let[N,$]of i)$===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$)};if(!t.name){if(t.redirections.length>0){let $=so(this.ctx,t.redirections,W3);r($);let T=await $.prepare(n);if(T.error){if(a(),!T.errorCause)return $.finish(),T.error;try{return io(T)}finally{$.finish()}}let _=X("",o,lc(this.ctx.state,t.redirections)),z=await ks(this.ctx,_,t.redirections,T.targets,T.dupSources,T.standardRoutes);return $.finish(),z}this.ctx.state.lastArg="";let N=(this.ctx.state.expansionStderr||"")+o;return this.ctx.state.expansionStderr="",X("",N,lc(this.ctx.state,[]))}let l=t.name&&Ch(t.name,["local","declare","typeset","export","readonly"]),c=Array.from(i.keys());if(c.length>0&&!l){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let N of c)this.ctx.state.tempExportedVars.add(N)}let u=await ze(this.ctx,t.name),f=[],d=[],p=(N,$)=>{if(f.length>=this.ctx.limits.maxArrayElements)throw new C(`expanded argument element limit exceeded (${this.ctx.limits.maxArrayElements})`,"array_elements");f.push(N),d.push($)};if(Ch(t.name,["local","declare","typeset","export","readonly"])&&(u==="local"||u==="declare"||u==="typeset"||u==="export"||u==="readonly"))for(let N of t.args){let $=await E3(this.ctx,N);if($)p($,!0);else{let T=await S3(this.ctx,N);if(T!==null)p(T,!0);else{let _=await br(this.ctx,N);for(let z of _.values)p(z,_.quoted)}}}else for(let N of t.args){let $=await br(this.ctx,N);for(let T of $.values)p(T,$.quoted)}let m=t.name.parts.every(N=>N.type==="CommandSubstitution"||N.type==="ParameterExpansion"||N.type==="ArithmeticExpansion");!u&&m&&f.length>0&&(u=f.shift(),d.shift());let g=so(this.ctx,t.redirections,u==="exec"?j3:ca);r(g);let b=await g.prepare(n);if(b.error)return a(),b.errorCause?io(b):(g.finish(),b.error);let y=b.stdinSourceFd,w=b.stdin!==void 0;if(b.stdin!==void 0&&(n=b.stdin),!u)return m?(g.finish(),X("","",lc(this.ctx.state,t.redirections))):(g.finish(),K(`bash: : command not found
1606
+ `,127));if(u==="exec"&&(f.length===0||f[0]==="--")){for(let[N,$]of i)$===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$);if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return g.finish(),Me}if(this.ctx.state.extraArgs){let N=this.ctx.state.extraArgs;this.ctx.state.extraArgs=void 0;for(let $ of N)p($,!0)}let x=await xb(this.ctx,u,f);i.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(i)));let S,E=null;try{S=await this.runCommand(u,f,d,n,!1,!1,y,w)}catch(N){if(N instanceof Yt||N instanceof Jt)E=N,S=Me;else throw N}y>=0&&u!=="read"&&As(this.ctx,y,S.internalStdinConsumed??0);let A=o+x;if(A&&(S={...S,stderr:A+S.stderr}),S=await ks(this.ctx,S,t.redirections,b.targets,b.dupSources,b.standardRoutes,S.internalProducerCommand??u,S.internalProducerOmitsShellPrefix),g.finish(),E)throw E;if(f.length>0){let N=f[f.length-1];if((u==="declare"||u==="local"||u==="typeset")&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(N)){let $=N.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);$&&(N=$[1])}this.ctx.state.lastArg=N}else this.ctx.state.lastArg=u;let I=e7(u)&&u!=="unset"&&u!=="eval";if(!this.ctx.state.options.posix||!I)for(let[N,$]of i)this.ctx.state.fullyUnsetLocals?.has(N)||($===void 0?this.ctx.state.env.delete(N):this.ctx.state.env.set(N,$));if(this.ctx.state.tempExportedVars)for(let N of i.keys())this.ctx.state.tempExportedVars.delete(N);return i.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(S={...S,stderr:this.ctx.state.expansionStderr+S.stderr},this.ctx.state.expansionStderr=""),S}async runCommand(t,n,r,s,i=!1,o=!1,a=-1,l=!1){let c={ctx:this.ctx,runCommand:(d,p,h,m,g,b,y,w)=>this.runCommand(d,p,h,m,g,b,y,w),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(d,p,h)=>this.executeUserScript(d,p,h)},u=await Rb(c,t,n,r,s,i,o,a,l);return u!==null?u.internalProducerCommand===void 0?{...u,internalProducerCommand:t}:u:{...await Pb(c,t,n,s,o),internalProducerCommand:t}}aliasExpansionStack=new Set;expandAlias(t){return Z7({env:this.ctx.state.env,limits:this.ctx.limits},t,this.aliasExpansionStack)}async findCommandInPath(t){return Hl(this.ctx,t)}async executeSubshell(t,n="",r=!1){return Wb(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeGroup(t,n="",r=!1){return jb(this.ctx,t,n,s=>this.executeStatement(s),r)}async executeArithmeticCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Fn(this.ctx,t.redirections,"",async()=>{try{let n=await Re(this.ctx,t.expression.expression),r=$t(n!==0);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){return K(`bash: arithmetic expression: ${n.message}
1607
+ `)}})}async executeConditionalCommand(t){return t.line!==void 0&&(this.ctx.state.currentLine=t.line),Fn(this.ctx,t.redirections,"",async()=>{try{let n=await xs(this.ctx,t.expression),r=$t(n);return this.ctx.state.expansionStderr&&(r={...r,stderr:this.ctx.state.expansionStderr+r.stderr},this.ctx.state.expansionStderr=""),r}catch(n){let r=n instanceof Ge?1:2;return K(`bash: conditional expression: ${n.message}
1608
1608
  `,r)}})}};mi();mn();Os();function Nh(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function D$(e){let t=Nh(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}var L$=3;function Vb(e){let t=e;for(let n=0;n<L$;n++){if(t.includes("\\")||t.includes(";")||/%(?![0-9a-f]{2})/i.test(t))return!0;let r=t.toLowerCase();if(r.includes("%2f")||r.includes("%2e")||r.includes("%5c")||r.includes("%3b"))return!0;let s;try{s=decodeURIComponent(t)}catch{return!0}if(s===t)return!1;t=s}return t.includes("%")}function F$(e,t){return t==="/"||t===""?!0:t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function Ih(e,t){let n=Nh(e);if(!n)return!1;let r=D$(t);return!r||n.origin!==r.origin||r.pathPrefix!=="/"&&r.pathPrefix!==""&&Vb(n.pathname)?!1:F$(n.pathname,r.pathPrefix)}function qb(e){return typeof e=="string"?e:e.url}function Gb(e,t){return!t||t.length===0?!1:t.some(n=>Ih(e,qb(n)))}function Oh(e){let t=M$(e);if(t==="localhost"||t.endsWith(".localhost"))return!0;let n=Zb(t);if(n)return Kc(n);let r=B$(t);return r?U$(r):!1}function M$(e){let t=e.trim().toLowerCase();return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function _$(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 Zb(e){let t=e.split(".");if(t.length===0||t.length>4)return null;let n=t.map(l=>_$(l));if(n.some(l=>l===null))return null;let r=n;if(t.length===1){let l=r[0];return l>4294967295?null:[l>>>24&255,l>>>16&255,l>>>8&255,l&255]}if(t.length===2){let[l,c]=r;return l>255||c>16777215?null:[l,c>>>16&255,c>>>8&255,c&255]}if(t.length===3){let[l,c,u]=r;return l>255||c>255||u>65535?null:[l,c,u>>>8&255,u&255]}let[s,i,o,a]=r;return s>255||i>255||o>255||a>255?null:[s,i,o,a]}function B$(e){let t=e,n=null;if(t.includes(".")){let m=t.lastIndexOf(":");if(m<0)return null;let g=t.slice(m+1),b=Zb(g);if(!b)return null;n=b,t=t.slice(0,m)}let r=t.includes("::")?t.split("::").length-1:0;if(r>1)return null;let[s,i]=t.split("::"),o=s?s.split(":").filter(Boolean):[],a=i?i.split(":").filter(Boolean):[],l=m=>/^[0-9a-f]{1,4}$/i.test(m)?Number.parseInt(m,16):null,c=o.map(l),u=a.map(l);if(c.some(m=>m===null)||u.some(m=>m===null))return null;let f=n?2:0,d=c.length+u.length+f,p=0;if(r===1){if(p=8-d,p<0)return null}else if(d!==8)return null;let h=[...c,...new Array(p).fill(0),...u];return n&&(h.push(n[0]<<8|n[1]),h.push(n[2]<<8|n[3])),h.length===8?h:null}function Kc(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 U$(e){if(e.every(s=>s===0)||e.slice(0,7).every(s=>s===0)&&e[7]===1||(e[0]&65472)===65152||(e[0]&65024)===64512)return!0;if(e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Kc(s)}if(e[0]===8193&&e[1]===3512)return!0;if(e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0){let s=[e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255];return Kc(s)}if(e[0]===100&&e[1]===65435&&e[2]===1)return!0;if(e[0]===8194){let s=[e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255];return Kc(s)}return!1}function Kb(e){let t=[];for(let n of e){if(typeof n!="string"&&(n===null||typeof n!="object"||!("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 r=qb(n);if(!Nh(r)){t.push(`Invalid URL in allow-list: "${r}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let i=new URL(r);if(i.protocol!=="http:"&&i.protocol!=="https:"){t.push(`Only http and https URLs are allowed in allow-list: "${r}"`);continue}if(!i.hostname){t.push(`Allow-list entry must include a hostname: "${r}"`);continue}if(i.pathname!=="/"&&i.pathname!==""&&Vb(i.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${r}"`);continue}(i.search||i.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${r}"`)}return t}var nr=class extends Error{constructor(t,n){let r=n??"URL not in allow-list";super(`Network access denied: ${r}: ${t}`),this.name="NetworkAccessDeniedError"}},ui=class extends Error{constructor(t){super(`Too many redirects (max: ${t})`),this.name="TooManyRedirectsError"}},Yr=class extends Error{constructor(t){super(`Redirect target not in allow-list: ${t}`),this.name="RedirectNotAllowedError"}},Xc=class extends Error{constructor(t,n){super(`HTTP method '${t}' not allowed. Allowed methods: ${n.join(", ")}`),this.name="MethodNotAllowedError"}},fi=class extends Error{constructor(t){super(`Response body too large (max: ${t} bytes)`),this.name="ResponseTooLargeError"}};var z$=20,W$=3e4,j$=10485760,H$=["GET","HEAD"],Th;Th=null;var V$=new Set(["GET","HEAD","OPTIONS"]),q$=new Set([301,302,303,307,308]);function wa(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted","AbortError")}function G$(e){if(e?.aborted)throw wa(e)}function Rh(e){let t=e.allowedUrlPrefixes??[];if(e._dnsResolve)throw new Error("NetworkConfig._dnsResolve is no longer supported: DNS resolution is performed by guarded-fetch and cannot be overridden");if(e._createConnectionOwner)throw new Error("NetworkConfig._createConnectionOwner is no longer supported: connect-time IP pinning is performed by guarded-fetch and cannot be overridden");let n=e._fetch;if(!e.dangerouslyAllowFullInternetAccess){let x=Kb(t);if(x.length>0)throw new Error(`Invalid network allow-list:
1609
1609
  ${x.join(`
1610
1610
  `)}`)}let r=[];for(let x of t)typeof x=="object"&&x.transform&&x.transform.length>0&&r.push(x);function s(x){if(r.length===0)return null;let S=null;for(let E of r)if(Ih(x,E.url)&&E.transform){S||(S=new Headers);for(let A of E.transform)for(let[I,R]of Object.entries(A.headers))S.set(I,R)}return S}if(e.maxRedirects!==void 0&&(!Number.isSafeInteger(e.maxRedirects)||e.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let i=e.maxRedirects??z$,o=e.timeoutMs??W$,a=e.maxResponseSize??j$,l=e.dangerouslyAllowFullInternetAccess?["GET","HEAD","POST","PUT","DELETE","PATCH","OPTIONS"]:e.allowedMethods??H$,c=e.denyPrivateRanges??(typeof process<"u"&&!0),u=[];for(let x of t){let S=typeof x=="string"?x:x.url;try{u.push(new URL(S).hostname)}catch{}}function f(x){try{return new URL(x).hostname||"localhost.invalid"}catch{return"localhost.invalid"}}function d(x){return e.dangerouslyAllowFullInternetAccess?c?{allowedHosts:void 0,skipSsrfCheckForAllowedHosts:void 0}:{allowedHosts:[f(x)],skipSsrfCheckForAllowedHosts:!0}:{allowedHosts:u,skipSsrfCheckForAllowedHosts:!c}}function p(x){try{return Oh(new URL(x).hostname)}catch{return!1}}async function h(x,S){let E={method:S.method,headers:S.headers,signal:S.signal,redirect:"manual"};return S.body!==void 0&&(E.body=S.body),await(n??globalThis.fetch)(x,E)}function m(x){if(!e.dangerouslyAllowFullInternetAccess&&!Gb(x,t))throw new nr(x)}function g(x){if(!c)return;let S;try{S=new URL(x)}catch{throw new nr(x,"invalid URL")}if(Oh(S.hostname))throw new nr(x,"private/loopback IP address blocked")}function b(x){if(e.dangerouslyAllowFullInternetAccess)return;let S=x.toUpperCase();if(!l.includes(S))throw new Xc(S,l)}function y(x,S,E,A){if(!E.isGuardedFetchError(x))return x;let I=x,{onRedirectHop:R,subReason:N}=A;switch(I.code){case"host_not_allowed":case"protocol_not_allowed":return R?new Yr(S):new nr(S);case"hostname_unsafe":return R?new Yr(S):new nr(S,N==="dns_resolution_failed"?"DNS resolution failed for private IP check":"hostname resolves to private/loopback IP address");case"redirect_to_unsafe_host":return new Yr(S);case"too_many_redirects":return new ui(i);case"response_too_large":return new fi(a);default:return x}}async function w(x,S={}){let E=S.method?.toUpperCase()??"GET",A=S.followRedirects??!0;if(S.maxRedirects!==void 0&&(!Number.isSafeInteger(S.maxRedirects)||S.maxRedirects<0))throw new RangeError("maxRedirects must be a non-negative safe integer");let I=S.maxRedirects??i,R=Math.min(i,I),N=S.timeoutMs!==void 0?Math.min(S.timeoutMs,o):o,$=new AbortController,T=Is(()=>$.abort(new DOMException("The operation was aborted","AbortError")),N),_=hi(S.signal,$.signal);try{m(x),g(x),b(E);let z=Th?await Th:null,O=x,B=0,U=[],L=E,W=S.body,D=S.headers,Q=!1;for(;;){G$(_.signal);let V=await Ct.runTrustedAsync(async()=>{let Y=D;if(Q&&Y){let pe=Y instanceof Headers?new Headers(Y):new Headers(Y);pe.delete("authorization"),pe.delete("cookie"),Y=pe}let ee=s(O),Se=K$(Y,ee),Te={method:L,headers:Se,signal:_.signal,followRedirects:!1,timeoutMs:N,sanitizeHeaders:!1};if(W&&!V$.has(L)&&(Te.body=W),Object.assign(Te,d(O)),!z||p(O)){if(c)throw new nr(O,"DNS pinning unavailable for private IP enforcement");return await h(O,Te)}c?n&&(Te.fetch=n):(Te.fetch=n??globalThis.fetch,Te.dispatcher=null);let Ae;Te.onUrlBlocked=pe=>{Ae=pe.subReason};try{return await z.guardedFetch(O,Te)}catch(pe){throw y(pe,O,z,{onRedirectHop:B>0,subReason:Ae})}});if(q$.has(V.status)&&A){let Y=V.headers.get("location");if(!Y)return await Xb(V,O,a,_.signal,U);U.push({status:V.status,statusText:V.statusText,headers:Qb(V.headers)});let ee=new URL(Y,O).href;await $h(Z$(V),_.signal);try{m(ee),g(ee)}catch(Ae){throw _.signal?.aborted?wa(_.signal):Ae instanceof nr?new Yr(ee):Ae}let Se=V.status;if(((Se===301||Se===302)&&L==="POST"||Se===303&&L!=="GET"&&L!=="HEAD")&&(L="GET",W=void 0,b(L)),new URL(ee).origin!==new URL(O).origin&&(Q=!0),B++,B>R)throw new ui(R);O=ee;continue}return await Xb(V,O,a,_.signal,U)}}finally{di(T),_.cleanup()}}return w}async function $h(e,t){if(!t)return e;if(t.aborted)throw e.catch(()=>{}),wa(t);let n,r=new Promise((s,i)=>{n=()=>i(wa(t)),t.addEventListener("abort",n,{once:!0})});try{return await Promise.race([e,r])}finally{n&&t.removeEventListener("abort",n)}}async function Z$(e){e.body&&!e.body.locked&&await e.body.cancel()}function K$(e,t){if(!e&&!t)return;if(!t)return e;let n=e instanceof Headers?new Headers(e):new Headers(e);for(let[r,s]of t)n.set(r,s);return n}function Qb(e){let t=Object.create(null);return e.forEach((n,r)=>{t[r.toLowerCase()]=n}),t}async function Xb(e,t,n,r,s){let i=Qb(e.headers);if(n>0){let l=e.headers.get("content-length");if(l){let c=parseInt(l,10);if(!Number.isNaN(c)&&c>n)throw new fi(n)}}let o;if(n>0&&e.body){let l=e.body.getReader(),c=[],u=0;try{for(;;){let{done:d,value:p}=await $h(l.read(),r);if(d)break;if(p){if(u+=p.byteLength,u>n)throw await l.cancel(),new fi(n);c.push(p)}}}catch(d){throw r?.aborted&&await l.cancel(wa(r)).catch(()=>{}),d}o=new Uint8Array(u);let f=0;for(let d of c)o.set(d,f),f+=d.byteLength}else{let l=await $h(e.arrayBuffer(),r);if(n>0&&l.byteLength>n)throw new fi(n);o=new Uint8Array(l)}let a={status:e.status,statusText:e.statusText,headers:i,body:o,url:t};return s&&s.length>0&&(a.redirectChain=s),a}mn();kt();G();function Qc(e,t){if(e.length>t||M(e)>t)throw new C(`script input size limit exceeded (${t} bytes)`,"string_length")}var Dh=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;abortOnUnresolvedCommands=!1;invokeToolFn;transformPlugins=[];state;constructor(t={}){if(this.limits=Ul({...t.executionLimits,...t.maxCallDepth!==void 0&&{maxCallDepth:t.maxCallDepth},...t.maxCommandCount!==void 0&&{maxCommandCount:t.maxCommandCount},...t.maxLoopIterations!==void 0&&{maxLoopIterations:t.maxLoopIterations}},t.executionLimitProfile),t.fs&&t.files)throw new Error("Bash: options.files is ignored when options.fs is provided; write the files into your filesystem directly or drop options.fs");let n=t.fs??new pr(t.files,{maxTotalBytes:this.limits.maxFileSystemBytes});this.fs=n,this.useDefaultLayout=!t.cwd&&!t.files;let r=t.cwd||(this.useDefaultLayout?"/home/user":"/"),s=new Map([["HOME",this.useDefaultLayout?"/home/user":"/"],["PATH","/usr/bin:/bin"],["IFS",`
1611
1611
  `],["OSTYPE","linux-gnu"],["MACHTYPE","x86_64-pc-linux-gnu"],["HOSTTYPE","x86_64"],["HOSTNAME","localhost"],["PWD",r],["OLDPWD",r],["OPTIND","1"],...Object.entries(t.env??{})]);if(t.fetch?this.secureFetch=t.fetch:t.network&&(this.secureFetch=Rh(t.network)),this.sleepFn=t.sleep,this.traceFn=t.trace,this.logger=t.logger,this.defenseInDepthConfig=t.defenseInDepth??!0,this.abortOnUnresolvedCommands=t.abortOnUnresolvedCommands??!1,this.coverageWriter=t.coverage,this.state={env:s,arrays:new Map,cwd:r,previousDir:"/home/user",functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastSubstitutionExitCode:null,lastArg:"",startTime:Date.now(),lastBackgroundPid:0,virtualPid:t.processInfo?.pid??1,virtualPpid:t.processInfo?.ppid??0,virtualUid:t.processInfo?.uid??1e3,virtualGid:t.processInfo?.gid??1e3,bashPid:t.processInfo?.pid??1,nextVirtualPid:(t.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(t.env||{})]),readonlyVars:new Set(["SHELLOPTS","BASHOPTS"]),hashTable:new Map},this.state.env.set("SHELLOPTS",Nd(this.state.options)),this.state.env.set("BASHOPTS",Id(this.state.shoptOptions)),Xw(n,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),r!=="/"&&(n instanceof pr||n instanceof as))try{n.mkdirSync(r,{recursive:!0})}catch{}for(let o of Lw(t.commands))this.registerBundledCommand(o);if(t.fetch||t.network)for(let o of Fw())this.registerBundledCommand(o);if(t.python)for(let o of Mw())this.registerBundledCommand(o);let i=typeof t.javascript=="object"?t.javascript:Object.create(null);if(t.javascript||i.invokeTool){for(let o of _w())this.registerBundledCommand(o);i.bootstrap&&(this.jsBootstrapCode=i.bootstrap),i.invokeTool&&(this.invokeToolFn=i.invokeTool)}if(t.customCommands)for(let o of t.customCommands)if(jw(o)){let a=Hw(o);this.registerCommandInternal(a,!0)}else this.registerCommandInternal(o,!0)}registerCommand(t){this.registerCommandInternal(t,!0)}registerBundledCommand(t){this.registerCommandInternal(t,!1)}registerCommandInternal(t,n,r=n?t.trusted??!0:t.trusted){let s=this.commands.get(t.name),i=n?s?.internalOriginalCommand??(s&&!s.internalIsExtension?s:void 0):void 0,o={name:t.name,trusted:r,internalIsExtension:n,internalOriginalCommand:i,handlesOwnVersion:t.handlesOwnVersion,execute:(l,c)=>t.execute(l,c)};this.commands.set(t.name,o);let a=this.fs;if(typeof a.writeFileSync=="function"){let l=`#!/bin/bash
1612
1612
  # Built-in command: ${t.name}
1613
1613
  `;try{a.writeFileSync(`/bin/${t.name}`,l)}catch{}try{a.writeFileSync(`/usr/bin/${t.name}`,l)}catch{}}}logResult(t){return this.logger&&(t.stdout&&this.logger.debug("stdout",{output:t.stdout}),t.stderr&&this.logger.info("stderr",{output:t.stderr}),this.logger.info("exit",{exitCode:t.exitCode})),t.stdout=Yb(t.stdout),t.stderr=Yb(t.stderr),t}async exec(t,n){let r=new zl(this.limits,n?.signal,this.abortOnUnresolvedCommands),s;try{s=await this.execInScope(t,n,r,0,n?.signal,!1,!1)}catch(o){try{await r.close()}catch{}throw o}let i=s;try{await r.close()}catch{i={...s,stderr:`${s.stderr}bash: execution cleanup failed
1614
- `,exitCode:126}}return i.unresolvedCommands=r.unresolvedCommandNames,t.trim()?this.logResult(i):i}async execInScope(t,n,r,s,i,o=!1,a=!0){let l=f=>a?this.logResult(f):f,c=hi(i,n?.signal),u=n?{...n,signal:c.signal}:{signal:c.signal};try{if(r.assertExecDepth(s),Qc(t,this.limits.maxSourceBytes),!t.trim())return{stdout:"",stderr:"",exitCode:0,env:bn(this.state.env,u.env)};this.logger?.info("exec",{command:t});let f=u.cwd??this.state.cwd,d,p=f;if(u.cwd)if(u.env&&"PWD"in u.env)d=u.env.PWD;else if(u.env&&!("PWD"in u.env))try{d=await this.fs.realpath(f),p=d}catch{d=f}else d=f;let h=u.replaceEnv?new Map:new Map(this.state.env);if(u.env)for(let[w,x]of Object.entries(u.env))h.set(w,x);d!==void 0&&h.set("PWD",d);let m={...this.state,env:h,arrays:u.replaceEnv?new Map:Qn(this.state.arrays),cwd:p,previousDir:u.env?.OLDPWD??this.state.previousDir,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:Y$(u.stdin,u.stdinKind,this.limits.maxInputBytes,this.limits.maxStringLength,r,o),signal:u.signal,extraArgs:u.args},g=t;u.rawScript||(g=Ph(t));let b=this.defenseInDepthConfig?Ct.getInstance(this.defenseInDepthConfig):null,y=b?.activate();try{let w=async()=>{let x=Yn(g,{maxHeredocSize:this.limits.maxHeredocSize}),S;if(this.transformPlugins.length>0){let N=Object.create(null);for(let $ of this.transformPlugins){let T=$.transform({ast:x,metadata:N});x=T.ast,T.metadata&&(N=_s(N,T.metadata))}S=N}let E={fs:this.fs,commands:this.commands,limits:this.limits,executionScope:r,exec:(N,$,T=!1)=>this.execInScope(N,$,r,s+1,u.signal,T),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:b?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},R=await new ya(E,m).executeScript(x);return S&&(R.metadata=S),l(R)};return y?await y.run(w):await w()}catch(w){if(w instanceof we)return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)});if(w instanceof Tt){if(s>0)throw w;return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)})}if(w instanceof gn)return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,env:bn(this.state.env,u.env)});if(w instanceof qe)return l({stdout:w.stdout,stderr:w.stderr,exitCode:1,env:bn(this.state.env,u.env)});if(w instanceof _e)return l({stdout:w.stdout,stderr:w.stderr,exitCode:124,env:bn(this.state.env,u.env)});if(w instanceof C)return l({stdout:w.stdout,stderr:Ge(w.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)});if(w instanceof Ce)return l({stdout:"",stderr:`bash: security violation: ${Ge(w.message)}
1615
- `,exitCode:1,env:bn(this.state.env,u.env)});if(w.name==="ParseException")return l({stdout:"",stderr:`bash: syntax error: ${Ge(w.message)}
1616
- `,exitCode:2,env:bn(this.state.env,u.env)});if(w instanceof Rn)return l({stdout:"",stderr:`bash: ${Ge(w.message)}
1617
- `,exitCode:2,env:bn(this.state.env,u.env)});if(w instanceof RangeError)return l({stdout:"",stderr:`bash: ${Ge(w.message)}
1618
- `,exitCode:1,env:bn(this.state.env,u.env)});throw w}finally{y?.deactivate()}}catch(f){if(f instanceof _e)return l({stdout:f.stdout,stderr:f.stderr,exitCode:124,env:bn(this.state.env,u.env)});if(f instanceof C)return l({stdout:f.stdout,stderr:Ge(f.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:f.internalOutputAccounting,env:bn(this.state.env,u.env)});throw f}finally{c.cleanup()}}async readFile(t){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,t))}async writeFile(t,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,t),n)}getCwd(){return this.state.cwd}getEnv(){return Vt(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){Qc(t,this.limits.maxSourceBytes);let n=Ph(t),r=Yn(n,{maxHeredocSize:this.limits.maxHeredocSize}),s=Object.create(null);for(let i of this.transformPlugins){let o=i.transform({ast:r,metadata:s});r=o.ast,o.metadata&&(s=_s(s,o.metadata))}return{script:_7(r),ast:r,metadata:s}}async analyzeCommands(t){Qc(t,this.limits.maxSourceBytes);let n=Yn(Ph(t),{maxHeredocSize:this.limits.maxHeredocSize}),{commands:r,definedFunctions:s,definedAliases:i}=Qw(n),o=[];for(let a of r)s.has(a)||i.has(a)||await this.resolvesCommandForAnalysis(a)||o.push(a);return{commands:r,unresolved:o}}async resolvesCommandForAnalysis(t){if((Yo.has(t)||dr.has(t))&&!dd.has(t)||this.state.functions.has(t))return!0;let n=await jl({fs:this.fs,state:{...this.state,hashTable:new Map},commands:this.commands},t);return n!==null&&!("error"in n)}};function X$(e,t){let n=t;for(let r=0;r<e.length;r++){let s=e[r];if(n==="single")s==="'"&&(n="none");else if(n==="double")s==="\\"?r++:s==='"'&&(n="none");else if(s==="'")n="single";else if(s==='"')n="double";else if(s==="\\")r++;else if(s==="#"&&(r===0||/\s/.test(e[r-1])))break}return n}function Ph(e){let t=e.split(`
1614
+ `,exitCode:126}}return i.unresolvedCommands=r.unresolvedCommandNames,t.trim()?this.logResult(i):i}async execInScope(t,n,r,s,i,o=!1,a=!0){let l=f=>a?this.logResult(f):f,c=hi(i,n?.signal),u=n?{...n,signal:c.signal}:{signal:c.signal};try{if(r.assertExecDepth(s),Qc(t,this.limits.maxSourceBytes),!t.trim())return{stdout:"",stderr:"",exitCode:0,env:bn(this.state.env,u.env)};this.logger?.info("exec",{command:t});let f=u.cwd??this.state.cwd,d,p=f;if(u.cwd)if(u.env&&"PWD"in u.env)d=u.env.PWD;else if(u.env&&!("PWD"in u.env))try{d=await this.fs.realpath(f),p=d}catch{d=f}else d=f;let h=u.replaceEnv?new Map:new Map(this.state.env);if(u.env)for(let[w,x]of Object.entries(u.env))h.set(w,x);d!==void 0&&h.set("PWD",d);let m={...this.state,env:h,arrays:u.replaceEnv?new Map:Qn(this.state.arrays),cwd:p,previousDir:u.env?.OLDPWD??this.state.previousDir,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:Y$(u.stdin,u.stdinKind,this.limits.maxInputBytes,this.limits.maxStringLength,r,o),signal:u.signal,extraArgs:u.args},g=t;u.rawScript||(g=Ph(t));let b=this.defenseInDepthConfig?Ct.getInstance(this.defenseInDepthConfig):null,y=b?.activate();try{let w=async()=>{let x=Yn(g,{maxHeredocSize:this.limits.maxHeredocSize}),S;if(this.transformPlugins.length>0){let N=Object.create(null);for(let $ of this.transformPlugins){let T=$.transform({ast:x,metadata:N});x=T.ast,T.metadata&&(N=_s(N,T.metadata))}S=N}let E={fs:this.fs,commands:this.commands,limits:this.limits,executionScope:r,exec:(N,$,T=!1)=>this.execInScope(N,$,r,s+1,u.signal,T),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:b?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode,invokeTool:this.invokeToolFn},R=await new ya(E,m).executeScript(x);return S&&(R.metadata=S),l(R)};return y?await y.run(w):await w()}catch(w){if(w instanceof we)return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)});if(w instanceof Tt){if(s>0)throw w;return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)})}if(w instanceof gn)return l({stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,env:bn(this.state.env,u.env)});if(w instanceof Ge)return l({stdout:w.stdout,stderr:w.stderr,exitCode:1,env:bn(this.state.env,u.env)});if(w instanceof Fe)return l({stdout:w.stdout,stderr:w.stderr,exitCode:124,env:bn(this.state.env,u.env)});if(w instanceof C)return l({stdout:w.stdout,stderr:Ze(w.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:w.internalOutputAccounting,env:bn(this.state.env,u.env)});if(w instanceof Ce)return l({stdout:"",stderr:`bash: security violation: ${Ze(w.message)}
1615
+ `,exitCode:1,env:bn(this.state.env,u.env)});if(w.name==="ParseException")return l({stdout:"",stderr:`bash: syntax error: ${Ze(w.message)}
1616
+ `,exitCode:2,env:bn(this.state.env,u.env)});if(w instanceof Rn)return l({stdout:"",stderr:`bash: ${Ze(w.message)}
1617
+ `,exitCode:2,env:bn(this.state.env,u.env)});if(w instanceof RangeError)return l({stdout:"",stderr:`bash: ${Ze(w.message)}
1618
+ `,exitCode:1,env:bn(this.state.env,u.env)});throw w}finally{y?.deactivate()}}catch(f){if(f instanceof Fe)return l({stdout:f.stdout,stderr:f.stderr,exitCode:124,env:bn(this.state.env,u.env)});if(f instanceof C)return l({stdout:f.stdout,stderr:Ze(f.stderr),exitCode:C.EXIT_CODE,internalOutputAccounting:f.internalOutputAccounting,env:bn(this.state.env,u.env)});throw f}finally{c.cleanup()}}async readFile(t){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,t))}async writeFile(t,n){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,t),n)}getCwd(){return this.state.cwd}getEnv(){return Vt(this.state.env)}registerTransformPlugin(t){this.transformPlugins.push(t)}transform(t){Qc(t,this.limits.maxSourceBytes);let n=Ph(t),r=Yn(n,{maxHeredocSize:this.limits.maxHeredocSize}),s=Object.create(null);for(let i of this.transformPlugins){let o=i.transform({ast:r,metadata:s});r=o.ast,o.metadata&&(s=_s(s,o.metadata))}return{script:_7(r),ast:r,metadata:s}}async analyzeCommands(t){Qc(t,this.limits.maxSourceBytes);let n=Yn(Ph(t),{maxHeredocSize:this.limits.maxHeredocSize}),{commands:r,definedFunctions:s,definedAliases:i}=Qw(n),o=[];for(let a of r)s.has(a)||i.has(a)||await this.resolvesCommandForAnalysis(a)||o.push(a);return{commands:r,unresolved:o}}async resolvesCommandForAnalysis(t){if((Yo.has(t)||dr.has(t))&&!dd.has(t)||this.state.functions.has(t))return!0;let n=await jl({fs:this.fs,state:{...this.state,hashTable:new Map},commands:this.commands},t);return n!==null&&!("error"in n)}};function X$(e,t){let n=t;for(let r=0;r<e.length;r++){let s=e[r];if(n==="single")s==="'"&&(n="none");else if(n==="double")s==="\\"?r++:s==='"'&&(n="none");else if(s==="'")n="single";else if(s==='"')n="double";else if(s==="\\")r++;else if(s==="#"&&(r===0||/\s/.test(e[r-1])))break}return n}function Ph(e){let t=e.split(`
1619
1619
  `),n=[],r=[],s="none";for(let i=0;i<t.length;i++){let o=t[i];if(r.length>0){let u=r[r.length-1];if((u.stripTabs?o.replace(/^\t+/,""):o)===u.delimiter){n.push(o.trimStart()),r.pop();continue}n.push(o);continue}let a=s,l=a==="none"?o.trimStart():o;if(n.push(l),s=X$(o,a),a!=="none")continue;let c=/<<(-?)\s*(['"]?)([\w-]+)\2/g;for(let u of l.matchAll(c)){let f=u[1]==="-",d=u[3];r.push({delimiter:d,stripTabs:f})}}return n.join(`
1620
1620
  `)}var Q$=new TextDecoder("utf-8",{fatal:!0});function Yb(e){if(!e)return e;let t=!1;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);if(s>255)return e;s>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);try{return Q$.decode(n)}catch{return e}}function Y$(e,t,n,r,s,i){if(e===void 0)return;let o=t==="bytes"?e.length:M(e);if(o>n||o>r)throw new C(`stdin size limit exceeded (${Math.min(n,r)} bytes)`,"string_length");return i||s.consumeInput(o,"stdin"),t==="bytes"?e:Mn(e)}export{Dh as Bash,pr as InMemoryFs,as as MountableFs,nr as NetworkAccessDeniedError,Yr as RedirectNotAllowedError,ui as TooManyRedirectsError,qN as createCommandContext,GN as defineCommand,WN as getCommandNames,jN as getNetworkCommandNames};
1621
1621
  /*! Bundled license information: