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

24 lines
142 KiB
JavaScript
Raw Normal View History

var As=Object.create;var gt=Object.defineProperty;var xs=Object.getOwnPropertyDescriptor;var Is=Object.getOwnPropertyNames;var Ls=Object.getPrototypeOf,qs=Object.prototype.hasOwnProperty;var fn=e=>gt(e,"__esModule",{value:!0});var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ns=(e,t)=>{for(var r in t)gt(e,r,{get:t[r],enumerable:!0})},ln=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Is(t))!qs.call(e,i)&&(r||i!=="default")&&gt(e,i,{get:()=>t[i],enumerable:!(n=xs(t,i))||n.enumerable});return e},Ds=(e,t)=>ln(fn(gt(e!=null?As(Ls(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),Ms=(e=>(t,r)=>e&&e.get(t)||(r=ln(fn({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var rr=v((kl,tr)=>{var cn=[],Fs=cn.forEach,js=cn.slice;tr.exports.extend=function(e){return Fs.call(js.call(arguments,1),function(t){if(t)for(var r in t)e[r]=t[r]}),e};tr.exports.parseJSON=function(e){try{return JSON.parse(e)}catch{return null}}});var mn=v((pn,yt)=>{var Bs=require("https"),Us=require("http"),nr=require("url"),dn=rr(),Rl=yt.exports.maxRedirects=5,hn={https:Bs,http:Us};for(vt in hn)re=function(){},re.prototype=hn[vt],re=new re,re.request=function(e){return function(t,r,n){n=n||{};var i=typeof t=="object"&&"maxRedirects"in t?t.maxRedirects:pn.maxRedirects,o=dn.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=nr.format(dn.extend({protocol:vt},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=nr.resolve(f,d.headers.location),w=nr.parse(h).protocol;return w=w.substr(0,w.length-1),yt.exports[w].get(h,c(f,l),l)}}return u}}(re),re.get=function(e){return function(t,r,n){var i=e.request(t,r,n);return i.end(),i}}(re),yt.exports[vt]=re;var re,vt});var ir=v((Pl,gn)=>{gn.exports=require("stream")});var wn=v((Ol,bn)=>{"use strict";function vn(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 Gs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vn(Object(r),!0).forEach(function(n){Ws(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vn(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ws(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yn(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 Vs(e,t,r){return t&&yn(e.prototype,t),r&&yn(e,r),e}var zs=require("buffer"),bt=zs.Buffer,$s=require("util"),or=$s.inspect,Ks=or&&or.custom||"inspect";function Ys(e,t,r){bt.prototype.copy.call(e,t,r)}bn.exports=function(){function e(){Hs(this,e),this.head=null,this.tail=null,this.length=0}return Vs(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+"+Mt.exports.humanize(this.diff)+"")}else e[0]=ff()+t+" "+e[0]}function ff(){return I.inspectOpts.hideDate?"":new Date().toISOString()+" "}function lf(...e){return process.stderr.write(Dt.format(...e)+`
`)}function cf(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function df(){return process.env.DEBUG}function hf(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]]}Mt.exports=qr()(I);var{formatters:Oi}=Mt.exports;Oi.o=function(e){return this.inspectOpts.colors=this.useColors,Dt.inspect(e,this.inspectOpts).split(`
`).map(t=>t.trim()).join(" ")};Oi.O=function(e){return this.inspectOpts.colors=this.useColors,Dt.inspect(e,this.inspectOpts)}});var xi=v((Xl,Dr)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Dr.exports=Ci():Dr.exports=Ai()});var Li=v((Ql,Ii)=>{var pf=require("fs");Ii.exports=function(e,t,r){t=typeof t!="undefined"?t:`
`,r=typeof r!="undefined"?r:"utf8";var n=[],i=pf.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 Di=v((ec,Ni)=>{var mf=require("querystring"),gf=mn(),Mr=require("fs"),Ft=require("path"),Me=require("url"),vf=wi(),jt=xi()("modem"),qi=rr(),yf=require("util"),Me=require("url"),bf=Li(),wf=require("os").type()==="Windows_NT",Sf=function(){var e,t={};if(!process.env.DOCKER_HOST)t.socketPath=wf?"//./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 Me.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=bf(Ft.join(process.env.DOCKER_CERT_PATH,"ca.pem")),t.cert=Mr.readFileSync(Ft.join(process.env.DOCKER_CERT_PATH,"cert.pem")),t.key=Mr.readFileSync(Ft.join(process.env.DOCKER_CERT_PATH,"key.pem"))),process.env.DOCKER_CLIENT_TIMEOUT&&(t.timeout=parseInt(process.env.DOCKER_CLIENT_TIMEOUT,10))}return t},Re=function(e){var t=Sf(),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"};Re.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=Me.parse(o.host);n=Me.format({protocol:s.protocol||o.protocol,hostname:s.hostname||o.host,port:o.port}),n=Me.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=Mr.createReadStream(Ft.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=Me.parse(n);a.hostname=u.hostname,a.port=u.port,a.path=u.path}this.buildRequest(a,e,i,t)};Re.prototype.buildRequest=function(e,t,r,n){var i=this,o,s=gf[i.protocol].request(e,function(){});jt("Sending: %s",yf.inspect(e,{showHidden:!0,depth:null})),i.connectionTimeout&&(o=setTimeout(function(){jt("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}};Re.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]}),mf.stringify(t)};Ni.exports=Re});var Wi=v((tc,Gi)=>{"use strict";var H=require("fs"),Pe=require("path"),_f=H.lchown?"lchown":"chown",Ef=H.lchownSync?"lchownSync":"chownSync",Mi=H.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),Fi=(e,t,r)=>{try{return H[Ef](e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Cf=(e,t,r)=>{try{return H.chownSync(e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Tf=Mi?(e,t,r,n)=>i=>{!i||i.code!=="EISDIR"?n(i):H.chown(e,t,r,n)}:(e,t,r,n)=>n,Fr=Mi?(e,t,r)=>{try{return Fi(e,t,r)}catch(n){if(n.code!=="EISDIR")throw n;Cf(e,t,r)}}:(e,t,r)=>Fi(e,t,r),kf=process.version,ji=(e,t,r)=>H.readdir(e,t,r),Rf=(e,t)=>H.readdirSync(e,t);/^v4\./.test(kf)&&(ji=(e,t,r)=>H.readdir(e,r));var Bt=(e,t,r,n)=>{H[_f](e,t,r,Tf(e,t,r,i=>{n(i&&i.code!=="ENOENT"?i:null)}))},Bi=(e,t,r,n,i)=>{if(typeof t=="string")return H.lstat(Pe.resolve(e,t),(o,s)=>{if(o)return i(o.code!=="ENOENT"?o:null);s.name=t,Bi(e,s,r,n,i)});if(t.isDirectory())jr(Pe.resolve(e,t.name),r,n,o=>{if(o)return i(o);let s=Pe.resolve(e,t.name);Bt(s,r,n,i)});else{let o=Pe.resolve(e,t.name);Bt(o,r,n,i)}},jr=(e,t,r,n)=>{ji(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 Bt(e,t,r,n);let s=o.length,a=null,u=c=>{if(!a){if(c)return n(a=c);if(--s===0)return Bt(e,t,r,n)}};o.forEach(c=>Bi(e,c,t,r,u))})},Pf=(e,t,r,n)=>{if(typeof t=="string")try{let i=H.lstatSync(Pe.resolve(e,t));i.name=t,t=i}catch(i){if(i.code==="ENOENT")return;throw i}t.isDirectory()&&Ui(Pe.resolve(e,t.name),r,n),Fr(Pe.resolve(e,t.name),r,n)},Ui=(e,t,r)=>{let n;try{n=Rf(e,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;if(i.code==="ENOTDIR"||i.code==="ENOTSUP")return Fr(e,t,r);throw i}return n&&n.length&&n.forEach(i=>Pf(e,i,t,r)),Fr(e,t,r)};Gi.exports=jr;jr.sync=Ui});var zi=v((rc,Vi)=>{"use strict";var{Buffer:K}=require("buffer"),Hi=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,Hi,{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||K.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]:K.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=K.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+=Gr(" linkpath="+e.linkname+`
`));var r=e.pax;if(r)for(var n in r)t+=Gr(" "+n+"="+r[n]+`
`);return Buffer.from(t)};je.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};je.encode=function(e){var t=Af(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(pe(e.mode&Df,6),100),t.write(pe(e.uid,6),108),t.write(pe(e.gid,6),116),t.write(pe(e.size,11),124),t.write(pe(e.mtime.getTime()/1e3|0,11),136),t[156]=Ki+jf(e.type),e.linkname&&t.write(e.linkname,157),Yi.copy(t,it),Lf.copy(t,Ur),e.uname&&t.write(e.uname,265),e.gname&&t.write(e.gname,297),t.write(pe(e.devmajor||0,6),329),t.write(pe(e.devminor||0,6),337),n&&t.write(n,345),t.write(pe(Zi(t),6),148),t)};je.decode=function(e,t,r){var n=e[156]===0?0:e[156]-Ki,i=Fe(e,0,100,t),o=me(e,100,8),s=me(e,108,8),a=me(e,116,8),u=me(e,124,12),c=me(e,136,12),f=Ff(n),l=e[157]===0?null:Fe(e,157,100,t),d=Fe(e,265,32),h=Fe(e,297,32),w=me(e,329,8),S=me(e,337,8),y=Zi(e);if(y===8*32)return null;if(y!==me(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(Yi.compare(e,it,it+6)===0)e[345]&&(i=Fe(e,345,155,t)+"/"+i);else if(!(qf.compare(e,it,it+6)===0&&Nf.compare(e,Ur,Ur+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 io=v((oc,no)=>{var Xi=require("util"),Uf=$i(),ot=Wr(),Qi=Te().Writable,eo=Te().PassThrough,to=function(){},ro=function(e){return e&=511,e&&512-e},Gf=function(e,t){var r=new Gt(e,t);return r.end(),r},Wf=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},Gt=function(e,t){this._parent=e,this.offset=t,eo.call(this,{autoDestroy:!1})};Xi.inherits(Gt,eo);Gt.prototype.destroy=function(e){this._parent.destroy(e)};var oe=function(e){if(!(this instanceof oe))return new oe(e);Qi.call(this,e),e=e||{},this._offset=0,this._buffer=Uf(),this._missing=0,this._partial=!1,this._onparse=to,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=ro(t._header.size);d?t._parse(d,s):t._parse(512,l),t._locked||n()},s=function(){t._buffer.consume(ro(t._header.size)),t._parse(512,l),n()},a=function(){var d=t._header.size;t._paxGlobal=ot.decodePax(r.slice(0,d)),r.consume(d),o()},u=function(){var d=t._header.size;t._pax=ot.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=ot.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},f=function(){var d=t._header.size;this._gnuLongLinkPath=ot.decodeLongPath(r.slice(0,d),e.filenameEncoding),r.consume(d),o()},l=function(){var d=t._offset,h;try{h=t._header=ot.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=Wf(h,t._pax),t._pax=null),t._locked=!0,!h.size||
`),Es=e=>"```\n"+e+"\n```";var ve=e=>e.State==="running",N=({Names:e,Name:t})=>e!==void 0?e.map(r=>r.replace(/^\//,"")).join(", "):t!==void 0?t.replace(/^\//,""):"-",Cs=e=>e!==void 0?`## ${N(e)}
`+_s([["Image",e.Config.Image],["Status",e.State.Status],["Command","`"+e.Config.Cmd?.join(" ")+"`"]])+Sl(e.Config.Env)+`
`:"",Sl=e=>e.length===0?"":[`
## Environment`,Es(e.join(`
`))].join(`
`);var sn=e=>e.errno===-61&&e.code==="ECONNREFUSED",ee=(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 Ve=require("@raycast/api"),te=({action:e,onSuccess:t,onFailure:r})=>async()=>{try{await e(),t!==void 0&&await(0,Ve.showToast)(Ve.ToastStyle.Success,...Ts(t()))}catch(n){n instanceof Error&&r!==void 0&&await(0,Ve.showToast)(Ve.ToastStyle.Failure,...Ts(r(n)))}},Ts=e=>Array.isArray(e)?e:[e];function an({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:Cs(n),actions:_jsx(M.ActionPanel,null,n?.State.Running===!0&&_jsx(M.ActionPanel.Item,{title:"Stop Container",shortcut:{modifiers:["cmd","shift"],key:"w"},onAction:te({action:()=>s(n),onSuccess:()=>`Container ${N(n)} stopped`,onFailure:c=>ee(c,n)})}),n?.State.Running===!0&&_jsx(M.ActionPanel.Item,{title:"Restart Container",icon:M.Icon.ArrowClockwise,shortcut:{modifiers:["opt"],key:"r"},onAction:te({action:()=>o(n),onSuccess:()=>`Container ${N(n)} restarted`,onFailure:c=>ee(c,n)})}),n?.State.Running===!1&&_jsx(M.ActionPanel.Item,{title:"Start Container",shortcut:{modifiers:["cmd","shift"],key:"r"},onAction:te({action:()=>i(n),onSuccess:()=>`Container ${N(n)} started`,onFailure:c=>ee(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:te({action:async()=>{await a(n),u()},onSuccess:()=>`Container ${N(n)} removed`,onFailure:c=>ee(c,n)})}))})}var O=require("react");var Qt=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 mt=1e3,ks=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,mt),()=>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,mt),()=>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,mt),()=>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,mt),()=>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{
`):`## An Error Occurred:
${t}`};function Os(e){let t=(0,Ps.useMemo)(()=>new Rs.default,[]),r=ks(t),{useContainers:n}=r,{containers:i,isLoading:o,error:s,startContainer:a,restartContainer:u,stopContainer:c,removeContainer:f}=n();return s?_jsx(un,{error:s}):_jsx(x.List,{isLoading:o},El(i,e.projectFilter)?.map(l=>_jsx(x.List.Item,{key:l.Id,title:N(l),subtitle:l.Image,accessoryTitle:l.State,icon:ve(l)?{source:"icon-container-running.png",tintColor:x.Color.Green}:{source:"icon-container.png",tintColor:x.Color.SecondaryText},actions:_jsx(x.ActionPanel,null,ve(l)&&_jsx(x.ActionPanel.Item,{title:"Stop Container",shortcut:{modifiers:["cmd","shift"],key:"w"},icon:{source:"icon-stop.png",tintColor:x.Color.PrimaryText},onAction:te({action:()=>c(l),onSuccess:()=>`Container ${N(l)} stopped`,onFailure:d=>ee(d,l)})}),ve(l)&&_jsx(x.ActionPanel.Item,{title:"Restart Container",icon:x.Icon.ArrowClockwise,shortcut:{modifiers:["opt"],key:"r"},onAction:te({action:()=>u(l),onSuccess:()=>`Container ${N(l)} restarted`,onFailure:d=>ee(d,l)})}),!ve(l)&&_jsx(x.ActionPanel.Item,{title:"Start Container",shortcut:{modifiers:["cmd","shift"],key:"r"},icon:{source:"icon-start.png",tintColor:x.Color.PrimaryText},onAction:te({action:()=>a(l),onSuccess:()=>`Container ${N(l)} started`,onFailure:d=>ee(d,l)})}),_jsx(x.PushAction,{title:"Inspect",icon:{source:x.Icon.Binoculars},shortcut:{modifiers:["cmd"],key:"i"},target:_jsx(an,{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:te({action:()=>f(l),onSuccess:()=>`Container ${N(l)} removed`,onFailure:d=>ee(d,l)})}))})))}var El=(e,t)=>t===void 0||e===void 0?e:e.filter(r=>r.Labels["com.docker.compose.project"]===t);module.exports=Ms(Cl);0&&(module.exports={});
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */