@raycast/api 1.104.23 → 1.104.24
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.
- package/dist/api/raycast.js +1 -1
- package/dist/commands/publish/index.js +54 -54
- package/dist/commands/version/index.js +1 -1
- package/oclif.manifest.json +43 -43
- package/package.json +1 -1
package/dist/api/raycast.js
CHANGED
|
@@ -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"),ke=(r,n,a)=>{if(n.length<a)throw new TypeError(`Failed to execute '${r}' on 'FormData': ${a} arguments required, but only ${n.length} present.`)},ot=class{#e=[];constructor(...n){if(n.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[Ze](){return"FormData"}[na](){return this.entries()}static[oa](n){return n&&typeof n=="object"&&n[Ze]==="FormData"&&!aa.some(a=>typeof n[a]!="function")}append(...n){ke("append",arguments,2),this.#e.push(fn(...n))}delete(n){ke("delete",arguments,1),n+="",this.#e=this.#e.filter(([a])=>a!==n)}get(n){ke("get",arguments,1),n+="";for(var a=this.#e,i=a.length,l=0;l<i;l++)if(a[l][0]===n)return a[l][1];return null}getAll(n,a){return ke("getAll",arguments,1),a=[],n+="",this.#e.forEach(i=>i[0]===n&&a.push(i[1])),a}has(n){return ke("has",arguments,1),n+="",this.#e.some(a=>a[0]===n)}forEach(n,a){ke("forEach",arguments,1);for(var[i,l]of this)n.call(a,l,i,this)}set(...n){ke("set",arguments,2);var a=[],i=!0;n=fn(...n),this.#e.forEach(l=>{l[0]===n[0]?i&&(i=!a.push(n)):a.push(l)}),i&&a.push(n),this.#e=a}*entries(){yield*this.#e}*keys(){for(var[n]of this)yield n}*values(){for(var[,n]of this)yield n}}}}),Ys=wn({"node_modules/node-domexception/index.js"(r,n){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)}n.exports=globalThis.DOMException}}),vt,ia,sa,pr,ga,_a,Sa,wa,dn,hn,mr,va=Pt({"node_modules/fetch-blob/from.js"(){vt=H(require("fs")),ia=H(require("path")),sa=H(Ys()),ya(),kt(),{stat:pr}=vt.promises,ga=(r,n)=>dn((0,vt.statSync)(r),r,n),_a=(r,n)=>pr(r).then(a=>dn(a,r,n)),Sa=(r,n)=>pr(r).then(a=>hn(a,r,n)),wa=(r,n)=>hn((0,vt.statSync)(r),r,n),dn=(r,n,a="")=>new nt([new mr({path:n,size:r.size,lastModified:r.mtimeMs,start:0})],{type:a}),hn=(r,n,a="")=>new Bt([new mr({path:n,size:r.size,lastModified:r.mtimeMs,start:0})],(0,ia.basename)(n),{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,n){return new mr({path:this.#e,lastModified:this.lastModified,size:n-r,start:this.#t+r})}async*stream(){let{mtimeMs:r}=await pr(this.#e);if(r>this.lastModified)throw new sa.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,vt.createReadStream)(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}}}),Ra={};ba(Ra,{toFormData:()=>Qs});function Gs(r){let n=r.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!n)return;let a=n[2]||n[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 Qs(r,n){if(!/multipart/i.test(n))throw new TypeError("Failed to fetch");let a=n.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!a)throw new TypeError("no or bad content-type header, no multipart boundary");let i=new Ta(a[1]||a[2]),l,c,p,d,y,g,O=[],I=new ot,D=v=>{p+=C.decode(v,{stream:!0})},S=v=>{O.push(v)},m=()=>{let v=new Bt(O,g,{type:y});I.append(d,v)},b=()=>{I.append(d,p)},C=new TextDecoder("utf-8");C.decode(),i.onPartBegin=function(){i.onPartData=D,i.onPartEnd=b,l="",c="",p="",d="",y="",g=null,O.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=Gs(c),g&&(i.onPartData=S,i.onPartEnd=m)}else l==="content-type"&&(y=c);c="",l=""};for await(let v of r)i.write(v);return i.end(),I}var se,W,pn,Se,Rt,Tt,la,et,ua,ca,fa,da,Be,Ta,Xs=Pt({"node_modules/node-fetch/src/utils/multipart-parser.js"(){va(),Rr(),se=0,W={START_BOUNDARY:se++,HEADER_FIELD_START:se++,HEADER_FIELD:se++,HEADER_VALUE_START:se++,HEADER_VALUE:se++,HEADER_VALUE_ALMOST_DONE:se++,HEADERS_ALMOST_DONE:se++,PART_DATA_START:se++,PART_DATA:se++,END:se++},pn=1,Se={PART_BOUNDARY:pn,LAST_BOUNDARY:pn*=2},Rt=10,Tt=13,la=32,et=45,ua=58,ca=97,fa=122,da=r=>r|32,Be=()=>{},Ta=class{constructor(r){this.index=0,this.flags=0,this.onHeaderEnd=Be,this.onHeaderField=Be,this.onHeadersEnd=Be,this.onHeaderValue=Be,this.onPartBegin=Be,this.onPartData=Be,this.onPartEnd=Be,this.boundaryChars={},r=`\r
|
|
12
12
|
--`+r;let n=new Uint8Array(r.length);for(let a=0;a<r.length;a++)n[a]=r.charCodeAt(a),this.boundaryChars[n[a]]=!0;this.boundary=n,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=W.START_BOUNDARY}write(r){let n=0,a=r.length,i=this.index,{lookbehind:l,boundary:c,boundaryChars:p,index:d,state:y,flags:g}=this,O=this.boundary.length,I=O-1,D=r.length,S,m,b=N=>{this[N+"Mark"]=n},C=N=>{delete this[N+"Mark"]},v=(N,q,L,x)=>{(q===void 0||q!==L)&&this[N](x&&x.subarray(q,L))},U=(N,q)=>{let L=N+"Mark";L in this&&(q?(v(N,this[L],n,r),delete this[L]):(v(N,this[L],r.length,r),this[L]=0))};for(n=0;n<a;n++)switch(S=r[n],y){case W.START_BOUNDARY:if(d===c.length-2){if(S===et)g|=Se.LAST_BOUNDARY;else if(S!==Tt)return;d++;break}else if(d-1===c.length-2){if(g&Se.LAST_BOUNDARY&&S===et)y=W.END,g=0;else if(!(g&Se.LAST_BOUNDARY)&&S===Rt)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===Tt){C("onHeaderField"),y=W.HEADERS_ALMOST_DONE;break}if(d++,S===et)break;if(S===ua){if(d===1)return;U("onHeaderField",!0),y=W.HEADER_VALUE_START;break}if(m=da(S),m<ca||m>fa)return;break;case W.HEADER_VALUE_START:if(S===la)break;b("onHeaderValue"),y=W.HEADER_VALUE;case W.HEADER_VALUE:S===Tt&&(U("onHeaderValue",!0),v("onHeaderEnd"),y=W.HEADER_VALUE_ALMOST_DONE);break;case W.HEADER_VALUE_ALMOST_DONE:if(S!==Rt)return;y=W.HEADER_FIELD_START;break;case W.HEADERS_ALMOST_DONE:if(S!==Rt)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(n+=I;n<D&&!(r[n]in p);)n+=O;n-=I,S=r[n]}if(d<c.length)c[d]===S?(d===0&&U("onPartData",!0),d++):d=0;else if(d===c.length)d++,S===Tt?g|=Se.PART_BOUNDARY:S===et?g|=Se.LAST_BOUNDARY:d=0;else if(d-1===c.length)if(g&Se.PART_BOUNDARY){if(d=0,S===Rt){g&=~Se.PART_BOUNDARY,v("onPartEnd"),v("onPartBegin"),y=W.HEADER_FIELD_START;break}}else g&Se.LAST_BOUNDARY&&S===et?(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"),n--}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")}}}});ba(Ba,{AbortError:()=>Pa,Blob:()=>yn,FetchError:()=>ue,File:()=>Bt,FormData:()=>ot,Headers:()=>we,Request:()=>At,Response:()=>K,blobFrom:()=>_a,blobFromSync:()=>ga,default:()=>ka,fileFrom:()=>Sa,fileFromSync:()=>wa,isRedirect:()=>Rn});var Js=H(require("http")),Ks=H(require("https")),tt=H(require("zlib")),fe=H(require("stream")),br=H(require("buffer"));function Zs(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 n=r.indexOf(",");if(n===-1||n<=4)throw new TypeError("malformed data: URI");let a=r.substring(5,n).split(";"),i="",l=!1,c=a[0]||"text/plain",p=c;for(let O=1;O<a.length;O++)a[O]==="base64"?l=!0:a[O]&&(p+=`;${a[O]}`,a[O].indexOf("charset=")===0&&(i=a[O].substring(8)));!a[0]&&!i.length&&(p+=";charset=US-ASCII",i="US-ASCII");let d=l?"base64":"ascii",y=unescape(r.substring(n+1)),g=Buffer.from(y,d);return g.type=c,g.typeFull=p,g.charset=i,g}var el=Zs,de=H(require("stream")),at=H(require("util")),te=H(require("buffer"));kt();Rr();var Tr=class extends Error{constructor(r,n){super(r),Error.captureStackTrace(this,this.constructor),this.type=n}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},ue=class extends Tr{constructor(r,n,a){super(r,n),a&&(this.code=this.errno=a.code,this.erroredSysCall=a.syscall)}},_r=Symbol.toStringTag,Ea=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[_r]==="URLSearchParams",Sr=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[_r]),tl=r=>typeof r=="object"&&(r[_r]==="AbortSignal"||r[_r]==="EventTarget"),rl=(r,n)=>{let a=new URL(n).hostname,i=new URL(r).hostname;return a===i||a.endsWith(`.${i}`)},nl=(r,n)=>{let a=new URL(n).protocol,i=new URL(r).protocol;return a===i},ol=(0,at.promisify)(de.default.pipeline),Q=Symbol("Body internals"),Ct=class{constructor(r,{size:n=0}={}){let a=null;r===null?r=null:Ea(r)?r=te.Buffer.from(r.toString()):Sr(r)||te.Buffer.isBuffer(r)||(at.types.isAnyArrayBuffer(r)?r=te.Buffer.from(r):ArrayBuffer.isView(r)?r=te.Buffer.from(r.buffer,r.byteOffset,r.byteLength):r instanceof de.default||(r instanceof ot?(r=Vs(r),a=r.type.split("=")[1]):r=te.Buffer.from(String(r))));let i=r;te.Buffer.isBuffer(r)?i=de.default.Readable.from(r):Sr(r)&&(i=de.default.Readable.from(r.stream())),this[Q]={body:r,stream:i,boundary:a,disturbed:!1,error:null},this.size=n,r instanceof de.default&&r.on("error",l=>{let c=l instanceof Tr?l:new ue(`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:n,byteLength:a}=await mn(this);return r.slice(n,n+a)}async formData(){let r=this.headers.get("content-type");if(r.startsWith("application/x-www-form-urlencoded")){let a=new ot,i=new URLSearchParams(await this.text());for(let[l,c]of i)a.append(l,c);return a}let{toFormData:n}=await Promise.resolve().then(()=>(Xs(),Ra));return n(this.body,r)}async blob(){let r=this.headers&&this.headers.get("content-type")||this[Q].body&&this[Q].body.type||"",n=await this.arrayBuffer();return new nt([n],{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)}};Ct.prototype.buffer=(0,at.deprecate)(Ct.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Ct.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,at.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:n}=r;if(n===null||!(n instanceof de.default))return te.Buffer.alloc(0);let a=[],i=0;try{for await(let l of n){if(r.size>0&&i+l.length>r.size){let c=new ue(`content size at ${r.url} over limit: ${r.size}`,"max-size");throw n.destroy(c),c}i+=l.length,a.push(l)}}catch(l){throw l instanceof Tr?l:new ue(`Invalid response body while trying to fetch ${r.url}: ${l.message}`,"system",l)}if(n.readableEnded===!0||n._readableState.ended===!0)try{return a.every(l=>typeof l=="string")?te.Buffer.from(a.join("")):te.Buffer.concat(a,i)}catch(l){throw new ue(`Could not create Buffer from response body for ${r.url}: ${l.message}`,"system",l)}else throw new ue(`Premature close of server response while trying to fetch ${r.url}`)}var vn=(r,n)=>{let a,i,{body:l}=r[Q];if(r.bodyUsed)throw new Error("cannot clone body after it is used");return l instanceof de.default&&typeof l.getBoundary!="function"&&(a=new de.PassThrough({highWaterMark:n}),i=new de.PassThrough({highWaterMark:n}),l.pipe(a),l.pipe(i),r[Q].stream=a,l=i),l},al=(0,at.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"),Ca=(r,n)=>r===null?null:typeof r=="string"?"text/plain;charset=UTF-8":Ea(r)?"application/x-www-form-urlencoded;charset=UTF-8":Sr(r)?r.type||null:te.Buffer.isBuffer(r)||at.types.isAnyArrayBuffer(r)||ArrayBuffer.isView(r)?null:r instanceof ot?`multipart/form-data; boundary=${n[Q].boundary}`:r&&typeof r.getBoundary=="function"?`multipart/form-data;boundary=${al(r)}`:r instanceof de.default?null:"text/plain;charset=UTF-8",il=r=>{let{body:n}=r[Q];return n===null?0:Sr(n)?n.size:te.Buffer.isBuffer(n)?n.length:n&&typeof n.getLengthSync=="function"&&n.hasKnownLength&&n.hasKnownLength()?n.getLengthSync():null},sl=async(r,{body:n})=>{n===null?r.end():await ol(n,r)},ha=H(require("util")),wr=H(require("http")),gr=typeof wr.default.validateHeaderName=="function"?wr.default.validateHeaderName:r=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(r)){let n=new TypeError(`Header name must be a valid HTTP token [${r}]`);throw Object.defineProperty(n,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),n}},Sn=typeof wr.default.validateHeaderValue=="function"?wr.default.validateHeaderValue:(r,n)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(n)){let a=new TypeError(`Invalid character in header content ["${r}"]`);throw Object.defineProperty(a,"code",{value:"ERR_INVALID_CHAR"}),a}},we=class extends URLSearchParams{constructor(r){let n=[];if(r instanceof we){let a=r.raw();for(let[i,l]of Object.entries(a))n.push(...l.map(c=>[i,c]))}else if(r!=null)if(typeof r=="object"&&!ha.types.isBoxedPrimitive(r)){let a=r[Symbol.iterator];if(a==null)n.push(...Object.entries(r));else{if(typeof a!="function")throw new TypeError("Header pairs must be iterable");n=[...r].map(i=>{if(typeof i!="object"||ha.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 n=n.length>0?n.map(([a,i])=>(gr(a),Sn(a,String(i)),[String(a).toLowerCase(),String(i)])):void 0,super(n),new Proxy(this,{get(a,i,l){switch(i){case"append":case"set":return(c,p)=>(gr(c),Sn(c,String(p)),URLSearchParams.prototype[i].call(a,String(c).toLowerCase(),String(p)));case"delete":case"has":case"getAll":return c=>(gr(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 n=this.getAll(r);if(n.length===0)return null;let a=n.join(", ");return/^content-encoding$/i.test(r)&&(a=a.toLowerCase()),a}forEach(r,n=void 0){for(let a of this.keys())Reflect.apply(r,n,[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,n)=>(r[n]=this.getAll(n),r),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((r,n)=>{let a=this.getAll(n);return n==="host"?r[n]=a[0]:r[n]=a.length>1?a:a[0],r},{})}};Object.defineProperties(we.prototype,["get","entries","forEach","values"].reduce((r,n)=>(r[n]={enumerable:!0},r),{}));function ll(r=[]){return new we(r.reduce((n,a,i,l)=>(i%2===0&&n.push(l.slice(i,i+2)),n),[]).filter(([n,a])=>{try{return gr(n),Sn(n,String(a)),!0}catch{return!1}}))}var ul=new Set([301,302,303,307,308]),Rn=r=>ul.has(r),le=Symbol("Response internals"),K=class extends Ct{constructor(r=null,n={}){super(r,n);let a=n.status!=null?n.status:200,i=new we(n.headers);if(r!==null&&!i.has("Content-Type")){let l=Ca(r,this);l&&i.append("Content-Type",l)}this[le]={type:"default",url:n.url,status:a,statusText:n.statusText||"",headers:i,counter:n.counter,highWaterMark:n.highWaterMark}}get type(){return this[le].type}get url(){return this[le].url||""}get status(){return this[le].status}get ok(){return this[le].status>=200&&this[le].status<300}get redirected(){return this[le].counter>0}get statusText(){return this[le].statusText}get headers(){return this[le].headers}get highWaterMark(){return this[le].highWaterMark}clone(){return new K(vn(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,n=302){if(!Rn(n))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new K(null,{headers:{location:new URL(r).toString()},status:n})}static error(){let r=new K(null,{status:0,statusText:""});return r[le].type="error",r}static json(r=void 0,n={}){let a=JSON.stringify(r);if(a===void 0)throw new TypeError("data is not JSON serializable");let i=new we(n&&n.headers);return i.has("content-type")||i.set("content-type","application/json"),new K(a,{...n,headers:i})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(K.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 cl=H(require("url")),fl=H(require("util")),dl=r=>{if(r.search)return r.search;let n=r.href.length-1,a=r.hash||(r.href[n]==="#"?"#":"");return r.href[n-a.length]==="?"?"?":""},hl=H(require("net"));function pa(r,n=!1){return r==null||(r=new URL(r),/^(about|blob|data):$/.test(r.protocol))?"no-referrer":(r.username="",r.password="",r.hash="",n&&(r.pathname="",r.search=""),r)}var Aa=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),pl="strict-origin-when-cross-origin";function ml(r){if(!Aa.has(r))throw new TypeError(`Invalid referrerPolicy: ${r}`);return r}function bl(r){if(/^(http|ws)s:$/.test(r.protocol))return!0;let n=r.host.replace(/(^\[)|(]$)/g,""),a=(0,hl.isIP)(n);return a===4&&/^127\./.test(n)||a===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(n)?!0:r.host==="localhost"||r.host.endsWith(".localhost")?!1:r.protocol==="file:"}function rt(r){return/^about:(blank|srcdoc)$/.test(r)||r.protocol==="data:"||/^(blob|filesystem):$/.test(r.protocol)?!0:bl(r)}function yl(r,{referrerURLCallback:n,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=pa(l),p=pa(l,!0);c.toString().length>4096&&(c=p),n&&(c=n(c)),a&&(p=a(p));let d=new URL(r.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return p;case"unsafe-url":return c;case"strict-origin":return rt(c)&&!rt(d)?"no-referrer":p.toString();case"strict-origin-when-cross-origin":return c.origin===d.origin?c:rt(c)&&!rt(d)?"no-referrer":p;case"same-origin":return c.origin===d.origin?c:"no-referrer";case"origin-when-cross-origin":return c.origin===d.origin?c:p;case"no-referrer-when-downgrade":return rt(c)&&!rt(d)?"no-referrer":c;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function gl(r){let n=(r.get("referrer-policy")||"").split(/[,\s]+/),a="";for(let i of n)i&&Aa.has(i)&&(a=i);return a}var M=Symbol("Request internals"),Et=r=>typeof r=="object"&&typeof r[M]=="object",_l=(0,fl.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),At=class extends Ct{constructor(r,n={}){let a;if(Et(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=n.method||r.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(i)&&(i=i.toUpperCase()),!Et(n)&&"data"in n&&_l(),(n.body!=null||Et(r)&&r.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let l=n.body?n.body:Et(r)&&r.body!==null?vn(r):null;super(l,{size:n.size||r.size||0});let c=new we(n.headers||r.headers||{});if(l!==null&&!c.has("Content-Type")){let y=Ca(l,this);y&&c.set("Content-Type",y)}let p=Et(r)?r.signal:null;if("signal"in n&&(p=n.signal),p!=null&&!tl(p))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let d=n.referrer==null?r.referrer:n.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:n.redirect||r.redirect||"follow",headers:c,parsedURL:a,signal:p,referrer:d},this.follow=n.follow===void 0?r.follow===void 0?20:r.follow:n.follow,this.compress=n.compress===void 0?r.compress===void 0?!0:r.compress:n.compress,this.counter=n.counter||r.counter||0,this.agent=n.agent||r.agent,this.highWaterMark=n.highWaterMark||r.highWaterMark||16384,this.insecureHTTPParser=n.insecureHTTPParser||r.insecureHTTPParser||!1,this.referrerPolicy=n.referrerPolicy||r.referrerPolicy||""}get method(){return this[M].method}get url(){return(0,cl.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=ml(r)}clone(){return new At(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(At.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 Sl=r=>{let{parsedURL:n}=r[M],a=new we(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=il(r);typeof d=="number"&&!Number.isNaN(d)&&(i=String(d))}i&&a.set("Content-Length",i),r.referrerPolicy===""&&(r.referrerPolicy=pl),r.referrer&&r.referrer!=="no-referrer"?r[M].referrer=yl(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(n));let c=dl(n),p={path:n.pathname+c,method:r.method,headers:a[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:r.insecureHTTPParser,agent:l};return{parsedURL:n,options:p}},Pa=class extends Tr{constructor(r,n="aborted"){super(r,n)}};Rr();va();var wl=new Set(["data:","http:","https:"]);async function ka(r,n){return new Promise((a,i)=>{let l=new At(r,n),{parsedURL:c,options:p}=Sl(l);if(!wl.has(c.protocol))throw new TypeError(`node-fetch cannot load ${r}. URL scheme "${c.protocol.replace(/:$/,"")}" is not supported.`);if(c.protocol==="data:"){let m=el(l.url),b=new K(m,{headers:{"Content-Type":m.typeFull}});a(b);return}let d=(c.protocol==="https:"?Ks.default:Js.default).request,{signal:y}=l,g=null,O=()=>{let m=new Pa("The operation was aborted.");i(m),l.body&&l.body instanceof fe.default.Readable&&l.body.destroy(m),!(!g||!g.body)&&g.body.emit("error",m)};if(y&&y.aborted){O();return}let I=()=>{O(),S()},D=d(c.toString(),p);y&&y.addEventListener("abort",I);let S=()=>{D.abort(),y&&y.removeEventListener("abort",I)};D.on("error",m=>{i(new ue(`request to ${l.url} failed, reason: ${m.message}`,"system",m)),S()}),vl(D,m=>{g&&g.body&&g.body.destroy(m)}),process.version<"v14"&&D.on("socket",m=>{let b;m.prependListener("end",()=>{b=m._eventsCount}),m.prependListener("close",C=>{if(g&&b<m._eventsCount&&!C){let v=new Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",g.body.emit("error",v)}})}),D.on("response",m=>{D.setTimeout(0);let b=ll(m.rawHeaders);if(Rn(m.statusCode)){let q=b.get("Location"),L=null;try{L=q===null?null:new URL(q,l.url)}catch{if(l.redirect!=="manual"){i(new ue(`uri requested responds with an invalid redirect URL: ${q}`,"invalid-redirect")),S();return}}switch(l.redirect){case"error":i(new ue(`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 ue(`maximum redirect reached at: ${l.url}`,"max-redirect")),S();return}let x={headers:new we(l.headers),follow:l.follow,counter:l.counter+1,agent:l.agent,compress:l.compress,method:l.method,body:vn(l),signal:l.signal,size:l.size,referrer:l.referrer,referrerPolicy:l.referrerPolicy};if(!rl(l.url,L)||!nl(l.url,L))for(let pe of["authorization","www-authenticate","cookie","cookie2"])x.headers.delete(pe);if(m.statusCode!==303&&l.body&&n.body instanceof fe.default.Readable){i(new ue("Cannot follow redirect with body being a readable stream","unsupported-redirect")),S();return}(m.statusCode===303||(m.statusCode===301||m.statusCode===302)&&l.method==="POST")&&(x.method="GET",x.body=void 0,x.headers.delete("content-length"));let De=gl(b);De&&(x.referrerPolicy=De),a(ka(new At(L,x))),S();return}default:return i(new TypeError(`Redirect option '${l.redirect}' is not a valid value of RequestRedirect`))}}y&&m.once("end",()=>{y.removeEventListener("abort",I)});let C=(0,fe.pipeline)(m,new fe.PassThrough,q=>{q&&i(q)});process.version<"v12.10"&&m.on("aborted",I);let v={url:l.url,status:m.statusCode,statusText:m.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||m.statusCode===204||m.statusCode===304){g=new K(C,v),a(g);return}let N={flush:tt.default.Z_SYNC_FLUSH,finishFlush:tt.default.Z_SYNC_FLUSH};if(U==="gzip"||U==="x-gzip"){C=(0,fe.pipeline)(C,tt.default.createGunzip(N),q=>{q&&i(q)}),g=new K(C,v),a(g);return}if(U==="deflate"||U==="x-deflate"){let q=(0,fe.pipeline)(m,new fe.PassThrough,L=>{L&&i(L)});q.once("data",L=>{(L[0]&15)===8?C=(0,fe.pipeline)(C,tt.default.createInflate(),x=>{x&&i(x)}):C=(0,fe.pipeline)(C,tt.default.createInflateRaw(),x=>{x&&i(x)}),g=new K(C,v),a(g)}),q.once("end",()=>{g||(g=new K(C,v),a(g))});return}if(U==="br"){C=(0,fe.pipeline)(C,tt.default.createBrotliDecompress(),q=>{q&&i(q)}),g=new K(C,v),a(g);return}g=new K(C,v),a(g)}),sl(D,l).catch(i)})}function vl(r,n){let a=br.Buffer.from(`0\r
|
|
13
13
|
\r
|
|
14
|
-
`),i=!1,l=!1,c;r.on("response",p=>{let{headers:d}=p;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),r.on("socket",p=>{let d=()=>{if(i&&!l){let g=new Error("Premature close");g.code="ERR_STREAM_PREMATURE_CLOSE",n(g)}},y=g=>{l=br.Buffer.compare(g.slice(-5),a)===0,!l&&c&&(l=br.Buffer.compare(c.slice(-3),a.slice(0,3))===0&&br.Buffer.compare(g.slice(-2),a.slice(3))===0),c=g};p.prependListener("close",d),p.on("data",y),r.on("close",()=>{p.removeListener("close",d),p.removeListener("data",y)})})}kt();Rr();});var Fa=Ke((Cu,Wa)=>{var Pl=require("node:tty"),kl=Pl?.WriteStream?.prototype?.hasColors?.()??!1,T=(r,n)=>{if(!kl)return l=>l;let a=`\x1B[${r}m`,i=`\x1B[${n}m`;return l=>{let c=l+"",p=c.indexOf(i);if(p===-1)return a+c+i;let d=a,y=0,O=(n===22?i:"")+a;for(;p!==-1;)d+=c.slice(y,p)+O,y=p+i.length,p=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);Wa.exports=R});var kn=Ke((ku,La)=>{"use strict";var Ia=require("fs"),Pn;function Ol(){try{return Ia.statSync("/.dockerenv"),!0}catch{return!1}}function Dl(){try{return Ia.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}La.exports=()=>(Pn===void 0&&(Pn=Ol()||Dl()),Pn)});var za=Ke((Bu,Bn)=>{"use strict";var ql=require("os"),Wl=require("fs"),$a=kn(),xa=()=>{if(process.platform!=="linux")return!1;if(ql.release().toLowerCase().includes("microsoft"))return!$a();try{return Wl.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!$a():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Bn.exports=xa:Bn.exports=xa()});var Ma=Ke((Ou,ja)=>{"use strict";ja.exports=(r,n,a)=>{let i=l=>Object.defineProperty(r,n,{value:l,enumerable:!0,writable:!0});return Object.defineProperty(r,n,{configurable:!0,enumerable:!0,get(){let l=a();return i(l),l},set(l){i(l)}}),r}});var Qa=Ke((Du,Ga)=>{var Fl=require("path"),Il=require("child_process"),{promises:Cr,constants:Ya}=require("fs"),Er=za(),Ll=kn(),Dn=Ma(),Ua=Fl.join(__dirname,"xdg-open"),{platform:it,arch:Na}=process,$l=()=>{try{return Cr.statSync("/run/.containerenv"),!0}catch{return!1}},On;function xl(){return On===void 0&&(On=$l()||Ll()),On}var zl=(()=>{let r="/mnt/",n;return async function(){if(n)return n;let a="/etc/wsl.conf",i=!1;try{await Cr.access(a,Ya.F_OK),i=!0}catch{}if(!i)return r;let l=await Cr.readFile(a,{encoding:"utf8"}),c=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(l);return c?(n=c.groups.mountPoint.trim(),n=n.endsWith("/")?n:`${n}/`,n):r}})(),Ha=async(r,n)=>{let a;for(let i of r)try{return await n(i)}catch(l){a=l}throw a},Ar=async r=>{if(r={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...r},Array.isArray(r.app))return Ha(r.app,d=>Ar({...r,app:d}));let{name:n,arguments:a=[]}=r.app||{};if(a=[...a],Array.isArray(n))return Ha(n,d=>Ar({...r,app:{name:d,arguments:a}}));let i,l=[],c={};if(it==="darwin")i="open",r.wait&&l.push("--wait-apps"),r.background&&l.push("--background"),r.newInstance&&l.push("--new"),n&&l.push("-a",n);else if(it==="win32"||Er&&!xl()&&!n){let d=await zl();i=Er?`${d}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,l.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Er||(c.windowsVerbatimArguments=!0);let y=["Start"];r.wait&&y.push("-Wait"),n?(y.push(`"\`"${n}\`""`,"-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(n)i=n;else{let d=!__dirname||__dirname==="/",y=!1;try{await Cr.access(Ua,Ya.X_OK),y=!0}catch{}i=process.versions.electron||it==="android"||d||!y?"xdg-open":Ua}a.length>0&&l.push(...a),r.wait||(c.stdio="ignore",c.detached=!0)}r.target&&l.push(r.target),it==="darwin"&&a.length>0&&l.push("--args",...a);let p=Il.spawn(i,l,c);return r.wait?new Promise((d,y)=>{p.once("error",y),p.once("close",g=>{if(!r.allowNonzeroExitCode&&g>0){y(new Error(`Exited with code ${g}`));return}d(p)})}):(p.unref(),p)},qn=(r,n)=>{if(typeof r!="string")throw new TypeError("Expected a `target`");return Ar({...n,target:r})},jl=(r,n)=>{if(typeof r!="string")throw new TypeError("Expected a `name`");let{arguments:a=[]}=n||{};if(a!=null&&!Array.isArray(a))throw new TypeError("Expected `appArguments` as Array type");return Ar({...n,app:{name:r,arguments:a}})};function Va(r){if(typeof r=="string"||Array.isArray(r))return r;let{[Na]:n}=r;if(!n)throw new Error(`${Na} is not supported`);return n}function Wn({[it]:r},{wsl:n}){if(n&&Er)return Va(n);if(!r)throw new Error(`${it} is not supported`);return Va(r)}var Pr={};Dn(Pr,"chrome",()=>Wn({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"]}}));Dn(Pr,"firefox",()=>Wn({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Dn(Pr,"edge",()=>Wn({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));qn.apps=Pr;qn.openApp=jl;Ga.exports=qn});var Kl={};Fs(Kl,{authorize:()=>Nl,checkAuthorization:()=>Ul,createVersion:()=>Xl,getCheckoutKey:()=>Jl,getOrganisation:()=>Gl,getOrganisations:()=>Yl,getProfile:()=>ni,getUser:()=>Vl,uploadFile:()=>oi,uploadMetadata:()=>Ql});module.exports=Is(Kl);var ei=J(require("http")),ti=J(require("url")),kr=J(require("querystring")),Wt=J(require("crypto")),ri=J(require("path")),qt=J(require("fs")),In=J(Tn()),xe=require("@oclif/core");var Dt=J(require("node:fs")),Cn=J(require("node:path")),Da=J(require("node:os"));var Z={debug:"debug",internal:"internal",release:"release",x:"x",xDevelopment:"x-development",xInternal:"x-internal"},hu=Object.values(Z);function Oa(r){return r===Z.release?"":r}var pu=[[Z.release,Z.x],[Z.internal,Z.xInternal],[Z.debug,Z.xDevelopment]];var Ot={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"],Rl="e69bae0ec90f5e838555",j={},Tl;function $(r){switch(r){case"raycastApiURL":return process.env.RAY_APIURL||j.APIURL||Ot.url;case"raycastAccessToken":return process.env.RAY_TOKEN||j.Token||j.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||j.ClientID||Ot.clientID;case"githubClientId":return process.env.RAY_GithubClientID||j.GithubClientID||Rl;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||j.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target?process.env.RAY_Target:typeof j.Target<"u"?j.Target:En(process.platform==="win32"?Z.x:Z.release)}}function qa(r,n){switch(r){case"raycastApiURL":n===void 0?delete j.APIURL:j.APIURL=n;break;case"raycastAccessToken":n===void 0?delete j.Token:j.Token=n,delete j.AccessToken;break;case"raycastClientId":n===void 0?delete j.ClientID:j.ClientID=n;break;case"githubAccessToken":n===void 0?delete j.GithubAccessToken:j.GithubAccessToken=n;break;case"flavorName":n===void 0?delete j.Target:j.Target=n;break}let a=Al();Dt.writeFileSync(Cn.join(a,"config.json"),JSON.stringify(j,null," "),"utf8")}function En(r){return typeof r<"u"?Oa(r):$("flavorName")}function El(r){return r==""?"raycast":`raycast-${r}`}function Cl(r){let n=Cn.join(Da.default.homedir(),".config",El(r));return Dt.mkdirSync(n,{recursive:!0}),n}function Al(){return Cl(En(Tl))}var V=J(Fa());var Au=(0,V.blue)((0,V.dim)("internal only"));function An(r,n,a){console.log(Bl[r]+n),typeof a?.exit<"u"&&process.exit(a.exit)}var Bl={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 Xa=require("@oclif/core"),Ja=J(Tn()),Ka=J(Qa());async function Oe(r,n){let a;try{a=await(0,Ja.default)(r,{method:n.method||"GET",headers:{"Content-Type":"application/json",Accept:"application/json",...n.token?{Authorization:`Bearer ${n.token}`}:void 0},body:n.body})}catch(i){throw new Error(`HTTP request: ${i.message}`)}if(!a.ok){switch(a.status){case 401:throw new he(a,"not authorized - please log in first using `npx ray login`");case 403:throw new he(a,"forbidden - you don't have permissions to perform the request");case 402:throw new he(a,"the limit of free commands has been reached")}let i=await a.text(),l;try{l=JSON.parse(i)}catch{throw new he(a,`HTTP error: ${a.status} - ${i}`)}throw Array.isArray(l.errors)&&l.errors.length>0?new he(a,`error: ${l.errors[0].status} - ${l.errors[0].title}`):new he(a,`HTTP error: ${a.status} - ${i}`)}return await a.json()}var he=class extends Error{constructor(n,a){let i=n.headers.get("X-Request-Id");i?super(`${a} (${n.url} RequestID: ${i})`):super(a),this.name="HTTPError"}};function Za(r){(0,Ka.default)(r).catch(n=>{Xa.ux.error(new Error(`failed opening browser to URL ${r}: ${n.message}`),{exit:1})})}var Ml=`${Ot.url}/sessions/success`,Fn=`${Ot.url}/sessions/failure`;function Ul(){$("raycastAccessToken")===""&&xe.ux.error("please first log in first using `npx ray login`",{exit:1})}async function Nl(){let r=$("raycastClientId"),n=$("raycastApiURL"),a=Wt.randomBytes(32).toString("hex"),l=Wt.createHash("sha256").update(a).digest("base64url").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=ei.createServer(),y=`http://127.0.0.1:${(await new Promise((I,D)=>{let S=c.listen(0,"127.0.0.1",()=>I(S));S.on("error",D)})).address().port}`,g=`${n}/oauth/authorize?response_type=code&client_id=${r}&code_challenge=${l}&code_challenge_method=S256&redirect_uri=${y}`;function O(I){I.close()}c.on("request",async(I,D)=>{try{let m=kr.parse(ti.parse(I.url).query).code;m||(D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed authorizing app"),{exit:1}));let b=await Hl(a,m,y);b||(D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed getting access token"),{exit:1}));try{qa("raycastAccessToken",b)}catch(v){console.log(v),D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed saving access token"),{exit:1})}D.writeHead(302,{Location:Ml}),D.end();let C=await ni();C||xe.ux.error(new Error("failed fetching profile"),{exit:1}),An("success",`logged in as '${C.username}'`),O(c)}catch(S){O(c),xe.ux.error(S,{exit:1})}}),An("info","continue login in your browser"),Za(g),await new Promise(I=>c.on("close",I))}async function Hl(r,n,a){let i=$("raycastClientId"),c=`${$("raycastApiURL")}/oauth/token`,p=kr.stringify({grant_type:"authorization_code",client_id:i,code_verifier:r,code:n,redirect_uri:a});try{let d=await(0,In.default)(c,{method:"POST",body:p,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 ni(){let r=$("raycastApiURL"),n=$("raycastAccessToken");return Oe(`${r}/api/v1/me`,{token:n})}function Vl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/users/${r}`,{token:a})}function Yl(){let r=$("raycastApiURL"),n=$("raycastAccessToken");return Oe(`${r}/api/v1/me/organizations`,{token:n})}function Gl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/organizations/${r}`,{token:a})}function Ql(r){return Promise.all(r.map(async n=>{try{return await oi(n,"image/png")}catch(a){throw new Error(`upload: ${a.message}`)}}))}async function oi(r,n){let a=$("raycastApiURL"),i=$("raycastAccessToken"),l=qt.statSync(r),c=await Oe(`${a}/api/v1/direct_uploads`,{token:i,method:"POST",body:JSON.stringify({blob:{content_type:n,filename:ri.basename(r),byte_size:l.size,checksum:Wt.createHash("md5").update(qt.readFileSync(r)).digest("base64")}})}),p=qt.readFileSync(r),d=await(0,In.default)(c.direct_upload.url,{method:"PUT",body:p,headers:c.direct_upload.headers});if(!d.ok)throw new he(d,d.statusText);return c.signed_id}function Xl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/versions`,{token:a,method:"POST",body:JSON.stringify(r)})}function Jl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/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",p=>{let{headers:d}=p;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),r.on("socket",p=>{let d=()=>{if(i&&!l){let g=new Error("Premature close");g.code="ERR_STREAM_PREMATURE_CLOSE",n(g)}},y=g=>{l=br.Buffer.compare(g.slice(-5),a)===0,!l&&c&&(l=br.Buffer.compare(c.slice(-3),a.slice(0,3))===0&&br.Buffer.compare(g.slice(-2),a.slice(3))===0),c=g};p.prependListener("close",d),p.on("data",y),r.on("close",()=>{p.removeListener("close",d),p.removeListener("data",y)})})}kt();Rr();});var Fa=Ke((Cu,Wa)=>{var Pl=require("node:tty"),kl=Pl?.WriteStream?.prototype?.hasColors?.()??!1,T=(r,n)=>{if(!kl)return l=>l;let a=`\x1B[${r}m`,i=`\x1B[${n}m`;return l=>{let c=l+"",p=c.indexOf(i);if(p===-1)return a+c+i;let d=a,y=0,O=(n===22?i:"")+a;for(;p!==-1;)d+=c.slice(y,p)+O,y=p+i.length,p=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);Wa.exports=R});var kn=Ke((ku,La)=>{"use strict";var Ia=require("fs"),Pn;function Ol(){try{return Ia.statSync("/.dockerenv"),!0}catch{return!1}}function Dl(){try{return Ia.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}La.exports=()=>(Pn===void 0&&(Pn=Ol()||Dl()),Pn)});var za=Ke((Bu,Bn)=>{"use strict";var ql=require("os"),Wl=require("fs"),$a=kn(),xa=()=>{if(process.platform!=="linux")return!1;if(ql.release().toLowerCase().includes("microsoft"))return!$a();try{return Wl.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!$a():!1}catch{return!1}};process.env.__IS_WSL_TEST__?Bn.exports=xa:Bn.exports=xa()});var Ma=Ke((Ou,ja)=>{"use strict";ja.exports=(r,n,a)=>{let i=l=>Object.defineProperty(r,n,{value:l,enumerable:!0,writable:!0});return Object.defineProperty(r,n,{configurable:!0,enumerable:!0,get(){let l=a();return i(l),l},set(l){i(l)}}),r}});var Qa=Ke((Du,Ga)=>{var Fl=require("path"),Il=require("child_process"),{promises:Cr,constants:Ya}=require("fs"),Er=za(),Ll=kn(),Dn=Ma(),Ua=Fl.join(__dirname,"xdg-open"),{platform:it,arch:Na}=process,$l=()=>{try{return Cr.statSync("/run/.containerenv"),!0}catch{return!1}},On;function xl(){return On===void 0&&(On=$l()||Ll()),On}var zl=(()=>{let r="/mnt/",n;return async function(){if(n)return n;let a="/etc/wsl.conf",i=!1;try{await Cr.access(a,Ya.F_OK),i=!0}catch{}if(!i)return r;let l=await Cr.readFile(a,{encoding:"utf8"}),c=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(l);return c?(n=c.groups.mountPoint.trim(),n=n.endsWith("/")?n:`${n}/`,n):r}})(),Ha=async(r,n)=>{let a;for(let i of r)try{return await n(i)}catch(l){a=l}throw a},Ar=async r=>{if(r={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...r},Array.isArray(r.app))return Ha(r.app,d=>Ar({...r,app:d}));let{name:n,arguments:a=[]}=r.app||{};if(a=[...a],Array.isArray(n))return Ha(n,d=>Ar({...r,app:{name:d,arguments:a}}));let i,l=[],c={};if(it==="darwin")i="open",r.wait&&l.push("--wait-apps"),r.background&&l.push("--background"),r.newInstance&&l.push("--new"),n&&l.push("-a",n);else if(it==="win32"||Er&&!xl()&&!n){let d=await zl();i=Er?`${d}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,l.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),Er||(c.windowsVerbatimArguments=!0);let y=["Start"];r.wait&&y.push("-Wait"),n?(y.push(`"\`"${n}\`""`,"-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(n)i=n;else{let d=!__dirname||__dirname==="/",y=!1;try{await Cr.access(Ua,Ya.X_OK),y=!0}catch{}i=process.versions.electron||it==="android"||d||!y?"xdg-open":Ua}a.length>0&&l.push(...a),r.wait||(c.stdio="ignore",c.detached=!0)}r.target&&l.push(r.target),it==="darwin"&&a.length>0&&l.push("--args",...a);let p=Il.spawn(i,l,c);return r.wait?new Promise((d,y)=>{p.once("error",y),p.once("close",g=>{if(!r.allowNonzeroExitCode&&g>0){y(new Error(`Exited with code ${g}`));return}d(p)})}):(p.unref(),p)},qn=(r,n)=>{if(typeof r!="string")throw new TypeError("Expected a `target`");return Ar({...n,target:r})},jl=(r,n)=>{if(typeof r!="string")throw new TypeError("Expected a `name`");let{arguments:a=[]}=n||{};if(a!=null&&!Array.isArray(a))throw new TypeError("Expected `appArguments` as Array type");return Ar({...n,app:{name:r,arguments:a}})};function Va(r){if(typeof r=="string"||Array.isArray(r))return r;let{[Na]:n}=r;if(!n)throw new Error(`${Na} is not supported`);return n}function Wn({[it]:r},{wsl:n}){if(n&&Er)return Va(n);if(!r)throw new Error(`${it} is not supported`);return Va(r)}var Pr={};Dn(Pr,"chrome",()=>Wn({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"]}}));Dn(Pr,"firefox",()=>Wn({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Dn(Pr,"edge",()=>Wn({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));qn.apps=Pr;qn.openApp=jl;Ga.exports=qn});var Kl={};Fs(Kl,{authorize:()=>Nl,checkAuthorization:()=>Ul,createVersion:()=>Xl,getCheckoutKey:()=>Jl,getOrganisation:()=>Gl,getOrganisations:()=>Yl,getProfile:()=>ni,getUser:()=>Vl,uploadFile:()=>oi,uploadMetadata:()=>Ql});module.exports=Is(Kl);var ei=J(require("http")),ti=J(require("url")),kr=J(require("querystring")),Wt=J(require("crypto")),ri=J(require("path")),qt=J(require("fs")),In=J(Tn()),xe=require("@oclif/core");var Dt=J(require("node:fs")),Cn=J(require("node:path")),Da=J(require("node:os"));var Z={debug:"debug",internal:"internal",release:"release",x:"x",xDevelopment:"x-development",xInternal:"x-internal"},hu=Object.values(Z);function Oa(r){return r===Z.release?"":r}var pu=[[Z.release,Z.x],[Z.internal,Z.xInternal],[Z.debug,Z.xDevelopment]];var Ot={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"],Rl="e69bae0ec90f5e838555",j={},Tl;function $(r){switch(r){case"raycastApiURL":return process.env.RAY_APIURL||j.APIURL||Ot.url;case"raycastAccessToken":return process.env.RAY_TOKEN||j.Token||j.AccessToken||"";case"raycastClientId":return process.env.RAY_CLIENT_ID||j.ClientID||Ot.clientID;case"githubClientId":return process.env.RAY_GithubClientID||j.GithubClientID||Rl;case"githubAccessToken":return process.env.GITHUB_ACCESS_TOKEN||j.GithubAccessToken||"";case"flavorName":return process.env.RAY_Target?process.env.RAY_Target:typeof j.Target<"u"?j.Target:En(process.platform==="win32"?Z.x:Z.release)}}function qa(r,n){switch(r){case"raycastApiURL":n===void 0?delete j.APIURL:j.APIURL=n;break;case"raycastAccessToken":n===void 0?delete j.Token:j.Token=n,delete j.AccessToken;break;case"raycastClientId":n===void 0?delete j.ClientID:j.ClientID=n;break;case"githubAccessToken":n===void 0?delete j.GithubAccessToken:j.GithubAccessToken=n;break;case"flavorName":n===void 0?delete j.Target:j.Target=n;break}let a=Al();Dt.writeFileSync(Cn.join(a,"config.json"),JSON.stringify(j,null," "),"utf8")}function En(r){return typeof r<"u"?Oa(r):$("flavorName")}function El(r){return r==""?"raycast":`raycast-${r}`}function Cl(r){let n=Cn.join(Da.default.homedir(),".config",El(r));return Dt.mkdirSync(n,{recursive:!0}),n}function Al(){return Cl(En(Tl))}var V=J(Fa());var Au=(0,V.blue)((0,V.dim)("internal only"));function An(r,n,a){console.log(Bl[r]+n),typeof a?.exit<"u"&&process.exit(a.exit)}var Bl={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 Xa=require("@oclif/core"),Ja=J(Tn()),Ka=J(Qa());async function Oe(r,n){let a;try{a=await(0,Ja.default)(r,{method:n.method||"GET",headers:{"Content-Type":"application/json",Accept:"application/json",...n.token?{Authorization:`Bearer ${n.token}`}:void 0},body:n.body})}catch(i){throw new Error(`HTTP request: ${i.message}`)}if(!a.ok){switch(a.status){case 401:throw new he(a,"not authorized - please log in first using `npx ray login`");case 403:throw new he(a,"forbidden - you don't have permissions to perform the request");case 402:throw new he(a,"the limit of free commands has been reached")}let i=await a.text(),l;try{l=JSON.parse(i)}catch{throw new he(a,`HTTP error: ${a.status} - ${i}`)}throw Array.isArray(l.errors)&&l.errors.length>0?new he(a,`error: ${l.errors[0].status} - ${l.errors[0].title}`):new he(a,`HTTP error: ${a.status} - ${i}`)}return await a.json()}var he=class extends Error{constructor(n,a){let i=n.headers.get("X-Request-Id");i?super(`${a} (${n.url} RequestID: ${i})`):super(a),this.name="HTTPError"}};function Za(r){(0,Ka.default)(r).catch(n=>{Xa.ux.error(new Error(`failed opening browser to URL ${r}: ${n.message}`),{exit:1})})}var Ml=`${Ot.url}/sessions/success`,Fn=`${Ot.url}/sessions/failure`;function Ul(){$("raycastAccessToken")===""&&xe.ux.error("please first log in first using `npx ray login`",{exit:1})}async function Nl(){let r=$("raycastClientId"),n=$("raycastApiURL"),a=Wt.randomBytes(32).toString("hex"),l=Wt.createHash("sha256").update(a).digest("base64url").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),c=ei.createServer(),y=`http://127.0.0.1:${(await new Promise((I,D)=>{let S=c.listen(0,"127.0.0.1",()=>I(S));S.on("error",D)})).address().port}`,g=`${n}/oauth/authorize?response_type=code&client_id=${r}&code_challenge=${l}&code_challenge_method=S256&redirect_uri=${y}`;function O(I){I.close()}c.on("request",async(I,D)=>{try{let m=kr.parse(ti.parse(I.url).query).code;m||(D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed authorizing app"),{exit:1}));let b=await Hl(a,m,y);b||(D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed getting access token"),{exit:1}));try{qa("raycastAccessToken",b)}catch(v){console.log(v),D.writeHead(302,{Location:Fn}),D.end(),O(c),xe.ux.error(new Error("failed saving access token"),{exit:1})}D.writeHead(302,{Location:Ml}),D.end();let C=await ni();C||xe.ux.error(new Error("failed fetching profile"),{exit:1}),An("success",`logged in as '${C.username}'`),O(c)}catch(S){O(c),xe.ux.error(S,{exit:1})}}),An("info","continue login in your browser"),Za(g),await new Promise(I=>c.on("close",I))}async function Hl(r,n,a){let i=$("raycastClientId"),c=`${$("raycastApiURL")}/oauth/token`,p=kr.stringify({grant_type:"authorization_code",client_id:i,code_verifier:r,code:n,redirect_uri:a});try{let d=await(0,In.default)(c,{method:"POST",body:p,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 ni(){let r=$("raycastApiURL"),n=$("raycastAccessToken");return Oe(`${r}/api/v1/me`,{token:n})}function Vl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/users/${r}`,{token:a})}function Yl(){let r=$("raycastApiURL"),n=$("raycastAccessToken");return Oe(`${r}/api/v1/me/organizations`,{token:n})}function Gl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/organizations/${r}`,{token:a})}function Ql(r){return Promise.all(r.map(async n=>{try{return await oi(n,"image/png")}catch(a){throw new Error(`upload: ${a.message}`)}}))}async function oi(r,n){let a=$("raycastApiURL"),i=$("raycastAccessToken"),l=qt.statSync(r),c=await Oe(`${a}/api/v1/direct_uploads`,{token:i,method:"POST",body:JSON.stringify({blob:{content_type:n,filename:ri.basename(r),byte_size:l.size,checksum:Wt.createHash("md5").update(qt.readFileSync(r)).digest("base64")}})}),p=qt.readFileSync(r),d=await(0,In.default)(c.direct_upload.url,{method:"PUT",body:p,headers:c.direct_upload.headers});if(!d.ok)throw new he(d,d.statusText);return c.signed_id}function Xl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/api/v1/versions`,{token:a,method:"POST",body:JSON.stringify(r)})}function Jl(r){let n=$("raycastApiURL"),a=$("raycastAccessToken");return Oe(`${n}/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:
|