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/pisell-config-provider/index.tsx
var pisell_config_provider_exports = {};
__export(pisell_config_provider_exports, {
  default: () => pisell_config_provider_default
});
module.exports = __toCommonJS(pisell_config_provider_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_context = __toESM(require("./context"));
var import_hooks = require("../../hooks");
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
var import_pisellMessage = require("../pisellMessage");
var import_functions = require("../pisellModal/components/functions");
var platformMap = {
  phone: "h5",
  pc: "pc",
  ipad: "ipad"
};
var PisellConfigProvider = (props) => {
  var _a;
  const {
    children,
    platform: propsPlatform,
    symbol: propsSymbol,
    locale
  } = props;
  const platform = (0, import_hooks.useResponsive)();
  const context = (0, import_useEngineContext.default)();
  const { getSymbolic } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
  const config = {
    // 设置平台，如果父组件未传入，则使用响应式获取
    platform: propsPlatform || platformMap[platform],
    // 设置符号，优先使用父组件传入的，如果没有则从主项目获取
    symbol: propsSymbol || (getSymbolic == null ? void 0 : getSymbolic()) || "",
    locale: locale || "en"
  };
  const staticFunction = import_antd.App.useApp();
  (0, import_pisellMessage.setMessage)(staticFunction.message);
  (0, import_functions.setModal)(staticFunction.modal);
  import_context.globalConfig.setConfig(config);
  return /* @__PURE__ */ import_react.default.createElement(import_context.default.Provider, { value: config }, children);
};
var pisell_config_provider_default = PisellConfigProvider;
