"use strict";(self.webpackChunkgetsshpubkey=self.webpackChunkgetsshpubkey||[]).push([[763],{763:(e,t,o)=>{o.r(t),o.d(t,{default:()=>u});var n,s=o(79),a=o(627),c=o(835),i=o(542),r=o(354);!function(e){e.createNew="getsshpubkey:getssh"}(n||(n={}));const l={id:"getsshpubkey:plugin",autoStart:!0,optional:[a.ISettingRegistry,s.ILauncher],activate:(e,t,o)=>{console.log("JupyterLab extension getsshpubkey is activated!");const{commands:s}=e,a=n.createNew;s.addCommand(a,{label:e=>(e.isPalette,"SSH Key"),caption:"SSH Key",icon:e=>{},execute:async e=>{(async function(e="",t={}){const o=r.ServerConnection.makeSettings(),n=i.URLExt.join(o.baseUrl,"getsshpubkey",e);let s;try{s=await r.ServerConnection.makeRequest(n,t,o)}catch(e){throw new r.ServerConnection.NetworkError(e)}let a=await s.text();if(a.length>0)try{a=JSON.parse(a)}catch(e){console.log("Not a JSON response body.",s)}if(!s.ok)throw new r.ServerConnection.ResponseError(s,a.message||a);return a})("get_ssh_pub_key",{method:"GET"}).then((e=>(0,c.showDialog)({title:"Public SSH key",body:`SSH key, for use in Github.  See https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account. \n              \n              ${e.ssh}\n              \n              RSA key, for use in Snowflake.  Run \`call SET_RSA_PUBLIC_KEY('${e.rsa.split("\n").slice(1,-1)}')\` from a Snowflake worksheet.`,focusNodeSelector:"input",buttons:[c.Dialog.cancelButton({label:"Cancel"}),c.Dialog.okButton({label:"Copy"})]}).then((t=>(console.log(t),t.button.accept?(c.Clipboard.copyToSystem(e.data),(0,c.showDialog)({body:"Copied!"})):null))))).catch((e=>{console.error(`The getsshpubkey server extension appears to be missing.\n${e}`)}))}}),o&&o.add({command:a,category:"Other",rank:2}),t&&t.load(l.id).then((e=>{console.log("getsshpubkey settings loaded:",e.composite)})).catch((e=>{console.error("Failed to load settings for getsshpubkey.",e)}))}},u=l}}]);