Dot_Files/.config/raycast/extensions/6d35b3a5-ae12-48b1-b5de-616a22387eae/projects_list.js

24 lines
144 KiB
JavaScript
Raw Normal View History

var Ns=Object.create;var yt=Object.defineProperty;var Ds=Object.getOwnPropertyDescriptor;var Ms=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,js=Object.prototype.hasOwnProperty;var hn=e=>yt(e,"__esModule",{value:!0});var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bs=(e,t)=>{for(var r in t)yt(e,r,{get:t[r],enumerable:!0})},pn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ms(t))!js.call(e,i)&&(r||i!=="default")&&yt(e,i,{get:()=>t[i],enumerable:!(n=Ds(t,i))||n.enumerable});return e},mn=(e,t)=>pn(hn(yt(e!=null?Ns(Fs(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Us=(e=>(t,r)=>e&&e.get(t)||(r=pn(hn({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var or=v((xl,ir)=>{var gn=[],Gs=gn.forEach,Ws=gn.slice;ir.exports.extend=function(e){return Gs.call(Ws.call(arguments,1),function(t){if(t)for(var r in t)e[r]=t[r]}),e};ir.exports.parseJSON=function(e){try{return JSON.parse(e)}catch{return null}}});var wn=v((bn,wt)=>{var Hs=require("https"),Vs=require("http"),sr=require("url"),vn=or(),Il=wt.exports.maxRedirects=5,yn={https:Hs,http:Vs};for(bt in yn)ie=function(){},ie.prototype=yn[bt],ie=new ie,ie.request=function(e){return function(t,r,n){n=n||{};var i=typeof t=="object"&&"maxRedirects"in t?t.maxRedirects:bn.maxRedirects,o=vn.extend({count:0,max:i,clientRequest:null,userCallback:r},n);if(o.count>o.max){var s=new Error("Max redirects exceeded. To allow more redirects, pass options.maxRedirects property.");return o.clientRequest.emit("error",s),o.clientRequest}o.count++;var a;typeof t=="string"?a=t:a=sr.format(vn.extend({protocol:bt},t));var u=Object.getPrototypeOf(e).request(t,c(a,o));o.clientRequest||(o.clientRequest=u);function c(f,l){return function(d){if(d.statusCode<300||d.statusCode>399||!("location"in d.headers))return l.userCallback(d);var h=sr.resolve(f,d.headers.location),w=sr.parse(h).protocol;return w=w.substr(0,w.length-1),wt.exports[w].get(h,c(f,l),l)}}return u}}(ie),ie.get=function(e){return function(t,r,n){var i=e.request(t,r,n);return i.end(),i}}(ie),wt.exports[bt]=ie;var ie,bt});var ar=v((Ll,Sn)=>{Sn.exports=require("stream")});var Tn=v((ql,En)=>{"use strict";function _n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function zs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_n(Object(r),!0).forEach(function(n){$s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_n(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ks(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ys(e,t,r){return t&&Cn(e.prototype,t),r&&Cn(e,r),e}var Js=require("buffer"),St=Js.Buffer,Zs=require("util"),ur=Zs.inspect,Xs=ur&&ur.custom||"inspect";function Qs(e,t,r){St.prototype.copy.call(e,t,r)}En.exports=function(){function e(){Ks(this,e),this.head=null,this.tail=null,this.length=0}return Ys(e,[{key:"push",value:function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}}
`).join(`
`+o),e.push(i+"m+"+jt.exports.humanize(this.diff)+"")}else e[0]=hf()+t+" "+e[0]}function hf(){return I.inspectOpts.hideDate?"":new Date().toISOString()+" "}function pf(...e){return process.stderr.write(Ft.format(...e)+`
`)}function mf(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function gf(){return process.env.DEBUG}function vf(e){e.inspectOpts={};let t=Object.keys(I.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=I.inspectOpts[t[r]]}jt.exports=Mr()(I);var{formatters:qi}=jt.exports;qi.o=function(e){return this.inspectOpts.colors=this.useColors,Ft.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};qi.O=function(e){return this.inspectOpts.colors=this.useColors,Ft.inspect(e,this.inspectOpts)}});var Di=v((nc,jr)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?jr.exports=Oi():jr.exports=Ni()});var Fi=v((ic,Mi)=>{var yf=require("fs");Mi.exports=function(e,t,r){t=typeof t!="undefined"?t:`
`,r=typeof r!="undefined"?r:"utf8";var n=[],i=yf.readFileSync(e,r);if(i.indexOf("-END CERTIFICATE-")<0||i.indexOf("-BEGIN CERTIFICATE-")<0)throw Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");i=i.split(t);var o=[],s,a;for(s=0,a=i.length;s<a;s++){var u=i[s];u.length!==0&&(o.push(u),u.match(/-END CERTIFICATE-/)&&(n.push(o.join(t)),o=[]))}return n}});var Ui=v((oc,Bi)=>{var bf=require("querystring"),wf=wn(),Br=require("fs"),Bt=require("path"),Fe=require("url"),Sf=Ti(),Ut=Di()("modem"),ji=or(),_f=require("util"),Fe=require("url"),Cf=Fi(),Ef=require("os").type()==="Windows_NT",Tf=function(){var e,t={};if(!process.env.DOCKER_HOST)t.socketPath=Ef?"//./pipe/docker_engine":"/var/run/docker.sock";else if(process.env.DOCKER_HOST.indexOf("unix://")===0)t.socketPath=process.env.DOCKER_HOST.substring(7)||"/var/run/docker.sock";else if(process.env.DOCKER_HOST.indexOf("npipe://")===0)t.socketPath=process.env.DOCKER_HOST.substring(8)||"//./pipe/docker_engine";else{var r=process.env.DOCKER_HOST;r.indexOf("//")<0&&(r="tcp://"+r);try{e=new Fe.URL(r)}catch{throw new Error("DOCKER_HOST env variable should be something like tcp://localhost:1234")}t.port=e.port,process.env.DOCKER_TLS_VERIFY==="1"||t.port==="2376"?t.protocol="https":t.protocol="http",t.host=e.hostname,process.env.DOCKER_CERT_PATH&&(t.ca=Cf(Bt.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=Br.readFileSync(Bt.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=Br.readFileSync(Bt.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}return t},Pe=function(e){var t=Tf(),r=Object.assign({},t,e);this.host=r.host,this.host||(this.socketPath=r.socketPath),this.port=r.port,this.username=r.username,this.password=r.password,this.version=r.version,this.key=r.key,this.cert=r.cert,this.ca=r.ca,this.timeout=r.timeout,this.connectionTimeout=r.connectionTimeout,this.checkServerIdentity=r.checkServerIdentity,this.agent=r.agent,this.headers=r.headers||{},this.key&&this.cert&&this.ca&&(this.protocol="https"),this.protocol=r.protocol||this.protocol||"http"};Pe.prototype.dial=function(e,t){var r,n,i,o=this;if(e.options&&(r=e.options),r&&r.authconfig&&delete r.authconfig,r&&r.abortSignal&&delete r.abortSignal,this.version&&(e.path="/"+this.version+e.path),this.host){var s=Fe.parse(o.host);n=Fe.format({protocol:s.protocol||o.protocol,hostname:s.hostname||o.host,port:o.port}),n=Fe.resolve(n,e.path)}else n=e.path;e.path.indexOf("?")!==-1&&(r&&Object.keys(r).length>0?n+=this.buildQuerystring(r._query||r):n=n.substring(0,n.length-1));var a={path:n,method:e.method,headers:e.headers||Object.assign({},o.headers),key:o.key,cert:o.cert,ca:o.ca};if(this.checkServerIdentity&&(a.checkServerIdentity=this.checkServerIdentity),this.agent&&(a.agent=this.agent),e.authconfig&&(a.headers["X-Registry-Auth"]=e.authconfig.key||e.authconfig.base64||Buffer.from(JSON.stringify(e.authconfig)).toString("base64")),e.registryconfig&&(a.headers["X-Registry-Config"]=e.registryconfig.base64||Buffer.from(JSON.stringify(e.registryconfig)).toString("base64")),e.abortSignal&&(a.signal=e.abortSignal),e.file?(typeof e.file=="string"?i=Br.createReadStream(Bt.resolve(e.file)):i=e.file,a.headers["Content-Type"]="application/tar"):r&&e.method==="POST"&&(i=JSON.stringify(r._body||r),e.allowEmpty||i!=="{}"&&i!=='""'?a.headers["Content-Type"]="application/json":i=void 0),typeof i=="string"?a.headers["Content-Length"]=Buffer.byteLength(i):Buffer.isBuffer(i)===!0?a.headers["Content-Length"]=i.length:(a.method==="PUT"||e.hijack||e.openStdin)&&(a.headers["Transfer-Encoding"]="chunked"),e.hijack&&(a.headers.Connection="Upgrade",a.headers.Upgrade="tcp"),this.socketPath)a.socketPath=this.socketPath;else{var u=Fe.parse(n);a.hostname=u.hostname,a.port=u.port,a.path=u.path}this.buildRequest(a,e,i,t)};Pe.prototype.buildRequest=function(e,t,r,n){var i=this,o,s=wf[i.protocol].request(e,function(){});Ut("Sending: %s",_f.inspect(e,{showHidden:!0,depth:null})),i.connectionTimeout&&(o=setTimeout(function(){Ut("Connection Timeout of %s ms exceeded",
`))>=0;){if(d==0){n=n.slice(1);continue}l(n.slice(0,d)),n=n.slice(d+1)}}function l(d){if(d[d.length-1]=="\r"&&(d=d.substr(0,d.length-1)),d.length>0){var h=JSON.parse(d);i.push(h),r&&r(h)}}}function a(c){o=!0,e.removeListener("data",s),e.removeListener("error",a),e.removeListener("end",u),e.removeListener("close",u),t(c,i)}function u(){o||t(null,i),o=!0}};Pe.prototype.buildQuerystring=function(e){var t={};return Object.keys(e).map(function(r,n){e[r]&&typeof e[r]=="object"&&!Array.isArray(e[r])||r==="cachefrom"?t[r]=JSON.stringify(e[r]):t[r]=e[r]}),bf.stringify(t)};Bi.exports=Pe});var Ki=v((sc,$i)=>{"use strict";var z=require("fs"),Oe=require("path"),kf=z.lchown?"lchown":"chown",Rf=z.lchownSync?"lchownSync":"chownSync",Gi=z.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),Wi=(e,t,r)=>{try{return z[Rf](e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Pf=(e,t,r)=>{try{return z.chownSync(e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Of=Gi?(e,t,r,n)=>i=>{!i||i.code!=="EISDIR"?n(i):z.chown(e,t,r,n)}:(e,t,r,n)=>n,Ur=Gi?(e,t,r)=>{try{return Wi(e,t,r)}catch(n){if(n.code!=="EISDIR")throw n;Pf(e,t,r)}}:(e,t,r)=>Wi(e,t,r),Af=process.version,Hi=(e,t,r)=>z.readdir(e,t,r),xf=(e,t)=>z.readdirSync(e,t);/^v4\./.test(Af)&&(Hi=(e,t,r)=>z.readdir(e,r));var Gt=(e,t,r,n)=>{z[kf](e,t,r,Of(e,t,r,i=>{n(i&&i.code!=="ENOENT"?i:null)}))},Vi=(e,t,r,n,i)=>{if(typeof t=="string")return z.lstat(Oe.resolve(e,t),(o,s)=>{if(o)return i(o.code!=="ENOENT"?o:null);s.name=t,Vi(e,s,r,n,i)});if(t.isDirectory())Gr(Oe.resolve(e,t.name),r,n,o=>{if(o)return i(o);let s=Oe.resolve(e,t.name);Gt(s,r,n,i)});else{let o=Oe.resolve(e,t.name);Gt(o,r,n,i)}},Gr=(e,t,r,n)=>{Hi(e,{withFileTypes:!0},(i,o)=>{if(i){if(i.code==="ENOENT")return n();if(i.code!=="ENOTDIR"&&i.code!=="ENOTSUP")return n(i)}if(i||!o.length)return Gt(e,t,r,n);let s=o.length,a=null,u=c=>{if(!a){if(c)return n(a=c);if(--s===0)return Gt(e,t,r,n)}};o.forEach(c=>Vi(e,c,t,r,u))})},If=(e,t,r,n)=>{if(typeof t=="string")try{let i=z.lstatSync(Oe.resolve(e,t));i.name=t,t=i}catch(i){if(i.code==="ENOENT")return;throw i}t.isDirectory()&&zi(Oe.resolve(e,t.name),r,n),Ur(Oe.resolve(e,t.name),r,n)},zi=(e,t,r)=>{let n;try{n=xf(e,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;if(i.code==="ENOTDIR"||i.code==="ENOTSUP")return Ur(e,t,r);throw i}return n&&n.length&&n.forEach(i=>If(e,i,t,r)),Ur(e,t,r)};$i.exports=Gr;Gr.sync=zi});var Zi=v((ac,Ji)=>{"use strict";var{Buffer:J}=require("buffer"),Yi=Symbol.for("BufferList");function P(e){if(!(this instanceof P))return new P(e);P._init.call(this,e)}P._init=function(t){Object.defineProperty(this,Yi,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)};P.prototype._new=function(t){return new P(t)};P.prototype._offset=function(t){if(t===0)return[0,0];let r=0;for(let n=0;n<this._bufs.length;n++){let i=r+this._bufs[n].length;if(t<i||n===this._bufs.length-1)return[n,t-r];r=i}};P.prototype._reverseOffset=function(e){let t=e[0],r=e[1];for(let n=0;n<t;n++)r+=this._bufs[n].length;return r};P.prototype.get=function(t){if(t>this.length||t<0)return;let r=this._offset(t);return this._bufs[r[0]][r[1]]};P.prototype.slice=function(t,r){return typeof t=="number"&&t<0&&(t+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,t,r)};P.prototype.copy=function(t,r,n,i){if((typeof n!="number"||n<0)&&(n=0),(typeof i!="number"||i>this.length)&&(i=this.length),n>=this.length||i<=0)return t||J.alloc(0);let o=!!t,s=this._offset(n),a=i-n,u=a,c=o&&r||0,f=s[1];if(n===0&&i===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:J.concat(this._bufs,this.length);for(let l=0;l<this._bufs.length;l++)this._bufs[l].copy(t,c),c+=this._bufs[l].length;return t}if(u<=this._bufs[s[0]].length-f)return o?this._bufs[s[0]].copy(t,r,f,f+u):this._bufs[s[0]].slice(f,f+u);o||(t=J.allocUnsafe(a));for(let l=s[0];l<this._bufs.length;l++){let d=this._bufs[l].length-f;if(u>d)this._bufs[l].copy(t,c,f),c+=d;else{this._bufs[l].copy(t,c,f,f+u),c+=d;break}u-=d,f&&(f=0)}return t.length>c?t.slice(0,c):t};P.prototype.shallowSlice=function(t,r){if(t=t||0,r=typeof r!="number"?this.
`)),e.linkname&&(t+=Vr(" linkpath="+e.linkname+`
`));var r=e.pax;if(r)for(var n in r)t+=Vr(" "+n+"="+r[n]+`
`);return Buffer.from(t)};Be.decodePax=function(e){for(var t={};e.length;){for(var r=0;r<e.length&&e[r]!==32;)r++;var n=parseInt(e.slice(0,r).toString(),10);if(!n)return t;var i=e.slice(r+1,n-1).toString(),o=i.indexOf("=");if(o===-1)return t;t[i.slice(0,o)]=i.slice(o+1),e=e.slice(n)}return t};Be.encode=function(e){var t=qf(512),r=e.name,n="";if(e.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var i=r.indexOf("/");if(i===-1)return null;n+=n?"/"+r.slice(0,i):r.slice(0,i),r=r.slice(i+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(n)>155||e.linkname&&Buffer.byteLength(e.linkname)>100?null:(t.write(r),t.write(ge(e.mode&Bf,6),100),t.write(ge(e.uid,6),108),t.write(ge(e.gid,6),116),t.write(ge(e.size,11),124),t.write(ge(e.mtime.getTime()/1e3|0,11),136),t[156]=Qi+Wf(e.type),e.linkname&&t.write(e.linkname,157),eo.copy(t,ot),Mf.copy(t,Hr),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(ge(e.devmajor||0,6),329),t.write(ge(e.devminor||0,6),337),n&&t.write(n,345),t.write(ge(ro(t),6),148),t)};Be.decode=function(e,t,r){var n=e[156]===0?0:e[156]-Qi,i=je(e,0,100,t),o=ve(e,100,8),s=ve(e,108,8),a=ve(e,116,8),u=ve(e,124,12),c=ve(e,136,12),f=Gf(n),l=e[157]===0?null:je(e,157,100,t),d=je(e,265,32),h=je(e,297,32),w=ve(e,329,8),S=ve(e,337,8),y=ro(e);if(y===8*32)return null;if(y!==ve(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(eo.compare(e,ot,ot+6)===0)e[345]&&(i=je(e,345,155,t)+"/"+i);else if(!(Ff.compare(e,ot,ot+6)===0&&jf.compare(e,Hr,Hr+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return n===0&&i&&i[i.length-1]==="/"&&(n=5),{name:i,mode:o,uid:s,gid:a,size:u,mtime:new Date(1e3*c),type:f,linkname:l,uname:d,gname:h,devmajor:w,devminor:S}}});var fo=v((lc,uo)=>{var no=require("util"),Vf=Xi(),st=zr(),io=ke().Writable,oo=ke().PassThrough,so=function(){},ao=function(e){return e&=511,e&&512-e},zf=function(e,t){var r=new Ht(e,t);return r.end(),r},$f=function(e,t){return t.path&&(e.name=t.path),t.linkpath&&(e.linkname=t.linkpath),t.size&&(e.size=parseInt(t.size,10)),e.pax=t,e},Ht=function(e,t){this._parent=e,this.offset=t,oo.call(this,{autoDestroy:!1})};no.inherits(Ht,oo);Ht.prototype.destroy=function(e){this._parent.destroy(e)};var ae=function(e){if(!(this instanceof ae))return new ae(e);io.call(this,e),e=e||{},this._offset=0,this._buffer=Vf(),this._missing=0,this._partial=!1,this._onparse=so,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var t=this,r=t._buffer,n=function(){t._continue()},i=function(d){if(t._locked=!1,d)return t.destroy(d);t._stream||n()},o=function(){t._stream=null;var d=ao(t._header.size);d?t._parse(d,s):t._parse(512,l),t._locked||n()},s=function(){t._buffer.consume(ao(t._header.size)),t._parse(512,l),n()},a=function(){var d=t._header.size;t._paxGlobal=st.decodePax(r.slice(0,d)),r.consume(d),o()},u=function(){var d=t._header.size;t._pax=st.decodePax(r.slice(0,d)),t._paxGlobal&&(t._pax=Object.assign({},t._paxGlobal,t._pax)),r.consume(d),o()},c=function(){var d=t._header.size;this._gnuLongPath=st.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},f=function(){var d=t._header.size;this._gnuLongLinkPath=st.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},l=function(){var d=t._offset,h;try{h=t._header=st.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(w){t.emit("error",w)}if(r.consume(512),!h){t._parse(512,l),n();return}if(h.type==="gnu-long-path"){t._parse(h.size,c),n();return}if(h.type==="gnu-long-link-path"){t._parse(h.size,f),n();return}if(h.type==="pax-global-header"){t._parse(h.size,a),n();return}if(h.type==="pax-header"){t._parse(h.size,u),n();return}if(t._gnuLongPath&&(h.name=t._gnuLongPath,t._gnuLongPath=null),t._gnuLongLinkPath&&(h.linkname=t._gnuLongLinkPath,t._gnuLongLinkPath=null),t._pax&&(t._header=h=$f(h,t._pax),t._pax=null),t._locked=!0,!h.size||
`),Rs=e=>"```\n"+e+"\n```";var re=e=>e.State==="running",N=({Names:e,Name:t})=>e!==void 0?e.map(r=>r.replace(/^\//,"")).join(", "):t!==void 0?t.replace(/^\//,""):"-",Ps=e=>e!==void 0?`## ${N(e)}
`+ks([["Image",e.Config.Image],["Status",e.State.Status],["Command","`"+e.Config.Cmd?.join(" ")+"`"]])+Tl(e.Config.Env)+`
`:"",Tl=e=>e.length===0?"":[`
## Environment`,Rs(e.join(`
`))].join(`
`);var ln=e=>e.errno===-61&&e.code==="ECONNREFUSED",ne=(e,t)=>e.message.includes("container already stopped")?`Container ${N(t)} already stopped`:e.message.includes("container already started")?`Container ${N(t)} already started`:e.message.includes("cannot remove a running container")?["Cannot remove running container",`Please stop ${N(t)} first`]:e.message;var ze=require("@raycast/api"),G=({action:e,onSuccess:t,onFailure:r})=>async()=>{try{await e(),t!==void 0&&await(0,ze.showToast)(ze.ToastStyle.Success,...Os(t()))}catch(n){n instanceof Error&&r!==void 0&&await(0,ze.showToast)(ze.ToastStyle.Failure,...Os(r(n)))}},Os=e=>Array.isArray(e)?e:[e];function cn({docker:e,containerId:t}){let{isLoading:r,containerInfo:n,startContainer:i,restartContainer:o,stopContainer:s,removeContainer:a}=e.useContainerInfo(t),{pop:u}=(0,M.useNavigation)();return _jsx(M.Detail,{isLoading:r,markdown:Ps(n),actions:_jsx(M.ActionPanel,null,n?.State.Running===!0&&_jsx(M.ActionPanel.Item,{title:"Stop Container",shortcut:{modifiers:["cmd","shift"],key:"w"},onAction:G({action:()=>s(n),onSuccess:()=>`Container ${N(n)} stopped`,onFailure:c=>ne(c,n)})}),n?.State.Running===!0&&_jsx(M.ActionPanel.Item,{title:"Restart Container",icon:M.Icon.ArrowClockwise,shortcut:{modifiers:["opt"],key:"r"},onAction:G({action:()=>o(n),onSuccess:()=>`Container ${N(n)} restarted`,onFailure:c=>ne(c,n)})}),n?.State.Running===!1&&_jsx(M.ActionPanel.Item,{title:"Start Container",shortcut:{modifiers:["cmd","shift"],key:"r"},onAction:G({action:()=>i(n),onSuccess:()=>`Container ${N(n)} started`,onFailure:c=>ne(c,n)})}),n!==void 0&&_jsx(M.ActionPanel.Item,{title:"Remove Container",icon:{source:M.Icon.Trash,tintColor:M.Color.Red},shortcut:{modifiers:["cmd","shift"],key:"x"},onAction:G({action:async()=>{await a(n),u()},onSuccess:()=>`Container ${N(n)} removed`,onFailure:c=>ne(c,n)})}))})}var O=require("react");var tr=e=>e.reduce((t,r)=>{let n=r.Labels["com.docker.compose.project"],i=r.Labels["com.docker.compose.config_files"],o=r.Labels["com.docker.compose.working_dir"];if(n===void 0)return t;let s=t.find(({name:a})=>a===n);return s!==void 0?(s.containers=[...s.containers,r],t):[...t,{name:n,configFiles:i,workingDir:o,containers:[r]}]},[]);var gt=1e3,rr=e=>{let t=({Id:f})=>e.getContainer(f).stop(),r=({Id:f})=>e.getContainer(f).start(),n=({Id:f})=>e.getContainer(f).restart(),i=({Id:f})=>e.getContainer(f).remove();return{useImages:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b=await e.listImages();l(b)}catch(b){b instanceof Error&&S(b)}}return D(h,p)(),y.current=setInterval(p,gt),()=>y.current&&clearInterval(y.current)},[]),{images:f,error:w,isLoading:d,removeImage:D(h,({Id:p})=>e.getImage(p).remove())}},useImageInfo:({Id:f})=>{let[l,d]=(0,O.useState)(),[h,w]=(0,O.useState)(!1),S=(0,O.useRef)();return(0,O.useEffect)(()=>{async function y(){let p=await e.getImage(f).inspect();d(p)}return D(w,y)(),S.current=setInterval(y,gt),()=>S.current&&clearInterval(S.current)},[f]),{imageInfo:l,isLoading:h}},useContainers:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b=await e.listContainers({all:!0});l(b)}catch(b){b instanceof Error&&S(b)}}return D(h,p)(),y.current=setInterval(p,gt),()=>y.current&&clearInterval(y.current)},[]),{containers:f,isLoading:d,error:w,startContainer:D(h,r),stopContainer:D(h,t),restartContainer:D(h,n),removeContainer:D(h,i)}},useContainerInfo:f=>{let[l,d]=(0,O.useState)(),[h,w]=(0,O.useState)(!1),S=(0,O.useRef)();return(0,O.useEffect)(()=>{async function y(){let p=await e.getContainer(f).inspect();d(p)}return D(w,y)(),S.current=setInterval(y,gt),()=>S.current&&clearInterval(S.current)},[f]),{containerInfo:l,isLoading:h,startContainer:D(w,r),restartContainer:D(w,n),stopContainer:D(w,t),removeContainer:D(w,i)}},useProjects:()=>{let[f,l]=(0,O.useState)(),[d,h]=(0,O.useState)(!1),[w,S]=(0,O.useState)(),y=(0,O.useRef)();return(0,O.useEffect)(()=>{async function p(){try{let b
`):`## An Error Occurred:
${t}`};function dn(e){let t=(0,xs.useMemo)(()=>new As.default,[]),r=rr(t),{useContainers:n}=r,{containers:i,isLoading:o,error:s,startContainer:a,restartContainer:u,stopContainer:c,removeContainer:f}=n();return s?_jsx(vt,{error:s}):_jsx(x.List,{isLoading:o},Rl(i,e.projectFilter)?.map(l=>_jsx(x.List.Item,{key:l.Id,title:N(l),subtitle:l.Image,accessoryTitle:l.State,icon:re(l)?{source:"icon-container-running.png",tintColor:x.Color.Green}:{source:"icon-container.png",tintColor:x.Color.SecondaryText},actions:_jsx(x.ActionPanel,null,re(l)&&_jsx(x.ActionPanel.Item,{title:"Stop Container",shortcut:{modifiers:["cmd","shift"],key:"w"},icon:{source:"icon-stop.png",tintColor:x.Color.PrimaryText},onAction:G({action:()=>c(l),onSuccess:()=>`Container ${N(l)} stopped`,onFailure:d=>ne(d,l)})}),re(l)&&_jsx(x.ActionPanel.Item,{title:"Restart Container",icon:x.Icon.ArrowClockwise,shortcut:{modifiers:["opt"],key:"r"},onAction:G({action:()=>u(l),onSuccess:()=>`Container ${N(l)} restarted`,onFailure:d=>ne(d,l)})}),!re(l)&&_jsx(x.ActionPanel.Item,{title:"Start Container",shortcut:{modifiers:["cmd","shift"],key:"r"},icon:{source:"icon-start.png",tintColor:x.Color.PrimaryText},onAction:G({action:()=>a(l),onSuccess:()=>`Container ${N(l)} started`,onFailure:d=>ne(d,l)})}),_jsx(x.PushAction,{title:"Inspect",icon:{source:x.Icon.Binoculars},shortcut:{modifiers:["cmd"],key:"i"},target:_jsx(cn,{docker:r,containerId:l.Id})}),_jsx(x.ActionPanel.Item,{title:"Remove Container",icon:{source:x.Icon.Trash,tintColor:x.Color.Red},shortcut:{modifiers:["cmd","shift"],key:"x"},onAction:G({action:()=>f(l),onSuccess:()=>`Container ${N(l)} removed`,onFailure:d=>ne(d,l)})}))})))}var Rl=(e,t)=>t===void 0||e===void 0?e:e.filter(r=>r.Labels["com.docker.compose.project"]===t);function qs(){let e=(0,Ls.useMemo)(()=>new Is.default,[]),{useProjects:t}=rr(e),{projects:r,isLoading:n,error:i,startProject:o,stopProject:s}=t();return i?_jsx(vt,{error:i}):_jsx(F.List,{isLoading:n},r?.map(a=>_jsx(F.List.Item,{key:a.name,icon:{source:"icon-compose.png",tintColor:F.Color.SecondaryText},title:a.name,subtitle:Pl(a),actions:_jsx(F.ActionPanel,null,_jsx(F.PushAction,{title:"Show Containers",icon:{source:F.Icon.Binoculars},target:_jsx(dn,{projectFilter:a.name})}),_jsx(F.ActionPanel.Item,{title:"Start All Containers",shortcut:{modifiers:["cmd","shift"],key:"r"},icon:{source:"icon-startall.png",tintColor:F.Color.PrimaryText},onAction:G({action:()=>o(a),onSuccess:()=>`Started ${a.name}`,onFailure:({message:u})=>u})}),_jsx(F.ActionPanel.Item,{title:"Stop All Containers",shortcut:{modifiers:["cmd","shift"],key:"w"},icon:{source:"icon-stopall.png",tintColor:F.Color.PrimaryText},onAction:G({action:()=>s(a),onSuccess:()=>`Stopped ${a.name}`,onFailure:({message:u})=>u})}))})))}var Pl=({containers:e})=>{let t=e.reduce((n,i)=>n+=re(i)?1:0,0),r=e.length-t;return`${t} Running, ${r} Stopped`};module.exports=Us(Ol);0&&(module.exports={});
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */