// Copyright (C) 2026 Zaher Salman // SPDX-License-Identifier: GPL-3.0-or-later // Preload bridge for the Electron build. The renderer runs with // contextIsolation:true and nodeIntegration:false, so it has no direct Node // access. This script (which runs with full Node access because sandbox:false) // deliberately exposes only the small, curated set of filesystem, path, // child-process, and environment helpers the muSRFlow renderer needs. All // values crossing the bridge are plain, serializable objects or callbacks. const { contextBridge, ipcRenderer } = require("electron"); const fs = require("fs"); const path = require("path"); const childProcess = require("child_process"); const { pathToFileURL } = require("url"); const zlib = require("zlib"); // Plotly ships as a single bundled script under node_modules/plotly.js-dist. // The renderer (nodeIntegration:false) cannot require it, so the bridge exposes // a local file:// URL that the shared renderer loads through a