UNPKG

@zubridge/electron

Version:

A streamlined state management library for Electron applications using Zustand.

375 lines (365 loc) 14.2 kB
// Renderer-safe build with polyfilled Node.js modules const _defineProperty = Object.defineProperty; //#region rolldown:runtime var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (all) => { let target = {}; for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); return target; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/_internal/utils.mjs /* @__NO_SIDE_EFFECTS__ */ function createNotImplementedError(name) { return /* @__PURE__ */ new Error(`[unenv] ${name} is not implemented yet!`); } /* @__NO_SIDE_EFFECTS__ */ function notImplemented(name) { const fn = () => { throw /* @__PURE__ */ createNotImplementedError(name); }; return Object.assign(fn, { __unenv__: true }); } /* @__NO_SIDE_EFFECTS__ */ function notImplementedAsync(name) { const fn = /* @__PURE__ */ notImplemented(name); fn.__promisify__ = () => /* @__PURE__ */ notImplemented(name + ".__promisify__"); fn.native = fn; return fn; } /* @__NO_SIDE_EFFECTS__ */ function notImplementedClass(name) { return class { constructor() { _defineProperty(this, "__unenv__", true); throw new Error(`[unenv] ${name} is not implemented yet!`); } }; } //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/types.mjs var types_exports = /* @__PURE__ */ __export({ isAnyArrayBuffer: () => isAnyArrayBuffer, isArgumentsObject: () => isArgumentsObject, isArrayBuffer: () => isArrayBuffer, isArrayBufferView: () => isArrayBufferView, isAsyncFunction: () => isAsyncFunction, isBigInt64Array: () => isBigInt64Array, isBigIntObject: () => isBigIntObject, isBigUint64Array: () => isBigUint64Array, isBooleanObject: () => isBooleanObject, isBoxedPrimitive: () => isBoxedPrimitive, isCryptoKey: () => isCryptoKey, isDataView: () => isDataView, isDate: () => isDate$1, isExternal: () => isExternal, isFloat32Array: () => isFloat32Array, isFloat64Array: () => isFloat64Array, isGeneratorFunction: () => isGeneratorFunction, isGeneratorObject: () => isGeneratorObject, isInt16Array: () => isInt16Array, isInt32Array: () => isInt32Array, isInt8Array: () => isInt8Array, isKeyObject: () => isKeyObject, isMap: () => isMap, isMapIterator: () => isMapIterator, isModuleNamespaceObject: () => isModuleNamespaceObject, isNativeError: () => isNativeError, isNumberObject: () => isNumberObject, isPromise: () => isPromise, isProxy: () => isProxy, isRegExp: () => isRegExp$1, isSet: () => isSet, isSetIterator: () => isSetIterator, isSharedArrayBuffer: () => isSharedArrayBuffer, isStringObject: () => isStringObject, isSymbolObject: () => isSymbolObject, isTypedArray: () => isTypedArray, isUint16Array: () => isUint16Array, isUint32Array: () => isUint32Array, isUint8Array: () => isUint8Array, isUint8ClampedArray: () => isUint8ClampedArray, isWeakMap: () => isWeakMap, isWeakSet: () => isWeakSet }); const isExternal = (_obj) => false; const isDate$1 = (val) => val instanceof Date; const isArgumentsObject = /* @__PURE__ */ notImplemented("util.types.isArgumentsObject"); const isBigIntObject = (val) => typeof val === "bigint"; const isBooleanObject = (val) => typeof val === "boolean"; const isNumberObject = (val) => typeof val === "number"; const isStringObject = (val) => typeof val === "string"; const isSymbolObject = (val) => typeof val === "symbol"; const isNativeError = /* @__PURE__ */ notImplemented("util.types.isNativeError"); const isRegExp$1 = (val) => val instanceof RegExp; const isAsyncFunction = /* @__PURE__ */ notImplemented("util.types.isAsyncFunction"); const isGeneratorFunction = /* @__PURE__ */ notImplemented("util.types.isGeneratorFunction"); const isGeneratorObject = /* @__PURE__ */ notImplemented("util.types.isGeneratorObject"); const isPromise = (val) => val instanceof Promise; const isMap = (val) => val instanceof Map; const isSet = (val) => val instanceof Set; const isMapIterator = /* @__PURE__ */ notImplemented("util.types.isMapIterator"); const isSetIterator = /* @__PURE__ */ notImplemented("util.types.isSetIterator"); const isWeakMap = (val) => val instanceof WeakMap; const isWeakSet = (val) => val instanceof WeakSet; const isArrayBuffer = (val) => val instanceof ArrayBuffer; const isDataView = (val) => val instanceof DataView; const isSharedArrayBuffer = (val) => val instanceof SharedArrayBuffer; const isProxy = /* @__PURE__ */ notImplemented("util.types.isProxy"); const isModuleNamespaceObject = /* @__PURE__ */ notImplemented("util.types.isModuleNamespaceObject"); const isAnyArrayBuffer = /* @__PURE__ */ notImplemented("util.types.isAnyArrayBuffer"); const isBoxedPrimitive = /* @__PURE__ */ notImplemented("util.types.isBoxedPrimitive"); const isArrayBufferView = /* @__PURE__ */ notImplemented("util.types.isArrayBufferView"); const isTypedArray = /* @__PURE__ */ notImplemented("util.types.isTypedArray"); const isUint8Array = /* @__PURE__ */ notImplemented("util.types.isUint8Array"); const isUint8ClampedArray = /* @__PURE__ */ notImplemented("util.types.isUint8ClampedArray"); const isUint16Array = /* @__PURE__ */ notImplemented("util.types.isUint16Array"); const isUint32Array = /* @__PURE__ */ notImplemented("util.types.isUint32Array"); const isInt8Array = /* @__PURE__ */ notImplemented("util.types.isInt8Array"); const isInt16Array = /* @__PURE__ */ notImplemented("util.types.isInt16Array"); const isInt32Array = /* @__PURE__ */ notImplemented("util.types.isInt32Array"); const isFloat32Array = /* @__PURE__ */ notImplemented("util.types.isFloat32Array"); const isFloat64Array = /* @__PURE__ */ notImplemented("util.types.isFloat64Array"); const isBigInt64Array = /* @__PURE__ */ notImplemented("util.types.isBigInt64Array"); const isBigUint64Array = /* @__PURE__ */ notImplemented("util.types.isBigUint64Array"); const isKeyObject = /* @__PURE__ */ notImplemented("util.types.isKeyObject"); const isCryptoKey = /* @__PURE__ */ notImplemented("util.types.isCryptoKey"); //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/util/types.mjs var types_default = types_exports; //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/inherits.mjs function inherits(ctor, superCtor) { if (!superCtor) return; ctor.super_ = superCtor; ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); } //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/promisify.mjs const customSymbol = /* @__PURE__ */ Symbol("customPromisify"); function _promisify(fn) { if (fn[customSymbol]) return fn[customSymbol]; return function(...args) { return new Promise((resolve, reject) => { try { fn.call(this, ...args, (err, val) => { if (err) return reject(err); resolve(val); }); } catch (error) { reject(error); } }); }; } const promisify = /* @__PURE__ */ Object.assign(_promisify, { custom: customSymbol }); //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/mime.mjs var MIMEType = class { constructor(input) { _defineProperty(this, "__unenv__", true); _defineProperty(this, "params", new MIMEParams()); _defineProperty(this, "type", void 0); _defineProperty(this, "subtype", void 0); const [essence = "", ...params] = String(input).split(";"); const [type = "", subtype = ""] = essence.split("/"); this.type = type; this.subtype = subtype; this.params = new MIMEParams(); for (const param of params) { const [name, value] = param.split("="); this.params.set(name, value); } } get essence() { return this.type + "/" + this.subtype; } toString() { const paramsStr = this.params.toString(); return this.essence + (paramsStr ? `;${paramsStr}` : ""); } }; var MIMEParams = class extends Map { constructor(..._args) { super(..._args); _defineProperty(this, "__unenv__", true); } get(name) { return super.get(name) || null; } toString() { return [...this.entries()].map(([name, value]) => `${name}=${value}`).join("&"); } }; //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/legacy-types.mjs const isRegExp = (val) => val instanceof RegExp; const isDate = (val) => val instanceof Date; const isArray = (val) => Array.isArray(val); const isBoolean = (val) => typeof val === "boolean"; const isNull = (val) => val === null; const isNullOrUndefined = (val) => val === null || val === void 0; const isNumber = (val) => typeof val === "number"; const isString = (val) => typeof val === "string"; const isSymbol = (val) => typeof val === "symbol"; const isUndefined = (val) => val === void 0; const isFunction = (val) => typeof val === "function"; const isBuffer = (val) => { return val && typeof val === "object" && typeof val.copy === "function" && typeof val.fill === "function" && typeof val.readUInt8 === "function"; }; const isDeepStrictEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b); const isObject = (val) => val !== null && typeof val === "object" && Object.getPrototypeOf(val).isPrototypeOf(Object); const isError = (val) => val instanceof Error; const isPrimitive = (val) => { if (typeof val === "object") return val === null; return typeof val !== "function"; }; //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/internal/util/log.mjs const log = (...args) => { console.log(...args); }; const debuglog = (section, _cb) => { const fn = (msg, ...params) => { if (fn.enabled) console.debug(`[${section}] ${msg}`, ...params); }; fn.enabled = true; return fn; }; const debug = debuglog; const inspect = (object) => JSON.stringify(object, null, 2); const format = (...args) => _format(...args); const formatWithOptions = (_options, ...args) => _format(...args); function _format(fmt, ...args) { const re = /(%?)(%([djos]))/g; if (args.length > 0) fmt = fmt.replace(re, (match, escaped, ptn, flag) => { let arg = args.shift(); switch (flag) { case "o": if (Array.isArray(arg)) { arg = JSON.stringify(arg); break; } break; case "s": arg = "" + arg; break; case "d": arg = Number(arg); break; case "j": arg = JSON.stringify(arg); break; } if (!escaped) return arg; args.unshift(arg); return match; }); if (args.length > 0) fmt += " " + args.join(" "); fmt = fmt.replace(/%{2}/g, "%"); return "" + fmt; } //#endregion //#region ../../node_modules/.pnpm/unenv@2.0.0-rc.24/node_modules/unenv/dist/runtime/node/util.mjs const TextDecoder = globalThis.TextDecoder; const TextEncoder = globalThis.TextEncoder; const deprecate = (fn) => fn; const _errnoException = /* @__PURE__ */ notImplemented("util._errnoException"); const _exceptionWithHostPort = /* @__PURE__ */ notImplemented("util._exceptionWithHostPort"); const _extend = /* @__PURE__ */ notImplemented("util._extend"); const aborted = /* @__PURE__ */ notImplemented("util.aborted"); const callbackify = /* @__PURE__ */ notImplemented("util.callbackify"); const getSystemErrorMap = /* @__PURE__ */ notImplemented("util.getSystemErrorMap"); const getSystemErrorName = /* @__PURE__ */ notImplemented("util.getSystemErrorName"); const toUSVString = /* @__PURE__ */ notImplemented("util.toUSVString"); const stripVTControlCharacters = /* @__PURE__ */ notImplemented("util.stripVTControlCharacters"); const transferableAbortController = /* @__PURE__ */ notImplemented("util.transferableAbortController"); const transferableAbortSignal = /* @__PURE__ */ notImplemented("util.transferableAbortSignal"); const parseArgs = /* @__PURE__ */ notImplemented("util.parseArgs"); const parseEnv = /* @__PURE__ */ notImplemented("util.parseEnv"); const styleText = /* @__PURE__ */ notImplemented("util.styleText"); /** @deprecated */ const getCallSite = /* @__PURE__ */ notImplemented("util.getCallSite"); const getCallSites = /* @__PURE__ */ notImplemented("util.getCallSites"); const getSystemErrorMessage = /* @__PURE__ */ notImplemented("util.getSystemErrorMessage"); var util_default = { _errnoException, _exceptionWithHostPort, _extend, aborted, callbackify, deprecate, getCallSite, getCallSites, getSystemErrorMessage, getSystemErrorMap, getSystemErrorName, inherits, promisify, stripVTControlCharacters, toUSVString, TextDecoder, TextEncoder, types: types_default, transferableAbortController, transferableAbortSignal, parseArgs, parseEnv, styleText, MIMEParams, MIMEType, isArray, isBoolean, isBuffer, isDate, isDeepStrictEqual, isError, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, debug, debuglog, format, formatWithOptions, inspect, log }; //#endregion export { __commonJS as a, notImplementedClass as i, notImplemented as n, __export as o, notImplementedAsync as r, __toESM as s, util_default as t };