"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DEFAULT_BULLISH_CONFIG = void 0;
exports.bullish = bullish;
exports.default = void 0;
var _MorningStar = _interopRequireWildcard(require("./MorningStar"));
var _BullishEngulfingPattern = _interopRequireWildcard(require("./BullishEngulfingPattern"));
var _BullishHarami = _interopRequireWildcard(require("./BullishHarami"));
var _BullishHaramiCross = _interopRequireWildcard(require("./BullishHaramiCross"));
var _MorningDojiStar = _interopRequireWildcard(require("./MorningDojiStar"));
var _DownsideTasukiGap = _interopRequireWildcard(require("./DownsideTasukiGap"));
var _BullishMarubozu = _interopRequireWildcard(require("./BullishMarubozu"));
var _PiercingLine = _interopRequireWildcard(require("./PiercingLine"));
var _ThreeWhiteSoldiers = _interopRequireWildcard(require("./ThreeWhiteSoldiers"));
var _BullishHammerStick = _interopRequireWildcard(require("./BullishHammerStick"));
var _BullishInvertedHammerStick = _interopRequireWildcard(require("./BullishInvertedHammerStick"));
var _HammerPattern = _interopRequireWildcard(require("./HammerPattern"));
var _HammerPatternUnconfirmed = _interopRequireWildcard(require("./HammerPatternUnconfirmed"));
var _CandlestickFinder = _interopRequireWildcard(require("./CandlestickFinder"));
var _TweezerBottom = _interopRequireWildcard(require("./TweezerBottom"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
 * Configuration interface for Bullish patterns composite.
 * Only requires scale parameter since this is a composite pattern.
 */

/**
 * Default configuration for Bullish patterns composite.
 */
const DEFAULT_BULLISH_CONFIG = exports.DEFAULT_BULLISH_CONFIG = {
  ..._CandlestickFinder.DEFAULT_CANDLESTICK_CONFIG,
  ..._BullishEngulfingPattern.DEFAULT_BULLISH_ENGULFING_CONFIG,
  ..._DownsideTasukiGap.DEFAULT_DOWNSIDE_TASUKI_GAP_CONFIG,
  ..._BullishHarami.DEFAULT_BULLISH_HARAMI_CONFIG,
  ..._BullishHaramiCross.DEFAULT_BULLISH_HARAMI_CROSS_CONFIG,
  ..._MorningStar.DEFAULT_MORNING_STAR_CONFIG,
  ..._MorningDojiStar.DEFAULT_MORNING_DOJI_STAR_CONFIG,
  ..._BullishMarubozu.DEFAULT_BULLISH_MARUBOZU_CONFIG,
  ..._PiercingLine.DEFAULT_PIERCING_LINE_CONFIG,
  ..._ThreeWhiteSoldiers.DEFAULT_THREE_WHITE_SOLDIERS_CONFIG,
  ..._BullishHammerStick.DEFAULT_BULLISH_HAMMER_CONFIG,
  ..._BullishInvertedHammerStick.DEFAULT_BULLISH_INVERTED_HAMMER_STICK_CONFIG,
  ..._HammerPattern.DEFAULT_HAMMER_PATTERN_CONFIG,
  ..._HammerPatternUnconfirmed.DEFAULT_HAMMER_PATTERN_UNCONFIRMED_CONFIG,
  ..._TweezerBottom.DEFAULT_TWEEZER_BOTTOM_CONFIG
};
class BullishPatterns extends _CandlestickFinder.default {
  bullishPatterns;
  constructor(config) {
    const finalConfig = {
      ...DEFAULT_BULLISH_CONFIG,
      ...config
    };
    super(finalConfig);
    this.name = 'Bullish Candlesticks';

    // Initialize all bullish patterns with their default configurations
    this.bullishPatterns = [new _BullishEngulfingPattern.default(config), new _DownsideTasukiGap.default(config), new _BullishHarami.default(config), new _BullishHaramiCross.default(config), new _MorningDojiStar.default(config), new _MorningStar.default(config), new _BullishMarubozu.default(config), new _PiercingLine.default(config), new _ThreeWhiteSoldiers.default(config), new _BullishHammerStick.default(config), new _BullishInvertedHammerStick.default(config), new _HammerPattern.default(config), new _HammerPatternUnconfirmed.default(config), new _TweezerBottom.default(config)];
  }
  hasPattern(data) {
    return this.bullishPatterns.reduce(function (state, pattern) {
      let result = pattern.hasPattern(data);
      return state || result;
    }, false);
  }
}

/**
 * Detects any bullish candlestick pattern in the provided stock data.
 *
 * This function checks for multiple bullish candlestick patterns including:
 * - Bullish Engulfing Pattern
 * - Bullish Harami and Bullish Harami Cross
 * - Morning Star and Morning Doji Star
 * - Bullish Marubozu
 * - Three White Soldiers
 * - Bullish Hammer Stick and Bullish Inverted Hammer Stick
 * - Hammer Pattern and Hammer Pattern Unconfirmed
 * - Downside Tasuki Gap, Piercing Line, and Tweezer Bottom
 *
 * @param data - Stock data containing OHLC values
 * @param config - Configuration object for pattern detection
 * @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
 * @returns True if any bullish pattern is detected, false otherwise
 *
 * @example
 * ```typescript
 * // Using default configuration
 * const hasBullishPattern = bullish(stockData);
 *
 * // Using custom configuration
 * const hasBullishPattern = bullish(stockData, {
 *   scale: 0.002
 * });
 *
 * // Backward compatibility with scale parameter
 * const hasBullishPattern = bullish(stockData, { scale: 0.002 });
 * ```
 */
exports.default = BullishPatterns;
function bullish(data, config = DEFAULT_BULLISH_CONFIG) {
  return new BullishPatterns(config).hasPattern(data);
}
//# sourceMappingURL=Bullish.js.map