"use strict";
(() => {
  // src/constants.ts
  var ZEQOND_NS = 777000777n;
  var ALPHA_K = 1e-3;
  var TAU_ZQ = Number(ZEQOND_NS) / 1e9;
  var F_H = 1e9 / Number(ZEQOND_NS);
  var DISPLAY = Object.freeze({
    F_H_HZ: 1.287,
    TAU_ZQ_S: 0.777,
    ALPHA_K: 129e-5,
    // published Zeq paper R(t) modulation coefficient
    ALPHA_K_RUNTIME: 1e-3,
    // mirrors runtime ALPHA_K for UIs showing 0.1 % bound
    KERNEL_VERSION: "1.287.5"
  });
  var NIST = {
    // ── Fundamental constants ─────────────────────────────────────────────────
    h: 662607015e-42,
    // Planck constant (J·s)
    hbar: 1054571817e-43,
    // Reduced Planck (J·s)
    c: 299792458,
    // Speed of light in vacuum (m/s)
    G: 66743e-15,
    // Gravitational constant (m³ kg⁻¹ s⁻²)
    k_B: 1380649e-29,
    // Boltzmann constant (J/K)
    N_A: 602214076e15,
    // Avogadro constant (mol⁻¹)
    e: 1602176634e-28,
    // Elementary charge (C)
    epsilon_0: 88541878128e-22,
    // Vacuum permittivity (F/m)
    mu_0: 125663706212e-17,
    // Vacuum permeability (H/m)
    sigma_SB: 5670374419e-17,
    // Stefan-Boltzmann constant (W m⁻² K⁻⁴)
    R: 8.314462618,
    // Gas constant (J mol⁻¹ K⁻¹)
    alpha: 0.0072973525693,
    // Fine-structure constant (dimensionless)
    // ── Particle masses ───────────────────────────────────────────────────────
    m_e: 91093837015e-41,
    // Electron mass (kg)
    m_p: 167262192369e-38,
    // Proton mass (kg)
    m_n: 167492749804e-38,
    // Neutron mass (kg)
    m_u: 16605390666e-37,
    // Atomic mass unit (kg)
    // ── Atomic/quantum ────────────────────────────────────────────────────────
    a_0: 529177210903e-22,
    // Bohr radius (m)
    E_h: 43597447222071e-31,
    // Hartree energy (J)
    r_e: 28179403262e-25,
    // Classical electron radius (m)
    // ── Derived/useful ────────────────────────────────────────────────────────
    eV: 1602176634e-28,
    // 1 eV in Joules
    amu_kg: 16605390666e-37,
    // 1 amu in kg
    atm_Pa: 101325,
    // 1 atm in Pa
    // ── Zeq Intrinsic Constants (sourced from kernel primitives above) ────
    f_H: F_H,
    // HulyaPulse frequency (Hz) — exact 10⁹/777_000_777
    tau_zq: TAU_ZQ,
    // Zeqond duration (s) — exact 0.777000777
    alpha_K: ALPHA_K,
    // KO42 amplitude modulation coefficient — exact 1e-3
    PHI: 1.6180339887
    // Golden ratio φ
  };
  if (typeof process !== "undefined" && process.env && true) {
    const product = F_H * TAU_ZQ;
    if (Math.abs(product - 1) > 1e-15) {
      throw new Error(`[@zeq/sdk/constants] Invariant broken: F_H\xB7TAU_ZQ = ${product}`);
    }
    if (ZEQOND_NS !== 777000777n) {
      throw new Error(`[@zeq/sdk/constants] ZEQOND_NS must equal 777_000_777n`);
    }
    if (ALPHA_K > 1e-3 + Number.EPSILON) {
      throw new Error(`[@zeq/sdk/constants] ALPHA_K = ${ALPHA_K} exceeds 0.1% bound`);
    }
  }

  // src/solvers.ts
  function clamp(v, lo, hi) {
    return Math.max(lo, Math.min(hi, v));
  }
  function safe(v, fallback = 0) {
    return isFinite(v) ? v : fallback;
  }
  function solveZR(inputs) {
    const t = inputs.t ?? Date.now() / 1e3;
    const S_t = inputs.S_t ?? inputs.amplitude ?? 1;
    const sinTerm = Math.sin(2 * Math.PI * NIST.f_H * t);
    const R_t = S_t * (1 + NIST.alpha_K * sinTerm);
    return {
      value: safe(R_t),
      unit: "dimensionless",
      uncertainty: Math.abs(NIST.alpha_K * sinTerm) * S_t,
      detail: { S_t, sinTerm: Number(sinTerm.toFixed(6)), f_H: NIST.f_H, alpha_K: NIST.alpha_K },
      equation: "R(t) = S(t) \xD7 [1 + \u03B1_K \xD7 sin(2\u03C0 \xD7 f_H \xD7 t)]"
    };
  }
  function solveQM(inputs) {
    const n = inputs.n ?? 1;
    const L = inputs.L ?? inputs.length ?? NIST.a_0 * 100;
    const m = inputs.m ?? inputs.mass ?? NIST.m_e;
    const E_n = n * n * Math.PI * Math.PI * NIST.hbar * NIST.hbar / (2 * m * L * L);
    const delta_p = NIST.hbar / (2 * L);
    return {
      value: safe(E_n),
      unit: "J",
      uncertainty: safe(delta_p * delta_p / (2 * m)),
      detail: { n, L, m_kg: m, E_n_eV: safe(E_n / NIST.eV) },
      equation: "E_n = n\xB2\u03C0\xB2\u210F\xB2 / (2mL\xB2)"
    };
  }
  function solveCM(inputs) {
    const m = inputs.m ?? inputs.mass ?? 1;
    const v = inputs.v ?? inputs.velocity ?? 0;
    const a = inputs.a ?? inputs.acceleration ?? 0;
    const F = m * a;
    const KE = 0.5 * m * v * v;
    const p = m * v;
    const primary = inputs.a !== void 0 ? F : inputs.v !== void 0 ? KE : p;
    const unit = inputs.a !== void 0 ? "N" : inputs.v !== void 0 ? "J" : "kg\xB7m/s";
    return {
      value: safe(primary),
      unit,
      uncertainty: safe(Math.abs(primary) * 1e-4),
      detail: { F_N: safe(F), KE_J: safe(KE), p_kgms: safe(p) },
      equation: "F = ma,  KE = \xBDmv\xB2,  p = mv"
    };
  }
  function solveTD(inputs) {
    const T = inputs.T ?? inputs.temperature ?? 293.15;
    const n = inputs.n ?? inputs.moles ?? 1;
    const V = inputs.V ?? inputs.volume ?? 0.0224;
    const P = n * NIST.R * T / V;
    const E_thermal = 3 / 2 * NIST.k_B * T;
    return {
      value: safe(P),
      unit: "Pa",
      uncertainty: safe(P * 1e-4),
      detail: { T_K: T, E_thermal_J: safe(E_thermal), kT_J: safe(NIST.k_B * T) },
      equation: "P = nRT/V,  E_th = (3/2)k_B T"
    };
  }
  function solveEM(inputs) {
    const q = inputs.q ?? inputs.charge ?? NIST.e;
    const r = inputs.r ?? inputs.distance ?? 1e-10;
    const E_field = inputs.E ?? 0;
    const B_field = inputs.B ?? 0;
    const v = inputs.v ?? inputs.velocity ?? 0;
    const F_coulomb = q * q / (4 * Math.PI * NIST.epsilon_0 * r * r);
    const F_lorentz = q * (E_field + v * B_field);
    const primary = E_field !== 0 || B_field !== 0 ? Math.abs(F_lorentz) : F_coulomb;
    return {
      value: safe(primary),
      unit: "N",
      uncertainty: safe(Math.abs(primary) * 1e-4),
      detail: { F_coulomb_N: safe(F_coulomb), F_lorentz_N: safe(F_lorentz) },
      equation: "F = q\xB2/(4\u03C0\u03B5\u2080r\xB2),  F = q(E + v\xD7B)"
    };
  }
  function solveGR(inputs) {
    const M = inputs.M ?? inputs.mass ?? 2e30;
    const r = inputs.r ?? inputs.radius ?? 1500;
    const r_s = 2 * NIST.G * M / (NIST.c * NIST.c);
    const dilation = r > r_s ? Math.sqrt(1 - r_s / r) : 0;
    const v_esc = r > 0 ? Math.sqrt(2 * NIST.G * M / r) : NIST.c;
    return {
      value: safe(r_s),
      unit: "m",
      uncertainty: safe(r_s * 1e-5),
      detail: { r_s_m: safe(r_s), time_dilation: safe(dilation), v_esc_ms: safe(Math.min(v_esc, NIST.c)), M_kg: M },
      equation: "r_s = 2GM/c\xB2,  d\u03C4/dt = \u221A(1 - r_s/r)"
    };
  }
  function solveWP(inputs) {
    const f = inputs.f ?? inputs.frequency ?? 440;
    const lam = inputs.lambda ?? inputs.wavelength ?? NIST.c / f;
    const v = inputs.v ?? f * lam;
    const k = 2 * Math.PI / lam;
    const omega = 2 * Math.PI * f;
    return {
      value: safe(v),
      unit: "m/s",
      uncertainty: safe(v * 1e-4),
      detail: { frequency_Hz: f, wavelength_m: lam, wave_number_k: safe(k), angular_freq: safe(omega) },
      equation: "v = \u03BBf,  k = 2\u03C0/\u03BB,  \u03C9 = 2\u03C0f"
    };
  }
  function solveFD(inputs) {
    const rho = inputs.rho ?? inputs.density ?? 1e3;
    const v1 = inputs.v1 ?? inputs.velocity ?? 1;
    const P1 = inputs.P1 ?? inputs.pressure ?? 101325;
    const h1 = inputs.h1 ?? inputs.height ?? 0;
    const g = 9.80665;
    const v2 = inputs.v2 ?? v1;
    const h2 = inputs.h2 ?? 0;
    const P2 = P1 + 0.5 * rho * (v1 * v1 - v2 * v2) + rho * g * (h1 - h2);
    return {
      value: safe(P2),
      unit: "Pa",
      uncertainty: safe(Math.abs(P2) * 1e-4),
      detail: { rho_kg_m3: rho, v1_ms: v1, P1_Pa: P1, P2_Pa: safe(P2) },
      equation: "P\u2081 + \xBD\u03C1v\u2081\xB2 + \u03C1gh\u2081 = P\u2082 + \xBD\u03C1v\u2082\xB2 + \u03C1gh\u2082"
    };
  }
  function solveSM(inputs) {
    const T = inputs.T ?? 293.15;
    const E = inputs.E ?? inputs.energy ?? NIST.k_B * T;
    const boltzmann = Math.exp(-E / (NIST.k_B * T));
    const E2 = inputs.E2 ?? E * 2;
    const Z = 1 + Math.exp(-E2 / (NIST.k_B * T));
    const prob = boltzmann / Z;
    return {
      value: safe(boltzmann),
      unit: "dimensionless",
      uncertainty: safe(Math.abs(boltzmann) * (E / (NIST.k_B * T * T)) * 0.1),
      detail: { T_K: T, E_J: E, Z_partition: safe(Z), prob: safe(prob) },
      equation: "P_i = e^(-E_i/k_BT) / Z"
    };
  }
  function solveOM(inputs) {
    const M = inputs.M ?? inputs.mass ?? 5972e21;
    const m = inputs.m ?? 1;
    const r = inputs.r ?? inputs.radius ?? 6371e3 + 4e5;
    const t = inputs.t ?? Date.now() / 1e3;
    const sinTerm = Math.sin(2 * Math.PI * NIST.f_H * t);
    const G_mod = NIST.G * (1 + NIST.alpha_K * sinTerm);
    const v_orb = Math.sqrt(G_mod * M / r);
    const T_orb = 2 * Math.PI * Math.sqrt(r * r * r / (G_mod * M));
    const U = -G_mod * M * m / r;
    return {
      value: safe(v_orb),
      unit: "m/s",
      uncertainty: safe(v_orb * Math.abs(NIST.alpha_K * sinTerm)),
      detail: { T_orb_s: safe(T_orb), U_J: safe(U), G_mod: safe(G_mod) },
      equation: "v_orb = \u221A(G_mod\xB7M/r),  G_mod = G\xB7[1 + \u03B1_K\xB7sin(2\u03C0f_H\xB7t)]"
    };
  }
  function solveNU(inputs) {
    const A = inputs.A ?? 12;
    const Z_atom = inputs.Z ?? 6;
    const N_n = A - Z_atom;
    const a_v = 1575e4 * NIST.eV;
    const a_s = 178e5 * NIST.eV;
    const a_c = 711e3 * NIST.eV;
    const a_a = 237e5 * NIST.eV;
    const delta = A % 2 === 0 ? Z_atom % 2 === 0 ? 12e6 * NIST.eV / Math.pow(A, 0.5) : -12e6 * NIST.eV / Math.pow(A, 0.5) : 0;
    const BE = a_v * A - a_s * Math.pow(A, 2 / 3) - a_c * Z_atom * (Z_atom - 1) / Math.pow(A, 1 / 3) - a_a * (N_n - Z_atom) * (N_n - Z_atom) / A + delta;
    return {
      value: safe(BE),
      unit: "J",
      uncertainty: safe(BE * 1e-3),
      detail: { A, Z: Z_atom, N: N_n, BE_MeV: safe(BE / (1e6 * NIST.eV)) },
      equation: "BE = a_v\xB7A \u2212 a_s\xB7A^(2/3) \u2212 a_c\xB7Z(Z\u22121)/A^(1/3) \u2212 a_a\xB7(N\u2212Z)\xB2/A \xB1 \u03B4"
    };
  }
  function solveOP(inputs) {
    const n1 = inputs.n1 ?? 1;
    const n2 = inputs.n2 ?? 1.5;
    const theta_i_deg = inputs.theta_i ?? 30;
    const theta_i = theta_i_deg * Math.PI / 180;
    const sin_theta_r = clamp(n1 / n2 * Math.sin(theta_i), -1, 1);
    const theta_r = Math.asin(sin_theta_r);
    const cos_i = Math.cos(theta_i);
    const cos_r = Math.cos(theta_r);
    const Rs = Math.pow((n1 * cos_i - n2 * cos_r) / (n1 * cos_i + n2 * cos_r), 2);
    return {
      value: safe(theta_r * 180 / Math.PI),
      unit: "degrees",
      uncertainty: 0.01,
      detail: { theta_refracted_deg: safe(theta_r * 180 / Math.PI), Rs_reflection: safe(Rs) },
      equation: "n\u2081 sin(\u03B8\u2081) = n\u2082 sin(\u03B8\u2082)"
    };
  }
  function solvePP(inputs) {
    const q = inputs.q ?? NIST.e;
    const r = inputs.r ?? inputs.distance ?? 1e-15;
    const V_coulomb = q * q / (4 * Math.PI * NIST.epsilon_0 * r);
    const m = inputs.m ?? inputs.mass ?? NIST.m_p;
    const v = inputs.v ?? inputs.velocity ?? 0.1 * NIST.c;
    const gamma = 1 / Math.sqrt(1 - (v / NIST.c) ** 2);
    const p_rel = gamma * m * v;
    const lambda_dB = NIST.h / p_rel;
    return {
      value: safe(V_coulomb),
      unit: "J",
      uncertainty: safe(V_coulomb * NIST.alpha),
      detail: { V_eV: safe(V_coulomb / NIST.eV), lambda_dB_m: safe(lambda_dB), gamma },
      equation: "V = q\xB2/(4\u03C0\u03B5\u2080r),  \u03BB = h/p_rel"
    };
  }
  function solveQR(inputs) {
    const L_h = inputs.L ?? 1e-6;
    const C_f = inputs.C ?? 1e-12;
    const R_ohm = inputs.R ?? 50;
    const omega_r = 1 / Math.sqrt(L_h * C_f);
    const Q = omega_r * L_h / R_ohm;
    return {
      value: safe(omega_r),
      unit: "rad/s",
      uncertainty: safe(omega_r / (2 * Q)),
      detail: { f_r_Hz: safe(omega_r / (2 * Math.PI)), Q_factor: safe(Q) },
      equation: "\u03C9_r = 1/\u221A(LC),  Q = \u03C9\u2080L/R"
    };
  }
  function solveGeneric(inputs, domainPrefix, c) {
    function applyKo42(value, unit, equation, detail) {
      const nowSec = Date.now() / 1e3;
      const sin = Math.sin(2 * Math.PI * NIST.f_H * nowSec);
      const modulated = value * (1 + NIST.alpha_K * sin);
      return {
        value: safe(modulated),
        unit,
        uncertainty: safe(Math.abs(NIST.alpha_K * sin) * Math.abs(value)),
        detail: { raw_value: safe(value), ko42_correction: safe(NIST.alpha_K * sin), ...detail ?? {} },
        equation: `${equation}  [+KO42]`
      };
    }
    const h = c.h ?? NIST.h;
    const c_light = c.c ?? NIST.c;
    const k_B = c.k_B ?? NIST.k_B;
    const epsilon0 = c.epsilon_0 ?? NIST.epsilon_0;
    const k_e = 1 / (4 * Math.PI * epsilon0);
    const freq = inputs.f ?? inputs.freq ?? inputs.frequency ?? inputs.nu;
    if (freq !== void 0) return applyKo42(h * freq, "J", "E = hf", { h, f: freq });
    if (inputs.m !== void 0 && !inputs.v && !inputs.a && !inputs.F) {
      return applyKo42(inputs.m * c_light ** 2, "J", "E = mc\xB2", { m: inputs.m, c: c_light });
    }
    if (inputs.m !== void 0 && inputs.v !== void 0) {
      return applyKo42(0.5 * inputs.m * inputs.v ** 2, "J", "E = \xBDmv\xB2", { m: inputs.m, v: inputs.v });
    }
    if (inputs.m !== void 0 && inputs.a !== void 0) {
      return applyKo42(inputs.m * inputs.a, "N", "F = ma", { m: inputs.m, a: inputs.a });
    }
    if (inputs.F !== void 0 && inputs.d !== void 0) {
      return applyKo42(inputs.F * inputs.d, "J", "W = F\xB7d", { F: inputs.F, d: inputs.d });
    }
    if (inputs.I !== void 0 && inputs.V !== void 0) {
      return applyKo42(inputs.I * inputs.V, "W", "P = IV", { I: inputs.I, V: inputs.V });
    }
    if (inputs.I !== void 0 && inputs.R !== void 0 && inputs.V === void 0) {
      return applyKo42(inputs.I * inputs.R, "V", "V = IR", { I: inputs.I, R: inputs.R });
    }
    if (inputs.m !== void 0 && inputs.g !== void 0 && inputs.h !== void 0) {
      return applyKo42(inputs.m * inputs.g * inputs.h, "J", "U = mgh", { m: inputs.m, g: inputs.g, h: inputs.h });
    }
    if (inputs.k !== void 0 && inputs.x !== void 0) {
      return applyKo42(0.5 * inputs.k * inputs.x ** 2, "J", "U = \xBDkx\xB2", { k: inputs.k, x: inputs.x });
    }
    if (inputs.q !== void 0 && inputs.r !== void 0) {
      return applyKo42(k_e * inputs.q ** 2 / inputs.r, "J", "U = kq\xB2/r", { k_e, q: inputs.q, r: inputs.r });
    }
    if (inputs.T !== void 0 && Object.keys(inputs).length === 1) {
      return applyKo42(k_B * inputs.T, "J", "E = k_B\xB7T", { k_B, T: inputs.T });
    }
    return {
      value: NaN,
      unit: "no-match",
      uncertainty: NaN,
      detail: {
        error: "NO_FORMULA_MATCH",
        provided_inputs: Object.keys(inputs).join(", "),
        note: "No operator equation matched the provided input keys."
      },
      equation: "NONE \u2014 no formula matched inputs: [" + Object.keys(inputs).join(", ") + "]"
    };
  }
  function computeByDomain(domainPrefix, inputs, constants = {}) {
    const p = domainPrefix.toUpperCase();
    switch (p) {
      case "ZR":
        return solveZR(inputs);
      case "QM":
        return solveQM(inputs);
      case "QR":
        return solveQR(inputs);
      case "WP":
        return solveWP(inputs);
      case "CM":
      case "NM":
        return solveCM(inputs);
      case "TH":
      case "TD":
        return solveTD(inputs);
      case "EM":
        return solveEM(inputs);
      case "FD":
        return solveFD(inputs);
      case "SM":
        return solveSM(inputs);
      case "RP":
      case "GR":
        return solveGR(inputs);
      case "NP":
      case "NU":
        return solveNU(inputs);
      case "PP":
        return solvePP(inputs);
      case "OP":
      case "AC":
        return solveOP(inputs);
      case "OM":
        return solveOM(inputs);
      default:
        return solveGeneric(inputs, domainPrefix, constants);
    }
  }

  // src/operators.ts
  var GROUP_COLORS = {
    "Core Physics": "#00ff88",
    "Extended Physics": "#00d4ff",
    "Applied Sciences": "#ffd700",
    "Industry": "#ff6b35",
    "Frontier": "#b44fff"
  };
  var DOMAINS = [
    // === CORE PHYSICS (15 domains) ===
    {
      name: "Zeq Resonance Theory",
      group: "Core Physics",
      prefix: "ZR",
      color: GROUP_COLORS["Core Physics"],
      equations: [
        "R(t) = S(t) \xD7 [1 + 0.00129 \xD7 sin(2\u03C0 \xD7 1.287 \xD7 t)]",
        "\u03A8_zeq = \u222B\u2080^\u221E R(\u03C4) \xD7 e^{-i\u03C9\u03C4} d\u03C4",
        "\u0394\u03C6 = 2\u03C0 \xD7 f_zeq \xD7 \u0394t where f_zeq = 1.287 Hz"
      ],
      operatorNames: [
        "Resonance Core",
        "Phase Sync",
        "Pulse Integrator",
        "Modal Align",
        "Zeqond Lock",
        "Harmonic Root",
        "Frequency Bind",
        "State Modulator",
        "Pulse Envelope",
        "Resonance Map",
        "Field Coupling",
        "Phase Derivative",
        "Amplitude Trace",
        "Frequency Sweep",
        "Zeq Normalizer",
        "Mode Separator",
        "Spectral Gate",
        "Phase Inversion",
        "Resonance Sink",
        "Temporal Bind",
        "Coherence Index",
        "Pulse Width",
        "State Mapper",
        "Phase Boundary"
      ]
    },
    {
      name: "Quantum Mechanics",
      group: "Core Physics",
      prefix: "QM",
      color: GROUP_COLORS["Core Physics"],
      equations: ["i\u210F \u2202\u03C8/\u2202t = \u0124\u03C8", "\u0394x\u0394p \u2265 \u210F/2", "P(x) = |\u03C8(x)|\xB2"],
      operatorNames: [
        "Wave Function Solver",
        "Uncertainty Bound",
        "Expectation Value",
        "Probability Density",
        "Energy Eigenstate",
        "Hamiltonian Eval",
        "Momentum Op",
        "Position Op",
        "Schr\xF6dinger Step",
        "Wavepacket Norm",
        "Commutator Ring",
        "Hermitian Test",
        "Hilbert Projector",
        "Dirac Notation",
        "Bra-Ket Map",
        "Eigenvalue Finder",
        "State Superpose",
        "Collapse Op",
        "Basis Expand",
        "Tensor Product",
        "Spin Operator",
        "Angular Momentum",
        "Parity Checker",
        "Time Evolution"
      ]
    },
    {
      name: "Classical Mechanics",
      group: "Core Physics",
      prefix: "CM",
      color: GROUP_COLORS["Core Physics"],
      equations: ["F = ma", "KE = \xBDmv\xB2", "p = mv", "U = mgh"],
      operatorNames: [
        "Force Balance",
        "Kinetic Energy",
        "Momentum Calc",
        "Potential Energy",
        "Work-Energy",
        "Impulse",
        "Centripetal Force",
        "Torque",
        "Angular Velocity",
        "Moment of Inertia",
        "Rotational KE",
        "Elastic Collision",
        "Inelastic Collision",
        "Projectile Motion",
        "Friction Force",
        "Simple Harmonic",
        "Damped Oscillation",
        "Driven Oscillation",
        "Lagrangian",
        "Hamiltonian",
        "Phase Space",
        "Virial Theorem",
        "Noether Current",
        "Action Integral"
      ]
    },
    {
      name: "Electromagnetism",
      group: "Core Physics",
      prefix: "EM",
      color: GROUP_COLORS["Core Physics"],
      equations: ["F = q\xB2/(4\u03C0\u03B5\u2080r\xB2)", "F = q(E + v\xD7B)", "V = IR", "P = IV"],
      operatorNames: [
        "Coulomb Force",
        "Lorentz Force",
        "Ohm's Law",
        "Electric Power",
        "Gauss Law",
        "Faraday Induction",
        "Ampere Law",
        "Maxwell Displacement",
        "Poynting Vector",
        "Wave Equation",
        "Impedance",
        "Capacitance",
        "Inductance",
        "RC Circuit",
        "RLC Resonance",
        "Skin Effect",
        "Waveguide Mode",
        "Antenna Radiation",
        "Dipole Field",
        "Magnetic Flux",
        "Hall Effect",
        "Eddy Current",
        "Dielectric",
        "Polarization"
      ]
    },
    {
      name: "Thermodynamics",
      group: "Core Physics",
      prefix: "TD",
      color: GROUP_COLORS["Core Physics"],
      equations: ["PV = nRT", "E_th = (3/2)k_BT", "S = k_B ln \u03A9", "dU = \u03B4Q \u2212 \u03B4W"],
      operatorNames: [
        "Ideal Gas Law",
        "Thermal Energy",
        "Entropy Calc",
        "First Law",
        "Second Law",
        "Carnot Efficiency",
        "Heat Capacity",
        "Adiabatic Process",
        "Isothermal Process",
        "Isobaric Process",
        "Free Energy",
        "Enthalpy",
        "Gibbs Free Energy",
        "Phase Transition",
        "Clausius Inequality",
        "Heat Transfer",
        "Conduction",
        "Convection",
        "Radiation",
        "Stefan-Boltzmann",
        "Planck Distribution",
        "Wien Displacement",
        "Maxwell Distribution",
        "Equipartition"
      ]
    },
    {
      name: "General Relativity",
      group: "Core Physics",
      prefix: "GR",
      color: GROUP_COLORS["Core Physics"],
      equations: ["G_\u03BC\u03BD + \u039Bg_\u03BC\u03BD = 8\u03C0G/c\u2074 T_\u03BC\u03BD", "r_s = 2GM/c\xB2", "d\u03C4/dt = \u221A(1 \u2212 r_s/r)"],
      operatorNames: [
        "Einstein Field Eq",
        "Schwarzschild Radius",
        "Time Dilation",
        "Geodesic Equation",
        "Christoffel Symbol",
        "Ricci Tensor",
        "Riemann Curvature",
        "Metric Tensor",
        "Stress Energy",
        "Cosmological Constant",
        "Kerr Metric",
        "Frame Dragging",
        "Gravitational Waves",
        "Penrose Diagram",
        "Causal Structure",
        "Hawking Radiation",
        "Black Hole Entropy",
        "ADM Mass",
        "Komar Integral",
        "Weyl Tensor",
        "Conformal Transform",
        "Penrose Process",
        "Ergosphere",
        "Singularity"
      ]
    },
    {
      name: "Wave Physics",
      group: "Core Physics",
      prefix: "WP",
      color: GROUP_COLORS["Core Physics"],
      equations: ["v = \u03BBf", "k = 2\u03C0/\u03BB", "\u03C9 = 2\u03C0f"],
      operatorNames: [
        "Dispersion",
        "Wave Number",
        "Angular Frequency",
        "Group Velocity",
        "Phase Velocity",
        "Superposition",
        "Interference",
        "Diffraction",
        "Standing Wave",
        "Fourier Transform",
        "Wavelet",
        "Envelope",
        "Modulation",
        "Beat Frequency",
        "Doppler Shift",
        "Reflection",
        "Refraction",
        "Polarization",
        "Attenuation",
        "Scattering",
        "Coherence",
        "Bandwidth",
        "Signal Propagation",
        "Dispersion Relation"
      ]
    },
    {
      name: "Fluid Dynamics",
      group: "Core Physics",
      prefix: "FD",
      color: GROUP_COLORS["Core Physics"],
      equations: ["P\u2081 + \xBD\u03C1v\u2081\xB2 + \u03C1gh\u2081 = P\u2082 + \xBD\u03C1v\u2082\xB2 + \u03C1gh\u2082", "Re = \u03C1vD/\u03BC"],
      operatorNames: [
        "Bernoulli",
        "Reynolds Number",
        "Navier-Stokes",
        "Continuity",
        "Vorticity",
        "Turbulence Model",
        "Boundary Layer",
        "Drag Coefficient",
        "Lift Force",
        "Viscosity",
        "Compressible Flow",
        "Mach Number",
        "Shock Wave",
        "Potential Flow",
        "Stream Function",
        "Stokes Flow",
        "Couette Flow",
        "Poiseuille Flow",
        "Venturi Effect",
        "Cavitation",
        "Surface Tension",
        "Capillary Action",
        "Buoyancy",
        "Archimedes Principle"
      ]
    },
    {
      name: "Statistical Mechanics",
      group: "Core Physics",
      prefix: "SM",
      color: GROUP_COLORS["Core Physics"],
      equations: ["P_i = e^(-E_i/k_BT) / Z", "Z = \u03A3 e^(-E_i/k_BT)", "S = -k_B \u03A3 p_i ln p_i"],
      operatorNames: [
        "Boltzmann Factor",
        "Partition Function",
        "Entropy",
        "Microstate Count",
        "Ensemble Average",
        "Canonical Distribution",
        "Grand Canonical",
        "Microcanonical",
        "Fermi-Dirac",
        "Bose-Einstein",
        "Density of States",
        "Occupation Number",
        "Chemical Potential",
        "Phase Space Volume",
        "Ergodic",
        "Fluctuation",
        "Correlation Function",
        "Mean Field",
        "Ising Model",
        "Monte Carlo",
        "Renormalization",
        "Critical Exponent",
        "Order Parameter",
        "Universality"
      ]
    },
    {
      name: "Orbital Mechanics",
      group: "Core Physics",
      prefix: "OM",
      color: GROUP_COLORS["Core Physics"],
      equations: ["v_orb = \u221A(GM/r)", "T = 2\u03C0\u221A(r\xB3/GM)", "E = -GMm/(2r)"],
      operatorNames: [
        "Orbital Velocity",
        "Orbital Period",
        "Orbital Energy",
        "Kepler First Law",
        "Kepler Second Law",
        "Kepler Third Law",
        "Escape Velocity",
        "Hohmann Transfer",
        "Delta-V",
        "Inclination Change",
        "Apoapsis",
        "Periapsis",
        "Eccentricity",
        "Semi-Major Axis",
        "Orbital Elements",
        "Two-Body Problem",
        "Three-Body Problem",
        "Lagrange Points",
        "Hill Sphere",
        "Roche Limit",
        "Tidal Force",
        "Precession",
        "Orbital Decay",
        "Gravitational Assist"
      ]
    },
    {
      name: "Nuclear Physics",
      group: "Core Physics",
      prefix: "NU",
      color: GROUP_COLORS["Core Physics"],
      equations: ["BE = a_v\xB7A \u2212 a_s\xB7A^(2/3) \u2212 a_c\xB7Z(Z\u22121)/A^(1/3) \u2212 a_a\xB7(N\u2212Z)\xB2/A \xB1 \u03B4"],
      operatorNames: [
        "Binding Energy",
        "Mass Defect",
        "Nuclear Radius",
        "Decay Constant",
        "Half-Life",
        "Cross Section",
        "Fission Yield",
        "Fusion Rate",
        "Neutron Flux",
        "Criticality",
        "Moderation",
        "Absorption",
        "Scattering",
        "Resonance",
        "Shell Model",
        "Liquid Drop",
        "Fermi Gas",
        "Pairing Energy",
        "Isospin",
        "Magic Numbers",
        "Alpha Decay",
        "Beta Decay",
        "Gamma Emission",
        "Tunneling"
      ]
    },
    {
      name: "Optics",
      group: "Core Physics",
      prefix: "OP",
      color: GROUP_COLORS["Core Physics"],
      equations: ["n\u2081 sin(\u03B8\u2081) = n\u2082 sin(\u03B8\u2082)", "Rs = [(n\u2081cos\u03B8\u2081 \u2212 n\u2082cos\u03B8\u2082)/(n\u2081cos\u03B8\u2081 + n\u2082cos\u03B8\u2082)]\xB2"],
      operatorNames: [
        "Snell's Law",
        "Fresnel Reflection",
        "Total Internal Reflection",
        "Brewster Angle",
        "Thin Lens",
        "Thick Lens",
        "Mirror Equation",
        "Magnification",
        "Aberration",
        "Diffraction Grating",
        "Airy Disk",
        "Rayleigh Criterion",
        "Interference Pattern",
        "Michelson Interferometer",
        "Fabry-Perot",
        "Optical Path",
        "Group Delay",
        "Dispersion Compensation",
        "Nonlinear Optics",
        "Kerr Effect",
        "Raman Scattering",
        "Brillouin Scattering",
        "Photonic Crystal",
        "Fiber Optics"
      ]
    },
    {
      name: "Quantum Resonance",
      group: "Core Physics",
      prefix: "QR",
      color: GROUP_COLORS["Core Physics"],
      equations: ["\u03C9_r = 1/\u221A(LC)", "Q = \u03C9\u2080L/R"],
      operatorNames: [
        "Resonance Frequency",
        "Quality Factor",
        "Susceptibility Map",
        "Amplitude Peak",
        "Decay Time",
        "Bandwidth Calc",
        "Coupling Strength",
        "Mode Volume",
        "Phase Response",
        "Gain Profile",
        "Damping Ratio",
        "Resonant Lift",
        "Spectral Width",
        "Transfer Func",
        "Impedance Match",
        "Loop Gain",
        "Feedback Factor",
        "Mode Splitter",
        "Cross-Coupling",
        "Resonance Shift",
        "Frequency Pull",
        "Noise Figure",
        "Signal-to-Noise",
        "Coherence Time"
      ]
    },
    {
      name: "Particle Physics",
      group: "Core Physics",
      prefix: "PP",
      color: GROUP_COLORS["Core Physics"],
      equations: ["V = q\xB2/(4\u03C0\u03B5\u2080r)", "\u03BB = h/p_rel", "p_rel = \u03B3mv"],
      operatorNames: [
        "Coulomb Potential",
        "de Broglie Wavelength",
        "Relativistic Momentum",
        "Cross Section",
        "Decay Width",
        "Feynman Diagram",
        "Propagator",
        "Vertex Factor",
        "S-Matrix",
        "Scattering Amplitude",
        "Invariant Mass",
        "Rapidity",
        "Pseudorapidity",
        "Luminosity",
        "Branching Ratio",
        "CKM Matrix",
        "CP Violation",
        "Spontaneous Symmetry",
        "Higgs Mechanism",
        "Gauge Boson",
        "Quark Model",
        "Lepton Number",
        "Baryon Number",
        "Color Charge"
      ]
    },
    {
      name: "Acoustics",
      group: "Core Physics",
      prefix: "AC",
      color: GROUP_COLORS["Core Physics"],
      equations: ["I = P/(4\u03C0r\xB2)", "L = 10 log\u2081\u2080(I/I\u2080)", "f_n = nv/(2L)"],
      operatorNames: [
        "Sound Intensity",
        "Decibel Level",
        "Resonant Frequency",
        "Impedance",
        "Absorption",
        "Reflection Coefficient",
        "Transmission Loss",
        "Reverberation Time",
        "Speed of Sound",
        "Doppler Effect",
        "Standing Wave",
        "Helmholtz Resonator",
        "Room Mode",
        "Critical Distance",
        "Flutter Echo",
        "Sound Power",
        "Directivity",
        "Wavelength",
        "Frequency Response",
        "Harmonic Series",
        "Beating",
        "Interference",
        "Diffraction",
        "Acoustic Pressure"
      ]
    }
  ];
  var _operatorCache = null;
  function getOperators() {
    if (_operatorCache) return _operatorCache;
    const ops = [];
    for (const domain of DOMAINS) {
      const eqCount = domain.equations.length;
      for (let i = 0; i < domain.operatorNames.length; i++) {
        const name = domain.operatorNames[i];
        const id = `${domain.prefix}${String(i + 1).padStart(2, "0")}`;
        ops.push({
          id,
          name,
          domain: domain.name,
          domainGroup: domain.group,
          equation: domain.equations[i % eqCount],
          precision: ALPHA_K,
          description: `${name} \u2014 ${domain.name} operator (${domain.group})`
        });
      }
    }
    _operatorCache = ops;
    return ops;
  }
  function findDomain(query) {
    const q = query.toLowerCase().replace(/[-_\s]/g, "");
    return DOMAINS.find(
      (d) => d.prefix.toLowerCase() === q || d.name.toLowerCase().replace(/[-_\s]/g, "") === q || d.name.toLowerCase().includes(query.toLowerCase())
    );
  }

  // local-engine.entry.ts
  function resolvePrefix(domain, operators) {
    if (domain) {
      const d = findDomain(domain);
      if (d) return d.prefix;
    }
    const ops = getOperators();
    for (const opId of operators ?? []) {
      const o = ops.find((x) => x.id === opId);
      if (o) {
        const d = findDomain(o.domain);
        if (d) return d.prefix;
      }
    }
    return "ZR";
  }
  function compute(args) {
    const prefix = resolvePrefix(args.domain, args.operators);
    const r = computeByDomain(prefix, args.inputs ?? {}, {});
    return {
      value: r.value,
      unit: r.unit,
      uncertainty: r.uncertainty,
      equation: r.equation,
      detail: r.detail,
      mode: "local",
      prefix
    };
  }
  var ZeqLocalEngine = { compute, resolvePrefix, version: "1.287" };
  globalThis.ZeqLocalEngine = ZeqLocalEngine;
})();
