"use strict";const e=require("electron"),r=require("fs"),n=require("fs/promises"),t=require("path");var o,a;function s(){if(a)return o;a=1;class e extends Error{constructor(r){super(e._prepareSuperMessage(r)),Object.defineProperty(this,"name",{value:"NonError",configurable:!0,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,e)}static _prepareSuperMessage(e){try{return JSON.stringify(e)}catch{return String(e)}}}const r=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],n=Symbol(".toJSON called"),t=({from:e,seen:o,to_:a,forceEnumerable:s,maxDepth:c,depth:i})=>{const l=a||(Array.isArray(e)?[]:{});if(o.push(e),i>=c)return l;if("function"==typeof e.toJSON&&!0!==e[n])return(e=>{e[n]=!0;const r=e.toJSON();return delete e[n],r})(e);for(const[r,n]of Object.entries(e))"function"==typeof Buffer&&Buffer.isBuffer(n)?l[r]="[object Buffer]":"function"!=typeof n&&(n&&"object"==typeof n?o.includes(e[r])?l[r]="[Circular]":(i++,l[r]=t({from:e[r],seen:o.slice(),forceEnumerable:s,maxDepth:c,depth:i})):l[r]=n);for(const{property:n,enumerable:t}of r)"string"==typeof e[n]&&Object.defineProperty(l,n,{value:e[n],enumerable:!!s||t,configurable:!0,writable:!0});return l};return o={serializeError:(e,r={})=>{const{maxDepth:n=Number.POSITIVE_INFINITY}=r;return"object"==typeof e&&null!==e?t({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0}):"function"==typeof e?`[Function: ${e.name||"anonymous"}]`:e},deserializeError:(r,n={})=>{const{maxDepth:o=Number.POSITIVE_INFINITY}=n;if(r instanceof Error)return r;if("object"==typeof r&&null!==r&&!Array.isArray(r)){const e=new Error;return t({from:r,seen:[],to_:e,maxDepth:o,depth:0}),e}return new e(r)}}}var c,i,l,d,u,f,p={};function h(){if(c)return p;c=1;const e=()=>`${Date.now()}-${Math.random()}`,r=e=>`%better-ipc-send-channel-${e}`,n=e=>`%better-ipc-send-channel-${e}`;return p.currentWindowChannel="%better-ipc-current-window",p.getSendChannel=r,p.getRendererSendChannel=n,p.getResponseChannels=n=>{const t=e();return{sendChannel:r(n),dataChannel:`%better-ipc-response-data-channel-${n}-${t}`,errorChannel:`%better-ipc-response-error-channel-${n}-${t}`}},p.getRendererResponseChannels=r=>{const t=e();return{sendChannel:n(r),dataChannel:`%better-ipc-response-data-channel-${r}-${t}`,errorChannel:`%better-ipc-response-error-channel-${r}-${t}`}},p}"renderer"===process.type?f=function(){if(l)return i;l=1;const r=e,{serializeError:n,deserializeError:t}=s(),o=h(),{ipcRenderer:a}=r,c=Object.create(a||{});return c.callMain=(e,r)=>new Promise((n,s)=>{const{sendChannel:c,dataChannel:i,errorChannel:l}=o.getResponseChannels(e),d=()=>{a.off(i,u),a.off(l,f)},u=(e,r)=>{d(),n(r)},f=(e,r)=>{d(),s(t(r))};a.once(i,u),a.once(l,f);const p={dataChannel:i,errorChannel:l,userData:r};a.send(c,p)}),c.answerMain=(e,r)=>{const t=o.getRendererSendChannel(e),s=async(e,t)=>{const{dataChannel:o,errorChannel:s,userData:c}=t;try{a.send(o,await r(c))}catch(e){a.send(s,n(e))}};return a.on(t,s),()=>{a.off(t,s)}},i=c}():function(){if(u)return d;u=1;const r=e,{serializeError:n,deserializeError:t}=s(),o=h(),{ipcMain:a,BrowserWindow:c}=r,i=Object.create(a||{});i.callRenderer=(e,r,n)=>new Promise((s,i)=>{if(!e)throw new Error("Browser window required");const{sendChannel:l,dataChannel:d,errorChannel:u}=o.getRendererResponseChannels(r),f=()=>{a.off(d,p),a.off(u,h)},p=(r,n)=>{c.fromWebContents(r.sender).id===e.id&&(f(),s(n))},h=(r,n)=>{c.fromWebContents(r.sender).id===e.id&&(f(),i(t(n)))};a.on(d,p),a.on(u,h);const b={dataChannel:d,errorChannel:u,userData:n};e.webContents&&e.webContents.send(l,b)}),i.callFocusedRenderer=async(...e)=>{const r=c.getFocusedWindow();if(!r)throw new Error("No browser window in focus");return i.callRenderer(r,...e)},i.answerRenderer=(e,r,t)=>{let s,i,l;if(void 0===t)i=e,l=r;else if(s=e,i=r,l=t,!s)throw new Error("Browser window required");const d=o.getSendChannel(i),u=async(e,r)=>{const t=c.fromWebContents(e.sender);if(s&&s.id!==t.id)return;const o=(r,n)=>{t&&t.isDestroyed()||e.sender.send(r,n)},{dataChannel:a,errorChannel:i,userData:d}=r;try{o(a,await l(d,t))}catch(e){o(i,n(e))}};return a.on(d,u),()=>{a.off(d,u)}},i.sendToRenderers=(e,r)=>{for(const n of c.getAllWindows())n.webContents&&n.webContents.send(e,r)},d=i}();let b=[];f.answerMain("win:close",async()=>{await Promise.allSettled(b.map(e=>e()))});const w={path:t,clipboard:e.clipboard,ipcRenderer:f,notification:function(e){return f.callMain("app:notification",e)},access:e=>n.access(e,r.constants.R_OK|r.constants.W_OK),versions:process.versions,addCloseFn:e=>b.every(r=>r!==e)&&b.push(e),onFileOpened:e=>f.on("file-opened",(r,n)=>e(n))};e.contextBridge.exposeInMainWorld("electron",w);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 23428 characters]
