#!/usr/bin/env node
"use strict";var u=Object.defineProperty;var s=(r,e)=>u(r,"name",{value:e,configurable:!0});var S=require("fs"),sysPath=require("path"),index=require("./index2.cjs"),commands_agent=require("./agent.index.cjs");require("node:url");require("node:fs");require("node:fs/promises");require("node:util");require("node:path");require("os");require("node:os");require("tty");require("util");require("node:perf_hooks");require("url");require("node:readline");require("node:process");require("node:tty");require("./index3.cjs");require("crypto");require("buffer");require("./index4.cjs");require("stream");require("events");require("string_decoder");require("zlib");require("http");require("https");require("assert");require("process");require("querystring");require("net");require("tls");require("dns");require("fs/promises");require("child_process");require("punycode");require("node:events");require("node:stream");require("http2");require("node:stream/web");require("timers");require("node:crypto");require("readline");require("./index5.cjs");require("./index6.cjs");/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */var nodeDomexception,hasRequiredNodeDomexception;function requireNodeDomexception(){if(hasRequiredNodeDomexception)return nodeDomexception;if(hasRequiredNodeDomexception=1,!globalThis.DOMException)try{const{MessageChannel:r}=require("worker_threads"),e=new r().port1,t=new ArrayBuffer;e.postMessage(t,[t,t])}catch(r){r.constructor.name==="DOMException"&&(globalThis.DOMException=r.constructor)}return nodeDomexception=globalThis.DOMException,nodeDomexception}s(requireNodeDomexception,"requireNodeDomexception");var nodeDomexceptionExports=requireNodeDomexception(),DOMException=index.getDefaultExportFromCjs(nodeDomexceptionExports);const getType=s(r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),"getType");function isPlainObject(r){if(getType(r)!=="object")return!1;const e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}s(isPlainObject,"isPlainObject");var __classPrivateFieldSet=function(r,e,t,i,o){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t},__classPrivateFieldGet=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_FileFromPath_path,_FileFromPath_start;const MESSAGE="The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.";class FileFromPath{static{s(this,"FileFromPath")}constructor(e){_FileFromPath_path.set(this,void 0),_FileFromPath_start.set(this,void 0),__classPrivateFieldSet(this,_FileFromPath_path,e.path,"f"),__classPrivateFieldSet(this,_FileFromPath_start,e.start||0,"f"),this.name=sysPath.basename(__classPrivateFieldGet(this,_FileFromPath_path,"f")),this.size=e.size,this.lastModified=e.lastModified}slice(e,t){return new FileFromPath({path:__classPrivateFieldGet(this,_FileFromPath_path,"f"),lastModified:this.lastModified,size:t-e,start:e})}async*stream(){const{mtimeMs:e}=await S.promises.stat(__classPrivateFieldGet(this,_FileFromPath_path,"f"));if(e>this.lastModified)throw new DOMException(MESSAGE,"NotReadableError");this.size&&(yield*S.createReadStream(__classPrivateFieldGet(this,_FileFromPath_path,"f"),{start:__classPrivateFieldGet(this,_FileFromPath_start,"f"),end:__classPrivateFieldGet(this,_FileFromPath_start,"f")+this.size-1}))}get[(_FileFromPath_path=new WeakMap,_FileFromPath_start=new WeakMap,Symbol.toStringTag)](){return"File"}}function createFileFromPath(r,{mtimeMs:e,size:t},i,o={}){let n;isPlainObject(i)?[o,n]=[i,void 0]:n=i;const a=new FileFromPath({path:r,size:t,lastModified:e});return n||(n=a.name),new commands_agent.File([a],n,{...o,lastModified:a.lastModified})}s(createFileFromPath,"createFileFromPath");async function fileFromPath(r,e,t){const i=await S.promises.stat(r);return createFileFromPath(r,i,e,t)}s(fileFromPath,"fileFromPath");exports.isFile=commands_agent.isFile;exports.fileFromPath=fileFromPath;
