/*!--------------------------------------------------------
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *--------------------------------------------------------*/
"use strict";(function(){const{ipcRenderer:n,webFrame:t,contextBridge:a,webUtils:u}=require("electron");function o(e){if(!e?.startsWith("vscode:"))throw new Error(`Unsupported event IPC channel '${e}'`);return!0}function d(e){for(const r of process.argv)if(r.indexOf(`--${e}=`)===0)return r.split("=")[1]}let s;const i=(async()=>{const e=d("vscode-window-config");if(!e)throw new Error("Preload: did not find expected vscode-window-config in renderer process arguments list.");try{o(e);const r=s=await n.invoke(e);return Object.assign(process.env,r.userEnv),t.setZoomLevel(r.zoomLevel??0),r}catch(r){throw new Error(`Preload: unable to fetch vscode-window-config: ${r}`)}})(),v=(async()=>{const[e,r]=await Promise.all([(async()=>(await i).userEnv)(),n.invoke("vscode:fetchShellEnv")]);return{...process.env,...r,...e}})(),g={ipcRenderer:{send(e,...r){o(e)&&n.send(e,...r)},invoke(e,...r){return o(e),n.invoke(e,...r)},on(e,r){return o(e),n.on(e,r),this},once(e,r){return o(e),n.once(e,r),this},removeListener(e,r){return o(e),n.removeListener(e,r),this}},ipcMessagePort:{acquire(e,r){if(o(e)){const c=(f,p)=>{r===p&&(n.off(e,c),window.postMessage(r,"*",f.ports))};n.on(e,c)}}},webFrame:{setZoomLevel(e){typeof e=="number"&&t.setZoomLevel(e)}},webUtils:{getPathForFile(e){return u.getPathForFile(e)}},process:{get platform(){return process.platform},get arch(){return process.arch},get env(){return{...process.env}},get versions(){return process.versions},get type(){return"renderer"},get execPath(){return process.execPath},cwd(){return process.env.VSCODE_CWD||process.execPath.substr(0,process.execPath.lastIndexOf(process.platform==="win32"?"\\":"/"))},shellEnv(){return v},getProcessMemoryInfo(){return process.getProcessMemoryInfo()},on(e,r){process.on(e,r)}},context:{configuration(){return s},async resolveConfiguration(){return i}}};try{a.exposeInMainWorld("vscode",g)}catch(e){console.error(e)}})();
//# sourceMappingURL=preload.js.map
