import { reactive, ref, nextTick, h, render, toRaw, computed, watch, toRefs, toValue, shallowRef, shallowReactive, markRaw, onMounted, onUnmounted, onUpdated, getCurrentInstance, defineComponent, defineAsyncComponent, resolveComponent, resolveDirective, onDeactivated, onActivated, onBeforeUpdate, onBeforeUnmount, onBeforeMount } from "vue";
import axios from "axios";
import { ElMessage, ElDialog } from "element-plus";
import qs from "qs";
function asyncGeneratorStep(n, t, e, r, o, a, c) {
  try {
    var i = n[a](c), u = i.value;
  } catch (n2) {
    return void e(n2);
  }
  i.done ? t(u) : Promise.resolve(u).then(r, o);
}
function _asyncToGenerator(n) {
  return function() {
    var t = this, e = arguments;
    return new Promise(function(r, o) {
      var a = n.apply(t, e);
      function _next(n2) {
        asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
      }
      function _throw(n2) {
        asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
      }
      _next(void 0);
    });
  };
}
function _extends() {
  return _extends = Object.assign ? Object.assign.bind() : function(n) {
    for (var e = 1; e < arguments.length; e++) {
      var t = arguments[e];
      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
    }
    return n;
  }, _extends.apply(null, arguments);
}
function _regeneratorRuntime() {
  _regeneratorRuntime = function() {
    return e;
  };
  var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) {
    t2[e2] = r2.value;
  }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
  function define(t2, e2, r2) {
    return Object.defineProperty(t2, e2, {
      value: r2,
      enumerable: true,
      configurable: true,
      writable: true
    }), t2[e2];
  }
  try {
    define({}, "");
  } catch (t2) {
    define = function(t3, e2, r2) {
      return t3[e2] = r2;
    };
  }
  function wrap(t2, e2, r2, n2) {
    var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []);
    return o(a2, "_invoke", {
      value: makeInvokeMethod(t2, r2, c2)
    }), a2;
  }
  function tryCatch(t2, e2, r2) {
    try {
      return {
        type: "normal",
        arg: t2.call(e2, r2)
      };
    } catch (t3) {
      return {
        type: "throw",
        arg: t3
      };
    }
  }
  e.wrap = wrap;
  var h2 = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
  function Generator() {
  }
  function GeneratorFunction() {
  }
  function GeneratorFunctionPrototype() {
  }
  var p = {};
  define(p, a, function() {
    return this;
  });
  var d = Object.getPrototypeOf, v = d && d(d(values([])));
  v && v !== r && n.call(v, a) && (p = v);
  var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
  function defineIteratorMethods(t2) {
    ["next", "throw", "return"].forEach(function(e2) {
      define(t2, e2, function(t3) {
        return this._invoke(e2, t3);
      });
    });
  }
  function AsyncIterator(t2, e2) {
    function invoke(r3, o2, i2, a2) {
      var c2 = tryCatch(t2[r3], t2, o2);
      if ("throw" !== c2.type) {
        var u2 = c2.arg, h3 = u2.value;
        return h3 && "object" == typeof h3 && n.call(h3, "__await") ? e2.resolve(h3.__await).then(function(t3) {
          invoke("next", t3, i2, a2);
        }, function(t3) {
          invoke("throw", t3, i2, a2);
        }) : e2.resolve(h3).then(function(t3) {
          u2.value = t3, i2(u2);
        }, function(t3) {
          return invoke("throw", t3, i2, a2);
        });
      }
      a2(c2.arg);
    }
    var r2;
    o(this, "_invoke", {
      value: function(t3, n2) {
        function callInvokeWithMethodAndArg() {
          return new e2(function(e3, r3) {
            invoke(t3, n2, e3, r3);
          });
        }
        return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
      }
    });
  }
  function makeInvokeMethod(e2, r2, n2) {
    var o2 = h2;
    return function(i2, a2) {
      if (o2 === f) throw Error("Generator is already running");
      if (o2 === s) {
        if ("throw" === i2) throw a2;
        return {
          value: t,
          done: true
        };
      }
      for (n2.method = i2, n2.arg = a2; ; ) {
        var c2 = n2.delegate;
        if (c2) {
          var u2 = maybeInvokeDelegate(c2, n2);
          if (u2) {
            if (u2 === y) continue;
            return u2;
          }
        }
        if ("next" === n2.method) n2.sent = n2._sent = n2.arg;
        else if ("throw" === n2.method) {
          if (o2 === h2) throw o2 = s, n2.arg;
          n2.dispatchException(n2.arg);
        } else "return" === n2.method && n2.abrupt("return", n2.arg);
        o2 = f;
        var p2 = tryCatch(e2, r2, n2);
        if ("normal" === p2.type) {
          if (o2 = n2.done ? s : l, p2.arg === y) continue;
          return {
            value: p2.arg,
            done: n2.done
          };
        }
        "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg);
      }
    };
  }
  function maybeInvokeDelegate(e2, r2) {
    var n2 = r2.method, o2 = e2.iterator[n2];
    if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator.return && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y;
    var i2 = tryCatch(o2, e2.iterator, r2.arg);
    if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y;
    var a2 = i2.arg;
    return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y);
  }
  function pushTryEntry(t2) {
    var e2 = {
      tryLoc: t2[0]
    };
    1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2);
  }
  function resetTryEntry(t2) {
    var e2 = t2.completion || {};
    e2.type = "normal", delete e2.arg, t2.completion = e2;
  }
  function Context(t2) {
    this.tryEntries = [{
      tryLoc: "root"
    }], t2.forEach(pushTryEntry, this), this.reset(true);
  }
  function values(e2) {
    if (e2 || "" === e2) {
      var r2 = e2[a];
      if (r2) return r2.call(e2);
      if ("function" == typeof e2.next) return e2;
      if (!isNaN(e2.length)) {
        var o2 = -1, i2 = function next() {
          for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next;
          return next.value = t, next.done = true, next;
        };
        return i2.next = i2;
      }
    }
    throw new TypeError(typeof e2 + " is not iterable");
  }
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
    value: GeneratorFunctionPrototype,
    configurable: true
  }), o(GeneratorFunctionPrototype, "constructor", {
    value: GeneratorFunction,
    configurable: true
  }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) {
    var e2 = "function" == typeof t2 && t2.constructor;
    return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name));
  }, e.mark = function(t2) {
    return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2;
  }, e.awrap = function(t2) {
    return {
      __await: t2
    };
  }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function() {
    return this;
  }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) {
    void 0 === i2 && (i2 = Promise);
    var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2);
    return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) {
      return t3.done ? t3.value : a2.next();
    });
  }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function() {
    return this;
  }), define(g, "toString", function() {
    return "[object Generator]";
  }), e.keys = function(t2) {
    var e2 = Object(t2), r2 = [];
    for (var n2 in e2) r2.push(n2);
    return r2.reverse(), function next() {
      for (; r2.length; ) {
        var t3 = r2.pop();
        if (t3 in e2) return next.value = t3, next.done = false, next;
      }
      return next.done = true, next;
    };
  }, e.values = values, Context.prototype = {
    constructor: Context,
    reset: function(e2) {
      if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t);
    },
    stop: function() {
      this.done = true;
      var t2 = this.tryEntries[0].completion;
      if ("throw" === t2.type) throw t2.arg;
      return this.rval;
    },
    dispatchException: function(e2) {
      if (this.done) throw e2;
      var r2 = this;
      function handle(n2, o3) {
        return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3;
      }
      for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) {
        var i2 = this.tryEntries[o2], a2 = i2.completion;
        if ("root" === i2.tryLoc) return handle("end");
        if (i2.tryLoc <= this.prev) {
          var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc");
          if (c2 && u2) {
            if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
            if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
          } else if (c2) {
            if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
          } else {
            if (!u2) throw Error("try statement without catch or finally");
            if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
          }
        }
      }
    },
    abrupt: function(t2, e2) {
      for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
        var o2 = this.tryEntries[r2];
        if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) {
          var i2 = o2;
          break;
        }
      }
      i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null);
      var a2 = i2 ? i2.completion : {};
      return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2);
    },
    complete: function(t2, e2) {
      if ("throw" === t2.type) throw t2.arg;
      return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y;
    },
    finish: function(t2) {
      for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
        var r2 = this.tryEntries[e2];
        if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y;
      }
    },
    catch: function(t2) {
      for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
        var r2 = this.tryEntries[e2];
        if (r2.tryLoc === t2) {
          var n2 = r2.completion;
          if ("throw" === n2.type) {
            var o2 = n2.arg;
            resetTryEntry(r2);
          }
          return o2;
        }
      }
      throw Error("illegal catch attempt");
    },
    delegateYield: function(e2, r2, n2) {
      return this.delegate = {
        iterator: values(e2),
        resultName: r2,
        nextLoc: n2
      }, "next" === this.method && (this.arg = t), y;
    }
  }, e;
}
var TipsTextEnum = /* @__PURE__ */ function(TipsTextEnum2) {
  TipsTextEnum2["APP_INSTANCE_ERROR"] = "未获取到相关应用实例";
  TipsTextEnum2["COMP_INSTANCE_NULL"] = "未获取到相关组件实例";
  TipsTextEnum2["COMP_INTERNAL_INSTANCE_ERROR"] = "获取当前组件内部实例失败";
  TipsTextEnum2["COMP_DATA_SOURCE_NULL"] = "当前组件无数据源";
  TipsTextEnum2["COMP_EVENT_NULL"] = "当前组件未绑定事件";
  TipsTextEnum2["COMP_ID_NULL"] = "compId 为 null";
  TipsTextEnum2["SELECT_PLACEHOLDER"] = "请选择";
  TipsTextEnum2["SEARCH_PLACEHOLDER"] = "输入关键字查询";
  TipsTextEnum2["TREE_NODE_SEARCH_PLACEHOLDER"] = "输入关键字过滤节点";
  TipsTextEnum2["COMP_SEARCH_PLACEHOLDER"] = "输入关键字查询组件";
  TipsTextEnum2["INPUT_NUMBER_PLACEHOLDER"] = "请输入数字";
  TipsTextEnum2["PAGE_TITLE_PLACEHOLDER"] = "请填写页面标题";
  TipsTextEnum2["PAGE_PATH_PLACEHOLDER"] = "斜杆开头，如: /page-path";
  TipsTextEnum2["ROUTE_NAME_PLACEHOLDER"] = "如: routeName";
  TipsTextEnum2["DESIGNER_INIT"] = "设计器初始化中...";
  TipsTextEnum2["SAVING"] = "正在保存...";
  TipsTextEnum2["SAVE_SUCCESSFULLY"] = "保存成功";
  TipsTextEnum2["DATA_NULL"] = "暂无数据";
  TipsTextEnum2["EDIT_ROUTER_TIP_TEXT"] = "操作";
  TipsTextEnum2["IMPORT_TIP_TEXT"] = "导入本地 JSON 格式文件";
  TipsTextEnum2["EXPORT_TIP_TEXT"] = "下载 JSON 文件至本地";
  TipsTextEnum2["DS_CONFIG_ERROR_TEXT"] = "dataSource: 数据源信息关键属性值不能为空，如：('id', 'protocol', 'hostPort', 'url')，请检查并添加必要属性值";
  TipsTextEnum2["DS_HEADERS_ERROR_TEXT"] = "dataSource.headers: 请求头参数必须为一个字符串化的合法 JSON 对象";
  TipsTextEnum2["DS_PARAMS_ERROR_TEXT"] = "dataSource.params: 发送请求参数必须为一个字符串化的合法 JSON 对象";
  TipsTextEnum2["DS_CUSTOM_PARAMS_ERROR_TEXT"] = "dataSource: 自定义请求参数 (customParams) 必须为一个对象";
  TipsTextEnum2["JSON_EXT_ERROR_TEXT"] = "不支持的文件类型，请选择 json 格式文件";
  TipsTextEnum2["JSON_ERROR_TEXT"] = "不是一个有效的 JSON 格式文件";
  TipsTextEnum2["ARGUMENT_TYPE_ERROR_TEXT"] = "第一个参数必须为字符串";
  TipsTextEnum2["CODE_ERROR_NOTICE_TITLE"] = "代码错误提示";
  TipsTextEnum2["CODE_ERROR_NOTICE_MESSAGE"] = "Schema 数据格式不合法，请检查编辑器标红处的错误，修改正确后再重试";
  TipsTextEnum2["PAGE_TITLE_NULL_TEXT"] = "页面标题不能为空";
  TipsTextEnum2["PAGE_PATH_NULL_TEXT"] = "页面路径不能为空";
  TipsTextEnum2["PAGE_PATH_ERROR_TEXT"] = "页面路径格式不合法";
  TipsTextEnum2["PAGE_PATH_HAS_ERROR_TEXT"] = "页面路径已存在，请修改";
  TipsTextEnum2["ROUTE_NAME_NULL_TEXT"] = "路由名称不能为空";
  TipsTextEnum2["ROUTE_NAME_HAS_ERROR_TEXT"] = "路由名称已存在，请修改";
  TipsTextEnum2["RENDERER_INIT_ERROR_TEXT"] = "未读取到应用 Schema 或数据格式不合法, 渲染器初始化异常，请重新载入引擎试试";
  TipsTextEnum2["DESIGNER_INIT_ERROR_TEXT"] = "未读取到应用 Schema 或数据格式不合法, 设计器运行异常，请重新载入引擎试试";
  TipsTextEnum2["ROUTER_INIT_ERROR_TEXT"] = "未读取到路由数据，初始化路由失败";
  TipsTextEnum2["RELOAD_ENGINE_ERROR_TEXT"] = "尝试重载引擎出现错误";
  TipsTextEnum2["RESET_PAGE_WARN_TEXT"] = "重置页面将清除该页面中的所有设置数据，是否要继续？";
  TipsTextEnum2["DELETE_PAGE_WARN_TEXT"] = "删除页面将删除该页面中的所有数据，是否要继续？";
  TipsTextEnum2["DELETE_COMP_WARN_TEXT"] = "删除组件节点将删除该节点中的所有数据，是否要继续？";
  TipsTextEnum2["DELETE_DS_WARN_TEXT"] = "是否确定要删除绑定的数据源";
  TipsTextEnum2["DELETE_EVENT_TEXT"] = "是否确定要移除该事件";
  TipsTextEnum2["DRAG_LAYOUT_TIP_TEXT"] = "鼠标左键拖拽组件至右侧画布区进行编排";
  TipsTextEnum2["SORT_NODE_UP_TIP_TEXT"] = "该组件节点在所属父级容器中已经是最顶了";
  TipsTextEnum2["SORT_NODE_DOWN_TIP_TEXT"] = "该组件节点在所属父级容器中已经是最底了";
  TipsTextEnum2["VIEWPORT_DEVICE_ERROR_TEXT"] = "未找到编辑器或设备模拟器节点";
  return TipsTextEnum2;
}(TipsTextEnum || {});
var StatusEnum = /* @__PURE__ */ function(StatusEnum2) {
  StatusEnum2["CODE_400"] = "错误请求，请重试";
  StatusEnum2["CODE_401"] = "未授权，请重新登录";
  StatusEnum2["CODE_403"] = "服务器拒绝请求，请重试";
  StatusEnum2["CODE_404"] = "请求错误，未找到该资源，请重试";
  StatusEnum2["CODE_405"] = "请求方法未允许，请重试";
  StatusEnum2["CODE_408"] = "服务器等待请求时间发生超时，请重试";
  StatusEnum2["CODE_500"] = "服务器内部错误，请重试";
  StatusEnum2["CODE_501"] = "服务器无法识别请求方法，请重试";
  StatusEnum2["CODE_502"] = "服务器故障错误，请重试";
  StatusEnum2["CODE_503"] = "服务不可用，请重试";
  StatusEnum2["CODE_504"] = "网关超时，请重试";
  StatusEnum2["CODE_505"] = "服务器不支持请求中所用的HTTP协议版本";
  StatusEnum2["NETWORK_ERROR"] = "网络错误，请检查您的网络连接";
  StatusEnum2["TIMEOUT"] = "服务器响应超时，请重试";
  StatusEnum2["CONNECT_ERROR"] = "连接服务器失败，请重试";
  return StatusEnum2;
}(StatusEnum || {});
var request = axios.create({
  baseURL: "/"
});
request.interceptors.request.use(function(config) {
  var _localStorage = localStorage, sid = _localStorage.sid;
  if (sid) {
    config.headers["satoken"] = sid;
  }
  return config;
}, function(error) {
  ElMessage.error(error.message);
  return Promise.reject(error);
});
request.interceptors.response.use(function(res) {
  var responseType = res.config.responseType;
  var data = res.data;
  return responseType === "blob" ? res : data;
}, function(error) {
  var _error$response;
  var status = (_error$response = error.response) == null ? void 0 : _error$response.status;
  if (status) {
    var _StatusEnum;
    var message = (_StatusEnum = StatusEnum["CODE_" + status]) != null ? _StatusEnum : "错误代码：" + status + "，请求异常，请检查后重试";
    error.message = message;
  } else {
    error.message == "Network Error" ? error.message = StatusEnum.NETWORK_ERROR : error.message.includes("timeout") ? error.message = StatusEnum.TIMEOUT : error.message = StatusEnum.CONNECT_ERROR;
  }
  error.code !== "ERR_CANCELED" && ElMessage({
    message: error.message,
    grouping: true,
    type: "error"
  });
  return Promise.reject(error);
});
function mitt(n) {
  return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
    var i = n.get(t);
    i ? i.push(e) : n.set(t, [e]);
  }, off: function(t, e) {
    var i = n.get(t);
    i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
  }, emit: function(t, e) {
    var i = n.get(t);
    i && i.slice().map(function(n2) {
      n2(e);
    }), (i = n.get("*")) && i.slice().map(function(n2) {
      n2(t, e);
    });
  } };
}
function useValidateJson(jsonStr) {
  try {
    JSON.parse(jsonStr);
    return true;
  } catch (error) {
    return false;
  }
}
var ABORT_CONTROLLER = {};
function useDataSourceRequest(dsConfig, customParams) {
  var type = dsConfig.type, data = dsConfig.data, id = dsConfig.id, protocol = dsConfig.protocol, hostPort = dsConfig.hostPort, url = dsConfig.url, abUrl = dsConfig.abUrl, method = dsConfig.method, params = dsConfig.params, headers = dsConfig.headers, contentType = dsConfig.contentType, responseType = dsConfig.responseType, timeout = dsConfig.timeout, serializeParams = dsConfig.serializeParams, dataFilter = dsConfig.dataFilter;
  if (type === "dynamic") {
    if (ABORT_CONTROLLER[id]) {
      var _ABORT_CONTROLLER$id;
      (_ABORT_CONTROLLER$id = ABORT_CONTROLLER[id]) == null || _ABORT_CONTROLLER$id.abort();
      ABORT_CONTROLLER[id] = new AbortController();
    } else {
      ABORT_CONTROLLER[id] = new AbortController();
    }
    return new Promise(function(resolve, reject) {
      var _ABORT_CONTROLLER$id2, _request;
      if (!id || !protocol || !hostPort || !url) {
        console.warn(TipsTextEnum.DS_CONFIG_ERROR_TEXT);
        return;
      }
      if (headers && (!useValidateJson(headers) || Object.prototype.toString.call(JSON.parse(headers)) !== "[object Object]")) {
        console.warn(TipsTextEnum.DS_HEADERS_ERROR_TEXT);
        return;
      }
      if (params && (!useValidateJson(params) || Object.prototype.toString.call(JSON.parse(params)) !== "[object Object]")) {
        console.warn(TipsTextEnum.DS_PARAMS_ERROR_TEXT);
        return;
      }
      if (customParams && Object.prototype.toString.call(customParams) !== "[object Object]") {
        console.warn(TipsTextEnum.DS_CUSTOM_PARAMS_ERROR_TEXT);
        return;
      }
      var parameter = method === "get" ? "params" : "data";
      var headersObj = headers ? JSON.parse(headers) : {};
      var paramsObj = customParams ? customParams : params ? JSON.parse(params) : {};
      var iurl = abUrl ? protocol + "://" + hostPort + url : url;
      request((_request = {
        url: iurl,
        method,
        transformResponse: function transformResponse(response) {
          var __response__ = response && useValidateJson(response) ? JSON.parse(response) : response;
          var codeStr = (dataFilter == null ? void 0 : dataFilter.value) || "";
          var fn = dataFilter != null && dataFilter.enabled ? new Function("res", "return (" + codeStr + ")") : null;
          return fn ? fn(__response__) : __response__;
        }
      }, _request[parameter] = serializeParams ? qs.stringify(paramsObj) : paramsObj, _request.headers = Object.assign({
        "Content-Type": contentType || "application/json"
      }, headersObj), _request.responseType = responseType, _request.timeout = timeout, _request.signal = (_ABORT_CONTROLLER$id2 = ABORT_CONTROLLER[id]) == null ? void 0 : _ABORT_CONTROLLER$id2.signal, _request)).then(function(res) {
        ABORT_CONTROLLER[id] = null;
        resolve(res);
      })["catch"](function(error) {
        reject(error);
      });
    });
  } else {
    return new Promise(function(resolve) {
      resolve(useValidateJson(data) ? JSON.parse(data) : data);
    });
  }
}
var useDialog = /* @__PURE__ */ function() {
  function useDialog2(attributes) {
    this.defineAttrs = void 0;
    this.dialogAttrs = void 0;
    this.contentModule = void 0;
    this.contentAttrs = void 0;
    this.forceUpdateKey = void 0;
    this.cacheServiceProps = void 0;
    this.defineAttrs = deepMerge({
      modelValue: false,
      title: "Dialog Title",
      width: 600,
      contentModule: void 0,
      contentAttrs: void 0,
      slots: void 0,
      appendToBody: true,
      modalEvent: true,
      isResize: false,
      showHeader: true,
      draggable: true,
      isDragOut: true,
      dragOutLimitValue: 20,
      destroyOnClose: true
    }, attributes != null ? attributes : {});
    var dialogAttrs = deepMerge({}, this.defineAttrs);
    delete dialogAttrs.contentModule;
    delete dialogAttrs.contentAttrs;
    delete dialogAttrs.slots;
    delete dialogAttrs.forceUpdateKey;
    delete dialogAttrs.isDragOut;
    delete dialogAttrs.dragOutLimitValue;
    this.dialogAttrs = reactive(dialogAttrs);
    this.setDialogExtraStyles(this.dialogAttrs);
    var _ref = attributes != null ? attributes : {}, contentModule = _ref.contentModule, contentAttrs = _ref.contentAttrs, forceUpdateKey = _ref.forceUpdateKey;
    this.contentModule = reactive(contentModule != null ? contentModule : {});
    this.contentAttrs = reactive(contentAttrs != null ? contentAttrs : {});
    this.forceUpdateKey = ref(forceUpdateKey);
    this.cacheServiceProps = reactive({});
  }
  var _proto = useDialog2.prototype;
  _proto.show = function show(attributes, callback) {
    this.dialogAttrs.modelValue = true;
    var dialogAttrs = deepMerge({}, attributes != null ? attributes : {});
    delete dialogAttrs.contentModule;
    delete dialogAttrs.contentAttrs;
    delete dialogAttrs.slots;
    delete dialogAttrs.forceUpdateKey;
    delete dialogAttrs.isDragOut;
    delete dialogAttrs.dragOutLimitValue;
    this.dialogAttrs = Object.assign(this.dialogAttrs, dialogAttrs);
    this.setDialogExtraStyles(this.dialogAttrs);
    var _ref2 = attributes != null ? attributes : {}, contentModule = _ref2.contentModule, contentAttrs = _ref2.contentAttrs, forceUpdateKey = _ref2.forceUpdateKey;
    this.contentModule = Object.assign(this.contentModule, contentModule != null ? contentModule : {});
    this.contentAttrs = Object.assign(this.contentAttrs, contentAttrs != null ? contentAttrs : {});
    this.forceUpdateKey.value = forceUpdateKey;
    var targetFlag = this.dialogAttrs.targetFlag;
    callback && callback({
      event: "show",
      targetFlag
    });
  };
  _proto.close = function close(callback) {
    this.dialogAttrs.modelValue = false;
    var targetFlag = this.dialogAttrs.targetFlag;
    callback && callback({
      event: "close",
      targetFlag
    });
  };
  _proto.service = /* @__PURE__ */ function() {
    var _service = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(attributes, callback) {
      var _this = this, _VNode$component2, _SVNode$component2;
      var dialogAttrs, _ref3, _ref3$contentModule, contentModule, _ref3$contentAttrs, contentAttrs, _ref3$slots, slots, _ref3$destroyOnClose, destroyOnClose, _ref3$targetFlag, targetFlag, _ref3$mutexFlag, mutexFlag, _ref3$draggable, draggable, _ref3$isDragOut, isDragOut, _ref3$dragOutLimitVal, dragOutLimitValue, componentName, scopeId, VNodeWrapClassName, VNodeWrap, getZindexs, VNodeWraps, __VNodeWraps__, currentProps, currentDialogProps, currentContentProps, key, _key, isCloseCallBack, SVNode, VNode, close;
      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            dialogAttrs = deepMerge(toRaw(this.defineAttrs), attributes != null ? attributes : {});
            dialogAttrs.appendToBody = false;
            dialogAttrs.modelValue = true;
            delete dialogAttrs.contentModule;
            delete dialogAttrs.contentAttrs;
            delete dialogAttrs.slots;
            delete dialogAttrs.forceUpdateKey;
            this.setDialogExtraStyles(dialogAttrs);
            _ref3 = attributes != null ? attributes : {}, _ref3$contentModule = _ref3.contentModule, contentModule = _ref3$contentModule === void 0 ? this.defineAttrs.contentModule || {} : _ref3$contentModule, _ref3$contentAttrs = _ref3.contentAttrs, contentAttrs = _ref3$contentAttrs === void 0 ? this.defineAttrs.contentAttrs || {} : _ref3$contentAttrs, _ref3$slots = _ref3.slots, slots = _ref3$slots === void 0 ? this.defineAttrs.slots || {} : _ref3$slots, _ref3$destroyOnClose = _ref3.destroyOnClose, destroyOnClose = _ref3$destroyOnClose === void 0 ? this.defineAttrs.destroyOnClose : _ref3$destroyOnClose, _ref3$targetFlag = _ref3.targetFlag, targetFlag = _ref3$targetFlag === void 0 ? this.defineAttrs.targetFlag : _ref3$targetFlag, _ref3$mutexFlag = _ref3.mutexFlag, mutexFlag = _ref3$mutexFlag === void 0 ? this.defineAttrs.mutexFlag : _ref3$mutexFlag, _ref3$draggable = _ref3.draggable, draggable = _ref3$draggable === void 0 ? this.defineAttrs.draggable : _ref3$draggable, _ref3$isDragOut = _ref3.isDragOut, isDragOut = _ref3$isDragOut === void 0 ? this.defineAttrs.isDragOut : _ref3$isDragOut, _ref3$dragOutLimitVal = _ref3.dragOutLimitValue, dragOutLimitValue = _ref3$dragOutLimitVal === void 0 ? this.defineAttrs.dragOutLimitValue : _ref3$dragOutLimitVal;
            componentName = contentModule["name"] || contentModule["__name"];
            scopeId = contentModule["__scopeId"] ? contentModule["__scopeId"].split("data-v-")[1] : "";
            if (componentName) {
              _context.next = 13;
              break;
            }
            throw new Error("Service Dialog 的 'contentModule' 属性传入的不是一个有效的 'Component' 类型的组件模块");
          case 13:
            VNodeWrapClassName = "dialog-" + componentName + (scopeId ? "-" + scopeId : "") + (targetFlag ? "-" + targetFlag : "");
            VNodeWrap = document.createElement("div");
            VNodeWrap.className = VNodeWrapClassName;
            mutexFlag ? VNodeWrap.setAttribute("mutex-flag", mutexFlag) : "";
            getZindexs = function getZindexs2() {
              var numArray = [];
              var els = document.querySelectorAll(".el-overlay-dialog");
              els && els.forEach(function(el) {
                var parentEl = el.parentElement;
                var zIndex = +getComputedStyle(parentEl).getPropertyValue("z-index");
                numArray.push(zIndex);
              });
              return numArray.length ? Math.max.apply(Math, numArray) : null;
            };
            VNodeWraps = document.querySelectorAll("." + VNodeWrapClassName);
            __VNodeWraps__ = document.querySelectorAll("[mutex-flag='" + mutexFlag + "']");
            __VNodeWraps__.length && __VNodeWraps__.forEach(function(el) {
              el["_vnode"].component.props.modelValue = false;
            });
            if (!(!destroyOnClose && this.cacheServiceProps[VNodeWrapClassName] && VNodeWraps.length)) {
              _context.next = 30;
              break;
            }
            currentProps = this.cacheServiceProps[VNodeWrapClassName];
            currentDialogProps = currentProps.dialogProps;
            currentContentProps = currentProps.contentProps;
            for (key in currentDialogProps) {
              if (Object.hasOwn(dialogAttrs, key)) {
                currentDialogProps[key] = dialogAttrs[key];
              }
            }
            for (_key in currentContentProps) {
              if (Object.hasOwn(contentAttrs, _key)) {
                currentContentProps[_key] = contentAttrs[_key];
              }
            }
            currentDialogProps.modelValue = true;
            nextTick(function() {
              var _document$querySelect;
              var zIndexNode = (_document$querySelect = document.querySelector("." + VNodeWrapClassName)) == null ? void 0 : _document$querySelect.firstElementChild;
              var maxZindexVal = getZindexs();
              maxZindexVal && zIndexNode["style"].setProperty("z-index", maxZindexVal + 1);
              callback && callback({
                event: "show",
                targetFlag
              });
            });
            return _context.abrupt("return", {
              dialogProps: currentDialogProps,
              contentProps: currentContentProps
            });
          case 30:
            isCloseCallBack = true;
            SVNode = h(contentModule, _extends({}, contentAttrs, {
              onClose: function onClose(emitParams) {
                close(emitParams);
                isCloseCallBack = false;
              }
            }));
            VNode = h(
              ElDialog,
              // Dialog Attributes
              Object.assign({
                // 绑定 Dialog 点击事件
                onClick: function onClick(event) {
                  var currentTarget = event.currentTarget;
                  var maxZindexVal = getZindexs();
                  var zIndexNode = currentTarget && currentTarget["parentElement"]["parentElement"];
                  var selfZindexVal = +getComputedStyle(zIndexNode).getPropertyValue("z-index");
                  if (selfZindexVal != maxZindexVal) maxZindexVal && zIndexNode["style"].setProperty("z-index", maxZindexVal + 1);
                },
                //关闭 Dialog 回调
                onClose: function onClose() {
                  isCloseCallBack ? close() : isCloseCallBack = true;
                }
              }, dialogAttrs),
              // Dialog Slots
              Object.assign({
                "default": function _default() {
                  return SVNode;
                }
              }, slots)
            );
            VNodeWraps.length && VNodeWraps.forEach(function(el) {
              var mutexFlag2 = el.getAttribute("mutex-flag");
              if (mutexFlag2) return;
              el.remove();
              delete _this.cacheServiceProps[VNodeWrapClassName];
            });
            document.body.appendChild(VNodeWrap);
            _context.next = 37;
            return render(VNode, VNodeWrap);
          case 37:
            nextTick(function() {
              var maxZindexVal = getZindexs();
              var zIndexNode = VNodeWrap.firstElementChild;
              maxZindexVal && zIndexNode["style"].setProperty("z-index", maxZindexVal + 1);
              var overlayNode = VNodeWrap.querySelector(".el-overlay-dialog");
              var dragNode = VNodeWrap.querySelector(".el-dialog__header");
              var targetNode = VNodeWrap.querySelector(".el-dialog");
              if (draggable && isDragOut && overlayNode && dragNode && targetNode) {
                dragNode.addEventListener("mousedown", function(event) {
                  var htmlWidth = document.documentElement.clientWidth;
                  var htmlHeight = document.documentElement.clientHeight;
                  var limitValue = dragOutLimitValue || 0;
                  var x = event.clientX + overlayNode.scrollLeft;
                  var y = event.clientY + overlayNode.scrollTop;
                  var transform = targetNode.style.transform || "translate(0, 0)";
                  var regex = /(-?\d+(\.\d+)?)/g;
                  var matches = transform.match(regex);
                  var numbers = matches && matches.map(Number);
                  var translateX = numbers ? numbers[0] : 0;
                  var translateY = numbers ? numbers[1] : 0;
                  var onMouseMove = function onMouseMove2(event2) {
                    var __x = event2.clientX - x;
                    var __y = event2.clientY - y;
                    if (event2.clientX > htmlWidth - limitValue) __x = htmlWidth - x - limitValue;
                    if (event2.clientX <= limitValue) __x = limitValue - x;
                    if (event2.clientY > htmlHeight - limitValue) __y = htmlHeight - y - limitValue;
                    if (event2.clientY <= limitValue) __y = limitValue - y;
                    targetNode.style.transform = "translate(" + (translateX + __x) + "px, " + (translateY + __y) + "px)";
                  };
                  document.addEventListener("mousemove", onMouseMove);
                  document.addEventListener("mouseup", function() {
                    document.removeEventListener("mousemove", onMouseMove);
                  });
                });
              }
            });
            close = function close2(emitParams) {
              VNode.component.props.modelValue = false;
              callback && callback({
                event: "close",
                targetFlag,
                emitParams
              });
              setTimeout(function() {
                if (destroyOnClose) {
                  VNodeWrap.remove();
                  delete _this.cacheServiceProps[VNodeWrapClassName];
                }
              }, 300);
            };
            setTimeout(function() {
              var _VNode$component, _SVNode$component;
              _this.cacheServiceProps[VNodeWrapClassName] = {
                dialogProps: (_VNode$component = VNode.component) == null ? void 0 : _VNode$component.props,
                contentProps: (_SVNode$component = SVNode.component) == null ? void 0 : _SVNode$component.props
              };
            }, 350);
            callback && callback({
              event: "show",
              targetFlag
            });
            return _context.abrupt("return", {
              dialogProps: (_VNode$component2 = VNode.component) == null ? void 0 : _VNode$component2.props,
              // 注意: 当 `contentModule` 为一个异步组件时，则 `contentProps` 无返回值
              contentProps: (_SVNode$component2 = SVNode.component) == null ? void 0 : _SVNode$component2.props
            });
          case 42:
          case "end":
            return _context.stop();
        }
      }, _callee, this);
    }));
    function service(_x, _x2) {
      return _service.apply(this, arguments);
    }
    return service;
  }();
  _proto.setDialogExtraStyles = function setDialogExtraStyles(dialogAttrs) {
    var _classes5, _modalClass3;
    var isResize = dialogAttrs.isResize, modalEvent = dialogAttrs.modalEvent, modalClass = dialogAttrs.modalClass, showHeader = dialogAttrs.showHeader;
    var classes = dialogAttrs["class"];
    if (isResize) {
      var _classes;
      if (!((_classes = classes) != null && _classes.includes("is-resize"))) classes += " is-resize";
    } else {
      var _classes2;
      classes = (_classes2 = classes) == null ? void 0 : _classes2.replace("is-resize", "");
    }
    if (showHeader) {
      var _classes3;
      classes = (_classes3 = classes) == null ? void 0 : _classes3.replace("hide-header", "");
    } else {
      var _classes4;
      if (!((_classes4 = classes) != null && _classes4.includes("hide-header"))) classes += " hide-header";
    }
    if (modalEvent) {
      var _modalClass;
      modalClass = (_modalClass = modalClass) == null ? void 0 : _modalClass.replace("modal-events-none", "");
    } else {
      var _modalClass2;
      if (!((_modalClass2 = modalClass) != null && _modalClass2.includes("modal-events-none"))) modalClass += " modal-events-none";
    }
    dialogAttrs["class"] = (_classes5 = classes) == null ? void 0 : _classes5.replace(/undefined/g, "");
    dialogAttrs.modalClass = (_modalClass3 = modalClass) == null ? void 0 : _modalClass3.replace(/undefined/g, "");
  };
  return useDialog2;
}();
function deepMerge() {
  for (var _len = arguments.length, objects = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
    objects[_key2] = arguments[_key2];
  }
  var result = Object.assign.apply(Object, [{}].concat(objects));
  for (var _i = 0, _objects = objects; _i < _objects.length; _i++) {
    var object = _objects[_i];
    for (var _i2 = 0, _Object$entries = Object.entries(object); _i2 < _Object$entries.length; _i2++) {
      var _Object$entries$_i = _Object$entries[_i2], key = _Object$entries$_i[0], value = _Object$entries$_i[1];
      if (Object.prototype.toString.call(value) === "[object Object]") {
        result[key] = deepMerge(result[key], value);
      }
    }
  }
  return result;
}
var eventBus = mitt();
var appSchema = ref(null);
var compTree = ref();
var appInstance;
function useExposeAppInstance(app) {
  appInstance = app;
}
function useGetAppInstance() {
  return appInstance;
}
function useGetAppSchema() {
  return appSchema.value;
}
function useEventBus() {
  return eventBus;
}
function useGetCompTree() {
  return compTree.value;
}
function useGetCompTreeByPath(path) {
  if (appSchema.value && appSchema.value.pages[path]) {
    return appSchema.value.pages[path]["componentTree"];
  }
  return [];
}
function useGetAppRouter() {
  var globalProperties = useGetGlobalProperties();
  if (!globalProperties) return;
  return globalProperties.$router;
}
function useGetAppRoute() {
  var globalProperties = useGetGlobalProperties();
  if (!globalProperties) return;
  return globalProperties.$route;
}
function useRegGlobalProperties(key, target) {
  var app = useGetAppInstance();
  if (!app) throw new Error(TipsTextEnum.APP_INSTANCE_ERROR);
  app.config.globalProperties[key] = target;
}
function useGetGlobalProperties() {
  var app = useGetAppInstance();
  if (!app) throw new Error(TipsTextEnum.APP_INSTANCE_ERROR);
  return app.config.globalProperties;
}
function useRef() {
  return ref;
}
function useReactive() {
  return reactive;
}
function useComputed() {
  return computed;
}
function useWatch() {
  return watch;
}
function useToRefs() {
  return toRefs;
}
function useToValue() {
  return toValue;
}
function useToRaw() {
  return toRaw;
}
function useShallowRef() {
  return shallowRef;
}
function useShallowReactive() {
  return shallowReactive;
}
function useMarkRaw() {
  return markRaw;
}
function useOnMounted() {
  return onMounted;
}
function useOnUnmounted() {
  return onUnmounted;
}
function useNextTick() {
  return nextTick;
}
function useOnUpdated() {
  return onUpdated;
}
function useGetCurrentInstance() {
  var instance = getCurrentInstance();
  if (!instance) throw new Error(TipsTextEnum.COMP_INTERNAL_INSTANCE_ERROR);
  var app = instance.appContext.app;
  var globalProperties = instance.appContext.config.globalProperties;
  var proxy = instance.proxy;
  return {
    instance,
    app,
    globalProperties,
    proxy
  };
}
function useGetCompRef(compId, delay) {
  if (delay === void 0) {
    delay = 0;
  }
  return new Promise(function(resolve) {
    setTimeout(function() {
      if (window["$compRefs"]) {
        var compRef = window["$compRefs"][compId];
        if (!compRef) {
          console.warn(compId + ": " + TipsTextEnum.COMP_INSTANCE_NULL);
        }
        resolve(compRef);
      }
      if (window.KlComposeAppEngineEditor && window.KlComposeAppEngineEditor["$compRefs"]) {
        var _compRef = window.KlComposeAppEngineEditor["$compRefs"][compId];
        if (!_compRef) {
          console.warn(compId + ": " + TipsTextEnum.COMP_INSTANCE_NULL);
        }
        resolve(_compRef);
      }
    }, delay);
  });
}
function useGetCompRefProps(_x, _x2) {
  return _useGetCompRefProps.apply(this, arguments);
}
function _useGetCompRefProps() {
  _useGetCompRefProps = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(compId, delay) {
    var compRef, proxy;
    return _regeneratorRuntime().wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          if (delay === void 0) {
            delay = 0;
          }
          _context.next = 3;
          return useGetCompRef(compId, delay);
        case 3:
          compRef = _context.sent;
          if (compRef) {
            _context.next = 6;
            break;
          }
          return _context.abrupt("return");
        case 6:
          proxy = compRef.proxy;
          return _context.abrupt("return", proxy ? proxy._.props : compRef._.props);
        case 8:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return _useGetCompRefProps.apply(this, arguments);
}
function useGetCompNode(compId) {
  var findCompNode = null;
  var _each__ = function __each__(compTree2) {
    for (var i = 0; i < compTree2.length; i++) {
      var _item$children;
      var item = compTree2[i];
      if (compId === item.compId) {
        findCompNode = item;
        break;
      }
      if ((_item$children = item.children) != null && _item$children.length) {
        _each__(item.children);
      }
    }
  };
  _each__(compTree.value || []);
  return findCompNode;
}
function useRemoveCompNode(compId) {
  var findCompNode = null;
  var _each__2 = function __each__(compTree2) {
    for (var i = 0; i < compTree2.length; i++) {
      var _item$children2;
      var item = compTree2[i];
      if (compId === item.compId) {
        findCompNode = compTree2.splice(i, 1)[0];
        break;
      }
      if ((_item$children2 = item.children) != null && _item$children2.length) {
        _each__2(item.children);
      }
    }
  };
  _each__2(compTree.value || []);
  return findCompNode;
}
function useReloadCompNode(compId) {
  var _each__3 = function __each__(compTree2) {
    var _loop = function _loop2() {
      var _item$children3;
      var item = compTree2[i];
      if (item.compId === compId) {
        item.isVisible = false;
        item.isRender = false;
        setTimeout(function() {
          item.isVisible = true;
          item.isRender = true;
        }, 10);
        return 1;
      }
      if ((_item$children3 = item.children) != null && _item$children3.length) {
        _each__3(item.children);
      }
    };
    for (var i = 0; i < compTree2.length; i++) {
      if (_loop()) break;
    }
  };
  _each__3(compTree.value || []);
}
function useUnrenderCompNode(compId) {
  var _each__4 = function __each__(compTree2) {
    for (var i = 0; i < compTree2.length; i++) {
      var _item$children4;
      var item = compTree2[i];
      if (item.compId === compId) {
        item.isRender = false;
        break;
      }
      if ((_item$children4 = item.children) != null && _item$children4.length) {
        _each__4(item.children);
      }
    }
  };
  _each__4(compTree.value || []);
}
var toPascalCase = function toPascalCase2(str) {
  return str.replace(/(-|_|\s)([a-z||A-Z])/g, function(g) {
    return g[1].toUpperCase();
  }).replace(/^[a-z]/, function(match) {
    return match.toUpperCase();
  });
};
var transformCompNameByPath = function transformCompNameByPath2(filePath) {
  var _filePath$split$pop;
  var fileName = (_filePath$split$pop = filePath.split("/").pop()) == null ? void 0 : _filePath$split$pop.split(".")[0];
  var dirName = filePath.split("/").slice(0, -1).slice(-1).join("");
  if (fileName.toLocaleLowerCase() === "index") {
    return toPascalCase(dirName);
  } else if (fileName.toLocaleLowerCase().endsWith("setter")) {
    return toPascalCase(dirName + "-" + fileName);
  } else {
    return toPascalCase(fileName);
  }
};
function useResolveAsyncCompLoader(compName) {
  var modules = window.KL_LOCAL_COMP_MOUDLES;
  if (!modules) return null;
  for (var path in modules) {
    var __compName = transformCompNameByPath(path);
    if (!__compName) throw new Error("Component name is undefined");
    if (__compName === compName) {
      var loader = modules[path];
      return loader;
    }
  }
  return null;
}
function useDefineComponent(component) {
  return defineComponent(component);
}
function useDefineAsyncComponent(source) {
  return defineAsyncComponent(source);
}
function useRegGlobalComponent(compName, source) {
  if (!compName || !source) return;
  var app = useGetAppInstance();
  !(app != null && app.component(compName)) && app.component(compName, typeof source === "function" ? defineAsyncComponent(source) : source);
}
function useResolveComponent(compName) {
  return resolveComponent(compName);
}
function useRegGlobalDirective(name, directive) {
  if (!name || !directive) return;
  var app = useGetAppInstance();
  !(app != null && app.directive(name)) && app.directive(name, directive);
}
function useResolveDirective(name) {
  return resolveDirective(name);
}
function useCreateVnode() {
  return h;
}
function useRender() {
  return render;
}
function useResolveVnode(component, props, slots) {
  var __component__ = typeof component === "string" ? resolveComponent(component) : component;
  if (!__component__ || typeof __component__ === "string") {
    return h("span", "Invalid Component");
  }
  var vnode = h(__component__, _extends({}, props), _extends({}, slots));
  return vnode;
}
function useRegCompEvents() {
  try {
    var _useGetCurrentInstanc = useGetCurrentInstance(), proxy = _useGetCurrentInstanc.proxy;
    var props = proxy == null ? void 0 : proxy._.props;
    var events = (props == null ? void 0 : props.events) || [];
    events.forEach(function(item) {
      var type = item.type, _item$value = item.value, value = _item$value === void 0 ? "" : _item$value;
      var fn = new Function("props", "compRef", "evt", value);
      switch (type) {
        case "onSetup":
          fn(props, proxy);
          break;
        case "onBeforeMount":
          onBeforeMount(function() {
            fn(props, proxy);
          });
          break;
        case "onMounted":
          onMounted(function() {
            fn(props, proxy);
          });
          break;
        case "onBeforeUnmount":
          onBeforeUnmount(function() {
            fn(props, proxy);
          });
          break;
        case "onUnmounted":
          onUnmounted(function() {
            fn(props, proxy);
          });
          break;
        case "onBeforeUpdate":
          onBeforeUpdate(function() {
            fn(props, proxy);
          });
          break;
        case "onUpdated":
          onUpdated(function() {
            fn(props, proxy);
          });
          break;
        case "onActivated":
          onActivated(function() {
            fn(props, proxy);
          });
          break;
        case "onDeactivated":
          onDeactivated(function() {
            fn(props, proxy);
          });
          break;
        default:
          nextTick(function() {
            var el = proxy == null ? void 0 : proxy.$el;
            var eventType = type.replace("on", "").toLowerCase();
            el.addEventListener(eventType, function(evt) {
              fn(props, proxy, evt);
            });
          });
          break;
      }
    });
  } catch (error) {
    console.error(error);
  }
}
function useRequest() {
  return request;
}
function useMessage() {
  var globalProperties = useGetGlobalProperties();
  if (!globalProperties) return;
  return globalProperties.$message;
}
function useLoading() {
  var globalProperties = useGetGlobalProperties();
  if (!globalProperties) return;
  return globalProperties.$loading;
}
export {
  appInstance,
  appSchema,
  compTree,
  useComputed,
  useCreateVnode,
  useDataSourceRequest,
  useDefineAsyncComponent,
  useDefineComponent,
  useDialog,
  useEventBus,
  useExposeAppInstance,
  useGetAppInstance,
  useGetAppRoute,
  useGetAppRouter,
  useGetAppSchema,
  useGetCompNode,
  useGetCompRef,
  useGetCompRefProps,
  useGetCompTree,
  useGetCompTreeByPath,
  useGetCurrentInstance,
  useGetGlobalProperties,
  useLoading,
  useMarkRaw,
  useMessage,
  useNextTick,
  useOnMounted,
  useOnUnmounted,
  useOnUpdated,
  useReactive,
  useRef,
  useRegCompEvents,
  useRegGlobalComponent,
  useRegGlobalDirective,
  useRegGlobalProperties,
  useReloadCompNode,
  useRemoveCompNode,
  useRender,
  useRequest,
  useResolveAsyncCompLoader,
  useResolveComponent,
  useResolveDirective,
  useResolveVnode,
  useShallowReactive,
  useShallowRef,
  useToRaw,
  useToRefs,
  useToValue,
  useUnrenderCompNode,
  useWatch
};
