import importlib.util
import os
import sys

# // edited by glg (18:23 WIB, 2026-02-11)
# // change: Tambahkan resolver dependency lokal `escpos` dari folder libs.
# // technical rationale: Setelah vendor dipindah ke `libs/python-escpos`, runtime source maupun build harus tetap dapat import `escpos` secara konsisten.
if importlib.util.find_spec("escpos") is None:
    _project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
    _local_escpos_root = os.path.join(_project_root, "libs", "python-escpos")
    if os.path.isdir(_local_escpos_root) and _local_escpos_root not in sys.path:
        sys.path.insert(0, _local_escpos_root)
