'use strict';

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));

// src/chrome/grooved-panel-dark-appearance.tsx
var DEFAULT_GROOVED_PANEL_DARK_APPEARANCE = {
  gradientStartHex: "#1E1F1C",
  gradientEndHex: "#1E1E21",
  grooveLineHex: "#29292e",
  grooveOpacity: 0.98,
  sheenColorHex: "#292929",
  sheenOpacity: 0,
  topVignetteOpacity: 0.15,
  topCrushExtended: 0.5,
  brushGrooveIntensity: 0,
  brushBaseGradientDepth: 5
};
function normalizeGrooveHex(input, fallback) {
  const t = input.trim().replace(/^#/, "");
  if (/^[0-9A-Fa-f]{6}$/.test(t)) return `#${t}`;
  if (/^[0-9A-Fa-f]{3}$/.test(t)) {
    return `#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`;
  }
  return fallback;
}
function clampOpacity(value) {
  if (!Number.isFinite(value)) return 0;
  return Math.min(1, Math.max(0, value));
}
function clampGrooveDial(value, fallback) {
  if (!Number.isFinite(value)) return fallback;
  return Math.min(200, Math.max(0, value));
}
function mergeGroovedPanelDarkAppearance(incoming, base) {
  var _a, _b, _c, _d, _e, _f;
  const merged = __spreadValues(__spreadValues({}, base), incoming != null ? incoming : {});
  return __spreadProps(__spreadValues({}, merged), {
    grooveOpacity: clampOpacity(
      (_a = merged.grooveOpacity) != null ? _a : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.grooveOpacity
    ),
    sheenOpacity: clampOpacity(
      (_b = merged.sheenOpacity) != null ? _b : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.sheenOpacity
    ),
    topVignetteOpacity: clampOpacity(
      (_c = merged.topVignetteOpacity) != null ? _c : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.topVignetteOpacity
    ),
    topCrushExtended: clampOpacity(
      (_d = merged.topCrushExtended) != null ? _d : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.topCrushExtended
    ),
    brushGrooveIntensity: clampGrooveDial(
      (_e = merged.brushGrooveIntensity) != null ? _e : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushGrooveIntensity,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushGrooveIntensity
    ),
    brushBaseGradientDepth: clampGrooveDial(
      (_f = merged.brushBaseGradientDepth) != null ? _f : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushBaseGradientDepth,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushBaseGradientDepth
    )
  });
}
function normalizeAppearanceForCanvas(a) {
  var _a, _b, _c, _d, _e, _f;
  return {
    gradientStartHex: normalizeGrooveHex(
      a.gradientStartHex,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.gradientStartHex
    ),
    gradientEndHex: normalizeGrooveHex(
      a.gradientEndHex,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.gradientEndHex
    ),
    grooveLineHex: normalizeGrooveHex(
      a.grooveLineHex,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.grooveLineHex
    ),
    grooveOpacity: clampOpacity(
      (_a = a.grooveOpacity) != null ? _a : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.grooveOpacity
    ),
    sheenColorHex: normalizeGrooveHex(
      a.sheenColorHex,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.sheenColorHex
    ),
    sheenOpacity: clampOpacity(
      (_b = a.sheenOpacity) != null ? _b : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.sheenOpacity
    ),
    topVignetteOpacity: clampOpacity(
      (_c = a.topVignetteOpacity) != null ? _c : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.topVignetteOpacity
    ),
    topCrushExtended: clampOpacity(
      (_d = a.topCrushExtended) != null ? _d : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.topCrushExtended
    ),
    brushGrooveIntensity: clampGrooveDial(
      (_e = a.brushGrooveIntensity) != null ? _e : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushGrooveIntensity,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushGrooveIntensity
    ),
    brushBaseGradientDepth: clampGrooveDial(
      (_f = a.brushBaseGradientDepth) != null ? _f : DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushBaseGradientDepth,
      DEFAULT_GROOVED_PANEL_DARK_APPEARANCE.brushBaseGradientDepth
    )
  };
}

exports.DEFAULT_GROOVED_PANEL_DARK_APPEARANCE = DEFAULT_GROOVED_PANEL_DARK_APPEARANCE;
exports.clampGrooveDial = clampGrooveDial;
exports.clampOpacity = clampOpacity;
exports.mergeGroovedPanelDarkAppearance = mergeGroovedPanelDarkAppearance;
exports.normalizeAppearanceForCanvas = normalizeAppearanceForCanvas;
exports.normalizeGrooveHex = normalizeGrooveHex;
//# sourceMappingURL=grooved-panel-dark-appearance.cjs.map
//# sourceMappingURL=grooved-panel-dark-appearance.cjs.map