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 __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/walletList/index.tsx
var walletList_exports = {};
__export(walletList_exports, {
  default: () => walletList_default
});
module.exports = __toCommonJS(walletList_exports);
var import_react = __toESM(require("react"));
var import_model = require("./model");
var import_materials = require("@pisell/materials");
var import_icons = require("@ant-design/icons");
var import_useEngineContext = __toESM(require("./../../hooks/useEngineContext"));
var import_serve = require("./serve");
var import_utils = require("@pisell/utils");
var import_utils2 = require("./../../utils");
var import_status = require("./status");
var import_locales = __toESM(require("./locales"));
var import_index = require("./index.less");
var import_classnames = __toESM(require("classnames"));
var import_tempHolderSelector = __toESM(require("./tempHolderSelector"));
var import_types = require("./types");
var import_pinModal = __toESM(require("../pinModal"));
var STORAGE_KEY = "pisell_wallet_list_data";
var STORAGE_KEY_BALANCE = "pisell_wallet_balance_data";
var safeLocalStorage = {
  getItem: (key) => {
    try {
      return typeof localStorage !== "undefined" ? localStorage.getItem(key) : null;
    } catch (error) {
      console.error("Error accessing localStorage:", error);
      return null;
    }
  },
  setItem: (key, value) => {
    try {
      if (typeof localStorage !== "undefined") {
        localStorage.setItem(key, value);
      }
    } catch (error) {
      console.error("Error writing to localStorage:", error);
    }
  }
};
var saveToLocalStorage = (key, data) => {
  try {
    safeLocalStorage.setItem(key, JSON.stringify(data));
  } catch (error) {
    console.error("Error saving to localStorage:", error);
  }
};
var getFromLocalStorage = (key) => {
  try {
    const data = safeLocalStorage.getItem(key);
    return data ? JSON.parse(data) : null;
  } catch (error) {
    console.error("Error reading from localStorage:", error);
    return null;
  }
};
var getLocalizedName = (name, translateLocale) => {
  if (!name) return "";
  return name[translateLocale || "en"] || name.original || "";
};
var DEFAULT_WALLET_CARD = {
  id: "default-wallet-card",
  code: "Wallet number",
  shop: {
    name: "Store name"
  },
  isLogin: false,
  showIcon: true,
  icon: "",
  wallet: {
    name: {
      original: "Level",
      "zh-CN": "Level",
      "zh-HK": "Level",
      "ja": "Level",
      "pt": "Level",
      en: "Level"
    },
    metadata: {
      showcaseWalletPassNew: [
        {
          type: "rechargeable",
          display: 1,
          custom_title: {
            original: "Balance",
            "zh-CN": "充值卡",
            "zh-HK": "充值卡",
            "ja": "充值卡",
            "pt": "Cartão de recarga",
            en: "Balance"
          }
        },
        {
          type: "point",
          display: 1,
          custom_title: {
            original: "Points",
            "zh-CN": "积分卡",
            "zh-HK": "積分卡",
            "ja": "ポイントカード",
            "pt": "Pontos",
            en: "Points"
          }
        },
        {
          type: "voucher",
          display: 1,
          custom_title: {
            original: "Voucher",
            "zh-CN": "代金券",
            "zh-HK": "代金券",
            "ja": "クーポン",
            "pt": "Cupom",
            en: "Voucher"
          }
        },
        {
          type: "discount",
          display: 1,
          custom_title: {
            original: "Discount",
            "zh-CN": "折扣卡",
            "zh-HK": "折扣卡",
            "ja": "割引カード",
            "pt": "Cartão de desconto",
            en: "Discount"
          }
        }
      ],
      coverImage: "",
      icon: ""
    }
  }
};
var DEFAULT_BALANCE = {
  gift_card_balance: 0,
  point_card_balance: 0,
  voucher_count: 0,
  discount_card_count: 0,
  good_pass_count: 0
};
var WalletList = (0, import_model.Provider)((props) => {
  var _a, _b, _c, _d, _e, _f, _g;
  const { globalState = {} } = props;
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
  const context = (0, import_useEngineContext.default)();
  const { constants, utils } = context.appHelper || {};
  const dvaStore = (_b = (_a = utils == null ? void 0 : utils.getStore) == null ? void 0 : _a.call(utils)) == null ? void 0 : _b.getState();
  import_utils.locales.init(import_locales.default, ((_d = (_c = context == null ? void 0 : context.engine) == null ? void 0 : _c.props) == null ? void 0 : _d.locale) || "en");
  const isMountedRef = (0, import_react.useRef)(true);
  const carouselRef = (0, import_react.useRef)(null);
  const { store } = utils;
  const symbol = ((_g = (_f = (_e = store == null ? void 0 : store.getState) == null ? void 0 : _e.call(store)) == null ? void 0 : _f.global) == null ? void 0 : _g.symbol) || "$";
  const prevButtonRef = (0, import_react.useRef)(null);
  const nextButtonRef = (0, import_react.useRef)(null);
  const [currentIndex, setCurrentIndex] = (0, import_react.useState)(0);
  const [walletShopList, setWalletShopList] = (0, import_react.useState)([]);
  const [editHolderVisible, setEditHolderVisible] = (0, import_react.useState)(false);
  const [editHolderData, setEditHolderData] = (0, import_react.useState)(null);
  const [updateHolderLoading, setUpdateHolderLoading] = (0, import_react.useState)(false);
  const requestIdRef = (0, import_react.useRef)("");
  const pubsub = utils == null ? void 0 : utils.pubsub;
  const pinModalRef = (0, import_react.useRef)(null);
  const isUserLoggedIn = (0, import_react.useMemo)(() => {
    var _a2, _b2;
    return !!((_b2 = (_a2 = utils == null ? void 0 : utils.token) == null ? void 0 : _a2.get) == null ? void 0 : _b2.call(_a2)) || false;
  }, [store]);
  const { list = [], error, authError, hasAttempted, isLoggedIn } = state;
  (0, import_react.useEffect)(() => {
    if (utils == null ? void 0 : utils.request) {
      import_utils2.request.setRequest(utils.request);
    }
  }, [utils == null ? void 0 : utils.request]);
  (0, import_react.useEffect)(() => {
    if (isUserLoggedIn) {
      (0, import_serve.getWalletShopList)({ skip: 1, num: 50 }).then((res) => {
        pubsub.publish("wallet:shopList", res);
      });
      const subscription = pubsub.subscribe("wallet:shopList", (res) => {
        setWalletShopList((res == null ? void 0 : res.list) || []);
      });
      return () => {
        subscription.unsubscribe();
      };
    }
  }, [isUserLoggedIn]);
  (0, import_react.useEffect)(() => {
    return () => {
      isMountedRef.current = false;
      requestIdRef.current = "";
    };
  }, []);
  (0, import_react.useEffect)(() => {
    if (hasAttempted) return;
    if (!isUserLoggedIn) {
      if (isMountedRef.current) {
        setState({
          list: [DEFAULT_WALLET_CARD],
          balance: [],
          hasAttempted: true,
          isLoggedIn: false
        });
      }
      return;
    }
    const currentRequestId = Date.now().toString();
    requestIdRef.current = currentRequestId;
    const fetchData = async () => {
      if (!isMountedRef.current) return;
      if (requestIdRef.current !== currentRequestId) return;
      await initData(currentRequestId);
    };
    fetchData().catch((err) => {
      if (isMountedRef.current) {
        console.error("请求数据出错:", err);
      }
    });
  }, [hasAttempted, isUserLoggedIn]);
  (0, import_react.useEffect)(() => {
    const timer = setTimeout(() => {
      if (!isMountedRef.current) return;
      const prevButton = document.querySelector(
        ".pisell-lowcode__walletList .slick-prev"
      );
      const nextButton = document.querySelector(
        ".pisell-lowcode__walletList .slick-next"
      );
      if (prevButton) {
        prevButtonRef.current = prevButton;
      }
      if (nextButton) {
        nextButtonRef.current = nextButton;
      }
    }, 300);
    return () => clearTimeout(timer);
  }, [list]);
  (0, import_react.useEffect)(() => {
    if (!isMountedRef.current) return;
    const timerId = setTimeout(() => {
      if (!isMountedRef.current) return;
    }, 500);
    return () => {
      clearTimeout(timerId);
    };
  }, [list]);
  const handleAfterChange = (current) => {
    if (isMountedRef.current) {
      setCurrentIndex(current);
    }
  };
  const setState = (0, import_react.useCallback)(
    (payload) => {
      if (isMountedRef.current) {
        dispatch({
          type: "setState",
          payload
        });
      }
    },
    [dispatch]
  );
  const handlePrevClick = (e) => {
    e.stopPropagation();
    e.preventDefault();
    if (currentIndex === 0) {
      return;
    }
    const newIndex = currentIndex - 1;
    if (isMountedRef.current) {
      setCurrentIndex(newIndex);
    }
    if (isMountedRef.current && carouselRef.current && typeof carouselRef.current.goTo === "function") {
      carouselRef.current.goTo(newIndex);
    }
  };
  const handleNextClick = (e) => {
    e.stopPropagation();
    e.preventDefault();
    if (currentIndex === list.length - 1) {
      return;
    }
    const newIndex = currentIndex + 1;
    if (isMountedRef.current) {
      setCurrentIndex(newIndex);
    }
    if (isMountedRef.current && carouselRef.current && typeof carouselRef.current.goTo === "function") {
      carouselRef.current.goTo(newIndex);
    }
  };
  const initData = async (requestId) => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h;
    if (!isMountedRef.current) return;
    if (requestIdRef.current !== requestId) return;
    if (!isUserLoggedIn) {
      setState({
        list: [DEFAULT_WALLET_CARD],
        balance: [],
        hasAttempted: true,
        isLoggedIn: false
      });
      return;
    }
    if (hasAttempted) return;
    let cachedList = null;
    let cachedBalance = null;
    try {
      cachedList = getFromLocalStorage(STORAGE_KEY);
      cachedBalance = getFromLocalStorage(STORAGE_KEY_BALANCE);
      if (!Array.isArray(cachedBalance) || !cachedBalance.some(
        (item) => {
          var _a3;
          return (_a3 = item.hasOwnProperty) == null ? void 0 : _a3.call(item, "gift_card_balance");
        }
      )) {
        cachedBalance = null;
      }
    } catch (e) {
      console.error("Error fetching from localStorage:", e);
    }
    if (cachedList && cachedBalance) {
      setState({
        list: cachedList,
        balance: cachedBalance,
        hasAttempted: false
      });
    }
    let tempList = [];
    try {
      if (!isMountedRef.current) return;
      const walletListData = await (0, import_serve.getWalletList)();
      const walletBalanceData = await (0, import_serve.batchGetWalletBalance)(
        walletListData.map((item) => item.wallet_id)
      );
      if (!isMountedRef.current || requestIdRef.current !== requestId) return;
      if (walletListData) {
        try {
          saveToLocalStorage(STORAGE_KEY, walletListData);
        } catch (e) {
          console.error("Error saving wallet list to localStorage:", e);
        }
      }
      if (walletBalanceData) {
        try {
          saveToLocalStorage(STORAGE_KEY_BALANCE, walletBalanceData);
        } catch (e) {
          console.error("Error saving wallet balance to localStorage:", e);
        }
      }
      if (!walletBalanceData || Array.isArray(walletListData) && walletListData.length === 0) {
        setTimeout(async () => {
          if (!isMountedRef.current || requestIdRef.current !== requestId)
            return;
          try {
            let retryBalanceData = walletBalanceData;
            let retryListData = walletListData;
            if (Array.isArray(walletListData) && walletListData.length === 0) {
              retryListData = await (0, import_serve.getWalletList)();
              if (retryListData && retryListData.length > 0) {
                try {
                  saveToLocalStorage(STORAGE_KEY, retryListData);
                } catch (e) {
                  console.error("Error saving retry list to localStorage:", e);
                }
              }
            }
            if (!walletBalanceData) {
              retryBalanceData = await (0, import_serve.batchGetWalletBalance)(
                retryListData.map((item) => item.wallet_id)
              );
              if (retryBalanceData) {
                try {
                  saveToLocalStorage(STORAGE_KEY_BALANCE, retryBalanceData);
                } catch (e) {
                  console.error(
                    "Error saving retry balance to localStorage:",
                    e
                  );
                }
              }
            }
            setState({
              list: retryListData || [],
              balance: retryBalanceData,
              hasAttempted: true
            });
            tempList = retryListData || [];
          } catch (retryErr) {
            setState({
              list: walletListData || [],
              balance: walletBalanceData,
              hasAttempted: true
            });
            tempList = walletListData || [];
          }
        }, 2e3);
      } else {
        setState({
          list: walletListData || [],
          balance: walletBalanceData,
          hasAttempted: true
        });
        tempList = walletListData || [];
      }
    } catch (err) {
      if (!isMountedRef.current || requestIdRef.current !== requestId) return;
      const isAuthError = (err == null ? void 0 : err.code) === 4001 || ((_a2 = err == null ? void 0 : err.message) == null ? void 0 : _a2.includes("login time out")) || ((_b2 = err == null ? void 0 : err.data) == null ? void 0 : _b2.code) === 4001;
      setState({
        error: err instanceof Error ? err : new Error("加载失败"),
        authError: isAuthError,
        hasAttempted: true
      });
    }
    const walletDetailId = new URLSearchParams(window.location.search).get(
      "wallet_detail_id"
    );
    if (walletDetailId) {
      const found = tempList.find((item) => String(item.id) === walletDetailId);
      if (found) {
        setCurrentIndex(tempList.indexOf(found));
        (_c2 = carouselRef.current) == null ? void 0 : _c2.goTo(tempList.indexOf(found), true);
        if (((_d2 = found.holder) == null ? void 0 : _d2.holder_type) === "form" && !((_e2 = found.holder) == null ? void 0 : _e2.holder_id)) {
          setEditHolderData({
            wallet_record_id: found.id,
            customer_id: (_f2 = found.holder) == null ? void 0 : _f2.customer_id,
            form_id: ((_h = (_g2 = found.holder) == null ? void 0 : _g2.metadata) == null ? void 0 : _h.custom_id) || ""
          });
          setEditHolderVisible(true);
        }
      }
    }
  };
  const onBindHolder = async (holderId) => {
    if (!(editHolderData == null ? void 0 : editHolderData.wallet_record_id)) {
      console.error("wallet_record_id is required");
      return;
    }
    setUpdateHolderLoading(true);
    try {
      const res = await (0, import_serve.updateWalletHolder)(editHolderData == null ? void 0 : editHolderData.wallet_record_id, {
        holder_id: holderId,
        holder_type: "form"
      });
      setEditHolderVisible(false);
      setEditHolderData(null);
      let newList = list;
      if (holderId) {
        if (res) {
          newList = newList.map((item) => {
            if (item.id === (editHolderData == null ? void 0 : editHolderData.wallet_record_id)) {
              return {
                ...item,
                holder: res
              };
            }
            return item;
          });
        }
      } else {
        newList = newList.map((item) => {
          if (item.id === (editHolderData == null ? void 0 : editHolderData.wallet_record_id)) {
            return {
              ...item,
              holder: null
            };
          }
          return item;
        });
      }
      setState({
        list: newList
      });
    } catch (error2) {
      console.error("Error updating wallet holder:", error2);
    } finally {
      setUpdateHolderLoading(false);
    }
  };
  const onViewPinClick = (card) => {
    var _a2;
    if (card == null ? void 0 : card.id) {
      (_a2 = pinModalRef.current) == null ? void 0 : _a2.open(card == null ? void 0 : card.id);
    } else {
      console.error("onViewPinClick方法需要传入wallet_detail_id");
    }
  };
  const renderWalletCard = (item) => {
    var _a2;
    const { code, shop, wallet, id, customer_id, holder } = item;
    const { metadata, name } = wallet || {};
    const {
      showcaseWalletPassNew = [],
      coverImage = "",
      icon = ""
    } = metadata || {};
    const { name: shopName } = shop;
    const { balance = [] } = state;
    const balanceItem = balance.find((bi) => bi.wallet_id == item.wallet_id) || DEFAULT_BALANCE;
    const _balanceKeyMap = {
      rechargeable: "gift_card_balance",
      point: "point_card_balance",
      voucher: "voucher_count",
      discount: "discount_card_count"
    };
    const cardItems = showcaseWalletPassNew.map((showCaseItem) => {
      const balanceKey = _balanceKeyMap[showCaseItem.type];
      let value = balanceKey ? balanceItem[balanceKey] || 0 : 0;
      if (showCaseItem.type === "voucher") {
        value += balanceItem.good_pass_count || 0;
      }
      return {
        ...showCaseItem,
        value
      };
    });
    const cardProps = {
      // 先应用默认配置
      ...import_types.DEFAULT_CARD_CONFIG,
      // 再应用globalState作为兜底
      ...globalState,
      // 最后应用API返回的数据，这些拥有最高优先级
      id: wallet.id,
      iconImg: icon,
      symbol,
      cardNo: code,
      walletName: getLocalizedName(name, (_a2 = dvaStore == null ? void 0 : dvaStore.core) == null ? void 0 : _a2.translateLocale),
      shopName,
      // codeType: barcodetype,
      items: cardItems.slice(0, 4),
      customBackgroundImage: coverImage,
      isLogin: isUserLoggedIn,
      // 添加登录状态
      holder,
      onSetHolder: () => {
        var _a3;
        setEditHolderData({
          wallet_record_id: id,
          customer_id: holder == null ? void 0 : holder.customer_id,
          form_id: (_a3 = holder == null ? void 0 : holder.metadata) == null ? void 0 : _a3.custom_id
        });
        setEditHolderVisible(true);
      }
    };
    return /* @__PURE__ */ import_react.default.createElement(
      import_materials.WalletCard,
      {
        key: id,
        ...cardProps,
        onViewPinClick: () => onViewPinClick(item)
      }
    );
  };
  const carouselProps = {
    className: (0, import_classnames.default)("pisell-lowcode__walletList"),
    arrows: false,
    // 关闭组件自带的箭头，我们使用自定义按钮
    infinite: false,
    // 禁用循环滚动
    slidesToShow: 1,
    slidesToScroll: 1,
    centerMode: false,
    autoplay: false,
    dots: false,
    // 完全禁用内置的导航点，使用自定义导航点
    draggable: true,
    swipe: true,
    accessibility: true,
    // 确保键盘导航可用
    pauseOnHover: true,
    pauseOnFocus: true,
    speed: 500,
    // 设置动画速度
    useCSS: true,
    // 使用CSS转换
    useTransform: true,
    // 使用CSS转换
    variableWidth: false,
    // 不使用可变宽度
    adaptiveHeight: true,
    // 使用自适应高度
    initialSlide: 0,
    // 从第一张幻灯片开始
    waitForAnimate: false,
    // 不等待动画完成
    afterChange: handleAfterChange,
    // 添加afterChange事件处理函数
    // 手动设置当前滑块
    currentSlide: currentIndex,
    // 将dots内容渲染为空元素，彻底隐藏
    appendDots: () => /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "none" } }),
    responsive: [
      {
        breakpoint: 768,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1,
          centerMode: false,
          infinite: false,
          // 在响应式设置中也禁用循环滚动
          swipe: true,
          draggable: true,
          accessibility: true,
          arrows: false
          // 响应式设置中也关闭箭头
        }
      }
    ]
  };
  const renderBalanceCard = (0, import_react.useCallback)((balance) => {
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-balance-card", key: balance.id }, /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-card-header" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-card-title" }, balance.name), /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-card-value" }, balance.value)), /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-card-content" }, balance.items && balance.items.map((item) => /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-item", key: item.key }, /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-item-label" }, item.label), /* @__PURE__ */ import_react.default.createElement("div", { className: "balance-item-value" }, item.value)))));
  }, []);
  const isShowGuide = (0, import_react.useMemo)(() => {
    var _a2;
    if (((_a2 = globalState == null ? void 0 : globalState.walletGuideConfig) == null ? void 0 : _a2.show) === 0) return false;
    return (walletShopList == null ? void 0 : walletShopList.length) > 0 && !(list == null ? void 0 : list.length);
  }, [walletShopList, list, globalState == null ? void 0 : globalState.walletGuideConfig]);
  const renderContent = () => {
    if (list.length === 0 && !isShowGuide) {
      return null;
    }
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-wallet-list-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-content" }, isShowGuide ? /* @__PURE__ */ import_react.default.createElement(
      import_materials.WalletCard,
      {
        key: (0, import_utils.getUniqueId)(),
        isGuide: true,
        ...globalState,
        walletGuideConfig: (globalState == null ? void 0 : globalState.walletGuideConfig) || (0, import_status.defaultWalletGuideConfig)()
      }
    ) : /* @__PURE__ */ import_react.default.createElement(import_materials.Carousel, { ref: carouselRef, ...carouselProps }, list.map((item) => renderWalletCard(item)))), list && list.length > 1 && isUserLoggedIn && /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-navigation" }, /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `wallet-nav-button wallet-prev ${currentIndex === 0 ? "disabled" : ""}`,
        onClick: handlePrevClick,
        role: "button"
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_icons.LeftOutlined,
        {
          style: {
            fontSize: "24px",
            color: currentIndex === 0 ? "#D0D5DD" : "#101828"
          }
        }
      )
    ), list && list.length <= 5 ? /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-dots-container" }, Array.from({ length: list.length }).map((_, index) => /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        key: index,
        className: `wallet-dot ${index === currentIndex ? "active" : ""}`,
        onClick: (e) => {
          e.stopPropagation();
          if (carouselRef.current) {
            carouselRef.current.slickGoTo(index);
          }
        }
      }
    ))) : /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-counter" }, currentIndex + 1, "/", list.length), /* @__PURE__ */ import_react.default.createElement(
      "div",
      {
        className: `wallet-nav-button wallet-next ${currentIndex === list.length - 1 ? "disabled" : ""}`,
        onClick: handleNextClick,
        role: "button"
      },
      /* @__PURE__ */ import_react.default.createElement(
        import_icons.RightOutlined,
        {
          style: {
            fontSize: "24px",
            color: currentIndex === list.length - 1 ? "#D0D5DD" : "#101828"
          }
        }
      )
    )), /* @__PURE__ */ import_react.default.createElement(import_pinModal.default, { ref: pinModalRef }));
  };
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "wallet-list-wrapper" }, renderContent()), editHolderVisible && /* @__PURE__ */ import_react.default.createElement(
    import_tempHolderSelector.default,
    {
      visible: true,
      value: editHolderData == null ? void 0 : editHolderData.holder_id,
      formId: editHolderData == null ? void 0 : editHolderData.form_id,
      customerId: editHolderData == null ? void 0 : editHolderData.customer_id,
      onConfirm: onBindHolder,
      onCancel: () => {
        setEditHolderVisible(false);
        setEditHolderData(null);
      },
      confirmLoading: updateHolderLoading
    }
  ));
});
var walletList_default = WalletList;
