Dot_Files/.config/raycast/extensions/c77c14f4-b65d-4b15-84d5-71d06d328090/index.js

10 lines
28 KiB
JavaScript
Raw Normal View History

var gn=Object.create;var j=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var xn=Object.getOwnPropertyNames;var bn=Object.getPrototypeOf,wn=Object.prototype.hasOwnProperty;var Pe=e=>j(e,"__esModule",{value:!0});var a=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),En=(e,t)=>{for(var r in t)j(e,r,{get:t[r],enumerable:!0})},Ce=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of xn(t))!wn.call(e,s)&&(r||s!=="default")&&j(e,s,{get:()=>t[s],enumerable:!(n=yn(t,s))||n.enumerable});return e},Ge=(e,t)=>Ce(Pe(j(e!=null?gn(bn(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),vn=(e=>(t,r)=>e&&e.get(t)||(r=Ce(Pe({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var Ne=a((xs,qe)=>{qe.exports=Re;Re.sync=Tn;var Ae=require("fs");function In(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var s=r[n].toLowerCase();if(s&&e.substr(-s.length).toLowerCase()===s)return!0}return!1}function Oe(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:In(t,r)}function Re(e,t,r){Ae.stat(e,function(n,s){r(n,n?!1:Oe(s,e,t))})}function Tn(e,t){return Oe(Ae.statSync(e),e,t)}});var Be=a((bs,_e)=>{_e.exports=Le;Le.sync=Pn;var ke=require("fs");function Le(e,t,r){ke.stat(e,function(n,s){r(n,n?!1:$e(s,t))})}function Pn(e,t){return $e(ke.statSync(e),t)}function $e(e,t){return e.isFile()&&Cn(e,t)}function Cn(e,t){var r=e.mode,n=e.uid,s=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),o=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),f=c|u,h=r&l||r&u&&s===o||r&c&&n===i||r&f&&i===0;return h}});var je=a((Es,Me)=>{var ws=require("fs"),F;process.platform==="win32"||global.TESTING_WINDOWS?F=Ne():F=Be();Me.exports=ee;ee.sync=Gn;function ee(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,s){ee(e,t||{},function(i,o){i?s(i):n(o)})})}F(e,t||{},function(n,s){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,s=!1),r(n,s)})}function Gn(e,t){try{return F.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ve=a((vs,Ke)=>{var I=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Fe=require("path"),An=I?";":":",Ue=je(),De=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Xe=(e,t)=>{let r=t.colon||An,n=e.match(/\//)||I&&e.match(/\\/)?[""]:[...I?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],s=I?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=I?s.split(r):[""];return I&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:s}},He=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:s,pathExtExe:i}=Xe(e,t),o=[],c=l=>new Promise((f,h)=>{if(l===n.length)return t.all&&o.length?f(o):h(De(e));let m=n[l],g=/^".*"$/.test(m)?m.slice(1,-1):m,y=Fe.join(g,e),x=!g&&/^\.[\\\/]/.test(e)?e.slice(0,2)+y:y;f(u(x,l,0))}),u=(l,f,h)=>new Promise((m,g)=>{if(h===s.length)return m(c(f+1));let y=s[h];Ue(l+y,{pathExt:i},(x,v)=>{if(!x&&v)if(t.all)o.push(l+y);else return m(l+y);return m(u(l,f,h+1))})});return r?c(0).then(l=>r(null,l),r):c(0)},On=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:s}=Xe(e,t),i=[];for(let o=0;o<r.length;o++){let c=r[o],u=/^".*"$/.test(c)?c.slice(1,-1):c,l=Fe.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let h=0;h<n.length;h++){let m=f+n[h];try{if(Ue.sync(m,{pathExt:s}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw De(e)};Ke.exports=He;He.sync=On});var ne=a((Is,te)=>{"use strict";var We=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};te.exports=We;te.exports.default=We});var Ze=a((Ts,Qe)=>{"use strict";var ze=require("path"),Rn=Ve(),qn=ne();function Ye(e,t){let r=e.options.env||
`:`
`.charCodeAt(),r=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,e.length-1)),e[e.length-1]===r&&(e=e.slice(0,e.length-1)),e}});var bt=a((ks,k)=>{"use strict";var N=require("path"),yt=ne(),xt=e=>{e={cwd:process.cwd(),path:process.env[yt()],execPath:process.execPath,...e};let t,r=N.resolve(e.cwd),n=[];for(;t!==r;)n.push(N.join(r,"node_modules/.bin")),t=r,r=N.resolve(r,"..");let s=N.resolve(e.cwd,e.execPath,"..");return n.push(s),n.concat(e.path).join(N.delimiter)};k.exports=xt;k.exports.default=xt;k.exports.env=e=>{e={env:process.env,...e};let t={...e.env},r=yt({env:t});return e.path=t[r],t[r]=k.exports(e),t}});var Et=a((Ls,le)=>{"use strict";var wt=(e,t)=>{for(let r of Reflect.ownKeys(t))Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));return e};le.exports=wt;le.exports.default=wt});var It=a(($s,D)=>{"use strict";var Yn=Et(),U=new WeakMap,vt=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,n=0,s=e.displayName||e.name||"<anonymous>",i=function(...o){if(U.set(i,++n),n===1)r=e.apply(this,o),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return Yn(i,e),U.set(i,n),i};D.exports=vt;D.exports.default=vt;D.exports.callCount=e=>{if(!U.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return U.get(e)}});var Tt=a(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.SIGNALS=void 0;var Qn=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",descr
${n.message}`:x,M=[B,t,e].filter(Boolean).join(`
`);return v?(n.originalMessage=n.message,n.message=M):n=new Error(M),n.shortMessage=B,n.command=o,n.escapedCommand=c,n.exitCode=i,n.signal=s,n.signalDescription=m,n.stdout=e,n.stderr=t,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=Boolean(u),n.isCanceled=l,n.killed=f&&!u,n};Rt.exports=Sr});var kt=a((Us,fe)=>{"use strict";var K=["stdin","stdout","stderr"],gr=e=>K.some(t=>e[t]!==void 0),Nt=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return K.map(n=>e[n]);if(gr(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${K.map(n=>`\`${n}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,K.length);return Array.from({length:r},(n,s)=>t[s])};fe.exports=Nt;fe.exports.node=e=>{let t=Nt(e);return t==="ipc"?"ipc":t===void 0||typeof t=="string"?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}});var Lt=a((Ds,V)=>{V.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&V.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&V.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var jt=a((Xs,O)=>{var d=global.process,w=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};w(d)?($t=require("assert"),G=Lt(),_t=/^win/i.test(d.platform),L=require("events"),typeof L!="function"&&(L=L.EventEmitter),d.__signal_exit_emitter__?p=d.__signal_exit_emitter__:(p=d.__signal_exit_emitter__=new L,p.count=0,p.emitted={}),p.infinite||(p.setMaxListeners(1/0),p.infinite=!0),O.exports=function(e,t){if(!!w(global.process)){$t.equal(typeof e,"function","a callback must be provided for exit handler"),A===!1&&pe();var r="exit";t&&t.alwaysLast&&(r="afterexit");var n=function(){p.removeListener(r,e),p.listeners("exit").length===0&&p.listeners("afterexit").length===0&&W()};return p.on(r,e),n}},W=function(){!A||!w(global.process)||(A=!1,G.forEach(function(t){try{d.removeListener(t,z[t])}catch{}}),d.emit=Y,d.reallyExit=me,p.count-=1)},O.exports.unload=W,E=function(t,r,n){p.emitted[t]||(p.emitted[t]=!0,p.emit(t,r,n))},z={},G.forEach(function(e){z[e]=function(){if(!!w(global.process)){var r=d.listeners(e);r.length===p.count&&(W(),E("exit",null,e),E("afterexit",null,e),_t&&e==="SIGHUP"&&(e="SIGINT"),d.kill(d.pid,e))}}}),O.exports.signals=function(){return G},A=!1,pe=function(){A||!w(global.process)||(A=!0,p.count+=1,G=G.filter(function(t){try{return d.on(t,z[t]),!0}catch{return!1}}),d.emit=Mt,d.reallyExit=Bt)},O.exports.load=pe,me=d.reallyExit,Bt=function(t){!w(global.process)||(d.exitCode=t||0,E("exit",d.exitCode,null),E("afterexit",d.exitCode,null),me.call(d,d.exitCode))},Y=d.emit,Mt=function(t,r){if(t==="exit"&&w(global.process)){r!==void 0&&(d.exitCode=r);var n=Y.apply(this,arguments);return E("exit",d.exitCode,null),E("afterexit",d.exitCode,null),n}else return Y.apply(this,arguments)}):O.exports=function(){};var $t,G,_t,L,p,W,E,z,A,pe,me,Bt,Y,Mt});var Ut=a((Hs,Ft)=>{"use strict";var yr=require("os"),xr=jt(),br=1e3*5,wr=(e,t="SIGTERM",r={})=>{let n=e(t);return Er(e,t,r,n),n},Er=(e,t,r,n)=>{if(!vr(t,r,n))return;let s=Tr(r),i=setTimeout(()=>{e("SIGKILL")},s);i.unref&&i.unref()},vr=(e,{forceKillAfterTimeout:t},r)=>Ir(e)&&t!==!1&&r,Ir=e=>e===yr.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",Tr=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return br;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Pr=(e,t)=>{e.kill()&&(t.isCanceled=!0)},Cr=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Gr=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{if(t===0||t===void 0)return n;let s,i=new Promise((c
tell application "Tunnelblick" to get configurations
`)).split(",").map(r=>{let n=r.replace("configuration ","").trim(),s=J(`
tell application "Tunnelblick" to get state of first configuration where name = "${n}"
`);return{name:n,status:s}})}catch{return new Promise((e,t)=>t("Couln't get VPN connections. Make sure you have Tunnelblick installed."))}}function hn(){let[e,t]=(0,q.useState)(!0),[r,n]=(0,q.useState)([]),[s,i]=(0,q.useState)(null);return(0,q.useEffect)(()=>{mn().then(o=>{n(o)}).catch(o=>{i(new Error(o))}).finally(()=>{t(!1)})},[]),s&&(0,S.showToast)(S.ToastStyle.Failure,"Something went wrong",s.message),_jsx(S.List,{isLoading:e},r.map(o=>_jsx(S.List.Item,{key:o.name,icon:o.status==="EXITING"?"xmark-circle-16":"checkmark-circle-16",title:o.name,subtitle:o.status==="EXITING"?"Connect":"Disconnect",actions:_jsx(S.ActionPanel,null,_jsx(S.ActionPanel.Item,{title:"Connect",key:o.name,onAction:()=>{o.status==="EXITING"?(J(`tell application "Tunnelblick" to connect "${o.name}"`),(0,S.showToast)(S.ToastStyle.Success,"Connected")):(J(`tell application "Tunnelblick" to disconnect "${o.name}"`),(0,S.showToast)(S.ToastStyle.Success,"Disconnected")),mn().then(n)}}))})))}module.exports=vn(gs);0&&(module.exports={});