@raycast/api 1.93.2 → 1.94.0

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.
@@ -11,7 +11,7 @@ Content-Type: ${c.type||"application/octet-stream"}\r
11
11
  `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),Pe=(r,o,a)=>{if(o.length<a)throw new TypeError(`Failed to execute '${r}' on 'FormData': ${a} arguments required, but only ${o.length} present.`)},nt=class{#e=[];constructor(...o){if(o.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Xe](){return"FormData"}[ta](){return this.entries()}static[ra](o){return o&&typeof o=="object"&&o[Xe]==="FormData"&&!na.some(a=>typeof o[a]!="function")}append(...o){Pe("append",arguments,2),this.#e.push(cn(...o))}delete(o){Pe("delete",arguments,1),o+="",this.#e=this.#e.filter(([a])=>a!==o)}get(o){Pe("get",arguments,1),o+="";for(var a=this.#e,i=a.length,l=0;l<i;l++)if(a[l][0]===o)return a[l][1];return null}getAll(o,a){return Pe("getAll",arguments,1),a=[],o+="",this.#e.forEach(i=>i[0]===o&&a.push(i[1])),a}has(o){return Pe("has",arguments,1),o+="",this.#e.some(a=>a[0]===o)}forEach(o,a){Pe("forEach",arguments,1);for(var[i,l]of this)o.call(a,l,i,this)}set(...o){Pe("set",arguments,2);var a=[],i=!0;o=cn(...o),this.#e.forEach(l=>{l[0]===o[0]?i&&(i=!a.push(o)):a.push(l)}),i&&a.push(o),this.#e=a}*entries(){yield*this.#e}*keys(){for(var[o]of this)yield o}*values(){for(var[,o]of this)yield o}}}}),Hs=Sn({"node_modules/node-domexception/index.js"(r,o){if(!globalThis.DOMException)try{let{MessageChannel:a}=require("worker_threads"),i=new a().port1,l=new ArrayBuffer;i.postMessage(l,[l,l])}catch(a){a.constructor.name==="DOMException"&&(globalThis.DOMException=a.constructor)}o.exports=globalThis.DOMException}}),wt,oa,aa,hr,ba,ya,ga,_a,fn,dn,mr,Sa=At({"node_modules/fetch-blob/from.js"(){wt=H(require("fs")),oa=H(require("path")),aa=H(Hs()),pa(),Pt(),{stat:hr}=wt.promises,ba=(r,o)=>fn((0,wt.statSync)(r),r,o),ya=(r,o)=>hr(r).then(a=>fn(a,r,o)),ga=(r,o)=>hr(r).then(a=>dn(a,r,o)),_a=(r,o)=>dn((0,wt.statSync)(r),r,o),fn=(r,o,a="")=>new rt([new mr({path:o,size:r.size,lastModified:r.mtimeMs,start:0})],{type:a}),dn=(r,o,a="")=>new kt([new mr({path:o,size:r.size,lastModified:r.mtimeMs,start:0})],(0,oa.basename)(o),{type:a,lastModified:r.mtimeMs}),mr=class{#e;#t;constructor(r){this.#e=r.path,this.#t=r.start,this.size=r.size,this.lastModified=r.lastModified}slice(r,o){return new mr({path:this.#e,lastModified:this.lastModified,size:o-r,start:this.#t+r})}async*stream(){let{mtimeMs:r}=await hr(this.#e);if(r>this.lastModified)throw new aa.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*(0,wt.createReadStream)(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}}}),wa={};ma(wa,{toFormData:()=>Ys});function Vs(r){let o=r.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!o)return;let a=o[2]||o[3]||"",i=a.slice(a.lastIndexOf("\\")+1);return i=i.replace(/%22/g,'"'),i=i.replace(/&#(\d{4});/g,(l,c)=>String.fromCharCode(c)),i}async function Ys(r,o){if(!/multipart/i.test(o))throw new TypeError("Failed to fetch");let a=o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!a)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new va(a[1]||a[2]),l,c,m,d,y,g,q=[],I=new nt,O=v=>{m+=C.decode(v,{stream:!0})},S=v=>{q.push(v)},p=()=>{let v=new kt(q,g,{type:y});I.append(d,v)},b=()=>{I.append(d,m)},C=new TextDecoder("utf-8");C.decode(),i.onPartBegin=function(){i.onPartData=O,i.onPartEnd=b,l="",c="",m="",d="",y="",g=null,q.length=0},i.onHeaderField=function(v){l+=C.decode(v,{stream:!0})},i.onHeaderValue=function(v){c+=C.decode(v,{stream:!0})},i.onHeaderEnd=function(){if(c+=C.decode(),l=l.toLowerCase(),l==="content-disposition"){let v=c.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);v&&(d=v[2]||v[3]||""),g=Vs(c),g&&(i.onPartData=S,i.onPartEnd=p)}else l==="content-type"&&(y=c);c="",l=""};for await(let v of r)i.write(v);return i.end(),I}var ie,W,hn,_e,vt,Rt,ia,Ze,sa,la,ua,ca,ke,va,Gs=At({"node_modules/node-fetch/src/utils/multipart-parser.js"(){Sa(),vr(),ie=0,W={START_BOUNDARY:ie++,HEADER_FIELD_START:ie++,HEADER_FIELD:ie++,HEADER_VALUE_START:ie++,HEADER_VALUE:ie++,HEADER_VALUE_ALMOST_DONE:ie++,HEADERS_ALMOST_DONE:ie++,PART_DATA_START:ie++,PART_DATA:ie++,END:ie++},hn=1,_e={PART_BOUNDARY:hn,LAST_BOUNDARY:hn*=2},vt=10,Rt=13,ia=32,Ze=45,sa=58,la=97,ua=122,ca=r=>r|32,ke=()=>{},va=class{constructor(r){this.index=0,this.flags=0,this.onHeaderEnd=ke,this.onHeaderField=ke,this.onHeadersEnd=ke,this.onHeaderValue=ke,this.onPartBegin=ke,this.onPartData=ke,this.onPartEnd=ke,this.boundaryChars={},r=`\r
12
12
  --`+r;let o=new Uint8Array(r.length);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a),this.boundaryChars[o[a]]=!0;this.boundary=o,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=W.START_BOUNDARY}write(r){let o=0,a=r.length,i=this.index,{lookbehind:l,boundary:c,boundaryChars:m,index:d,state:y,flags:g}=this,q=this.boundary.length,I=q-1,O=r.length,S,p,b=N=>{this[N+"Mark"]=o},C=N=>{delete this[N+"Mark"]},v=(N,D,L,z)=>{(D===void 0||D!==L)&&this[N](z&&z.subarray(D,L))},U=(N,D)=>{let L=N+"Mark";L in this&&(D?(v(N,this[L],o,r),delete this[L]):(v(N,this[L],r.length,r),this[L]=0))};for(o=0;o<a;o++)switch(S=r[o],y){case W.START_BOUNDARY:if(d===c.length-2){if(S===Ze)g|=_e.LAST_BOUNDARY;else if(S!==Rt)return;d++;break}else if(d-1===c.length-2){if(g&_e.LAST_BOUNDARY&&S===Ze)y=W.END,g=0;else if(!(g&_e.LAST_BOUNDARY)&&S===vt)d=0,v("onPartBegin"),y=W.HEADER_FIELD_START;else return;break}S!==c[d+2]&&(d=-2),S===c[d+2]&&d++;break;case W.HEADER_FIELD_START:y=W.HEADER_FIELD,b("onHeaderField"),d=0;case W.HEADER_FIELD:if(S===Rt){C("onHeaderField"),y=W.HEADERS_ALMOST_DONE;break}if(d++,S===Ze)break;if(S===sa){if(d===1)return;U("onHeaderField",!0),y=W.HEADER_VALUE_START;break}if(p=ca(S),p<la||p>ua)return;break;case W.HEADER_VALUE_START:if(S===ia)break;b("onHeaderValue"),y=W.HEADER_VALUE;case W.HEADER_VALUE:S===Rt&&(U("onHeaderValue",!0),v("onHeaderEnd"),y=W.HEADER_VALUE_ALMOST_DONE);break;case W.HEADER_VALUE_ALMOST_DONE:if(S!==vt)return;y=W.HEADER_FIELD_START;break;case W.HEADERS_ALMOST_DONE:if(S!==vt)return;v("onHeadersEnd"),y=W.PART_DATA_START;break;case W.PART_DATA_START:y=W.PART_DATA,b("onPartData");case W.PART_DATA:if(i=d,d===0){for(o+=I;o<O&&!(r[o]in m);)o+=q;o-=I,S=r[o]}if(d<c.length)c[d]===S?(d===0&&U("onPartData",!0),d++):d=0;else if(d===c.length)d++,S===Rt?g|=_e.PART_BOUNDARY:S===Ze?g|=_e.LAST_BOUNDARY:d=0;else if(d-1===c.length)if(g&_e.PART_BOUNDARY){if(d=0,S===vt){g&=~_e.PART_BOUNDARY,v("onPartEnd"),v("onPartBegin"),y=W.HEADER_FIELD_START;break}}else g&_e.LAST_BOUNDARY&&S===Ze?(v("onPartEnd"),y=W.END,g=0):d=0;if(d>0)l[d-1]=S;else if(i>0){let N=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);v("onPartData",0,i,N),i=0,b("onPartData"),o--}break;case W.END:break;default:throw new Error(`Unexpected state entered: ${y}`)}U("onHeaderField"),U("onHeaderValue"),U("onPartData"),this.index=d,this.state=y,this.flags=g}end(){if(this.state===W.HEADER_FIELD_START&&this.index===0||this.state===W.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==W.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}}});ma(Pa,{AbortError:()=>Ca,Blob:()=>bn,FetchError:()=>le,File:()=>kt,FormData:()=>nt,Headers:()=>Se,Request:()=>Ct,Response:()=>X,blobFrom:()=>ya,blobFromSync:()=>ba,default:()=>Aa,fileFrom:()=>ga,fileFromSync:()=>_a,isRedirect:()=>vn});var Qs=H(require("http")),Js=H(require("https")),et=H(require("zlib")),ce=H(require("stream")),pr=H(require("buffer"));function Ks(r){if(!/^data:/i.test(r))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');r=r.replace(/\r?\n/g,"");let o=r.indexOf(",");if(o===-1||o<=4)throw new TypeError("malformed data: URI");let a=r.substring(5,o).split(";"),i="",l=!1,c=a[0]||"text/plain",m=c;for(let q=1;q<a.length;q++)a[q]==="base64"?l=!0:a[q]&&(m+=`;${a[q]}`,a[q].indexOf("charset=")===0&&(i=a[q].substring(8)));!a[0]&&!i.length&&(m+=";charset=US-ASCII",i="US-ASCII");let d=l?"base64":"ascii",y=unescape(r.substring(o+1)),g=Buffer.from(y,d);return g.type=c,g.typeFull=m,g.charset=i,g}var Xs=Ks,fe=H(require("stream")),ot=H(require("util")),ee=H(require("buffer"));Pt();vr();var Rr=class extends Error{constructor(r,o){super(r),Error.captureStackTrace(this,this.constructor),this.type=o}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},le=class extends Rr{constructor(r,o,a){super(r,o),a&&(this.code=this.errno=a.code,this.erroredSysCall=a.syscall)}},gr=Symbol.toStringTag,Ra=r=>typeof r=="object"&&typeof r.append=="function"&&typeof r.delete=="function"&&typeof r.get=="function"&&typeof r.getAll=="function"&&typeof r.has=="function"&&typeof r.set=="function"&&typeof r.sort=="function"&&r[gr]==="URLSearchParams",_r=r=>r&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.constructor=="function"&&/^(Blob|File)$/.test(r[gr]),Zs=r=>typeof r=="object"&&(r[gr]==="AbortSignal"||r[gr]==="EventTarget"),el=(r,o)=>{let a=new URL(o).hostname,i=new URL(r).hostname;return a===i||a.endsWith(`.${i}`)},tl=(r,o)=>{let a=new URL(o).protocol,i=new URL(r).protocol;return a===i},rl=(0,ot.promisify)(fe.default.pipeline),Q=Symbol("Body internals"),Et=class{constructor(r,{size:o=0}={}){let a=null;r===null?r=null:Ra(r)?r=ee.Buffer.from(r.toString()):_r(r)||ee.Buffer.isBuffer(r)||(ot.types.isAnyArrayBuffer(r)?r=ee.Buffer.from(r):ArrayBuffer.isView(r)?r=ee.Buffer.from(r.buffer,r.byteOffset,r.byteLength):r instanceof fe.default||(r instanceof nt?(r=Ns(r),a=r.type.split("=")[1]):r=ee.Buffer.from(String(r))));let i=r;ee.Buffer.isBuffer(r)?i=fe.default.Readable.from(r):_r(r)&&(i=fe.default.Readable.from(r.stream())),this[Q]={body:r,stream:i,boundary:a,disturbed:!1,error:null},this.size=o,r instanceof fe.default&&r.on("error",l=>{let c=l instanceof Rr?l:new le(`Invalid response body while trying to fetch ${this.url}: ${l.message}`,"system",l);this[Q].error=c})}get body(){return this[Q].stream}get bodyUsed(){return this[Q].disturbed}async arrayBuffer(){let{buffer:r,byteOffset:o,byteLength:a}=await mn(this);return r.slice(o,o+a)}async formData(){let r=this.headers.get("content-type");if(r.startsWith("application/x-www-form-urlencoded")){let a=new nt,i=new URLSearchParams(await this.text());for(let[l,c]of i)a.append(l,c);return a}let{toFormData:o}=await Promise.resolve().then(()=>(Gs(),wa));return o(this.body,r)}async blob(){let r=this.headers&&this.headers.get("content-type")||this[Q].body&&this[Q].body.type||"",o=await this.arrayBuffer();return new rt([o],{type:r})}async json(){let r=await this.text();return JSON.parse(r)}async text(){let r=await mn(this);return new TextDecoder().decode(r)}buffer(){return mn(this)}};Et.prototype.buffer=(0,ot.deprecate)(Et.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Et.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,ot.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function mn(r){if(r[Q].disturbed)throw new TypeError(`body used already for: ${r.url}`);if(r[Q].disturbed=!0,r[Q].error)throw r[Q].error;let{body:o}=r;if(o===null||!(o instanceof fe.default))return ee.Buffer.alloc(0);let a=[],i=0;try{for await(let l of o){if(r.size>0&&i+l.length>r.size){let c=new le(`content size at ${r.url} over limit: ${r.size}`,"max-size");throw o.destroy(c),c}i+=l.length,a.push(l)}}catch(l){throw l instanceof Rr?l:new le(`Invalid response body while trying to fetch ${r.url}: ${l.message}`,"system",l)}if(o.readableEnded===!0||o._readableState.ended===!0)try{return a.every(l=>typeof l=="string")?ee.Buffer.from(a.join("")):ee.Buffer.concat(a,i)}catch(l){throw new le(`Could not create Buffer from response body for ${r.url}: ${l.message}`,"system",l)}else throw new le(`Premature close of server response while trying to fetch ${r.url}`)}var wn=(r,o)=>{let a,i,{body:l}=r[Q];if(r.bodyUsed)throw new Error("cannot clone body after it is used");return l instanceof fe.default&&typeof l.getBoundary!="function"&&(a=new fe.PassThrough({highWaterMark:o}),i=new fe.PassThrough({highWaterMark:o}),l.pipe(a),l.pipe(i),r[Q].stream=a,l=i),l},nl=(0,ot.deprecate)(r=>r.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),Ta=(r,o)=>r===null?null:typeof r=="string"?"text/plain;charset=UTF-8":Ra(r)?"application/x-www-form-urlencoded;charset=UTF-8":_r(r)?r.type||null:ee.Buffer.isBuffer(r)||ot.types.isAnyArrayBuffer(r)||ArrayBuffer.isView(r)?null:r instanceof nt?`multipart/form-data; boundary=${o[Q].boundary}`:r&&typeof r.getBoundary=="function"?`multipart/form-data;boundary=${nl(r)}`:r instanceof fe.default?null:"text/plain;charset=UTF-8",ol=r=>{let{body:o}=r[Q];return o===null?0:_r(o)?o.size:ee.Buffer.isBuffer(o)?o.length:o&&typeof o.getLengthSync=="function"&&o.hasKnownLength&&o.hasKnownLength()?o.getLengthSync():null},al=async(r,{body:o})=>{o===null?r.end():await rl(o,r)},fa=H(require("util")),Sr=H(require("http")),yr=typeof Sr.default.validateHeaderName=="function"?Sr.default.validateHeaderName:r=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(r)){let o=new TypeError(`Header name must be a valid HTTP token [${r}]`);throw Object.defineProperty(o,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),o}},_n=typeof Sr.default.validateHeaderValue=="function"?Sr.default.validateHeaderValue:(r,o)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(o)){let a=new TypeError(`Invalid character in header content ["${r}"]`);throw Object.defineProperty(a,"code",{value:"ERR_INVALID_CHAR"}),a}},Se=class extends URLSearchParams{constructor(r){let o=[];if(r instanceof Se){let a=r.raw();for(let[i,l]of Object.entries(a))o.push(...l.map(c=>[i,c]))}else if(r!=null)if(typeof r=="object"&&!fa.types.isBoxedPrimitive(r)){let a=r[Symbol.iterator];if(a==null)o.push(...Object.entries(r));else{if(typeof a!="function")throw new TypeError("Header pairs must be iterable");o=[...r].map(i=>{if(typeof i!="object"||fa.types.isBoxedPrimitive(i))throw new TypeError("Each header pair must be an iterable object");return[...i]}).map(i=>{if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...i]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return o=o.length>0?o.map(([a,i])=>(yr(a),_n(a,String(i)),[String(a).toLowerCase(),String(i)])):void 0,super(o),new Proxy(this,{get(a,i,l){switch(i){case"append":case"set":return(c,m)=>(yr(c),_n(c,String(m)),URLSearchParams.prototype[i].call(a,String(c).toLowerCase(),String(m)));case"delete":case"has":case"getAll":return c=>(yr(c),URLSearchParams.prototype[i].call(a,String(c).toLowerCase()));case"keys":return()=>(a.sort(),new Set(URLSearchParams.prototype.keys.call(a)).keys());default:return Reflect.get(a,i,l)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(r){let o=this.getAll(r);if(o.length===0)return null;let a=o.join(", ");return/^content-encoding$/i.test(r)&&(a=a.toLowerCase()),a}forEach(r,o=void 0){for(let a of this.keys())Reflect.apply(r,o,[this.get(a),a,this])}*values(){for(let r of this.keys())yield this.get(r)}*entries(){for(let r of this.keys())yield[r,this.get(r)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((r,o)=>(r[o]=this.getAll(o),r),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((r,o)=>{let a=this.getAll(o);return o==="host"?r[o]=a[0]:r[o]=a.length>1?a:a[0],r},{})}};Object.defineProperties(Se.prototype,["get","entries","forEach","values"].reduce((r,o)=>(r[o]={enumerable:!0},r),{}));function il(r=[]){return new Se(r.reduce((o,a,i,l)=>(i%2===0&&o.push(l.slice(i,i+2)),o),[]).filter(([o,a])=>{try{return yr(o),_n(o,String(a)),!0}catch{return!1}}))}var sl=new Set([301,302,303,307,308]),vn=r=>sl.has(r),se=Symbol("Response internals"),X=class extends Et{constructor(r=null,o={}){super(r,o);let a=o.status!=null?o.status:200,i=new Se(o.headers);if(r!==null&&!i.has("Content-Type")){let l=Ta(r,this);l&&i.append("Content-Type",l)}this[se]={type:"default",url:o.url,status:a,statusText:o.statusText||"",headers:i,counter:o.counter,highWaterMark:o.highWaterMark}}get type(){return this[se].type}get url(){return this[se].url||""}get status(){return this[se].status}get ok(){return this[se].status>=200&&this[se].status<300}get redirected(){return this[se].counter>0}get statusText(){return this[se].statusText}get headers(){return this[se].headers}get highWaterMark(){return this[se].highWaterMark}clone(){return new X(wn(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(r,o=302){if(!vn(o))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new X(null,{headers:{location:new URL(r).toString()},status:o})}static error(){let r=new X(null,{status:0,statusText:""});return r[se].type="error",r}static json(r=void 0,o={}){let a=JSON.stringify(r);if(a===void 0)throw new TypeError("data is not JSON serializable");let i=new Se(o&&o.headers);return i.has("content-type")||i.set("content-type","application/json"),new X(a,{...o,headers:i})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(X.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var ll=H(require("url")),ul=H(require("util")),cl=r=>{if(r.search)return r.search;let o=r.href.length-1,a=r.hash||(r.href[o]==="#"?"#":"");return r.href[o-a.length]==="?"?"?":""},fl=H(require("net"));function da(r,o=!1){return r==null||(r=new URL(r),/^(about|blob|data):$/.test(r.protocol))?"no-referrer":(r.username="",r.password="",r.hash="",o&&(r.pathname="",r.search=""),r)}var Ea=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),dl="strict-origin-when-cross-origin";function hl(r){if(!Ea.has(r))throw new TypeError(`Invalid referrerPolicy: ${r}`);return r}function ml(r){if(/^(http|ws)s:$/.test(r.protocol))return!0;let o=r.host.replace(/(^\[)|(]$)/g,""),a=(0,fl.isIP)(o);return a===4&&/^127\./.test(o)||a===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(o)?!0:r.host==="localhost"||r.host.endsWith(".localhost")?!1:r.protocol==="file:"}function tt(r){return/^about:(blank|srcdoc)$/.test(r)||r.protocol==="data:"||/^(blob|filesystem):$/.test(r.protocol)?!0:ml(r)}function pl(r,{referrerURLCallback:o,referrerOriginCallback:a}={}){if(r.referrer==="no-referrer"||r.referrerPolicy==="")return null;let i=r.referrerPolicy;if(r.referrer==="about:client")return"no-referrer";let l=r.referrer,c=da(l),m=da(l,!0);c.toString().length>4096&&(c=m),o&&(c=o(c)),a&&(m=a(m));let d=new URL(r.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return m;case"unsafe-url":return c;case"strict-origin":return tt(c)&&!tt(d)?"no-referrer":m.toString();case"strict-origin-when-cross-origin":return c.origin===d.origin?c:tt(c)&&!tt(d)?"no-referrer":m;case"same-origin":return c.origin===d.origin?c:"no-referrer";case"origin-when-cross-origin":return c.origin===d.origin?c:m;case"no-referrer-when-downgrade":return tt(c)&&!tt(d)?"no-referrer":c;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function bl(r){let o=(r.get("referrer-policy")||"").split(/[,\s]+/),a="";for(let i of o)i&&Ea.has(i)&&(a=i);return a}var M=Symbol("Request internals"),Tt=r=>typeof r=="object"&&typeof r[M]=="object",yl=(0,ul.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Ct=class extends Et{constructor(r,o={}){let a;if(Tt(r)?a=new URL(r.url):(a=new URL(r),r={}),a.username!==""||a.password!=="")throw new TypeError(`${a} is an url with embedded credentials.`);let i=o.method||r.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(i)&&(i=i.toUpperCase()),!Tt(o)&&"data"in o&&yl(),(o.body!=null||Tt(r)&&r.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let l=o.body?o.body:Tt(r)&&r.body!==null?wn(r):null;super(l,{size:o.size||r.size||0});let c=new Se(o.headers||r.headers||{});if(l!==null&&!c.has("Content-Type")){let y=Ta(l,this);y&&c.set("Content-Type",y)}let m=Tt(r)?r.signal:null;if("signal"in o&&(m=o.signal),m!=null&&!Zs(m))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=o.referrer==null?r.referrer:o.referrer;if(d==="")d="no-referrer";else if(d){let y=new URL(d);d=/^about:(\/\/)?client$/.test(y)?"client":y}else d=void 0;this[M]={method:i,redirect:o.redirect||r.redirect||"follow",headers:c,parsedURL:a,signal:m,referrer:d},this.follow=o.follow===void 0?r.follow===void 0?20:r.follow:o.follow,this.compress=o.compress===void 0?r.compress===void 0?!0:r.compress:o.compress,this.counter=o.counter||r.counter||0,this.agent=o.agent||r.agent,this.highWaterMark=o.highWaterMark||r.highWaterMark||16384,this.insecureHTTPParser=o.insecureHTTPParser||r.insecureHTTPParser||!1,this.referrerPolicy=o.referrerPolicy||r.referrerPolicy||""}get method(){return this[M].method}get url(){return(0,ll.format)(this[M].parsedURL)}get headers(){return this[M].headers}get redirect(){return this[M].redirect}get signal(){return this[M].signal}get referrer(){if(this[M].referrer==="no-referrer")return"";if(this[M].referrer==="client")return"about:client";if(this[M].referrer)return this[M].referrer.toString()}get referrerPolicy(){return this[M].referrerPolicy}set referrerPolicy(r){this[M].referrerPolicy=hl(r)}clone(){return new Ct(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Ct.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var gl=r=>{let{parsedURL:o}=r[M],a=new Se(r[M].headers);a.has("Accept")||a.set("Accept","*/*");let i=null;if(r.body===null&&/^(post|put)$/i.test(r.method)&&(i="0"),r.body!==null){let d=ol(r);typeof d=="number"&&!Number.isNaN(d)&&(i=String(d))}i&&a.set("Content-Length",i),r.referrerPolicy===""&&(r.referrerPolicy=dl),r.referrer&&r.referrer!=="no-referrer"?r[M].referrer=pl(r):r[M].referrer="no-referrer",r[M].referrer instanceof URL&&a.set("Referer",r.referrer),a.has("User-Agent")||a.set("User-Agent","node-fetch"),r.compress&&!a.has("Accept-Encoding")&&a.set("Accept-Encoding","gzip, deflate, br");let{agent:l}=r;typeof l=="function"&&(l=l(o));let c=cl(o),m={path:o.pathname+c,method:r.method,headers:a[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:r.insecureHTTPParser,agent:l};return{parsedURL:o,options:m}},Ca=class extends Rr{constructor(r,o="aborted"){super(r,o)}};vr();Sa();var _l=new Set(["data:","http:","https:"]);async function Aa(r,o){return new Promise((a,i)=>{let l=new Ct(r,o),{parsedURL:c,options:m}=gl(l);if(!_l.has(c.protocol))throw new TypeError(`node-fetch cannot load ${r}. URL scheme "${c.protocol.replace(/:$/,"")}" is not supported.`);if(c.protocol==="data:"){let p=Xs(l.url),b=new X(p,{headers:{"Content-Type":p.typeFull}});a(b);return}let d=(c.protocol==="https:"?Js.default:Qs.default).request,{signal:y}=l,g=null,q=()=>{let p=new Ca("The operation was aborted.");i(p),l.body&&l.body instanceof ce.default.Readable&&l.body.destroy(p),!(!g||!g.body)&&g.body.emit("error",p)};if(y&&y.aborted){q();return}let I=()=>{q(),S()},O=d(c.toString(),m);y&&y.addEventListener("abort",I);let S=()=>{O.abort(),y&&y.removeEventListener("abort",I)};O.on("error",p=>{i(new le(`request to ${l.url} failed, reason: ${p.message}`,"system",p)),S()}),Sl(O,p=>{g&&g.body&&g.body.destroy(p)}),process.version<"v14"&&O.on("socket",p=>{let b;p.prependListener("end",()=>{b=p._eventsCount}),p.prependListener("close",C=>{if(g&&b<p._eventsCount&&!C){let v=new Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",g.body.emit("error",v)}})}),O.on("response",p=>{O.setTimeout(0);let b=il(p.rawHeaders);if(vn(p.statusCode)){let D=b.get("Location"),L=null;try{L=D===null?null:new URL(D,l.url)}catch{if(l.redirect!=="manual"){i(new le(`uri requested responds with an invalid redirect URL: ${D}`,"invalid-redirect")),S();return}}switch(l.redirect){case"error":i(new le(`uri requested responds with a redirect, redirect mode is set to error: ${l.url}`,"no-redirect")),S();return;case"manual":break;case"follow":{if(L===null)break;if(l.counter>=l.follow){i(new le(`maximum redirect reached at: ${l.url}`,"max-redirect")),S();return}let z={headers:new Se(l.headers),follow:l.follow,counter:l.counter+1,agent:l.agent,compress:l.compress,method:l.method,body:wn(l),signal:l.signal,size:l.size,referrer:l.referrer,referrerPolicy:l.referrerPolicy};if(!el(l.url,L)||!tl(l.url,L))for(let he of["authorization","www-authenticate","cookie","cookie2"])z.headers.delete(he);if(p.statusCode!==303&&l.body&&o.body instanceof ce.default.Readable){i(new le("Cannot follow redirect with body being a readable stream","unsupported-redirect")),S();return}(p.statusCode===303||(p.statusCode===301||p.statusCode===302)&&l.method==="POST")&&(z.method="GET",z.body=void 0,z.headers.delete("content-length"));let Oe=bl(b);Oe&&(z.referrerPolicy=Oe),a(Aa(new Ct(L,z))),S();return}default:return i(new TypeError(`Redirect option '${l.redirect}' is not a valid value of RequestRedirect`))}}y&&p.once("end",()=>{y.removeEventListener("abort",I)});let C=(0,ce.pipeline)(p,new ce.PassThrough,D=>{D&&i(D)});process.version<"v12.10"&&p.on("aborted",I);let v={url:l.url,status:p.statusCode,statusText:p.statusMessage,headers:b,size:l.size,counter:l.counter,highWaterMark:l.highWaterMark},U=b.get("Content-Encoding");if(!l.compress||l.method==="HEAD"||U===null||p.statusCode===204||p.statusCode===304){g=new X(C,v),a(g);return}let N={flush:et.default.Z_SYNC_FLUSH,finishFlush:et.default.Z_SYNC_FLUSH};if(U==="gzip"||U==="x-gzip"){C=(0,ce.pipeline)(C,et.default.createGunzip(N),D=>{D&&i(D)}),g=new X(C,v),a(g);return}if(U==="deflate"||U==="x-deflate"){let D=(0,ce.pipeline)(p,new ce.PassThrough,L=>{L&&i(L)});D.once("data",L=>{(L[0]&15)===8?C=(0,ce.pipeline)(C,et.default.createInflate(),z=>{z&&i(z)}):C=(0,ce.pipeline)(C,et.default.createInflateRaw(),z=>{z&&i(z)}),g=new X(C,v),a(g)}),D.once("end",()=>{g||(g=new X(C,v),a(g))});return}if(U==="br"){C=(0,ce.pipeline)(C,et.default.createBrotliDecompress(),D=>{D&&i(D)}),g=new X(C,v),a(g);return}g=new X(C,v),a(g)}),al(O,l).catch(i)})}function Sl(r,o){let a=pr.Buffer.from(`0\r
