var h=Object.create;var w=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var W=(o,e)=>{for(var t in e)w(o,t,{get:e[t],enumerable:!0})},d=(o,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!B.call(o,n)&&n!==t&&w(o,n,{get:()=>e[n],enumerable:!(r=C(e,n))||r.enumerable});return o};var v=(o,e,t)=>(t=o!=null?h(y(o)):{},d(e||!o||!o.__esModule?w(t,"default",{value:o,enumerable:!0}):t,o)),E=o=>d(w({},"__esModule",{value:!0}),o);var A={};W(A,{initWindow:()=>k});module.exports=E(A);var i=require("electron/main"),p=v(require("../../common/modules/l10n")),l=require("../../common/modules/client"),a=require("path"),f=require("deepmerge-ts"),c=require("./extensions"),m=require("./error"),u=require("../../common/global");const P=["invite"];function k(o,e,t){const r=P.includes(o);if(!i.app.isReady())throw new Error("Tried to initialize a new parent window when app is not ready!");const n=r?i.session.defaultSession:i.session.fromPartition("temp:"+o);for(const b of e.getChildWindows())if(b.webContents.session===n)return;e.isVisible()||e.show();const s=new i.BrowserWindow((0,f.deepmerge)({title:i.app.getName()+" \u2013 "+new p.default().client.windows[o],show:!1,parent:e,backgroundColor:l.appInfo.backgroundColor,webPreferences:{session:n,nodeIntegration:!1,contextIsolation:!0,sandbox:!1,enableWebSQL:!1,webgl:!1,autoplayPolicy:"user-gesture-required",defaultFontFamily:u.fonts,...r?{}:{preload:(0,a.resolve)(i.app.getAppPath(),"app/code/renderer/preload/"+o+".js")}},...process.platform!=="win32"?{icon:l.appInfo.icons.app}:{}},t??{}));if(s.webContents.session===e.webContents.session&&!r)throw new Error("Child took session from parent!");return r&&(s.removeMenu(),s.webContents.on("did-navigate",()=>{c.styles.load(s.webContents).catch(m.commonCatches.throw)})),s.once("closed",()=>s.removeAllListeners()),s.setAutoHideMenuBar(!0),s.setMenuBarVisibility(!1),(0,l.getBuildInfo)().type==="release"&&s.removeMenu(),r||s.loadFile((0,a.resolve)(i.app.getAppPath(),"sources/assets/web/html/"+o+".html")),setTimeout(()=>{!s.isDestroyed()&&!s.isVisible()&&s.show()},1e4),s}0&&(module.exports={initWindow});