13
13
  \r
14
- `),i=!1,l=!1,c;r.on("response",m=>{let{headers:d}=m;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),r.on("socket",m=>{let d=()=>{if(i&&!l){let g=new Error("Premature close");g.code="ERR_STREAM_PREMATURE_CLOSE",o(g)}},y=g=>{l=pr.Buffer.compare(g.slice(-5),a)===0,!l&&c&&(l=pr.Buffer.compare(c.slice(-3),a.slice(0,3))===0&&pr.Buffer.compare(g.slice(-2),a.slice(3))===0),c=g};m.prependListener("close",d),m.on("data",y),r.on("close",()=>{m.removeListener("close",d),m.removeListener("data",y)})})}Pt();vr();});var Da=Ke((mu,qa)=>{var El=require("node:tty"),Cl=El?.WriteStream?.prototype?.hasColors?.()??!1,T=(r,o)=>{if(!Cl)return l=>l;let a=`\x1B[${r}m`,i=`\x1B[${o}m`;return l=>{let c=l+"",m=c.indexOf(i);if(m===-1)return a+c+i;let d=a,y=0;for(;m!==-1;)d+=c.slice(y,m)+a,y=m+i.length,m=c.indexOf(i,y);return d+=c.slice(y)+i,d}},R={};R.reset=T(0,0);R.bold=T(1,22);R.dim=T(2,22);R.italic=T(3,23);R.underline=T(4,24);R.overline=T(53,55);R.inverse=T(7,27);R.hidden=T(8,28);R.strikethrough=T(9,29);R.black=T(30,39);R.red=T(31,39);R.green=T(32,39);R.yellow=T(33,39);R.blue=T(34,39);R.magenta=T(35,39);R.cyan=T(36,39);R.white=T(37,39);R.gray=T(90,39);R.bgBlack=T(40,49);R.bgRed=T(41,49);R.bgGreen=T(42,49);R.bgYellow=T(43,49);R.bgBlue=T(44,49);R.bgMagenta=T(45,49);R.bgCyan=T(46,49);R.bgWhite=T(47,49);R.bgGray=T(100,49);R.redBright=T(91,39);R.greenBright=T(92,39);R.yellowBright=T(93,39);R.blueBright=T(94,39);R.magentaBright=T(95,39);R.cyanBright=T(96,39);R.whiteBright=T(97,39);R.bgRedBright=T(101,49);R.bgGreenBright=T(102,49);R.bgYellowBright=T(103,49);R.bgBlueBright=T(104,49);R.bgMagentaBright=T(105,49);R.bgCyanBright=T(106,49);R.bgWhiteBright=T(107,49);qa.exports=R});var An=Ke((yu,Fa)=>{"use strict";var Wa=require("fs"),Cn;function Pl(){try{return Wa.statSync("/.dockerenv"),!0}catch{return!1}}function kl(){try{return Wa.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}Fa.exports=()=>(Cn===void 0&&(Cn=Pl()||kl()),Cn)});var $a=Ke((gu,Pn)=>{"use strict";var Bl=require("os"),Ol=require("fs"),Ia=An(),La=()=>{if(process.platform!=="linux")return!1;if(Bl.release().toLowerCase().includes("microsoft"))return!Ia();try{return Ol.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ia():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Pn.exports=La:Pn.exports=La()});var xa=Ke((_u,za)=>{"use strict";za.exports=(r,o,a)=>{let i=l=>Object.defineProperty(r,o,{value:l,enumerable:!0,writable:!0});return Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){let l=a();return i(l),l},set(l){i(l)}}),r}});var Ya=Ke((Su,Va)=>{var ql=require("path"),Dl=require("child_process"),{promises:Er,constants:Ha}=require("fs"),Tr=$a(),Wl=An(),Bn=xa(),ja=ql.join(__dirname,"xdg-open"),{platform:at,arch:Ma}=process,Fl=()=>{try{return Er.statSync("/run/.containerenv"),!0}catch{return!1}},kn;function Il(){return kn===void 0&&(kn=Fl()||Wl()),kn}var Ll=(()=>{let r="/mnt/",o;return async function(){if(o)return o;let a="/etc/wsl.conf",i=!1;try{await Er.access(a,Ha.F_OK),i=!0}catch{}if(!i)return r;let l=await Er.readFile(a,{encoding:"utf8"}),c=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(l);return c?(o=c.groups.mountPoint.trim(),o=o.endsWith("/")?o:`${o}/`,o):r}})(),Ua=async(r,o)=>{let a;for(let i of r)try{return await o(i)}catch(l){a=l}throw a},Cr=async r=>{if(r={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...r},Array.isArray(r.app))return Ua(r.app,d=>Cr({...r,app:d}));let{name:o,arguments:a=[]}=r.app||{};if(a=[...a],Array.isArray(o))return Ua(o,d=>Cr({...r,app:{name:d,arguments:a}}));let i,l=[],c={};if(at==="darwin")i="open",r.wait&&l.push("--wait-apps"),r.background&&l.push("--background"),r.newInstance&&l.push("--new"),o&&l.push("-a",o);else if(at==="win32"||Tr&&!Il()&&!o){let d=await Ll();i=Tr?`${d}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,l.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Tr||(c.windowsVerbatimArguments=!0);let y=["Start"];r.wait&&y.push("-Wait"),o?(y.push(`"\`"${o}\`""`,"-ArgumentList"),r.target&&a.unshift(r.target)):r.target&&y.push(`"${r.target}"`),a.length>0&&(a=a.map(g=>`"\`"${g}\`""`),y.push(a.join(","))),r.target=Buffer.from(y.join(" "),"utf16le").toString("base64")}else{if(o)i=o;else{let d=!__dirname||__dirname==="/",y=!1;try{await Er.access(ja,Ha.X_OK),y=!0}catch{}i=process.versions.electron||at==="android"||d||!y?"xdg-open":ja}a.length>0&&l.push(...a),r.wait||(c.stdio="ignore",c.detached=!0)}r.target&&l.push(r.target),at==="darwin"&&a.length>0&&l.push("--args",...a);let m=Dl.spawn(i,l,c);return r.wait?new Promise((d,y)=>{m.once("error",y),m.once("close",g=>{if(!r.allowNonzeroExitCode&&g>0){y(new Error(`Exited with code ${g}`));return}d(m)})}):(m.unref(),m)},On=(r,o)=>{if(typeof r!="string")throw new TypeError("Expected a `target`");return Cr({...o,target:r})},$l=(r,o)=>{if(typeof r!="string")throw new TypeError("Expected a `name`");let{arguments:a=[]}=o||{};if(a!=null&&!Array.isArray(a))throw new TypeError("Expected `appArguments` as Array type");return Cr({...o,app:{name:r,arguments:a}})};function Na(r){if(typeof r=="string"||Array.isArray(r))return r;let{[Ma]:o}=r;if(!o)throw new Error(`${Ma} is not supported`);return o}function qn({[at]:r},{wsl:o}){if(o&&Tr)return Na(o);if(!r)throw new Error(`${at} is not supported`);return Na(r)}var Ar={};Bn(Ar,"chrome",()=>qn({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Bn(Ar,"firefox",()=>qn({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Bn(Ar,"edge",()=>qn({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));On.apps=Ar;On.openApp=$l;Va.exports=On});var Ql={};Ds(Ql,{authorize:()=>jl,checkAuthorization:()=>xl,createVersion:()=>Yl,getCheckoutKey:()=>Gl,getOrganisation:()=>Hl,getOrganisations:()=>Nl,getProfile:()=>ti,getUser:()=>Ul,uploadFile:()=>ri,uploadMetadata:()=>Vl});module.exports=Ws(Ql);var Xa=K(require("http")),Za=K(require("url")),Pr=K(require("querystring")),Dt=K(require("crypto")),ei=K(require("path")),qt=K(require("fs")),Wn=K(Rn()),$e=require("@oclif/core");var Ot=K(require("node:fs")),Tn=K(require("node:path")),ka=K(require("node:os"));var Bt={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],wl="e69bae0ec90f5e838555",j={},vl;function $(r){switch(r){case"raycastApiURL":return process.env.RAY_APIURL||j.APIURL||Bt.url;case"raycastAccessToken":return process.env.RAY_TOKEN||j.Token||j.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||j.ClientID||Bt.clientID;case"githubClientId":return process.env.RAY_GithubClientID||j.GithubClientID||wl;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||j.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof j.Target>"u"?Oa("release"):j.Target)}}function Ba(r,o){switch(r){case"raycastApiURL":o===void 0?delete j.APIURL:j.APIURL=o;break;case"raycastAccessToken":o===void 0?delete j.Token:j.Token=o,delete j.AccessToken;break;case"raycastClientId":o===void 0?delete j.ClientID:j.ClientID=o;break;case"githubAccessToken":o===void 0?delete j.GithubAccessToken:j.GithubAccessToken=o;break;case"flavorName":o===void 0?delete j.Target:j.Target=o;break}let a=Tl();Ot.writeFileSync(Tn.join(a,"config.json"),JSON.stringify(j,null," "),"utf8")}function Oa(r){switch(r){case"debug":return"debug";case"internal":return"internal";case"release":return"";case void 0:return $("flavorName")}}function Rl(){let r=Oa(vl);return r==""?"raycast":`raycast-${r}`}function Tl(){let r=Tn.join(ka.default.homedir(),".config",Rl());return Ot.mkdirSync(r,{recursive:!0}),r}var V=K(Da());var pu=(0,V.blue)((0,V.dim)("internal only"));function En(r,o,a){console.log(Al[r]+o),typeof a?.exit<"u"&&process.exit(a.exit)}var Al={wait:`\u{1F550}${(0,V.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,V.cyan)("info")} - `,success:`\u2705${(0,V.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,V.yellow)("warn")} - `,error:`\u{1F4A5}${(0,V.red)("error")} - `,event:`\u26A1\uFE0F${(0,V.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,V.yellowBright)("plan")} - `};var Ga=require("@oclif/core"),Qa=K(Rn()),Ja=K(Ya());async function Be(r,o){let a;try{a=await(0,Qa.default)(r,{method:o.method||"GET",headers:{"Content-Type":"application/json",Accept:"application/json",...o.token?{Authorization:`Bearer ${o.token}`}:void 0},body:o.body})}catch(i){throw new Error(`HTTP request: ${i.message}`)}if(!a.ok){switch(a.status){case 401:throw new de(a,"not authorized - please log in first using `npx ray login`");case 403:throw new de(a,"forbidden - you don't have permissions to perform the request");case 402:throw new de(a,"the limit of free commands has been reached")}let i=await a.text(),l;try{l=JSON.parse(i)}catch{throw new de(a,`HTTP error: ${a.status} - ${i}`)}throw Array.isArray(l.errors)&&l.errors.length>0?new de(a,`error: ${l.errors[0].status} - ${l.errors[0].title}`):new de(a,`HTTP error: ${a.status} - ${i}`)}return await a.json()}var de=class extends Error{constructor(o,a){let i=o.headers.get("X-Request-Id");i?super(`${a} (${o.url} RequestID: ${i})`):super(a),this.name="HTTPError"}};function Ka(r){(0,Ja.default)(r).catch(o=>{Ga.ux.error(new Error(`failed opening browser to URL ${r}: ${o.message}`),{exit:1})})}var zl=`${Bt.url}/sessions/success`,Dn=`${Bt.url}/sessions/failure`;function xl(){$("raycastAccessToken")===""&&$e.ux.error("please first log in first using `npx ray login`",{exit:1})}async function jl(){let r=$("raycastClientId"),o=$("raycastApiURL"),a=Dt.randomBytes(32).toString("hex"),l=Dt.createHash("sha256").update(a).digest("base64url").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=Xa.createServer(),y=`http://127.0.0.1:${(await new Promise((I,O)=>{let S=c.listen(0,"127.0.0.1",()=>I(S));S.on("error",O)})).address().port}`,g=`${o}/oauth/authorize?response_type=code&client_id=${r}&code_challenge=${l}&code_challenge_method=S256&redirect_uri=${y}`;function q(I){I.close()}c.on("request",async(I,O)=>{try{let p=Pr.parse(Za.parse(I.url).query).code;p||(O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed authorizing app"),{exit:1}));let b=await Ml(a,p,y);b||(O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed getting access token"),{exit:1}));try{Ba("raycastAccessToken",b)}catch(v){console.log(v),O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed saving access token"),{exit:1})}O.writeHead(302,{Location:zl}),O.end();let C=await ti();C||$e.ux.error(new Error("failed fetching profile"),{exit:1}),En("success",`logged in as '${C.username}'`),q(c)}catch(S){q(c),$e.ux.error(S,{exit:1})}}),En("info","continue login in your browser"),Ka(g),await new Promise(I=>c.on("close",I))}async function Ml(r,o,a){let i=$("raycastClientId"),c=`${$("raycastApiURL")}/oauth/token`,m=Pr.stringify({grant_type:"authorization_code",client_id:i,code_verifier:r,code:o,redirect_uri:a});try{let d=await(0,Wn.default)(c,{method:"POST",body:m,headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(!d.ok)throw new Error(d.statusText);return(await d.json()).access_token}catch(d){throw new Error(`failed getting access token: ${d.message}`)}}function ti(){let r=$("raycastApiURL"),o=$("raycastAccessToken");return Be(`${r}/api/v1/me`,{token:o})}function Ul(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/users/${r}`,{token:a})}function Nl(){let r=$("raycastApiURL"),o=$("raycastAccessToken");return Be(`${r}/api/v1/me/organizations`,{token:o})}function Hl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/organizations/${r}`,{token:a})}function Vl(r){return Promise.all(r.map(async o=>{try{return await ri(o,"image/png")}catch(a){throw new Error(`upload: ${a.message}`)}}))}async function ri(r,o){let a=$("raycastApiURL"),i=$("raycastAccessToken"),l=qt.statSync(r),c=await Be(`${a}/api/v1/direct_uploads`,{token:i,method:"POST",body:JSON.stringify({blob:{content_type:o,filename:ei.basename(r),byte_size:l.size,checksum:Dt.createHash("md5").update(qt.readFileSync(r)).digest("base64")}})}),m=qt.readFileSync(r),d=await(0,Wn.default)(c.direct_upload.url,{method:"PUT",body:m,headers:c.direct_upload.headers});if(!d.ok)throw new de(d,d.statusText);return c.signed_id}function Yl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/versions`,{token:a,method:"POST",body:JSON.stringify(r)})}function Gl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/organizations/%${r}/billing/checkouts`,{token:a,method:"POST"}).then(i=>i.key).catch(()=>{})}0&&(module.exports={authorize,checkAuthorization,createVersion,getCheckoutKey,getOrganisation,getOrganisations,getProfile,getUser,uploadFile,uploadMetadata});
14
+ `),i=!1,l=!1,c;r.on("response",m=>{let{headers:d}=m;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),r.on("socket",m=>{let d=()=>{if(i&&!l){let g=new Error("Premature close");g.code="ERR_STREAM_PREMATURE_CLOSE",o(g)}},y=g=>{l=pr.Buffer.compare(g.slice(-5),a)===0,!l&&c&&(l=pr.Buffer.compare(c.slice(-3),a.slice(0,3))===0&&pr.Buffer.compare(g.slice(-2),a.slice(3))===0),c=g};m.prependListener("close",d),m.on("data",y),r.on("close",()=>{m.removeListener("close",d),m.removeListener("data",y)})})}Pt();vr();});var Da=Ke((mu,qa)=>{var El=require("node:tty"),Cl=El?.WriteStream?.prototype?.hasColors?.()??!1,T=(r,o)=>{if(!Cl)return l=>l;let a=`\x1B[${r}m`,i=`\x1B[${o}m`;return l=>{let c=l+"",m=c.indexOf(i);if(m===-1)return a+c+i;let d=a,y=0;for(;m!==-1;)d+=c.slice(y,m)+a,y=m+i.length,m=c.indexOf(i,y);return d+=c.slice(y)+i,d}},R={};R.reset=T(0,0);R.bold=T(1,22);R.dim=T(2,22);R.italic=T(3,23);R.underline=T(4,24);R.overline=T(53,55);R.inverse=T(7,27);R.hidden=T(8,28);R.strikethrough=T(9,29);R.black=T(30,39);R.red=T(31,39);R.green=T(32,39);R.yellow=T(33,39);R.blue=T(34,39);R.magenta=T(35,39);R.cyan=T(36,39);R.white=T(37,39);R.gray=T(90,39);R.bgBlack=T(40,49);R.bgRed=T(41,49);R.bgGreen=T(42,49);R.bgYellow=T(43,49);R.bgBlue=T(44,49);R.bgMagenta=T(45,49);R.bgCyan=T(46,49);R.bgWhite=T(47,49);R.bgGray=T(100,49);R.redBright=T(91,39);R.greenBright=T(92,39);R.yellowBright=T(93,39);R.blueBright=T(94,39);R.magentaBright=T(95,39);R.cyanBright=T(96,39);R.whiteBright=T(97,39);R.bgRedBright=T(101,49);R.bgGreenBright=T(102,49);R.bgYellowBright=T(103,49);R.bgBlueBright=T(104,49);R.bgMagentaBright=T(105,49);R.bgCyanBright=T(106,49);R.bgWhiteBright=T(107,49);qa.exports=R});var An=Ke((yu,Fa)=>{"use strict";var Wa=require("fs"),Cn;function Pl(){try{return Wa.statSync("/.dockerenv"),!0}catch{return!1}}function kl(){try{return Wa.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}Fa.exports=()=>(Cn===void 0&&(Cn=Pl()||kl()),Cn)});var $a=Ke((gu,Pn)=>{"use strict";var Bl=require("os"),Ol=require("fs"),Ia=An(),La=()=>{if(process.platform!=="linux")return!1;if(Bl.release().toLowerCase().includes("microsoft"))return!Ia();try{return Ol.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ia():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Pn.exports=La:Pn.exports=La()});var xa=Ke((_u,za)=>{"use strict";za.exports=(r,o,a)=>{let i=l=>Object.defineProperty(r,o,{value:l,enumerable:!0,writable:!0});return Object.defineProperty(r,o,{configurable:!0,enumerable:!0,get(){let l=a();return i(l),l},set(l){i(l)}}),r}});var Ya=Ke((Su,Va)=>{var ql=require("path"),Dl=require("child_process"),{promises:Er,constants:Ha}=require("fs"),Tr=$a(),Wl=An(),Bn=xa(),ja=ql.join(__dirname,"xdg-open"),{platform:at,arch:Ma}=process,Fl=()=>{try{return Er.statSync("/run/.containerenv"),!0}catch{return!1}},kn;function Il(){return kn===void 0&&(kn=Fl()||Wl()),kn}var Ll=(()=>{let r="/mnt/",o;return async function(){if(o)return o;let a="/etc/wsl.conf",i=!1;try{await Er.access(a,Ha.F_OK),i=!0}catch{}if(!i)return r;let l=await Er.readFile(a,{encoding:"utf8"}),c=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(l);return c?(o=c.groups.mountPoint.trim(),o=o.endsWith("/")?o:`${o}/`,o):r}})(),Ua=async(r,o)=>{let a;for(let i of r)try{return await o(i)}catch(l){a=l}throw a},Cr=async r=>{if(r={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...r},Array.isArray(r.app))return Ua(r.app,d=>Cr({...r,app:d}));let{name:o,arguments:a=[]}=r.app||{};if(a=[...a],Array.isArray(o))return Ua(o,d=>Cr({...r,app:{name:d,arguments:a}}));let i,l=[],c={};if(at==="darwin")i="open",r.wait&&l.push("--wait-apps"),r.background&&l.push("--background"),r.newInstance&&l.push("--new"),o&&l.push("-a",o);else if(at==="win32"||Tr&&!Il()&&!o){let d=await Ll();i=Tr?`${d}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,l.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Tr||(c.windowsVerbatimArguments=!0);let y=["Start"];r.wait&&y.push("-Wait"),o?(y.push(`"\`"${o}\`""`,"-ArgumentList"),r.target&&a.unshift(r.target)):r.target&&y.push(`"${r.target}"`),a.length>0&&(a=a.map(g=>`"\`"${g}\`""`),y.push(a.join(","))),r.target=Buffer.from(y.join(" "),"utf16le").toString("base64")}else{if(o)i=o;else{let d=!__dirname||__dirname==="/",y=!1;try{await Er.access(ja,Ha.X_OK),y=!0}catch{}i=process.versions.electron||at==="android"||d||!y?"xdg-open":ja}a.length>0&&l.push(...a),r.wait||(c.stdio="ignore",c.detached=!0)}r.target&&l.push(r.target),at==="darwin"&&a.length>0&&l.push("--args",...a);let m=Dl.spawn(i,l,c);return r.wait?new Promise((d,y)=>{m.once("error",y),m.once("close",g=>{if(!r.allowNonzeroExitCode&&g>0){y(new Error(`Exited with code ${g}`));return}d(m)})}):(m.unref(),m)},On=(r,o)=>{if(typeof r!="string")throw new TypeError("Expected a `target`");return Cr({...o,target:r})},$l=(r,o)=>{if(typeof r!="string")throw new TypeError("Expected a `name`");let{arguments:a=[]}=o||{};if(a!=null&&!Array.isArray(a))throw new TypeError("Expected `appArguments` as Array type");return Cr({...o,app:{name:r,arguments:a}})};function Na(r){if(typeof r=="string"||Array.isArray(r))return r;let{[Ma]:o}=r;if(!o)throw new Error(`${Ma} is not supported`);return o}function qn({[at]:r},{wsl:o}){if(o&&Tr)return Na(o);if(!r)throw new Error(`${at} is not supported`);return Na(r)}var Ar={};Bn(Ar,"chrome",()=>qn({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Bn(Ar,"firefox",()=>qn({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Bn(Ar,"edge",()=>qn({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));On.apps=Ar;On.openApp=$l;Va.exports=On});var Ql={};Ds(Ql,{authorize:()=>jl,checkAuthorization:()=>xl,createVersion:()=>Yl,getCheckoutKey:()=>Gl,getOrganisation:()=>Hl,getOrganisations:()=>Nl,getProfile:()=>ti,getUser:()=>Ul,uploadFile:()=>ri,uploadMetadata:()=>Vl});module.exports=Ws(Ql);var Xa=K(require("http")),Za=K(require("url")),Pr=K(require("querystring")),Dt=K(require("crypto")),ei=K(require("path")),qt=K(require("fs")),Wn=K(Rn()),$e=require("@oclif/core");var Ot=K(require("node:fs")),Tn=K(require("node:path")),ka=K(require("node:os"));var Bt={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],wl="e69bae0ec90f5e838555",j={},vl;function $(r){switch(r){case"raycastApiURL":return process.env.RAY_APIURL||j.APIURL||Bt.url;case"raycastAccessToken":return process.env.RAY_TOKEN||j.Token||j.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||j.ClientID||Bt.clientID;case"githubClientId":return process.env.RAY_GithubClientID||j.GithubClientID||wl;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||j.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof j.Target>"u"?Oa("release"):j.Target)}}function Ba(r,o){switch(r){case"raycastApiURL":o===void 0?delete j.APIURL:j.APIURL=o;break;case"raycastAccessToken":o===void 0?delete j.Token:j.Token=o,delete j.AccessToken;break;case"raycastClientId":o===void 0?delete j.ClientID:j.ClientID=o;break;case"githubAccessToken":o===void 0?delete j.GithubAccessToken:j.GithubAccessToken=o;break;case"flavorName":o===void 0?delete j.Target:j.Target=o;break}let a=Tl();Ot.writeFileSync(Tn.join(a,"config.json"),JSON.stringify(j,null," "),"utf8")}function Oa(r){switch(r){case"debug":return"debug";case"internal":return"internal";case"release":return"";case"x":return"x";case"x-internal":return"x-internal";case"x-debug":return"x-debug";case void 0:return $("flavorName")}}function Rl(){let r=Oa(vl);return r==""?"raycast":`raycast-${r}`}function Tl(){let r=Tn.join(ka.default.homedir(),".config",Rl());return Ot.mkdirSync(r,{recursive:!0}),r}var V=K(Da());var pu=(0,V.blue)((0,V.dim)("internal only"));function En(r,o,a){console.log(Al[r]+o),typeof a?.exit<"u"&&process.exit(a.exit)}var Al={wait:`\u{1F550}${(0,V.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,V.cyan)("info")} - `,success:`\u2705${(0,V.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,V.yellow)("warn")} - `,error:`\u{1F4A5}${(0,V.red)("error")} - `,event:`\u26A1\uFE0F${(0,V.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,V.yellowBright)("plan")} - `};var Ga=require("@oclif/core"),Qa=K(Rn()),Ja=K(Ya());async function Be(r,o){let a;try{a=await(0,Qa.default)(r,{method:o.method||"GET",headers:{"Content-Type":"application/json",Accept:"application/json",...o.token?{Authorization:`Bearer ${o.token}`}:void 0},body:o.body})}catch(i){throw new Error(`HTTP request: ${i.message}`)}if(!a.ok){switch(a.status){case 401:throw new de(a,"not authorized - please log in first using `npx ray login`");case 403:throw new de(a,"forbidden - you don't have permissions to perform the request");case 402:throw new de(a,"the limit of free commands has been reached")}let i=await a.text(),l;try{l=JSON.parse(i)}catch{throw new de(a,`HTTP error: ${a.status} - ${i}`)}throw Array.isArray(l.errors)&&l.errors.length>0?new de(a,`error: ${l.errors[0].status} - ${l.errors[0].title}`):new de(a,`HTTP error: ${a.status} - ${i}`)}return await a.json()}var de=class extends Error{constructor(o,a){let i=o.headers.get("X-Request-Id");i?super(`${a} (${o.url} RequestID: ${i})`):super(a),this.name="HTTPError"}};function Ka(r){(0,Ja.default)(r).catch(o=>{Ga.ux.error(new Error(`failed opening browser to URL ${r}: ${o.message}`),{exit:1})})}var zl=`${Bt.url}/sessions/success`,Dn=`${Bt.url}/sessions/failure`;function xl(){$("raycastAccessToken")===""&&$e.ux.error("please first log in first using `npx ray login`",{exit:1})}async function jl(){let r=$("raycastClientId"),o=$("raycastApiURL"),a=Dt.randomBytes(32).toString("hex"),l=Dt.createHash("sha256").update(a).digest("base64url").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=Xa.createServer(),y=`http://127.0.0.1:${(await new Promise((I,O)=>{let S=c.listen(0,"127.0.0.1",()=>I(S));S.on("error",O)})).address().port}`,g=`${o}/oauth/authorize?response_type=code&client_id=${r}&code_challenge=${l}&code_challenge_method=S256&redirect_uri=${y}`;function q(I){I.close()}c.on("request",async(I,O)=>{try{let p=Pr.parse(Za.parse(I.url).query).code;p||(O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed authorizing app"),{exit:1}));let b=await Ml(a,p,y);b||(O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed getting access token"),{exit:1}));try{Ba("raycastAccessToken",b)}catch(v){console.log(v),O.writeHead(302,{Location:Dn}),O.end(),q(c),$e.ux.error(new Error("failed saving access token"),{exit:1})}O.writeHead(302,{Location:zl}),O.end();let C=await ti();C||$e.ux.error(new Error("failed fetching profile"),{exit:1}),En("success",`logged in as '${C.username}'`),q(c)}catch(S){q(c),$e.ux.error(S,{exit:1})}}),En("info","continue login in your browser"),Ka(g),await new Promise(I=>c.on("close",I))}async function Ml(r,o,a){let i=$("raycastClientId"),c=`${$("raycastApiURL")}/oauth/token`,m=Pr.stringify({grant_type:"authorization_code",client_id:i,code_verifier:r,code:o,redirect_uri:a});try{let d=await(0,Wn.default)(c,{method:"POST",body:m,headers:{"Content-Type":"application/x-www-form-urlencoded"}});if(!d.ok)throw new Error(d.statusText);return(await d.json()).access_token}catch(d){throw new Error(`failed getting access token: ${d.message}`)}}function ti(){let r=$("raycastApiURL"),o=$("raycastAccessToken");return Be(`${r}/api/v1/me`,{token:o})}function Ul(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/users/${r}`,{token:a})}function Nl(){let r=$("raycastApiURL"),o=$("raycastAccessToken");return Be(`${r}/api/v1/me/organizations`,{token:o})}function Hl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/organizations/${r}`,{token:a})}function Vl(r){return Promise.all(r.map(async o=>{try{return await ri(o,"image/png")}catch(a){throw new Error(`upload: ${a.message}`)}}))}async function ri(r,o){let a=$("raycastApiURL"),i=$("raycastAccessToken"),l=qt.statSync(r),c=await Be(`${a}/api/v1/direct_uploads`,{token:i,method:"POST",body:JSON.stringify({blob:{content_type:o,filename:ei.basename(r),byte_size:l.size,checksum:Dt.createHash("md5").update(qt.readFileSync(r)).digest("base64")}})}),m=qt.readFileSync(r),d=await(0,Wn.default)(c.direct_upload.url,{method:"PUT",body:m,headers:c.direct_upload.headers});if(!d.ok)throw new de(d,d.statusText);return c.signed_id}function Yl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/versions`,{token:a,method:"POST",body:JSON.stringify(r)})}function Gl(r){let o=$("raycastApiURL"),a=$("raycastAccessToken");return Be(`${o}/api/v1/organizations/%${r}/billing/checkouts`,{token:a,method:"POST"}).then(i=>i.key).catch(()=>{})}0&&(module.exports={authorize,checkAuthorization,createVersion,getCheckoutKey,getOrganisation,getOrganisations,getProfile,getUser,uploadFile,uploadMetadata});
15
15
  /*! Bundled license information:
16
16
 
17
17
  node-fetch-cjs/dist/index.js:
@@ -616,10 +616,10 @@ ${d}`,T8t=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),x8t=Obj
616
616
  `:`
617
617
  `)+S,O=E+1,E=f.indexOf(`
618
618
  `,O)}while(E!==-1);return z+=f.slice(O),z}var{stdout:sGe,stderr:aGe}=rGe,I2e=Symbol("GENERATOR"),V7=Symbol("STYLER"),pJ=Symbol("IS_EMPTY"),oGe=["ansi","ansi","ansi256","ansi16m"],q7=Object.create(null),L8t=(f,d={})=>{if(d.level&&!(Number.isInteger(d.level)&&d.level>=0&&d.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let S=sGe?sGe.level:0;f.level=d.level===void 0?S:d.level};var M8t=f=>{let d=(...S)=>S.join(" ");return L8t(d,f),Object.setPrototypeOf(d,dJ.prototype),d};function dJ(f){return M8t(f)}Object.setPrototypeOf(dJ.prototype,Function.prototype);for(let[f,d]of Object.entries(GS))q7[f]={get(){let S=Pee(this,O2e(d.open,d.close,this[V7]),this[pJ]);return Object.defineProperty(this,f,{value:S}),S}};q7.visible={get(){let f=Pee(this,this[V7],!0);return Object.defineProperty(this,"visible",{value:f}),f}};var F2e=(f,d,S,...E)=>f==="rgb"?d==="ansi16m"?GS[S].ansi16m(...E):d==="ansi256"?GS[S].ansi256(GS.rgbToAnsi256(...E)):GS[S].ansi(GS.rgbToAnsi(...E)):f==="hex"?F2e("rgb",d,S,...GS.hexToRgb(...E)):GS[S][f](...E),R8t=["rgb","hex","ansi256"];for(let f of R8t){q7[f]={get(){let{level:S}=this;return function(...E){let O=O2e(F2e(f,oGe[S],"color",...E),GS.color.close,this[V7]);return Pee(this,O,this[pJ])}}};let d="bg"+f[0].toUpperCase()+f.slice(1);q7[d]={get(){let{level:S}=this;return function(...E){let O=O2e(F2e(f,oGe[S],"bgColor",...E),GS.bgColor.close,this[V7]);return Pee(this,O,this[pJ])}}}}var B8t=Object.defineProperties(()=>{},{...q7,level:{enumerable:!0,get(){return this[I2e].level},set(f){this[I2e].level=f}}}),O2e=(f,d,S)=>{let E,O;return S===void 0?(E=f,O=d):(E=S.openAll+f,O=d+S.closeAll),{open:f,close:d,openAll:E,closeAll:O,parent:S}},Pee=(f,d,S)=>{let E=(...O)=>j8t(E,O.length===1?""+O[0]:O.join(" "));return Object.setPrototypeOf(E,B8t),E[I2e]=f,E[V7]=d,E[pJ]=S,E},j8t=(f,d)=>{if(f.level<=0||!d)return f[pJ]?"":d;let S=f[V7];if(S===void 0)return d;let{openAll:E,closeAll:O}=S;if(d.includes("\x1B"))for(;S!==void 0;)d=nGe(d,S.close,S.open),S=S.parent;let z=d.indexOf(`
619
- `);return z!==-1&&(d=iGe(d,O,E,z)),E+d+O};Object.defineProperties(dJ.prototype,q7);var J8t=dJ(),DVt=dJ({level:aGe?aGe.level:0});var Tk=J8t;var o2=lc(require("node:process"),1);function L2e(){return o2.default.platform!=="win32"?o2.default.env.TERM!=="linux":!!o2.default.env.CI||!!o2.default.env.WT_SESSION||!!o2.default.env.TERMINUS_SUBLIME||o2.default.env.ConEmuTask==="{cmd::Cmder}"||o2.default.env.TERM_PROGRAM==="Terminus-Sublime"||o2.default.env.TERM_PROGRAM==="vscode"||o2.default.env.TERM==="xterm-256color"||o2.default.env.TERM==="alacritty"||o2.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var z8t={info:Tk.blue("\u2139"),success:Tk.green("\u2714"),warning:Tk.yellow("\u26A0"),error:Tk.red("\u2716")},U8t={info:Tk.blue("i"),success:Tk.green("\u221A"),warning:Tk.yellow("\u203C"),error:Tk.red("\xD7")},W8t=L2e()?z8t:U8t,mJ=W8t;function M2e({onlyFirst:f=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,f?void 0:"g")}var V8t=M2e();function gJ(f){if(typeof f!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof f}\``);return f.replace(V8t,"")}function cGe(f){return f===161||f===164||f===167||f===168||f===170||f===173||f===174||f>=176&&f<=180||f>=182&&f<=186||f>=188&&f<=191||f===198||f===208||f===215||f===216||f>=222&&f<=225||f===230||f>=232&&f<=234||f===236||f===237||f===240||f===242||f===243||f>=247&&f<=250||f===252||f===254||f===257||f===273||f===275||f===283||f===294||f===295||f===299||f>=305&&f<=307||f===312||f>=319&&f<=322||f===324||f>=328&&f<=331||f===333||f===338||f===339||f===358||f===359||f===363||f===462||f===464||f===466||f===468||f===470||f===472||f===474||f===476||f===593||f===609||f===708||f===711||f>=713&&f<=715||f===717||f===720||f>=728&&f<=731||f===733||f===735||f>=768&&f<=879||f>=913&&f<=929||f>=931&&f<=937||f>=945&&f<=961||f>=963&&f<=969||f===1025||f>=1040&&f<=1103||f===1105||f===8208||f>=8211&&f<=8214||f===8216||f===8217||f===8220||f===8221||f>=8224&&f<=8226||f>=8228&&f<=8231||f===8240||f===8242||f===8243||f===8245||f===8251||f===8254||f===8308||f===8319||f>=8321&&f<=8324||f===8364||f===8451||f===8453||f===8457||f===8467||f===8470||f===8481||f===8482||f===8486||f===8491||f===8531||f===8532||f>=8539&&f<=8542||f>=8544&&f<=8555||f>=8560&&f<=8569||f===8585||f>=8592&&f<=8601||f===8632||f===8633||f===8658||f===8660||f===8679||f===8704||f===8706||f===8707||f===8711||f===8712||f===8715||f===8719||f===8721||f===8725||f===8730||f>=8733&&f<=8736||f===8739||f===8741||f>=8743&&f<=8748||f===8750||f>=8756&&f<=8759||f===8764||f===8765||f===8776||f===8780||f===8786||f===8800||f===8801||f>=8804&&f<=8807||f===8810||f===8811||f===8814||f===8815||f===8834||f===8835||f===8838||f===8839||f===8853||f===8857||f===8869||f===8895||f===8978||f>=9312&&f<=9449||f>=9451&&f<=9547||f>=9552&&f<=9587||f>=9600&&f<=9615||f>=9618&&f<=9621||f===9632||f===9633||f>=9635&&f<=9641||f===9650||f===9651||f===9654||f===9655||f===9660||f===9661||f===9664||f===9665||f>=9670&&f<=9672||f===9675||f>=9678&&f<=9681||f>=9698&&f<=9701||f===9711||f===9733||f===9734||f===9737||f===9742||f===9743||f===9756||f===9758||f===9792||f===9794||f===9824||f===9825||f>=9827&&f<=9829||f>=9831&&f<=9834||f===9836||f===9837||f===9839||f===9886||f===9887||f===9919||f>=9926&&f<=9933||f>=9935&&f<=9939||f>=9941&&f<=9953||f===9955||f===9960||f===9961||f>=9963&&f<=9969||f===9972||f>=9974&&f<=9977||f===9979||f===9980||f===9982||f===9983||f===10045||f>=10102&&f<=10111||f>=11094&&f<=11097||f>=12872&&f<=12879||f>=57344&&f<=63743||f>=65024&&f<=65039||f===65533||f>=127232&&f<=127242||f>=127248&&f<=127277||f>=127280&&f<=127337||f>=127344&&f<=127373||f===127375||f===127376||f>=127387&&f<=127404||f>=917760&&f<=917999||f>=983040&&f<=1048573||f>=1048576&&f<=1114109}function lGe(f){return f===12288||f>=65281&&f<=65376||f>=65504&&f<=65510}function uGe(f){return f>=4352&&f<=4447||f===8986||f===8987||f===9001||f===9002||f>=9193&&f<=9196||f===9200||f===9203||f===9725||f===9726||f===9748||f===9749||f>=9776&&f<=9783||f>=9800&&f<=9811||f===9855||f>=9866&&f<=9871||f===9875||f===9889||f===9898||f===9899||f===9917||f===9918||f===9924||f===9925||f===9934||f===9940||f===9962||f===9970||f===9971||f===9973||f===9978||f===9981||f===9989||f===9994||f===9995||f===10024||f===10060||f===10062||f>=10067&&f<=10069||f===10071||f>=10133&&f<=10135||f===10160||f===10175||f===11035||f===11036||f===11088||f===11093||f>=11904&&f<=11929||f>=11931&&f<=12019||f>=12032&&f<=12245||f>=12272&&f<=12287||f>=12289&&f<=12350||f>=12353&&f<=12438||f>=12441&&f<=12543||f>=12549&&f<=12591||f>=12593&&f<=12686||f>=12688&&f<=12773||f>=12783&&f<=12830||f>=12832&&f<=12871||f>=12880&&f<=42124||f>=42128&&f<=42182||f>=43360&&f<=43388||f>=44032&&f<=55203||f>=63744&&f<=64255||f>=65040&&f<=65049||f>=65072&&f<=65106||f>=65108&&f<=65126||f>=65128&&f<=65131||f>=94176&&f<=94180||f===94192||f===94193||f>=94208&&f<=100343||f>=100352&&f<=101589||f>=101631&&f<=101640||f>=110576&&f<=110579||f>=110581&&f<=110587||f===110589||f===110590||f>=110592&&f<=110882||f===110898||f>=110928&&f<=110930||f===110933||f>=110948&&f<=110951||f>=110960&&f<=111355||f>=119552&&f<=119638||f>=119648&&f<=119670||f===126980||f===127183||f===127374||f>=127377&&f<=127386||f>=127488&&f<=127490||f>=127504&&f<=127547||f>=127552&&f<=127560||f===127568||f===127569||f>=127584&&f<=127589||f>=127744&&f<=127776||f>=127789&&f<=127797||f>=127799&&f<=127868||f>=127870&&f<=127891||f>=127904&&f<=127946||f>=127951&&f<=127955||f>=127968&&f<=127984||f===127988||f>=127992&&f<=128062||f===128064||f>=128066&&f<=128252||f>=128255&&f<=128317||f>=128331&&f<=128334||f>=128336&&f<=128359||f===128378||f===128405||f===128406||f===128420||f>=128507&&f<=128591||f>=128640&&f<=128709||f===128716||f>=128720&&f<=128722||f>=128725&&f<=128727||f>=128732&&f<=128735||f===128747||f===128748||f>=128756&&f<=128764||f>=128992&&f<=129003||f===129008||f>=129292&&f<=129338||f>=129340&&f<=129349||f>=129351&&f<=129535||f>=129648&&f<=129660||f>=129664&&f<=129673||f>=129679&&f<=129734||f>=129742&&f<=129756||f>=129759&&f<=129769||f>=129776&&f<=129784||f>=131072&&f<=196605||f>=196608&&f<=262141}function q8t(f){if(!Number.isSafeInteger(f))throw new TypeError(`Expected a code point, got \`${typeof f}\`.`)}function _Ge(f,{ambiguousAsWide:d=!1}={}){return q8t(f),lGe(f)||uGe(f)||d&&cGe(f)?2:1}var dGe=lc(pGe(),1),$8t=new Intl.Segmenter,G8t=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function R2e(f,d={}){if(typeof f!="string"||f.length===0)return 0;let{ambiguousIsNarrow:S=!0,countAnsiEscapeCodes:E=!1}=d;if(E||(f=gJ(f)),f.length===0)return 0;let O=0,z={ambiguousAsWide:!S};for(let{segment:se}of $8t.segment(f)){let Ae=se.codePointAt(0);if(!(Ae<=31||Ae>=127&&Ae<=159)&&!(Ae>=8203&&Ae<=8207||Ae===65279)&&!(Ae>=768&&Ae<=879||Ae>=6832&&Ae<=6911||Ae>=7616&&Ae<=7679||Ae>=8400&&Ae<=8447||Ae>=65056&&Ae<=65071)&&!(Ae>=55296&&Ae<=57343)&&!(Ae>=65024&&Ae<=65039)&&!G8t.test(se)){if((0,dGe.default)().test(se)){O+=2;continue}O+=_Ge(Ae,z)}}return O}function B2e({stream:f=process.stdout}={}){return!!(f&&f.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var HS=lc(require("node:process"),1),H8t=3,j2e=class{#r=0;start(){this.#r++,this.#r===1&&this.#i()}stop(){if(this.#r<=0)throw new Error("`stop` called more times than `start`");this.#r--,this.#r===0&&this.#e()}#i(){HS.default.platform==="win32"||!HS.default.stdin.isTTY||(HS.default.stdin.setRawMode(!0),HS.default.stdin.on("data",this.#n),HS.default.stdin.resume())}#e(){HS.default.stdin.isTTY&&(HS.default.stdin.off("data",this.#n),HS.default.stdin.pause(),HS.default.stdin.setRawMode(!1))}#n(d){d[0]===H8t&&HS.default.emit("SIGINT")}},Q8t=new j2e,J2e=Q8t;var Y8t=lc(P2e(),1),z2e=class{#r=0;#i=!1;#e=0;#n=-1;#o=0;#t;#a;#s;#p;#m;#u;#_;#f;#g;#c;#l;color;constructor(d){typeof d=="string"&&(d={text:d}),this.#t={color:"cyan",stream:hJ.default.stderr,discardStdin:!0,hideCursor:!0,...d},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#m=this.#t.interval,this.#s=this.#t.stream,this.#u=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:B2e({stream:this.#s}),this.#_=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,hJ.default.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#u,Object.defineProperty(this,"_linesToClear",{get(){return this.#r},set(S){this.#r=S}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#n}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#f}set indent(d=0){if(!(d>=0&&Number.isInteger(d)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=d,this.#d()}get interval(){return this.#m??this.#a.interval??100}get spinner(){return this.#a}set spinner(d){if(this.#n=-1,this.#m=void 0,typeof d=="object"){if(d.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#a=d}else if(!$j())this.#a=yJ.default.line;else if(d===void 0)this.#a=yJ.default.dots;else if(d!=="default"&&yJ.default[d])this.#a=yJ.default[d];else throw new Error(`There is no built-in spinner named '${d}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(d=""){this.#g=d,this.#d()}get prefixText(){return this.#c}set prefixText(d=""){this.#c=d,this.#d()}get suffixText(){return this.#l}set suffixText(d=""){this.#l=d,this.#d()}get isSpinning(){return this.#p!==void 0}#h(d=this.#c,S=" "){return typeof d=="string"&&d!==""?d+S:typeof d=="function"?d()+S:""}#y(d=this.#l,S=" "){return typeof d=="string"&&d!==""?S+d:typeof d=="function"?S+d():""}#d(){let d=this.#s.columns??80,S=this.#h(this.#c,"-"),E=this.#y(this.#l,"-"),O=" ".repeat(this.#f)+S+"--"+this.#g+"--"+E;this.#e=0;for(let z of gJ(O).split(`
619
+ `);return z!==-1&&(d=iGe(d,O,E,z)),E+d+O};Object.defineProperties(dJ.prototype,q7);var J8t=dJ(),DVt=dJ({level:aGe?aGe.level:0});var Tk=J8t;var o2=lc(require("node:process"),1);function L2e(){return o2.default.platform!=="win32"?o2.default.env.TERM!=="linux":!!o2.default.env.CI||!!o2.default.env.WT_SESSION||!!o2.default.env.TERMINUS_SUBLIME||o2.default.env.ConEmuTask==="{cmd::Cmder}"||o2.default.env.TERM_PROGRAM==="Terminus-Sublime"||o2.default.env.TERM_PROGRAM==="vscode"||o2.default.env.TERM==="xterm-256color"||o2.default.env.TERM==="alacritty"||o2.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var z8t={info:Tk.blue("\u2139"),success:Tk.green("\u2714"),warning:Tk.yellow("\u26A0"),error:Tk.red("\u2716")},U8t={info:Tk.blue("i"),success:Tk.green("\u221A"),warning:Tk.yellow("\u203C"),error:Tk.red("\xD7")},W8t=L2e()?z8t:U8t,mJ=W8t;function M2e({onlyFirst:f=!1}={}){let S=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(S,f?void 0:"g")}var V8t=M2e();function gJ(f){if(typeof f!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof f}\``);return f.replace(V8t,"")}function cGe(f){return f===161||f===164||f===167||f===168||f===170||f===173||f===174||f>=176&&f<=180||f>=182&&f<=186||f>=188&&f<=191||f===198||f===208||f===215||f===216||f>=222&&f<=225||f===230||f>=232&&f<=234||f===236||f===237||f===240||f===242||f===243||f>=247&&f<=250||f===252||f===254||f===257||f===273||f===275||f===283||f===294||f===295||f===299||f>=305&&f<=307||f===312||f>=319&&f<=322||f===324||f>=328&&f<=331||f===333||f===338||f===339||f===358||f===359||f===363||f===462||f===464||f===466||f===468||f===470||f===472||f===474||f===476||f===593||f===609||f===708||f===711||f>=713&&f<=715||f===717||f===720||f>=728&&f<=731||f===733||f===735||f>=768&&f<=879||f>=913&&f<=929||f>=931&&f<=937||f>=945&&f<=961||f>=963&&f<=969||f===1025||f>=1040&&f<=1103||f===1105||f===8208||f>=8211&&f<=8214||f===8216||f===8217||f===8220||f===8221||f>=8224&&f<=8226||f>=8228&&f<=8231||f===8240||f===8242||f===8243||f===8245||f===8251||f===8254||f===8308||f===8319||f>=8321&&f<=8324||f===8364||f===8451||f===8453||f===8457||f===8467||f===8470||f===8481||f===8482||f===8486||f===8491||f===8531||f===8532||f>=8539&&f<=8542||f>=8544&&f<=8555||f>=8560&&f<=8569||f===8585||f>=8592&&f<=8601||f===8632||f===8633||f===8658||f===8660||f===8679||f===8704||f===8706||f===8707||f===8711||f===8712||f===8715||f===8719||f===8721||f===8725||f===8730||f>=8733&&f<=8736||f===8739||f===8741||f>=8743&&f<=8748||f===8750||f>=8756&&f<=8759||f===8764||f===8765||f===8776||f===8780||f===8786||f===8800||f===8801||f>=8804&&f<=8807||f===8810||f===8811||f===8814||f===8815||f===8834||f===8835||f===8838||f===8839||f===8853||f===8857||f===8869||f===8895||f===8978||f>=9312&&f<=9449||f>=9451&&f<=9547||f>=9552&&f<=9587||f>=9600&&f<=9615||f>=9618&&f<=9621||f===9632||f===9633||f>=9635&&f<=9641||f===9650||f===9651||f===9654||f===9655||f===9660||f===9661||f===9664||f===9665||f>=9670&&f<=9672||f===9675||f>=9678&&f<=9681||f>=9698&&f<=9701||f===9711||f===9733||f===9734||f===9737||f===9742||f===9743||f===9756||f===9758||f===9792||f===9794||f===9824||f===9825||f>=9827&&f<=9829||f>=9831&&f<=9834||f===9836||f===9837||f===9839||f===9886||f===9887||f===9919||f>=9926&&f<=9933||f>=9935&&f<=9939||f>=9941&&f<=9953||f===9955||f===9960||f===9961||f>=9963&&f<=9969||f===9972||f>=9974&&f<=9977||f===9979||f===9980||f===9982||f===9983||f===10045||f>=10102&&f<=10111||f>=11094&&f<=11097||f>=12872&&f<=12879||f>=57344&&f<=63743||f>=65024&&f<=65039||f===65533||f>=127232&&f<=127242||f>=127248&&f<=127277||f>=127280&&f<=127337||f>=127344&&f<=127373||f===127375||f===127376||f>=127387&&f<=127404||f>=917760&&f<=917999||f>=983040&&f<=1048573||f>=1048576&&f<=1114109}function lGe(f){return f===12288||f>=65281&&f<=65376||f>=65504&&f<=65510}function uGe(f){return f>=4352&&f<=4447||f===8986||f===8987||f===9001||f===9002||f>=9193&&f<=9196||f===9200||f===9203||f===9725||f===9726||f===9748||f===9749||f>=9776&&f<=9783||f>=9800&&f<=9811||f===9855||f>=9866&&f<=9871||f===9875||f===9889||f===9898||f===9899||f===9917||f===9918||f===9924||f===9925||f===9934||f===9940||f===9962||f===9970||f===9971||f===9973||f===9978||f===9981||f===9989||f===9994||f===9995||f===10024||f===10060||f===10062||f>=10067&&f<=10069||f===10071||f>=10133&&f<=10135||f===10160||f===10175||f===11035||f===11036||f===11088||f===11093||f>=11904&&f<=11929||f>=11931&&f<=12019||f>=12032&&f<=12245||f>=12272&&f<=12287||f>=12289&&f<=12350||f>=12353&&f<=12438||f>=12441&&f<=12543||f>=12549&&f<=12591||f>=12593&&f<=12686||f>=12688&&f<=12773||f>=12783&&f<=12830||f>=12832&&f<=12871||f>=12880&&f<=42124||f>=42128&&f<=42182||f>=43360&&f<=43388||f>=44032&&f<=55203||f>=63744&&f<=64255||f>=65040&&f<=65049||f>=65072&&f<=65106||f>=65108&&f<=65126||f>=65128&&f<=65131||f>=94176&&f<=94180||f===94192||f===94193||f>=94208&&f<=100343||f>=100352&&f<=101589||f>=101631&&f<=101640||f>=110576&&f<=110579||f>=110581&&f<=110587||f===110589||f===110590||f>=110592&&f<=110882||f===110898||f>=110928&&f<=110930||f===110933||f>=110948&&f<=110951||f>=110960&&f<=111355||f>=119552&&f<=119638||f>=119648&&f<=119670||f===126980||f===127183||f===127374||f>=127377&&f<=127386||f>=127488&&f<=127490||f>=127504&&f<=127547||f>=127552&&f<=127560||f===127568||f===127569||f>=127584&&f<=127589||f>=127744&&f<=127776||f>=127789&&f<=127797||f>=127799&&f<=127868||f>=127870&&f<=127891||f>=127904&&f<=127946||f>=127951&&f<=127955||f>=127968&&f<=127984||f===127988||f>=127992&&f<=128062||f===128064||f>=128066&&f<=128252||f>=128255&&f<=128317||f>=128331&&f<=128334||f>=128336&&f<=128359||f===128378||f===128405||f===128406||f===128420||f>=128507&&f<=128591||f>=128640&&f<=128709||f===128716||f>=128720&&f<=128722||f>=128725&&f<=128727||f>=128732&&f<=128735||f===128747||f===128748||f>=128756&&f<=128764||f>=128992&&f<=129003||f===129008||f>=129292&&f<=129338||f>=129340&&f<=129349||f>=129351&&f<=129535||f>=129648&&f<=129660||f>=129664&&f<=129673||f>=129679&&f<=129734||f>=129742&&f<=129756||f>=129759&&f<=129769||f>=129776&&f<=129784||f>=131072&&f<=196605||f>=196608&&f<=262141}function q8t(f){if(!Number.isSafeInteger(f))throw new TypeError(`Expected a code point, got \`${typeof f}\`.`)}function _Ge(f,{ambiguousAsWide:d=!1}={}){return q8t(f),lGe(f)||uGe(f)||d&&cGe(f)?2:1}var dGe=lc(pGe(),1),$8t=new Intl.Segmenter,G8t=/^\p{Default_Ignorable_Code_Point}$/u;function R2e(f,d={}){if(typeof f!="string"||f.length===0)return 0;let{ambiguousIsNarrow:S=!0,countAnsiEscapeCodes:E=!1}=d;if(E||(f=gJ(f)),f.length===0)return 0;let O=0,z={ambiguousAsWide:!S};for(let{segment:se}of $8t.segment(f)){let Ae=se.codePointAt(0);if(!(Ae<=31||Ae>=127&&Ae<=159)&&!(Ae>=8203&&Ae<=8207||Ae===65279)&&!(Ae>=768&&Ae<=879||Ae>=6832&&Ae<=6911||Ae>=7616&&Ae<=7679||Ae>=8400&&Ae<=8447||Ae>=65056&&Ae<=65071)&&!(Ae>=55296&&Ae<=57343)&&!(Ae>=65024&&Ae<=65039)&&!G8t.test(se)){if((0,dGe.default)().test(se)){O+=2;continue}O+=_Ge(Ae,z)}}return O}function B2e({stream:f=process.stdout}={}){return!!(f&&f.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var HS=lc(require("node:process"),1),H8t=3,j2e=class{#r=0;start(){this.#r++,this.#r===1&&this.#i()}stop(){if(this.#r<=0)throw new Error("`stop` called more times than `start`");this.#r--,this.#r===0&&this.#e()}#i(){HS.default.platform==="win32"||!HS.default.stdin.isTTY||(HS.default.stdin.setRawMode(!0),HS.default.stdin.on("data",this.#n),HS.default.stdin.resume())}#e(){HS.default.stdin.isTTY&&(HS.default.stdin.off("data",this.#n),HS.default.stdin.pause(),HS.default.stdin.setRawMode(!1))}#n(d){d[0]===H8t&&HS.default.emit("SIGINT")}},Q8t=new j2e,J2e=Q8t;var Y8t=lc(P2e(),1),z2e=class{#r=0;#i=!1;#e=0;#n=-1;#o=0;#t;#a;#s;#p;#m;#u;#_;#f;#g;#c;#l;color;constructor(d){typeof d=="string"&&(d={text:d}),this.#t={color:"cyan",stream:hJ.default.stderr,discardStdin:!0,hideCursor:!0,...d},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#m=this.#t.interval,this.#s=this.#t.stream,this.#u=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:B2e({stream:this.#s}),this.#_=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,hJ.default.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#u,Object.defineProperty(this,"_linesToClear",{get(){return this.#r},set(S){this.#r=S}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#n}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#f}set indent(d=0){if(!(d>=0&&Number.isInteger(d)))throw new Error("The `indent` option must be an integer from 0 and up");this.#f=d,this.#d()}get interval(){return this.#m??this.#a.interval??100}get spinner(){return this.#a}set spinner(d){if(this.#n=-1,this.#m=void 0,typeof d=="object"){if(d.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#a=d}else if(!$j())this.#a=yJ.default.line;else if(d===void 0)this.#a=yJ.default.dots;else if(d!=="default"&&yJ.default[d])this.#a=yJ.default[d];else throw new Error(`There is no built-in spinner named '${d}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(d=""){this.#g=d,this.#d()}get prefixText(){return this.#c}set prefixText(d=""){this.#c=d,this.#d()}get suffixText(){return this.#l}set suffixText(d=""){this.#l=d,this.#d()}get isSpinning(){return this.#p!==void 0}#h(d=this.#c,S=" "){return typeof d=="string"&&d!==""?d+S:typeof d=="function"?d()+S:""}#y(d=this.#l,S=" "){return typeof d=="string"&&d!==""?S+d:typeof d=="function"?S+d():""}#d(){let d=this.#s.columns??80,S=this.#h(this.#c,"-"),E=this.#y(this.#l,"-"),O=" ".repeat(this.#f)+S+"--"+this.#g+"--"+E;this.#e=0;for(let z of gJ(O).split(`
620
620
  `))this.#e+=Math.max(1,Math.ceil(R2e(z,{countAnsiEscapeCodes:!0})/d))}get isEnabled(){return this.#u&&!this.#_}set isEnabled(d){if(typeof d!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#u=d}get isSilent(){return this.#_}set isSilent(d){if(typeof d!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#_=d}frame(){let d=Date.now();(this.#n===-1||d-this.#o>=this.interval)&&(this.#n=++this.#n%this.#a.frames.length,this.#o=d);let{frames:S}=this.#a,E=S[this.#n];this.color&&(E=W$e[this.color](E));let O=typeof this.#c=="string"&&this.#c!==""?this.#c+" ":"",z=typeof this.text=="string"?" "+this.text:"",se=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return O+E+z+se}clear(){if(!this.#u||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let d=0;d<this.#r;d++)d>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#f||this.lastIndent!==this.#f)&&this.#s.cursorTo(this.#f),this.lastIndent=this.#f,this.#r=0,this}render(){return this.#_?this:(this.clear(),this.#s.write(this.frame()),this.#r=this.#e,this)}start(d){return d&&(this.text=d),this.#_?this:this.#u?this.isSpinning?this:(this.#t.hideCursor&&A2e.hide(this.#s),this.#t.discardStdin&&hJ.default.stdin.isTTY&&(this.#i=!0,J2e.start()),this.render(),this.#p=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#s.write(`- ${this.text}
621
621
  `),this)}stop(){return this.#u?(clearInterval(this.#p),this.#p=void 0,this.#n=0,this.clear(),this.#t.hideCursor&&A2e.show(this.#s),this.#t.discardStdin&&hJ.default.stdin.isTTY&&this.#i&&(J2e.stop(),this.#i=!1),this):this}succeed(d){return this.stopAndPersist({symbol:mJ.success,text:d})}fail(d){return this.stopAndPersist({symbol:mJ.error,text:d})}warn(d){return this.stopAndPersist({symbol:mJ.warning,text:d})}info(d){return this.stopAndPersist({symbol:mJ.info,text:d})}stopAndPersist(d={}){if(this.#_)return this;let S=d.prefixText??this.#c,E=this.#h(S," "),O=d.symbol??" ",z=d.text??this.text,Ae=typeof z=="string"?(O?" ":"")+z:"",Ye=d.suffixText??this.#l,Dt=this.#y(Ye," "),Ut=E+O+Ae+Dt+`
622
- `;return this.stop(),this.#s.write(Ut),this}};function U2e(f){return new z2e(f)}var W2e=(0,Wf.blue)((0,Wf.dim)("internal only"));function Iv(f,d,S){console.log(xk[f]+d),typeof S?.exit<"u"&&process.exit(S.exit)}async function mGe(f,d,S){if(!gGe){Iv("wait",f);try{let O=await d();O&&console.log(O),Iv("success",f);return}catch(O){return Iv("error",f),S?.printError!==!1&&console.log((0,Wf.red)(O.message)),O}}let E=U2e({spinner:"simpleDots",prefixText:xk.wait+f}).start();try{let O=await d();E.stop(),Iv("success",f),O&&console.log(O)}catch(O){return E.stop(),Iv("error",f),S?.printError!==!1&&console.error(O.message),O}}var xk={wait:`\u{1F550}${(0,Wf.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,Wf.cyan)("info")} - `,success:`\u2705${(0,Wf.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,Wf.yellow)("warn")} - `,error:`\u{1F4A5}${(0,Wf.red)("error")} - `,event:`\u26A1\uFE0F${(0,Wf.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,Wf.yellowBright)("plan")} - `},gGe=!0;function hGe(f,d){f||(xk.wait=`${(0,Wf.blue)("wait")} - `,xk.info=`${(0,Wf.cyan)("info")} - `,xk.success=`${(0,Wf.green)("ready")} - `,xk.warn=`${(0,Wf.yellow)("warn")} - `,xk.error=`${(0,Wf.red)("error")} - `,xk.event=`${(0,Wf.magenta)("event")} - `,xk.paymentPrompt=`${(0,Wf.yellowBright)("plan")} - `),d&&(gGe=!1)}var gw=require("@oclif/core");var vJ=lc(require("node:fs")),Iee=lc(require("node:path")),SGe=lc(require("node:os"));var yGe=lc(require("node:path")),vGe=lc(require("node:fs"));function Nee(){let f;try{f=yGe.resolve("package.json")}catch(S){throw new Error(`cannot resolve package manifest path: ${S}`)}let d;try{d=JSON.parse(vGe.readFileSync(f,"utf8"))}catch(S){throw new Error(`cannot read package manifest: ${S}`)}return d.name=d.name.replace(/^@workaround/g,""),d}var bGe={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],X8t="e69bae0ec90f5e838555",Dk={},TGe;function xGe(){let f=Nee();if(!f.name)throw new Error("extension name in manifest cannot be empty");return Iee.join(kGe(),"extensions",f.name)}function DGe(f){TGe=f;try{Dk=JSON.parse(vJ.readFileSync(Iee.join(kGe(),"config.json"),"utf8"))}catch(d){if(d instanceof Error&&d.code==="ENOENT")return;throw new Error(`Failed to read config file: ${d}`)}}function K8t(f){switch(f){case"raycastApiURL":return process.env.RAY_APIURL||Dk.APIURL||bGe.url;case"raycastAccessToken":return process.env.RAY_TOKEN||Dk.Token||Dk.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||Dk.ClientID||bGe.clientID;case"githubClientId":return process.env.RAY_GithubClientID||Dk.GithubClientID||X8t;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||Dk.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof Dk.Target>"u"?CGe("release"):Dk.Target)}}function CGe(f){switch(f){case"debug":return"debug";case"internal":return"internal";case"release":return"";case void 0:return K8t("flavorName")}}function Z8t(){let f=CGe(TGe);return f==""?"raycast":`raycast-${f}`}function kGe(){let f=Iee.join(SGe.default.homedir(),".config",Z8t());return vJ.mkdirSync(f,{recursive:!0}),f}var Fee=class extends gw.Command{static baseFlags={"exit-on-error":gw.Flags.boolean({default:!0,helpGroup:"GLOBAL",aliases:["exitOnError"],deprecateAliases:!0,summary:"Always exit with non-zero code on error",allowNo:!0}),emoji:gw.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Prefix output with emojis \u{1F308}"}),help:gw.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Show the help message for the command"}),"non-interactive":gw.Flags.boolean({char:"I",default:!1,helpGroup:"GLOBAL",summary:"Disable interactive outputs, useful for CI"}),target:gw.Flags.option({char:"t",description:"Raycast app target",helpGroup:"GLOBAL",multiple:!1,options:["debug","internal","release"],hidden:!0})()};flags;args;async init(){await super.init(),process.on("SIGINT",()=>process.exit(1));let{args:d,flags:S}=await this.parse({flags:this.ctor.flags,baseFlags:super.ctor.baseFlags,enableJsonFlag:this.ctor.enableJsonFlag,args:this.ctor.args,strict:this.ctor.strict});this.flags=S,this.args=d,DGe(this.flags.target),hGe(this.flags.emoji,this.flags["non-interactive"])}error(d,S){return S?.message&&d instanceof Error&&(d.message=`${S.message} (${d.message})`,delete S.message),super.error(d,S)}async catch(d){return super.catch(d)}async finally(d){return super.finally(d)}};var IGe=lc(require("fs"));var eIt=/[\p{Lu}]/u,tIt=/[\p{Ll}]/u,EGe=/^[\p{Lu}](?![\p{Lu}])/gu,PGe=/([\p{Alpha}\p{N}_]|$)/u,V2e=/[_.\- ]+/,rIt=new RegExp("^"+V2e.source),wGe=new RegExp(V2e.source+PGe.source,"gu"),AGe=new RegExp("\\d+"+PGe.source,"gu"),nIt=(f,d,S,E)=>{let O=!1,z=!1,se=!1,Ae=!1;for(let Ye=0;Ye<f.length;Ye++){let Dt=f[Ye];Ae=Ye>2?f[Ye-3]==="-":!0,O&&eIt.test(Dt)?(f=f.slice(0,Ye)+"-"+f.slice(Ye),O=!1,se=z,z=!0,Ye++):z&&se&&tIt.test(Dt)&&(!Ae||E)?(f=f.slice(0,Ye-1)+"-"+f.slice(Ye-1),se=z,z=!1,O=!0):(O=d(Dt)===Dt&&S(Dt)!==Dt,se=z,z=S(Dt)===Dt&&d(Dt)!==Dt)}return f},iIt=(f,d)=>(EGe.lastIndex=0,f.replaceAll(EGe,S=>d(S))),sIt=(f,d)=>(wGe.lastIndex=0,AGe.lastIndex=0,f.replaceAll(AGe,(S,E,O)=>["_","-"].includes(f.charAt(O+S.length))?S:d(S)).replaceAll(wGe,(S,E)=>d(E)));function Oee(f,d){if(!(typeof f=="string"||Array.isArray(f)))throw new TypeError("Expected the input to be `string | string[]`");if(d={pascalCase:!1,preserveConsecutiveUppercase:!1,...d},Array.isArray(f)?f=f.map(z=>z.trim()).filter(z=>z.length).join("-"):f=f.trim(),f.length===0)return"";let S=d.locale===!1?z=>z.toLowerCase():z=>z.toLocaleLowerCase(d.locale),E=d.locale===!1?z=>z.toUpperCase():z=>z.toLocaleUpperCase(d.locale);return f.length===1?V2e.test(f)?"":d.pascalCase?E(f):S(f):(f!==S(f)&&(f=nIt(f,S,E,d.preserveConsecutiveUppercase)),f=f.replace(rIt,""),f=d.preserveConsecutiveUppercase?iIt(f,S):S(f),d.pascalCase&&(f=E(f.charAt(0))+f.slice(1)),sIt(f,E))}function FGe(f,d){let S=`type ExtensionPreferences = ${NGe(f.preferences)}
622
+ `;return this.stop(),this.#s.write(Ut),this}};function U2e(f){return new z2e(f)}var W2e=(0,Wf.blue)((0,Wf.dim)("internal only"));function Iv(f,d,S){console.log(xk[f]+d),typeof S?.exit<"u"&&process.exit(S.exit)}async function mGe(f,d,S){if(!gGe){Iv("wait",f);try{let O=await d();O&&console.log(O),Iv("success",f);return}catch(O){return Iv("error",f),S?.printError!==!1&&console.log((0,Wf.red)(O.message)),O}}let E=U2e({spinner:"simpleDots",prefixText:xk.wait+f}).start();try{let O=await d();E.stop(),Iv("success",f),O&&console.log(O)}catch(O){return E.stop(),Iv("error",f),S?.printError!==!1&&console.error(O.message),O}}var xk={wait:`\u{1F550}${(0,Wf.blue)("wait")} - `,info:`${process.env.GITHUB_ACTIONS==="true"?"\u2139\uFE0F":"\u2139\uFE0F "}${(0,Wf.cyan)("info")} - `,success:`\u2705${(0,Wf.green)("ready")} - `,warn:`${process.env.GITHUB_ACTIONS==="true"?"\u26A0\uFE0F":"\u26A0\uFE0F "}${(0,Wf.yellow)("warn")} - `,error:`\u{1F4A5}${(0,Wf.red)("error")} - `,event:`\u26A1\uFE0F${(0,Wf.magenta)("event")} - `,paymentPrompt:`\u{1F4B0}${(0,Wf.yellowBright)("plan")} - `},gGe=!0;function hGe(f,d){f||(xk.wait=`${(0,Wf.blue)("wait")} - `,xk.info=`${(0,Wf.cyan)("info")} - `,xk.success=`${(0,Wf.green)("ready")} - `,xk.warn=`${(0,Wf.yellow)("warn")} - `,xk.error=`${(0,Wf.red)("error")} - `,xk.event=`${(0,Wf.magenta)("event")} - `,xk.paymentPrompt=`${(0,Wf.yellowBright)("plan")} - `),d&&(gGe=!1)}var gw=require("@oclif/core");var vJ=lc(require("node:fs")),Iee=lc(require("node:path")),SGe=lc(require("node:os"));var yGe=lc(require("node:path")),vGe=lc(require("node:fs"));function Nee(){let f;try{f=yGe.resolve("package.json")}catch(S){throw new Error(`cannot resolve package manifest path: ${S}`)}let d;try{d=JSON.parse(vGe.readFileSync(f,"utf8"))}catch(S){throw new Error(`cannot read package manifest: ${S}`)}return d.name=d.name.replace(/^@workaround/g,""),d}var bGe={production:{url:"https://www.raycast.com",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},staging:{url:"https://www.rayca.st",clientID:"KqAdcGhNfBKiUpfjD3nU3VNgh1t0iMPoX2hYEkN9d4I"},development:{url:"http://localhost:3000",clientID:"rOCD_LhnXFObSLu9v7788qOGu25FZDqEzGjet4Q45ZY"}}[process.env.API_ENV||"production"],X8t="e69bae0ec90f5e838555",Dk={},TGe;function xGe(){let f=Nee();if(!f.name)throw new Error("extension name in manifest cannot be empty");return Iee.join(kGe(),"extensions",f.name)}function DGe(f){TGe=f;try{Dk=JSON.parse(vJ.readFileSync(Iee.join(kGe(),"config.json"),"utf8"))}catch(d){if(d instanceof Error&&d.code==="ENOENT")return;throw new Error(`Failed to read config file: ${d}`)}}function K8t(f){switch(f){case"raycastApiURL":return process.env.RAY_APIURL||Dk.APIURL||bGe.url;case"raycastAccessToken":return process.env.RAY_TOKEN||Dk.Token||Dk.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||Dk.ClientID||bGe.clientID;case"githubClientId":return process.env.RAY_GithubClientID||Dk.GithubClientID||X8t;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||Dk.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target||(typeof Dk.Target>"u"?CGe("release"):Dk.Target)}}function CGe(f){switch(f){case"debug":return"debug";case"internal":return"internal";case"release":return"";case"x":return"x";case"x-internal":return"x-internal";case"x-debug":return"x-debug";case void 0:return K8t("flavorName")}}function Z8t(){let f=CGe(TGe);return f==""?"raycast":`raycast-${f}`}function kGe(){let f=Iee.join(SGe.default.homedir(),".config",Z8t());return vJ.mkdirSync(f,{recursive:!0}),f}var Fee=class extends gw.Command{static baseFlags={"exit-on-error":gw.Flags.boolean({default:!0,helpGroup:"GLOBAL",aliases:["exitOnError"],deprecateAliases:!0,summary:"Always exit with non-zero code on error",allowNo:!0}),emoji:gw.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Prefix output with emojis \u{1F308}"}),help:gw.Flags.boolean({default:!1,helpGroup:"GLOBAL",summary:"Show the help message for the command"}),"non-interactive":gw.Flags.boolean({char:"I",default:!1,helpGroup:"GLOBAL",summary:"Disable interactive outputs, useful for CI"}),target:gw.Flags.option({char:"t",description:"Raycast app target",helpGroup:"GLOBAL",multiple:!1,options:["debug","internal","release","x","x-debug","x-internal"],hidden:!0})()};flags;args;async init(){await super.init(),process.on("SIGINT",()=>process.exit(1));let{args:d,flags:S}=await this.parse({flags:this.ctor.flags,baseFlags:super.ctor.baseFlags,enableJsonFlag:this.ctor.enableJsonFlag,args:this.ctor.args,strict:this.ctor.strict});this.flags=S,this.args=d,DGe(this.flags.target),hGe(this.flags.emoji,this.flags["non-interactive"])}error(d,S){return S?.message&&d instanceof Error&&(d.message=`${S.message} (${d.message})`,delete S.message),super.error(d,S)}async catch(d){return super.catch(d)}async finally(d){return super.finally(d)}};var IGe=lc(require("fs"));var eIt=/[\p{Lu}]/u,tIt=/[\p{Ll}]/u,EGe=/^[\p{Lu}](?![\p{Lu}])/gu,PGe=/([\p{Alpha}\p{N}_]|$)/u,V2e=/[_.\- ]+/,rIt=new RegExp("^"+V2e.source),wGe=new RegExp(V2e.source+PGe.source,"gu"),AGe=new RegExp("\\d+"+PGe.source,"gu"),nIt=(f,d,S,E)=>{let O=!1,z=!1,se=!1,Ae=!1;for(let Ye=0;Ye<f.length;Ye++){let Dt=f[Ye];Ae=Ye>2?f[Ye-3]==="-":!0,O&&eIt.test(Dt)?(f=f.slice(0,Ye)+"-"+f.slice(Ye),O=!1,se=z,z=!0,Ye++):z&&se&&tIt.test(Dt)&&(!Ae||E)?(f=f.slice(0,Ye-1)+"-"+f.slice(Ye-1),se=z,z=!1,O=!0):(O=d(Dt)===Dt&&S(Dt)!==Dt,se=z,z=S(Dt)===Dt&&d(Dt)!==Dt)}return f},iIt=(f,d)=>(EGe.lastIndex=0,f.replaceAll(EGe,S=>d(S))),sIt=(f,d)=>(wGe.lastIndex=0,AGe.lastIndex=0,f.replaceAll(AGe,(S,E,O)=>["_","-"].includes(f.charAt(O+S.length))?S:d(S)).replaceAll(wGe,(S,E)=>d(E)));function Oee(f,d){if(!(typeof f=="string"||Array.isArray(f)))throw new TypeError("Expected the input to be `string | string[]`");if(d={pascalCase:!1,preserveConsecutiveUppercase:!1,...d},Array.isArray(f)?f=f.map(z=>z.trim()).filter(z=>z.length).join("-"):f=f.trim(),f.length===0)return"";let S=d.locale===!1?z=>z.toLowerCase():z=>z.toLocaleLowerCase(d.locale),E=d.locale===!1?z=>z.toUpperCase():z=>z.toLocaleUpperCase(d.locale);return f.length===1?V2e.test(f)?"":d.pascalCase?E(f):S(f):(f!==S(f)&&(f=nIt(f,S,E,d.preserveConsecutiveUppercase)),f=f.replace(rIt,""),f=d.preserveConsecutiveUppercase?iIt(f,S):S(f),d.pascalCase&&(f=E(f.charAt(0))+f.slice(1)),sIt(f,E))}function FGe(f,d){let S=`type ExtensionPreferences = ${NGe(f.preferences)}
623
623
 
624
624
  /** Preferences accessible in all the extension's commands */
625
625
  declare type Preferences = ExtensionPreferences
@@ -753,7 +753,7 @@ You can try to delete the ${E} folder and run this command again, sometimes it h
753
753
  Make sure the tool name in the package.json corresponds to a file in the src/tools directory`)})||[],se=["@raycast/api","react","react-devtools-raycast","@parcel/source-map"].concat(S.external||[]),Ae=f.environment==="dist"?"external":"inline",Ye=[];function Dt(Ut){Ye.push(Ut)}if(Iv("info",`entry points ${JSON.stringify(O.concat(z))}`),await BYe({entryPoints:O,entryNames:"[name]",external:se,environment:f.environment,sourceMap:Ae,outputDir:f.outputDir},d,Dt),await BYe({entryPoints:z,entryNames:"[name]",external:se,environment:f.environment,sourceMap:Ae,outputDir:rm.join(f.outputDir,"tools")},d,Dt),Iv("info","compiled entry points"),E&&(FGe(S,Ye),Iv("info","generated extension's TypeScript definitions")),f.skipTypeDeclarations?Iv("info","skipping types generation"):f.environment==="dist"&&E&&(await W5t(),Iv("info","checked TypeScript")),S.tools){let[Ut,tr]=(0,zYe.getSchemas)(".",S.tools);if(tr.length){let ve=[];throw tr.forEach(tn=>{let At="";At=`${rm.resolve(tn.filePath)}
754
754
  ${tn.level} ${tn.message}`,ve.push(At)}),new Error(`extracting tool schemas failed
755
755
  ${(0,UYe.red)(ve.join(`
756
- `))}`)}f.printExtractedSchemas&&(Iv("info","extracted tool schemas:"),console.log(_3.ux.colorizeJson(Ut,{theme:{null:"red",string:"green",number:"magenta",boolean:"cyan",key:"white",comma:"yellow",brace:"yellow",bracket:"yellow"},pretty:!0}))),S.tools=Ut;try{let ve=RYe();ve&&(S.ai={...S.ai||{},...ve})}catch(ve){throw ve instanceof Error&&(ve.message=`reading AI file failed (${ve.message})`),ve}}delete S.type,vh.writeFileSync(rm.join(f.outputDir,"package.json"),JSON.stringify(S,null," ")),vh.rmSync(rm.join(f.outputDir,"assets"),{recursive:!0,force:!0}),vh.existsSync("assets")&&vh.cpSync("assets",rm.join(f.outputDir,"assets"),{recursive:!0}),jYe(f.outputDir,O),jYe(rm.join(f.outputDir,"tools"),z),Iv("success","built extension successfully")}async function BYe(f,d,S){let E=f.environment=="dist",O=await JYe.build({entryPoints:f.entryPoints,entryNames:f.entryNames,sourcemap:f.sourceMap,outdir:f.outputDir,platform:"node",external:f.external,target:"node20.15.1",jsxFactory:"_jsx",jsxFragment:"_jsxFragment",bundle:!0,minifyWhitespace:E,minifyIdentifiers:E,minifySyntax:E,write:!0,logLevel:"silent",metafile:f.metaOutputDir!="",banner:f.banner,alias:f.alias,loader:{".wasm":"binary"},plugins:[OGe,RGe(E,d,S)]});if(O.errors.length>0){let z=O.errors[0];throw new Error(`build failed (${z.location?.file}:${z.location?.line}:${z.location?.column} ${z.location?.lineText}): ${z.text}`)}f.metaOutputDir&&O.metafile&&vh.writeFileSync(rm.join(f.metaOutputDir,"meta.json"),JSON.stringify(O.metafile,null," "),"utf-8")}function jYe(f,d){try{vh.readdirSync(f).forEach(E=>{rm.extname(E)===".js"&&(d.find(O=>rm.basename(O,rm.extname(O))===rm.basename(E,rm.extname(E)))||vh.unlinkSync(rm.join(f,E)))})}catch{}}async function W5t(){let f="./node_modules/.bin/tsc";if(!vh.existsSync(f))throw new Error("please install the TypeScript compiler (npm install typescript)");try{await vee(f,["-p","tsconfig.json","--noEmit"],{preferLocal:!0,stderr:"inherit",stdout:"inherit"})}catch(d){throw new Error(`TypeScript check failed (${d.message})`)}}0&&(module.exports={build});
756
+ `))}`)}f.printExtractedSchemas&&(Iv("info","extracted tool schemas:"),console.log(_3.ux.colorizeJson(Ut,{theme:{null:"red",string:"green",number:"magenta",boolean:"cyan",key:"white",comma:"yellow",brace:"yellow",bracket:"yellow"},pretty:!0}))),S.tools=Ut;try{let ve=RYe();ve&&(S.ai={...S.ai||{},...ve})}catch(ve){throw ve instanceof Error&&(ve.message=`reading AI file failed (${ve.message})`),ve}}delete S.type,vh.writeFileSync(rm.join(f.outputDir,"package.json"),JSON.stringify(S,null," ")),vh.rmSync(rm.join(f.outputDir,"assets"),{recursive:!0,force:!0}),vh.existsSync("assets")&&vh.cpSync("assets",rm.join(f.outputDir,"assets"),{recursive:!0}),jYe(f.outputDir,O),jYe(rm.join(f.outputDir,"tools"),z),Iv("success","built extension successfully")}async function BYe(f,d,S){let E=f.environment=="dist",O=await JYe.build({entryPoints:f.entryPoints,entryNames:f.entryNames,sourcemap:f.sourceMap,outdir:f.outputDir,platform:"node",external:f.external,target:"node22.14.0",jsxFactory:"_jsx",jsxFragment:"_jsxFragment",bundle:!0,minifyWhitespace:E,minifyIdentifiers:E,minifySyntax:E,write:!0,logLevel:"silent",metafile:f.metaOutputDir!="",banner:f.banner,alias:f.alias,loader:{".wasm":"binary"},plugins:[OGe,RGe(E,d,S)]});if(O.errors.length>0){let z=O.errors[0];throw new Error(`build failed (${z.location?.file}:${z.location?.line}:${z.location?.column} ${z.location?.lineText}): ${z.text}`)}f.metaOutputDir&&O.metafile&&vh.writeFileSync(rm.join(f.metaOutputDir,"meta.json"),JSON.stringify(O.metafile,null," "),"utf-8")}function jYe(f,d){try{vh.readdirSync(f).forEach(E=>{rm.extname(E)===".js"&&(d.find(O=>rm.basename(O,rm.extname(O))===rm.basename(E,rm.extname(E)))||vh.unlinkSync(rm.join(f,E)))})}catch{}}async function W5t(){let f="./node_modules/.bin/tsc";if(!vh.existsSync(f))throw new Error("please install the TypeScript compiler (npm install typescript)");try{await vee(f,["-p","tsconfig.json","--noEmit"],{preferLocal:!0,stderr:"inherit",stdout:"inherit"})}catch(d){throw new Error(`TypeScript check failed (${d.message})`)}}0&&(module.exports={build});
757
757
  /*! Bundled license information:
758
758
 
759
759
  typescript/lib/typescript.js: