refactor(upload): 重构文件上传逻辑,改用OSS直传方案 refactor(vendor): 禁用开发模式下的日志WebSocket连接 style: 统一文件末尾换行符和代码格式 chore: 更新项目配置中的appid和编译设置
7211 lines
241 KiB
JavaScript
7211 lines
241 KiB
JavaScript
require("../@babel/runtime/helpers/Arrayincludes");require("../@babel/runtime/helpers/Objectentries");var _inherits2 = require("../@babel/runtime/helpers/inherits");var _createSuper2 = require("../@babel/runtime/helpers/createSuper");var _createForOfIteratorHelper2 = require("../@babel/runtime/helpers/createForOfIteratorHelper");var _classCallCheck2 = require("../@babel/runtime/helpers/classCallCheck");var _createClass2 = require("../@babel/runtime/helpers/createClass");var _defineProperty2 = require("../@babel/runtime/helpers/defineProperty");var _slicedToArray2 = require("../@babel/runtime/helpers/slicedToArray");var _toConsumableArray2 = require("../@babel/runtime/helpers/toConsumableArray");var _typeof2 = require("../@babel/runtime/helpers/typeof");var _ErrorTypeStrings;function makeMap(str, expectsLowerCase) {
|
||
var set2 = new Set(str.split(","));
|
||
return expectsLowerCase ? function (val) {
|
||
return set2.has(val.toLowerCase());
|
||
} : function (val) {
|
||
return set2.has(val);
|
||
};
|
||
}var EMPTY_OBJ = Object.freeze({});var EMPTY_ARR = Object.freeze([]);var NOOP = function NOOP() {};var NO = function NO() {
|
||
return false;
|
||
};var isOn = function isOn(key) {
|
||
return key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (
|
||
// uppercase letter
|
||
key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
||
};var isModelListener = function isModelListener(key) {
|
||
return key.startsWith("onUpdate:");
|
||
};var extend = Object.assign;var remove = function remove(arr, el) {
|
||
var i = arr.indexOf(el);
|
||
if (i > -1) {
|
||
arr.splice(i, 1);
|
||
}
|
||
};var hasOwnProperty$1 = Object.prototype.hasOwnProperty;var hasOwn = function hasOwn(val, key) {
|
||
return hasOwnProperty$1.call(val, key);
|
||
};var isArray = Array.isArray;var isMap = function isMap(val) {
|
||
return toTypeString(val) === "[object Map]";
|
||
};var isSet = function isSet(val) {
|
||
return toTypeString(val) === "[object Set]";
|
||
};var isFunction = function isFunction(val) {
|
||
return typeof val === "function";
|
||
};var isString = function isString(val) {
|
||
return typeof val === "string";
|
||
};var isSymbol = function isSymbol(val) {
|
||
return _typeof2(val) === "symbol";
|
||
};var isObject = function isObject(val) {
|
||
return val !== null && _typeof2(val) === "object";
|
||
};var isPromise = function isPromise(val) {
|
||
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
||
};var objectToString = Object.prototype.toString;var toTypeString = function toTypeString(value) {
|
||
return objectToString.call(value);
|
||
};var toRawType = function toRawType(value) {
|
||
return toTypeString(value).slice(8, -1);
|
||
};var isPlainObject = function isPlainObject(val) {
|
||
return toTypeString(val) === "[object Object]";
|
||
};var isIntegerKey = function isIntegerKey(key) {
|
||
return isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||
};var isReservedProp = /* @__PURE__ */makeMap(
|
||
// the leading comma is intentional so empty string "" is also included
|
||
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");var isBuiltInDirective = /* @__PURE__ */makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");var cacheStringFunction = function cacheStringFunction(fn) {
|
||
var cache = /* @__PURE__ */Object.create(null);
|
||
return function (str) {
|
||
var hit = cache[str];
|
||
return hit || (cache[str] = fn(str));
|
||
};
|
||
};var camelizeRE = /-(\w)/g;var camelize = cacheStringFunction(function (str) {
|
||
return str.replace(camelizeRE, function (_, c) {
|
||
return c ? c.toUpperCase() : "";
|
||
});
|
||
});var hyphenateRE = /\B([A-Z])/g;var hyphenate = cacheStringFunction(function (str) {
|
||
return str.replace(hyphenateRE, "-$1").toLowerCase();
|
||
});var capitalize = cacheStringFunction(function (str) {
|
||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||
});var toHandlerKey = cacheStringFunction(function (str) {
|
||
var s = str ? "on".concat(capitalize(str)) : "";
|
||
return s;
|
||
});var hasChanged = function hasChanged(value, oldValue) {
|
||
return !Object.is(value, oldValue);
|
||
};var invokeArrayFns$1 = function invokeArrayFns$1(fns, arg) {
|
||
for (var i = 0; i < fns.length; i++) {
|
||
fns[i](arg);
|
||
}
|
||
};var def = function def(obj, key, value) {
|
||
Object.defineProperty(obj, key, {
|
||
configurable: true,
|
||
enumerable: false,
|
||
value: value
|
||
});
|
||
};var looseToNumber = function looseToNumber(val) {
|
||
var n = parseFloat(val);
|
||
return isNaN(n) ? val : n;
|
||
};var toDisplayString = function toDisplayString(val) {
|
||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||
};var replacer = function replacer(_key, val) {
|
||
if (val && val.__v_isRef) {
|
||
return replacer(_key, val.value);
|
||
} else if (isMap(val)) {
|
||
return _defineProperty2({}, "Map(".concat(val.size, ")"), _toConsumableArray2(val.entries()).reduce(function (entries, _ref, i) {
|
||
var _ref2 = _slicedToArray2(_ref, 2),
|
||
key = _ref2[0],
|
||
val2 = _ref2[1];
|
||
entries[stringifySymbol(key, i) + " =>"] = val2;
|
||
return entries;
|
||
}, {}));
|
||
} else if (isSet(val)) {
|
||
return _defineProperty2({}, "Set(".concat(val.size, ")"), _toConsumableArray2(val.values()).map(function (v) {
|
||
return stringifySymbol(v);
|
||
}));
|
||
} else if (isSymbol(val)) {
|
||
return stringifySymbol(val);
|
||
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||
return String(val);
|
||
}
|
||
return val;
|
||
};var stringifySymbol = function stringifySymbol(v) {
|
||
var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
||
var _a;
|
||
return isSymbol(v) ? "Symbol(".concat((_a = v.description) != null ? _a : i, ")") : v;
|
||
};var LOCALE_ZH_HANS = "zh-Hans";var LOCALE_ZH_HANT = "zh-Hant";var LOCALE_EN = "en";var LOCALE_FR = "fr";var LOCALE_ES = "es";function include(str, parts) {
|
||
return !!parts.find(function (part) {
|
||
return str.indexOf(part) !== -1;
|
||
});
|
||
}function startsWith(str, parts) {
|
||
return parts.find(function (part) {
|
||
return str.indexOf(part) === 0;
|
||
});
|
||
}function normalizeLocale(locale, messages) {
|
||
if (!locale) {
|
||
return;
|
||
}
|
||
locale = locale.trim().replace(/_/g, "-");
|
||
if (messages && messages[locale]) {
|
||
return locale;
|
||
}
|
||
locale = locale.toLowerCase();
|
||
if (locale === "chinese") {
|
||
return LOCALE_ZH_HANS;
|
||
}
|
||
if (locale.indexOf("zh") === 0) {
|
||
if (locale.indexOf("-hans") > -1) {
|
||
return LOCALE_ZH_HANS;
|
||
}
|
||
if (locale.indexOf("-hant") > -1) {
|
||
return LOCALE_ZH_HANT;
|
||
}
|
||
if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
|
||
return LOCALE_ZH_HANT;
|
||
}
|
||
return LOCALE_ZH_HANS;
|
||
}
|
||
var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
|
||
if (messages && Object.keys(messages).length > 0) {
|
||
locales = Object.keys(messages);
|
||
}
|
||
var lang = startsWith(locale, locales);
|
||
if (lang) {
|
||
return lang;
|
||
}
|
||
}var SLOT_DEFAULT_NAME = "d";var ON_SHOW = "onShow";var ON_HIDE = "onHide";var ON_LAUNCH = "onLaunch";var ON_ERROR = "onError";var ON_THEME_CHANGE = "onThemeChange";var ON_PAGE_NOT_FOUND = "onPageNotFound";var ON_UNHANDLE_REJECTION = "onUnhandledRejection";var ON_EXIT = "onExit";var ON_LOAD = "onLoad";var ON_READY = "onReady";var ON_UNLOAD = "onUnload";var ON_INIT = "onInit";var ON_SAVE_EXIT_STATE = "onSaveExitState";var ON_RESIZE = "onResize";var ON_BACK_PRESS = "onBackPress";var ON_PAGE_SCROLL = "onPageScroll";var ON_TAB_ITEM_TAP = "onTabItemTap";var ON_REACH_BOTTOM = "onReachBottom";var ON_PULL_DOWN_REFRESH = "onPullDownRefresh";var ON_SHARE_TIMELINE = "onShareTimeline";var ON_SHARE_CHAT = "onShareChat";var ON_ADD_TO_FAVORITES = "onAddToFavorites";var ON_SHARE_APP_MESSAGE = "onShareAppMessage";var ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";var ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = "onNavigationBarSearchInputClicked";var ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = "onNavigationBarSearchInputChanged";var ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = "onNavigationBarSearchInputConfirmed";var ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = "onNavigationBarSearchInputFocusChanged";var VIRTUAL_HOST_STYLE = "virtualHostStyle";var VIRTUAL_HOST_CLASS = "virtualHostClass";var VIRTUAL_HOST_HIDDEN = "virtualHostHidden";var VIRTUAL_HOST_ID = "virtualHostId";function hasLeadingSlash(str) {
|
||
return str.indexOf("/") === 0;
|
||
}function addLeadingSlash(str) {
|
||
return hasLeadingSlash(str) ? str : "/" + str;
|
||
}var invokeArrayFns = function invokeArrayFns(fns, arg) {
|
||
var ret;
|
||
for (var i = 0; i < fns.length; i++) {
|
||
ret = fns[i](arg);
|
||
}
|
||
return ret;
|
||
};function once(fn) {
|
||
var ctx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
var res;
|
||
return function () {
|
||
if (fn) {
|
||
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
||
args[_key2] = arguments[_key2];
|
||
}
|
||
res = fn.apply(ctx, args);
|
||
fn = null;
|
||
}
|
||
return res;
|
||
};
|
||
}function getValueByDataPath(obj, path) {
|
||
if (!isString(path)) {
|
||
return;
|
||
}
|
||
path = path.replace(/\[(\d+)\]/g, ".$1");
|
||
var parts = path.split(".");
|
||
var key = parts[0];
|
||
if (!obj) {
|
||
obj = {};
|
||
}
|
||
if (parts.length === 1) {
|
||
return obj[key];
|
||
}
|
||
return getValueByDataPath(obj[key], parts.slice(1).join("."));
|
||
}function sortObject(obj) {
|
||
var sortObj = {};
|
||
if (isPlainObject(obj)) {
|
||
Object.keys(obj).sort().forEach(function (key) {
|
||
var _key = key;
|
||
sortObj[_key] = obj[_key];
|
||
});
|
||
}
|
||
return !Object.keys(sortObj) ? obj : sortObj;
|
||
}var customizeRE = /:/g;function customizeEvent(str) {
|
||
return camelize(str.replace(customizeRE, "-"));
|
||
}var encode = encodeURIComponent;function stringifyQuery(obj) {
|
||
var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
|
||
var res = obj ? Object.keys(obj).map(function (key) {
|
||
var val = obj[key];
|
||
if (_typeof2(val) === void 0 || val === null) {
|
||
val = "";
|
||
} else if (isPlainObject(val)) {
|
||
val = JSON.stringify(val);
|
||
}
|
||
return encodeStr(key) + "=" + encodeStr(val);
|
||
}).filter(function (x) {
|
||
return x.length > 0;
|
||
}).join("&") : null;
|
||
return res ? "?".concat(res) : "";
|
||
}var PAGE_HOOKS = [ON_INIT, ON_LOAD, ON_SHOW, ON_HIDE, ON_UNLOAD, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SHARE_TIMELINE, ON_SHARE_APP_MESSAGE, ON_SHARE_CHAT, ON_ADD_TO_FAVORITES, ON_SAVE_EXIT_STATE, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED];function isRootHook(name) {
|
||
return PAGE_HOOKS.indexOf(name) > -1;
|
||
}var UniLifecycleHooks = [ON_SHOW, ON_HIDE, ON_LAUNCH, ON_ERROR, ON_THEME_CHANGE, ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION, ON_EXIT, ON_INIT, ON_LOAD, ON_READY, ON_UNLOAD, ON_RESIZE, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SHARE_TIMELINE, ON_ADD_TO_FAVORITES, ON_SHARE_APP_MESSAGE, ON_SHARE_CHAT, ON_SAVE_EXIT_STATE, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED];var MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */function () {
|
||
return {
|
||
onPageScroll: 1,
|
||
onShareAppMessage: 1 << 1,
|
||
onShareTimeline: 1 << 2
|
||
};
|
||
}();function isUniLifecycleHook(name, value) {
|
||
var checkType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||
if (checkType && !isFunction(value)) {
|
||
return false;
|
||
}
|
||
if (UniLifecycleHooks.indexOf(name) > -1) {
|
||
return true;
|
||
} else if (name.indexOf("on") === 0) {
|
||
return true;
|
||
}
|
||
return false;
|
||
}var vueApp;var createVueAppHooks = [];function onCreateVueApp(hook) {
|
||
if (vueApp) {
|
||
return hook(vueApp);
|
||
}
|
||
createVueAppHooks.push(hook);
|
||
}function invokeCreateVueAppHook(app) {
|
||
vueApp = app;
|
||
createVueAppHooks.forEach(function (hook) {
|
||
return hook(app);
|
||
});
|
||
}var invokeCreateErrorHandler = once(function (app, createErrorHandler2) {
|
||
return createErrorHandler2(app);
|
||
});var E = function E() {};E.prototype = {
|
||
_id: 1,
|
||
on: function on(name, callback, ctx) {
|
||
var e2 = this.e || (this.e = {});
|
||
(e2[name] || (e2[name] = [])).push({
|
||
fn: callback,
|
||
ctx: ctx,
|
||
_id: this._id
|
||
});
|
||
return this._id++;
|
||
},
|
||
once: function once(name, callback, ctx) {
|
||
var self2 = this;
|
||
function listener() {
|
||
self2.off(name, listener);
|
||
callback.apply(ctx, arguments);
|
||
}
|
||
listener._ = callback;
|
||
return this.on(name, listener, ctx);
|
||
},
|
||
emit: function emit(name) {
|
||
var data = [].slice.call(arguments, 1);
|
||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||
var i = 0;
|
||
var len = evtArr.length;
|
||
for (i; i < len; i++) {
|
||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||
}
|
||
return this;
|
||
},
|
||
off: function off(name, event) {
|
||
var e2 = this.e || (this.e = {});
|
||
var evts = e2[name];
|
||
var liveEvents = [];
|
||
if (evts && event) {
|
||
for (var i = evts.length - 1; i >= 0; i--) {
|
||
if (evts[i].fn === event || evts[i].fn._ === event || evts[i]._id === event) {
|
||
evts.splice(i, 1);
|
||
break;
|
||
}
|
||
}
|
||
liveEvents = evts;
|
||
}
|
||
liveEvents.length ? e2[name] = liveEvents : delete e2[name];
|
||
return this;
|
||
}
|
||
};var E$1 = E;function warn$2(msg) {
|
||
var _console;
|
||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
|
||
args[_key3 - 1] = arguments[_key3];
|
||
}
|
||
(_console = console).warn.apply(_console, ["[Vue warn] ".concat(msg)].concat(args));
|
||
}var activeEffectScope;var EffectScope = /*#__PURE__*/function () {
|
||
function EffectScope() {
|
||
var detached = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||
_classCallCheck2(this, EffectScope);
|
||
this.detached = detached;
|
||
this._active = true;
|
||
this.effects = [];
|
||
this.cleanups = [];
|
||
this.parent = activeEffectScope;
|
||
if (!detached && activeEffectScope) {
|
||
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
||
}
|
||
}
|
||
_createClass2(EffectScope, [{
|
||
key: "active",
|
||
get: function get() {
|
||
return this._active;
|
||
}
|
||
}, {
|
||
key: "run",
|
||
value: function run(fn) {
|
||
if (this._active) {
|
||
var currentEffectScope = activeEffectScope;
|
||
try {
|
||
activeEffectScope = this;
|
||
return fn();
|
||
} finally {
|
||
activeEffectScope = currentEffectScope;
|
||
}
|
||
} else {
|
||
warn$2("cannot run an inactive effect scope.");
|
||
}
|
||
}
|
||
/**
|
||
* This should only be called on non-detached scopes
|
||
* @internal
|
||
*/
|
||
}, {
|
||
key: "on",
|
||
value: function on() {
|
||
activeEffectScope = this;
|
||
}
|
||
/**
|
||
* This should only be called on non-detached scopes
|
||
* @internal
|
||
*/
|
||
}, {
|
||
key: "off",
|
||
value: function off() {
|
||
activeEffectScope = this.parent;
|
||
}
|
||
}, {
|
||
key: "stop",
|
||
value: function stop(fromParent) {
|
||
if (this._active) {
|
||
var i, l;
|
||
for (i = 0, l = this.effects.length; i < l; i++) {
|
||
this.effects[i].stop();
|
||
}
|
||
for (i = 0, l = this.cleanups.length; i < l; i++) {
|
||
this.cleanups[i]();
|
||
}
|
||
if (this.scopes) {
|
||
for (i = 0, l = this.scopes.length; i < l; i++) {
|
||
this.scopes[i].stop(true);
|
||
}
|
||
}
|
||
if (!this.detached && this.parent && !fromParent) {
|
||
var last = this.parent.scopes.pop();
|
||
if (last && last !== this) {
|
||
this.parent.scopes[this.index] = last;
|
||
last.index = this.index;
|
||
}
|
||
}
|
||
this.parent = void 0;
|
||
this._active = false;
|
||
}
|
||
}
|
||
}]);
|
||
return EffectScope;
|
||
}();function recordEffectScope(effect2) {
|
||
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : activeEffectScope;
|
||
if (scope && scope.active) {
|
||
scope.effects.push(effect2);
|
||
}
|
||
}function getCurrentScope() {
|
||
return activeEffectScope;
|
||
}var activeEffect;var ReactiveEffect = /*#__PURE__*/function () {
|
||
function ReactiveEffect(fn, trigger2, scheduler, scope) {
|
||
_classCallCheck2(this, ReactiveEffect);
|
||
this.fn = fn;
|
||
this.trigger = trigger2;
|
||
this.scheduler = scheduler;
|
||
this.active = true;
|
||
this.deps = [];
|
||
this._dirtyLevel = 4;
|
||
this._trackId = 0;
|
||
this._runnings = 0;
|
||
this._shouldSchedule = false;
|
||
this._depsLength = 0;
|
||
recordEffectScope(this, scope);
|
||
}
|
||
_createClass2(ReactiveEffect, [{
|
||
key: "dirty",
|
||
get: function get() {
|
||
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
||
this._dirtyLevel = 1;
|
||
pauseTracking();
|
||
for (var i = 0; i < this._depsLength; i++) {
|
||
var dep = this.deps[i];
|
||
if (dep.computed) {
|
||
triggerComputed(dep.computed);
|
||
if (this._dirtyLevel >= 4) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (this._dirtyLevel === 1) {
|
||
this._dirtyLevel = 0;
|
||
}
|
||
resetTracking();
|
||
}
|
||
return this._dirtyLevel >= 4;
|
||
},
|
||
set: function set(v) {
|
||
this._dirtyLevel = v ? 4 : 0;
|
||
}
|
||
}, {
|
||
key: "run",
|
||
value: function run() {
|
||
this._dirtyLevel = 0;
|
||
if (!this.active) {
|
||
return this.fn();
|
||
}
|
||
var lastShouldTrack = shouldTrack;
|
||
var lastEffect = activeEffect;
|
||
try {
|
||
shouldTrack = true;
|
||
activeEffect = this;
|
||
this._runnings++;
|
||
preCleanupEffect(this);
|
||
return this.fn();
|
||
} finally {
|
||
postCleanupEffect(this);
|
||
this._runnings--;
|
||
activeEffect = lastEffect;
|
||
shouldTrack = lastShouldTrack;
|
||
}
|
||
}
|
||
}, {
|
||
key: "stop",
|
||
value: function stop() {
|
||
var _a;
|
||
if (this.active) {
|
||
preCleanupEffect(this);
|
||
postCleanupEffect(this);
|
||
(_a = this.onStop) == null ? void 0 : _a.call(this);
|
||
this.active = false;
|
||
}
|
||
}
|
||
}]);
|
||
return ReactiveEffect;
|
||
}();function triggerComputed(computed2) {
|
||
return computed2.value;
|
||
}function preCleanupEffect(effect2) {
|
||
effect2._trackId++;
|
||
effect2._depsLength = 0;
|
||
}function postCleanupEffect(effect2) {
|
||
if (effect2.deps.length > effect2._depsLength) {
|
||
for (var i = effect2._depsLength; i < effect2.deps.length; i++) {
|
||
cleanupDepEffect(effect2.deps[i], effect2);
|
||
}
|
||
effect2.deps.length = effect2._depsLength;
|
||
}
|
||
}function cleanupDepEffect(dep, effect2) {
|
||
var trackId = dep.get(effect2);
|
||
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
||
dep.delete(effect2);
|
||
if (dep.size === 0) {
|
||
dep.cleanup();
|
||
}
|
||
}
|
||
}var shouldTrack = true;var pauseScheduleStack = 0;var trackStack = [];function pauseTracking() {
|
||
trackStack.push(shouldTrack);
|
||
shouldTrack = false;
|
||
}function resetTracking() {
|
||
var last = trackStack.pop();
|
||
shouldTrack = last === void 0 ? true : last;
|
||
}function pauseScheduling() {
|
||
pauseScheduleStack++;
|
||
}function resetScheduling() {
|
||
pauseScheduleStack--;
|
||
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
||
queueEffectSchedulers.shift()();
|
||
}
|
||
}function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
||
var _a;
|
||
if (dep.get(effect2) !== effect2._trackId) {
|
||
dep.set(effect2, effect2._trackId);
|
||
var oldDep = effect2.deps[effect2._depsLength];
|
||
if (oldDep !== dep) {
|
||
if (oldDep) {
|
||
cleanupDepEffect(oldDep, effect2);
|
||
}
|
||
effect2.deps[effect2._depsLength++] = dep;
|
||
} else {
|
||
effect2._depsLength++;
|
||
}
|
||
{
|
||
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({
|
||
effect: effect2
|
||
}, debuggerEventExtraInfo));
|
||
}
|
||
}
|
||
}var queueEffectSchedulers = [];function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
||
var _a;
|
||
pauseScheduling();
|
||
var _iterator = _createForOfIteratorHelper2(dep.keys()),
|
||
_step;
|
||
try {
|
||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||
var effect2 = _step.value;
|
||
var tracking = void 0;
|
||
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
||
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0);
|
||
effect2._dirtyLevel = dirtyLevel;
|
||
}
|
||
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) {
|
||
{
|
||
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({
|
||
effect: effect2
|
||
}, debuggerEventExtraInfo));
|
||
}
|
||
effect2.trigger();
|
||
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) {
|
||
effect2._shouldSchedule = false;
|
||
if (effect2.scheduler) {
|
||
queueEffectSchedulers.push(effect2.scheduler);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} catch (err) {
|
||
_iterator.e(err);
|
||
} finally {
|
||
_iterator.f();
|
||
}
|
||
resetScheduling();
|
||
}var createDep = function createDep(cleanup, computed2) {
|
||
var dep = /* @__PURE__ */new Map();
|
||
dep.cleanup = cleanup;
|
||
dep.computed = computed2;
|
||
return dep;
|
||
};var targetMap = /* @__PURE__ */new WeakMap();var ITERATE_KEY = Symbol("iterate");var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");function track(target, type, key) {
|
||
if (shouldTrack && activeEffect) {
|
||
var depsMap = targetMap.get(target);
|
||
if (!depsMap) {
|
||
targetMap.set(target, depsMap = /* @__PURE__ */new Map());
|
||
}
|
||
var dep = depsMap.get(key);
|
||
if (!dep) {
|
||
depsMap.set(key, dep = createDep(function () {
|
||
return depsMap.delete(key);
|
||
}));
|
||
}
|
||
trackEffect(activeEffect, dep, {
|
||
target: target,
|
||
type: type,
|
||
key: key
|
||
});
|
||
}
|
||
}function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||
var depsMap = targetMap.get(target);
|
||
if (!depsMap) {
|
||
return;
|
||
}
|
||
var deps = [];
|
||
if (type === "clear") {
|
||
deps = _toConsumableArray2(depsMap.values());
|
||
} else if (key === "length" && isArray(target)) {
|
||
var newLength = Number(newValue);
|
||
depsMap.forEach(function (dep, key2) {
|
||
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
||
deps.push(dep);
|
||
}
|
||
});
|
||
} else {
|
||
if (key !== void 0) {
|
||
deps.push(depsMap.get(key));
|
||
}
|
||
switch (type) {
|
||
case "add":
|
||
if (!isArray(target)) {
|
||
deps.push(depsMap.get(ITERATE_KEY));
|
||
if (isMap(target)) {
|
||
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||
}
|
||
} else if (isIntegerKey(key)) {
|
||
deps.push(depsMap.get("length"));
|
||
}
|
||
break;
|
||
case "delete":
|
||
if (!isArray(target)) {
|
||
deps.push(depsMap.get(ITERATE_KEY));
|
||
if (isMap(target)) {
|
||
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||
}
|
||
}
|
||
break;
|
||
case "set":
|
||
if (isMap(target)) {
|
||
deps.push(depsMap.get(ITERATE_KEY));
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
pauseScheduling();
|
||
var _iterator2 = _createForOfIteratorHelper2(deps),
|
||
_step2;
|
||
try {
|
||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
||
var dep = _step2.value;
|
||
if (dep) {
|
||
triggerEffects(dep, 4, {
|
||
target: target,
|
||
type: type,
|
||
key: key,
|
||
newValue: newValue,
|
||
oldValue: oldValue,
|
||
oldTarget: oldTarget
|
||
});
|
||
}
|
||
}
|
||
} catch (err) {
|
||
_iterator2.e(err);
|
||
} finally {
|
||
_iterator2.f();
|
||
}
|
||
resetScheduling();
|
||
}var isNonTrackableKeys = /* @__PURE__ */makeMap("__proto__,__v_isRef,__isVue");var builtInSymbols = new Set( /* @__PURE__ */Object.getOwnPropertyNames(Symbol).filter(function (key) {
|
||
return key !== "arguments" && key !== "caller";
|
||
}).map(function (key) {
|
||
return Symbol[key];
|
||
}).filter(isSymbol));var arrayInstrumentations = /* @__PURE__ */createArrayInstrumentations();function createArrayInstrumentations() {
|
||
var instrumentations = {};
|
||
["includes", "indexOf", "lastIndexOf"].forEach(function (key) {
|
||
instrumentations[key] = function () {
|
||
var arr = toRaw(this);
|
||
for (var i = 0, l = this.length; i < l; i++) {
|
||
track(arr, "get", i + "");
|
||
}
|
||
for (var _len3 = arguments.length, args = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {
|
||
args[_key4] = arguments[_key4];
|
||
}
|
||
var res = arr[key].apply(arr, args);
|
||
if (res === -1 || res === false) {
|
||
return arr[key].apply(arr, _toConsumableArray2(args.map(toRaw)));
|
||
} else {
|
||
return res;
|
||
}
|
||
};
|
||
});
|
||
["push", "pop", "shift", "unshift", "splice"].forEach(function (key) {
|
||
instrumentations[key] = function () {
|
||
pauseTracking();
|
||
pauseScheduling();
|
||
for (var _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
|
||
args[_key5] = arguments[_key5];
|
||
}
|
||
var res = toRaw(this)[key].apply(this, args);
|
||
resetScheduling();
|
||
resetTracking();
|
||
return res;
|
||
};
|
||
});
|
||
return instrumentations;
|
||
}function hasOwnProperty(key) {
|
||
var obj = toRaw(this);
|
||
track(obj, "has", key);
|
||
return obj.hasOwnProperty(key);
|
||
}var BaseReactiveHandler = /*#__PURE__*/function () {
|
||
function BaseReactiveHandler() {
|
||
var _isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||
var _isShallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
_classCallCheck2(this, BaseReactiveHandler);
|
||
this._isReadonly = _isReadonly;
|
||
this._isShallow = _isShallow;
|
||
}
|
||
_createClass2(BaseReactiveHandler, [{
|
||
key: "get",
|
||
value: function get(target, key, receiver) {
|
||
var isReadonly2 = this._isReadonly,
|
||
isShallow2 = this._isShallow;
|
||
if (key === "__v_isReactive") {
|
||
return !isReadonly2;
|
||
} else if (key === "__v_isReadonly") {
|
||
return isReadonly2;
|
||
} else if (key === "__v_isShallow") {
|
||
return isShallow2;
|
||
} else if (key === "__v_raw") {
|
||
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) ||
|
||
// receiver is not the reactive proxy, but has the same prototype
|
||
// this means the reciever is a user proxy of the reactive proxy
|
||
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
||
return target;
|
||
}
|
||
return;
|
||
}
|
||
var targetIsArray = isArray(target);
|
||
if (!isReadonly2) {
|
||
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||
}
|
||
if (key === "hasOwnProperty") {
|
||
return hasOwnProperty;
|
||
}
|
||
}
|
||
var res = Reflect.get(target, key, receiver);
|
||
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
||
return res;
|
||
}
|
||
if (!isReadonly2) {
|
||
track(target, "get", key);
|
||
}
|
||
if (isShallow2) {
|
||
return res;
|
||
}
|
||
if (isRef(res)) {
|
||
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
||
}
|
||
if (isObject(res)) {
|
||
return isReadonly2 ? readonly(res) : reactive(res);
|
||
}
|
||
return res;
|
||
}
|
||
}]);
|
||
return BaseReactiveHandler;
|
||
}();var MutableReactiveHandler = /*#__PURE__*/function (_BaseReactiveHandler) {
|
||
_inherits2(MutableReactiveHandler, _BaseReactiveHandler);
|
||
var _super = _createSuper2(MutableReactiveHandler);
|
||
function MutableReactiveHandler() {
|
||
var isShallow2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||
_classCallCheck2(this, MutableReactiveHandler);
|
||
return _super.call(this, false, isShallow2);
|
||
}
|
||
_createClass2(MutableReactiveHandler, [{
|
||
key: "set",
|
||
value: function set(target, key, value, receiver) {
|
||
var oldValue = target[key];
|
||
if (!this._isShallow) {
|
||
var isOldValueReadonly = isReadonly(oldValue);
|
||
if (!isShallow(value) && !isReadonly(value)) {
|
||
oldValue = toRaw(oldValue);
|
||
value = toRaw(value);
|
||
}
|
||
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||
if (isOldValueReadonly) {
|
||
return false;
|
||
} else {
|
||
oldValue.value = value;
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
var hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
||
var result = Reflect.set(target, key, value, receiver);
|
||
if (target === toRaw(receiver)) {
|
||
if (!hadKey) {
|
||
trigger(target, "add", key, value);
|
||
} else if (hasChanged(value, oldValue)) {
|
||
trigger(target, "set", key, value, oldValue);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
}, {
|
||
key: "deleteProperty",
|
||
value: function deleteProperty(target, key) {
|
||
var hadKey = hasOwn(target, key);
|
||
var oldValue = target[key];
|
||
var result = Reflect.deleteProperty(target, key);
|
||
if (result && hadKey) {
|
||
trigger(target, "delete", key, void 0, oldValue);
|
||
}
|
||
return result;
|
||
}
|
||
}, {
|
||
key: "has",
|
||
value: function has(target, key) {
|
||
var result = Reflect.has(target, key);
|
||
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
||
track(target, "has", key);
|
||
}
|
||
return result;
|
||
}
|
||
}, {
|
||
key: "ownKeys",
|
||
value: function ownKeys(target) {
|
||
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
||
return Reflect.ownKeys(target);
|
||
}
|
||
}]);
|
||
return MutableReactiveHandler;
|
||
}(BaseReactiveHandler);var ReadonlyReactiveHandler = /*#__PURE__*/function (_BaseReactiveHandler2) {
|
||
_inherits2(ReadonlyReactiveHandler, _BaseReactiveHandler2);
|
||
var _super2 = _createSuper2(ReadonlyReactiveHandler);
|
||
function ReadonlyReactiveHandler() {
|
||
var isShallow2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
||
_classCallCheck2(this, ReadonlyReactiveHandler);
|
||
return _super2.call(this, true, isShallow2);
|
||
}
|
||
_createClass2(ReadonlyReactiveHandler, [{
|
||
key: "set",
|
||
value: function set(target, key) {
|
||
{
|
||
warn$2("Set operation on key \"".concat(String(key), "\" failed: target is readonly."), target);
|
||
}
|
||
return true;
|
||
}
|
||
}, {
|
||
key: "deleteProperty",
|
||
value: function deleteProperty(target, key) {
|
||
{
|
||
warn$2("Delete operation on key \"".concat(String(key), "\" failed: target is readonly."), target);
|
||
}
|
||
return true;
|
||
}
|
||
}]);
|
||
return ReadonlyReactiveHandler;
|
||
}(BaseReactiveHandler);var mutableHandlers = /* @__PURE__ */new MutableReactiveHandler();var readonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler();var shallowReactiveHandlers = /* @__PURE__ */new MutableReactiveHandler(true);var shallowReadonlyHandlers = /* @__PURE__ */new ReadonlyReactiveHandler(true);var toShallow = function toShallow(value) {
|
||
return value;
|
||
};var getProto = function getProto(v) {
|
||
return Reflect.getPrototypeOf(v);
|
||
};function _get(target, key) {
|
||
var isReadonly2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var isShallow2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
target = target["__v_raw"];
|
||
var rawTarget = toRaw(target);
|
||
var rawKey = toRaw(key);
|
||
if (!isReadonly2) {
|
||
if (hasChanged(key, rawKey)) {
|
||
track(rawTarget, "get", key);
|
||
}
|
||
track(rawTarget, "get", rawKey);
|
||
}
|
||
var _getProto = getProto(rawTarget),
|
||
has2 = _getProto.has;
|
||
var wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
||
if (has2.call(rawTarget, key)) {
|
||
return wrap(target.get(key));
|
||
} else if (has2.call(rawTarget, rawKey)) {
|
||
return wrap(target.get(rawKey));
|
||
} else if (target !== rawTarget) {
|
||
target.get(key);
|
||
}
|
||
}function has$1(key) {
|
||
var isReadonly2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
var target = this["__v_raw"];
|
||
var rawTarget = toRaw(target);
|
||
var rawKey = toRaw(key);
|
||
if (!isReadonly2) {
|
||
if (hasChanged(key, rawKey)) {
|
||
track(rawTarget, "has", key);
|
||
}
|
||
track(rawTarget, "has", rawKey);
|
||
}
|
||
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
||
}function size(target) {
|
||
var isReadonly2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
target = target["__v_raw"];
|
||
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
|
||
return Reflect.get(target, "size", target);
|
||
}function add(value) {
|
||
value = toRaw(value);
|
||
var target = toRaw(this);
|
||
var proto = getProto(target);
|
||
var hadKey = proto.has.call(target, value);
|
||
if (!hadKey) {
|
||
target.add(value);
|
||
trigger(target, "add", value, value);
|
||
}
|
||
return this;
|
||
}function set$1(key, value) {
|
||
value = toRaw(value);
|
||
var target = toRaw(this);
|
||
var _getProto2 = getProto(target),
|
||
has2 = _getProto2.has,
|
||
get2 = _getProto2.get;
|
||
var hadKey = has2.call(target, key);
|
||
if (!hadKey) {
|
||
key = toRaw(key);
|
||
hadKey = has2.call(target, key);
|
||
} else {
|
||
checkIdentityKeys(target, has2, key);
|
||
}
|
||
var oldValue = get2.call(target, key);
|
||
target.set(key, value);
|
||
if (!hadKey) {
|
||
trigger(target, "add", key, value);
|
||
} else if (hasChanged(value, oldValue)) {
|
||
trigger(target, "set", key, value, oldValue);
|
||
}
|
||
return this;
|
||
}function deleteEntry(key) {
|
||
var target = toRaw(this);
|
||
var _getProto3 = getProto(target),
|
||
has2 = _getProto3.has,
|
||
get2 = _getProto3.get;
|
||
var hadKey = has2.call(target, key);
|
||
if (!hadKey) {
|
||
key = toRaw(key);
|
||
hadKey = has2.call(target, key);
|
||
} else {
|
||
checkIdentityKeys(target, has2, key);
|
||
}
|
||
var oldValue = get2 ? get2.call(target, key) : void 0;
|
||
var result = target.delete(key);
|
||
if (hadKey) {
|
||
trigger(target, "delete", key, void 0, oldValue);
|
||
}
|
||
return result;
|
||
}function clear() {
|
||
var target = toRaw(this);
|
||
var hadItems = target.size !== 0;
|
||
var oldTarget = isMap(target) ? new Map(target) : new Set(target);
|
||
var result = target.clear();
|
||
if (hadItems) {
|
||
trigger(target, "clear", void 0, void 0, oldTarget);
|
||
}
|
||
return result;
|
||
}function createForEach(isReadonly2, isShallow2) {
|
||
return function forEach(callback, thisArg) {
|
||
var observed = this;
|
||
var target = observed["__v_raw"];
|
||
var rawTarget = toRaw(target);
|
||
var wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
||
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
|
||
return target.forEach(function (value, key) {
|
||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||
});
|
||
};
|
||
}function createIterableMethod(method, isReadonly2, isShallow2) {
|
||
return function () {
|
||
var target = this["__v_raw"];
|
||
var rawTarget = toRaw(target);
|
||
var targetIsMap = isMap(rawTarget);
|
||
var isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
||
var isKeyOnly = method === "keys" && targetIsMap;
|
||
var innerIterator = target[method].apply(target, arguments);
|
||
var wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
||
!isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||
return _defineProperty2({
|
||
// iterator protocol
|
||
next: function next() {
|
||
var _innerIterator$next = innerIterator.next(),
|
||
value = _innerIterator$next.value,
|
||
done = _innerIterator$next.done;
|
||
return done ? {
|
||
value: value,
|
||
done: done
|
||
} : {
|
||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||
done: done
|
||
};
|
||
}
|
||
}, Symbol.iterator, function () {
|
||
return this;
|
||
});
|
||
};
|
||
}function createReadonlyMethod(type) {
|
||
return function () {
|
||
{
|
||
var key = (arguments.length <= 0 ? undefined : arguments[0]) ? "on key \"".concat(arguments.length <= 0 ? undefined : arguments[0], "\" ") : "";
|
||
warn$2("".concat(capitalize(type), " operation ").concat(key, "failed: target is readonly."), toRaw(this));
|
||
}
|
||
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
||
};
|
||
}function createInstrumentations() {
|
||
var mutableInstrumentations2 = {
|
||
get: function get(key) {
|
||
return _get(this, key);
|
||
},
|
||
get size() {
|
||
return size(this);
|
||
},
|
||
has: has$1,
|
||
add: add,
|
||
set: set$1,
|
||
delete: deleteEntry,
|
||
clear: clear,
|
||
forEach: createForEach(false, false)
|
||
};
|
||
var shallowInstrumentations2 = {
|
||
get: function get(key) {
|
||
return _get(this, key, false, true);
|
||
},
|
||
get size() {
|
||
return size(this);
|
||
},
|
||
has: has$1,
|
||
add: add,
|
||
set: set$1,
|
||
delete: deleteEntry,
|
||
clear: clear,
|
||
forEach: createForEach(false, true)
|
||
};
|
||
var readonlyInstrumentations2 = {
|
||
get: function get(key) {
|
||
return _get(this, key, true);
|
||
},
|
||
get size() {
|
||
return size(this, true);
|
||
},
|
||
has: function has(key) {
|
||
return has$1.call(this, key, true);
|
||
},
|
||
add: createReadonlyMethod("add"),
|
||
set: createReadonlyMethod("set"),
|
||
delete: createReadonlyMethod("delete"),
|
||
clear: createReadonlyMethod("clear"),
|
||
forEach: createForEach(true, false)
|
||
};
|
||
var shallowReadonlyInstrumentations2 = {
|
||
get: function get(key) {
|
||
return _get(this, key, true, true);
|
||
},
|
||
get size() {
|
||
return size(this, true);
|
||
},
|
||
has: function has(key) {
|
||
return has$1.call(this, key, true);
|
||
},
|
||
add: createReadonlyMethod("add"),
|
||
set: createReadonlyMethod("set"),
|
||
delete: createReadonlyMethod("delete"),
|
||
clear: createReadonlyMethod("clear"),
|
||
forEach: createForEach(true, true)
|
||
};
|
||
var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
|
||
iteratorMethods.forEach(function (method) {
|
||
mutableInstrumentations2[method] = createIterableMethod(method, false, false);
|
||
readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
|
||
shallowInstrumentations2[method] = createIterableMethod(method, false, true);
|
||
shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
|
||
});
|
||
return [mutableInstrumentations2, readonlyInstrumentations2, shallowInstrumentations2, shallowReadonlyInstrumentations2];
|
||
}var _createInstrumentatio = /* @__PURE__ */createInstrumentations(),
|
||
_createInstrumentatio2 = _slicedToArray2(_createInstrumentatio, 4),
|
||
mutableInstrumentations = _createInstrumentatio2[0],
|
||
readonlyInstrumentations = _createInstrumentatio2[1],
|
||
shallowInstrumentations = _createInstrumentatio2[2],
|
||
shallowReadonlyInstrumentations = _createInstrumentatio2[3];function createInstrumentationGetter(isReadonly2, shallow) {
|
||
var instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
|
||
return function (target, key, receiver) {
|
||
if (key === "__v_isReactive") {
|
||
return !isReadonly2;
|
||
} else if (key === "__v_isReadonly") {
|
||
return isReadonly2;
|
||
} else if (key === "__v_raw") {
|
||
return target;
|
||
}
|
||
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
||
};
|
||
}var mutableCollectionHandlers = {
|
||
get: /* @__PURE__ */createInstrumentationGetter(false, false)
|
||
};var shallowCollectionHandlers = {
|
||
get: /* @__PURE__ */createInstrumentationGetter(false, true)
|
||
};var readonlyCollectionHandlers = {
|
||
get: /* @__PURE__ */createInstrumentationGetter(true, false)
|
||
};var shallowReadonlyCollectionHandlers = {
|
||
get: /* @__PURE__ */createInstrumentationGetter(true, true)
|
||
};function checkIdentityKeys(target, has2, key) {
|
||
var rawKey = toRaw(key);
|
||
if (rawKey !== key && has2.call(target, rawKey)) {
|
||
var type = toRawType(target);
|
||
warn$2("Reactive ".concat(type, " contains both the raw and reactive versions of the same object").concat(type === "Map" ? " as keys" : "", ", which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible."));
|
||
}
|
||
}var reactiveMap = /* @__PURE__ */new WeakMap();var shallowReactiveMap = /* @__PURE__ */new WeakMap();var readonlyMap = /* @__PURE__ */new WeakMap();var shallowReadonlyMap = /* @__PURE__ */new WeakMap();function targetTypeMap(rawType) {
|
||
switch (rawType) {
|
||
case "Object":
|
||
case "Array":
|
||
return 1;
|
||
case "Map":
|
||
case "Set":
|
||
case "WeakMap":
|
||
case "WeakSet":
|
||
return 2;
|
||
default:
|
||
return 0;
|
||
}
|
||
}function getTargetType(value) {
|
||
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
||
}function reactive(target) {
|
||
if (isReadonly(target)) {
|
||
return target;
|
||
}
|
||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
||
}function shallowReactive(target) {
|
||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
||
}function readonly(target) {
|
||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
||
}function shallowReadonly(target) {
|
||
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
||
}function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
||
if (!isObject(target)) {
|
||
{
|
||
warn$2("value cannot be made reactive: ".concat(String(target)));
|
||
}
|
||
return target;
|
||
}
|
||
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
||
return target;
|
||
}
|
||
var existingProxy = proxyMap.get(target);
|
||
if (existingProxy) {
|
||
return existingProxy;
|
||
}
|
||
var targetType = getTargetType(target);
|
||
if (targetType === 0) {
|
||
return target;
|
||
}
|
||
var proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
||
proxyMap.set(target, proxy);
|
||
return proxy;
|
||
}function isReactive(value) {
|
||
if (isReadonly(value)) {
|
||
return isReactive(value["__v_raw"]);
|
||
}
|
||
return !!(value && value["__v_isReactive"]);
|
||
}function isReadonly(value) {
|
||
return !!(value && value["__v_isReadonly"]);
|
||
}function isShallow(value) {
|
||
return !!(value && value["__v_isShallow"]);
|
||
}function toRaw(observed) {
|
||
var raw = observed && observed["__v_raw"];
|
||
return raw ? toRaw(raw) : observed;
|
||
}function markRaw(value) {
|
||
if (Object.isExtensible(value)) {
|
||
def(value, "__v_skip", true);
|
||
}
|
||
return value;
|
||
}var toReactive = function toReactive(value) {
|
||
return isObject(value) ? reactive(value) : value;
|
||
};var toReadonly = function toReadonly(value) {
|
||
return isObject(value) ? readonly(value) : value;
|
||
};var COMPUTED_SIDE_EFFECT_WARN = "Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free";var ComputedRefImpl = /*#__PURE__*/function () {
|
||
function ComputedRefImpl(getter, _setter, isReadonly2, isSSR) {
|
||
var _this = this;
|
||
_classCallCheck2(this, ComputedRefImpl);
|
||
this.getter = getter;
|
||
this._setter = _setter;
|
||
this.dep = void 0;
|
||
this.__v_isRef = true;
|
||
this["__v_isReadonly"] = false;
|
||
this.effect = new ReactiveEffect(function () {
|
||
return getter(_this._value);
|
||
}, function () {
|
||
return triggerRefValue(_this, _this.effect._dirtyLevel === 2 ? 2 : 3);
|
||
});
|
||
this.effect.computed = this;
|
||
this.effect.active = this._cacheable = !isSSR;
|
||
this["__v_isReadonly"] = isReadonly2;
|
||
}
|
||
_createClass2(ComputedRefImpl, [{
|
||
key: "value",
|
||
get: function get() {
|
||
var self = toRaw(this);
|
||
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
||
triggerRefValue(self, 4);
|
||
}
|
||
trackRefValue(self);
|
||
if (self.effect._dirtyLevel >= 2) {
|
||
if (this._warnRecursive) {
|
||
warn$2(COMPUTED_SIDE_EFFECT_WARN, "\n\ngetter: ", this.getter);
|
||
}
|
||
triggerRefValue(self, 2);
|
||
}
|
||
return self._value;
|
||
},
|
||
set: function set(newValue) {
|
||
this._setter(newValue);
|
||
}
|
||
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
||
}, {
|
||
key: "_dirty",
|
||
get: function get() {
|
||
return this.effect.dirty;
|
||
},
|
||
set: function set(v) {
|
||
this.effect.dirty = v;
|
||
}
|
||
// #endregion
|
||
}]);
|
||
return ComputedRefImpl;
|
||
}();function computed$1(getterOrOptions, debugOptions) {
|
||
var isSSR = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var getter;
|
||
var setter;
|
||
var onlyGetter = isFunction(getterOrOptions);
|
||
if (onlyGetter) {
|
||
getter = getterOrOptions;
|
||
setter = function setter() {
|
||
warn$2("Write operation failed: computed value is readonly");
|
||
};
|
||
} else {
|
||
getter = getterOrOptions.get;
|
||
setter = getterOrOptions.set;
|
||
}
|
||
var cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
||
if (debugOptions && !isSSR) {
|
||
cRef.effect.onTrack = debugOptions.onTrack;
|
||
cRef.effect.onTrigger = debugOptions.onTrigger;
|
||
}
|
||
return cRef;
|
||
}function trackRefValue(ref2) {
|
||
var _a;
|
||
if (shouldTrack && activeEffect) {
|
||
ref2 = toRaw(ref2);
|
||
trackEffect(activeEffect, (_a = ref2.dep) != null ? _a : ref2.dep = createDep(function () {
|
||
return ref2.dep = void 0;
|
||
}, ref2 instanceof ComputedRefImpl ? ref2 : void 0), {
|
||
target: ref2,
|
||
type: "get",
|
||
key: "value"
|
||
});
|
||
}
|
||
}function triggerRefValue(ref2) {
|
||
var dirtyLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
|
||
var newVal = arguments.length > 2 ? arguments[2] : undefined;
|
||
ref2 = toRaw(ref2);
|
||
var dep = ref2.dep;
|
||
if (dep) {
|
||
triggerEffects(dep, dirtyLevel, {
|
||
target: ref2,
|
||
type: "set",
|
||
key: "value",
|
||
newValue: newVal
|
||
});
|
||
}
|
||
}function isRef(r2) {
|
||
return !!(r2 && r2.__v_isRef === true);
|
||
}function ref(value) {
|
||
return createRef(value, false);
|
||
}function createRef(rawValue, shallow) {
|
||
if (isRef(rawValue)) {
|
||
return rawValue;
|
||
}
|
||
return new RefImpl(rawValue, shallow);
|
||
}var RefImpl = /*#__PURE__*/function () {
|
||
function RefImpl(value, __v_isShallow) {
|
||
_classCallCheck2(this, RefImpl);
|
||
this.__v_isShallow = __v_isShallow;
|
||
this.dep = void 0;
|
||
this.__v_isRef = true;
|
||
this._rawValue = __v_isShallow ? value : toRaw(value);
|
||
this._value = __v_isShallow ? value : toReactive(value);
|
||
}
|
||
_createClass2(RefImpl, [{
|
||
key: "value",
|
||
get: function get() {
|
||
trackRefValue(this);
|
||
return this._value;
|
||
},
|
||
set: function set(newVal) {
|
||
var useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
||
newVal = useDirectValue ? newVal : toRaw(newVal);
|
||
if (hasChanged(newVal, this._rawValue)) {
|
||
this._rawValue = newVal;
|
||
this._value = useDirectValue ? newVal : toReactive(newVal);
|
||
triggerRefValue(this, 4, newVal);
|
||
}
|
||
}
|
||
}]);
|
||
return RefImpl;
|
||
}();function unref(ref2) {
|
||
return isRef(ref2) ? ref2.value : ref2;
|
||
}var shallowUnwrapHandlers = {
|
||
get: function get(target, key, receiver) {
|
||
return unref(Reflect.get(target, key, receiver));
|
||
},
|
||
set: function set(target, key, value, receiver) {
|
||
var oldValue = target[key];
|
||
if (isRef(oldValue) && !isRef(value)) {
|
||
oldValue.value = value;
|
||
return true;
|
||
} else {
|
||
return Reflect.set(target, key, value, receiver);
|
||
}
|
||
}
|
||
};function proxyRefs(objectWithRefs) {
|
||
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||
}var stack = [];function pushWarningContext(vnode) {
|
||
stack.push(vnode);
|
||
}function popWarningContext() {
|
||
stack.pop();
|
||
}function warn$1(msg) {
|
||
pauseTracking();
|
||
var instance = stack.length ? stack[stack.length - 1].component : null;
|
||
var appWarnHandler = instance && instance.appContext.config.warnHandler;
|
||
var trace = getComponentTrace();
|
||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {
|
||
args[_key6 - 1] = arguments[_key6];
|
||
}
|
||
if (appWarnHandler) {
|
||
callWithErrorHandling(appWarnHandler, instance, 11, [msg + args.map(function (a) {
|
||
var _a, _b;
|
||
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
||
}).join(""), instance && instance.proxy, trace.map(function (_ref3) {
|
||
var vnode = _ref3.vnode;
|
||
return "at <".concat(formatComponentName(instance, vnode.type), ">");
|
||
}).join("\n"), trace]);
|
||
} else {
|
||
var _console2;
|
||
var warnArgs = ["[Vue warn]: ".concat(msg)].concat(args);
|
||
if (trace.length &&
|
||
// avoid spamming console during tests
|
||
true) {
|
||
warnArgs.push.apply(warnArgs, ["\n"].concat(_toConsumableArray2(formatTrace(trace))));
|
||
}
|
||
(_console2 = console).warn.apply(_console2, _toConsumableArray2(warnArgs));
|
||
}
|
||
resetTracking();
|
||
}function getComponentTrace() {
|
||
var currentVNode = stack[stack.length - 1];
|
||
if (!currentVNode) {
|
||
return [];
|
||
}
|
||
var normalizedStack = [];
|
||
while (currentVNode) {
|
||
var last = normalizedStack[0];
|
||
if (last && last.vnode === currentVNode) {
|
||
last.recurseCount++;
|
||
} else {
|
||
normalizedStack.push({
|
||
vnode: currentVNode,
|
||
recurseCount: 0
|
||
});
|
||
}
|
||
var parentInstance = currentVNode.component && currentVNode.component.parent;
|
||
currentVNode = parentInstance && parentInstance.vnode;
|
||
}
|
||
return normalizedStack;
|
||
}function formatTrace(trace) {
|
||
var logs = [];
|
||
trace.forEach(function (entry, i) {
|
||
logs.push.apply(logs, _toConsumableArray2(i === 0 ? [] : ["\n"]).concat(_toConsumableArray2(formatTraceEntry(entry))));
|
||
});
|
||
return logs;
|
||
}function formatTraceEntry(_ref4) {
|
||
var vnode = _ref4.vnode,
|
||
recurseCount = _ref4.recurseCount;
|
||
var postfix = recurseCount > 0 ? "... (".concat(recurseCount, " recursive calls)") : "";
|
||
var isRoot = vnode.component ? vnode.component.parent == null : false;
|
||
var open = " at <".concat(formatComponentName(vnode.component, vnode.type, isRoot));
|
||
var close = ">" + postfix;
|
||
return vnode.props ? [open].concat(_toConsumableArray2(formatProps(vnode.props)), [close]) : [open + close];
|
||
}function formatProps(props) {
|
||
var res = [];
|
||
var keys = Object.keys(props);
|
||
keys.slice(0, 3).forEach(function (key) {
|
||
res.push.apply(res, _toConsumableArray2(formatProp(key, props[key])));
|
||
});
|
||
if (keys.length > 3) {
|
||
res.push(" ...");
|
||
}
|
||
return res;
|
||
}function formatProp(key, value, raw) {
|
||
if (isString(value)) {
|
||
value = JSON.stringify(value);
|
||
return raw ? value : ["".concat(key, "=").concat(value)];
|
||
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
||
return raw ? value : ["".concat(key, "=").concat(value)];
|
||
} else if (isRef(value)) {
|
||
value = formatProp(key, toRaw(value.value), true);
|
||
return raw ? value : ["".concat(key, "=Ref<"), value, ">"];
|
||
} else if (isFunction(value)) {
|
||
return ["".concat(key, "=fn").concat(value.name ? "<".concat(value.name, ">") : "")];
|
||
} else {
|
||
value = toRaw(value);
|
||
return raw ? value : ["".concat(key, "="), value];
|
||
}
|
||
}var ErrorTypeStrings = (_ErrorTypeStrings = {}, _defineProperty2(_ErrorTypeStrings, "sp", "serverPrefetch hook"), _defineProperty2(_ErrorTypeStrings, "bc", "beforeCreate hook"), _defineProperty2(_ErrorTypeStrings, "c", "created hook"), _defineProperty2(_ErrorTypeStrings, "bm", "beforeMount hook"), _defineProperty2(_ErrorTypeStrings, "m", "mounted hook"), _defineProperty2(_ErrorTypeStrings, "bu", "beforeUpdate hook"), _defineProperty2(_ErrorTypeStrings, "u", "updated"), _defineProperty2(_ErrorTypeStrings, "bum", "beforeUnmount hook"), _defineProperty2(_ErrorTypeStrings, "um", "unmounted hook"), _defineProperty2(_ErrorTypeStrings, "a", "activated hook"), _defineProperty2(_ErrorTypeStrings, "da", "deactivated hook"), _defineProperty2(_ErrorTypeStrings, "ec", "errorCaptured hook"), _defineProperty2(_ErrorTypeStrings, "rtc", "renderTracked hook"), _defineProperty2(_ErrorTypeStrings, "rtg", "renderTriggered hook"), _defineProperty2(_ErrorTypeStrings, 0, "setup function"), _defineProperty2(_ErrorTypeStrings, 1, "render function"), _defineProperty2(_ErrorTypeStrings, 2, "watcher getter"), _defineProperty2(_ErrorTypeStrings, 3, "watcher callback"), _defineProperty2(_ErrorTypeStrings, 4, "watcher cleanup function"), _defineProperty2(_ErrorTypeStrings, 5, "native event handler"), _defineProperty2(_ErrorTypeStrings, 6, "component event handler"), _defineProperty2(_ErrorTypeStrings, 7, "vnode hook"), _defineProperty2(_ErrorTypeStrings, 8, "directive hook"), _defineProperty2(_ErrorTypeStrings, 9, "transition hook"), _defineProperty2(_ErrorTypeStrings, 10, "app errorHandler"), _defineProperty2(_ErrorTypeStrings, 11, "app warnHandler"), _defineProperty2(_ErrorTypeStrings, 12, "ref function"), _defineProperty2(_ErrorTypeStrings, 13, "async component loader"), _defineProperty2(_ErrorTypeStrings, 14, "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."), _ErrorTypeStrings);function callWithErrorHandling(fn, instance, type, args) {
|
||
try {
|
||
return args ? fn.apply(void 0, _toConsumableArray2(args)) : fn();
|
||
} catch (err) {
|
||
handleError(err, instance, type);
|
||
}
|
||
}function callWithAsyncErrorHandling(fn, instance, type, args) {
|
||
if (isFunction(fn)) {
|
||
var res = callWithErrorHandling(fn, instance, type, args);
|
||
if (res && isPromise(res)) {
|
||
res.catch(function (err) {
|
||
handleError(err, instance, type);
|
||
});
|
||
}
|
||
return res;
|
||
}
|
||
var values = [];
|
||
for (var i = 0; i < fn.length; i++) {
|
||
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
||
}
|
||
return values;
|
||
}function handleError(err, instance, type) {
|
||
var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||
var contextVNode = instance ? instance.vnode : null;
|
||
if (instance) {
|
||
var cur = instance.parent;
|
||
var exposedInstance = instance.proxy;
|
||
var errorInfo = ErrorTypeStrings[type] || type;
|
||
while (cur) {
|
||
var errorCapturedHooks = cur.ec;
|
||
if (errorCapturedHooks) {
|
||
for (var i = 0; i < errorCapturedHooks.length; i++) {
|
||
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
cur = cur.parent;
|
||
}
|
||
var appErrorHandler = instance.appContext.config.errorHandler;
|
||
if (appErrorHandler) {
|
||
callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]);
|
||
return;
|
||
}
|
||
}
|
||
logError(err, type, contextVNode, throwInDev);
|
||
}function logError(err, type, contextVNode) {
|
||
var throwInDev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||
{
|
||
var info = ErrorTypeStrings[type] || type;
|
||
if (contextVNode) {
|
||
pushWarningContext(contextVNode);
|
||
}
|
||
warn$1("Unhandled error".concat(info ? " during execution of ".concat(info) : ""));
|
||
if (contextVNode) {
|
||
popWarningContext();
|
||
}
|
||
if (throwInDev) {
|
||
console.error(err);
|
||
} else {
|
||
console.error(err);
|
||
}
|
||
}
|
||
}var isFlushing = false;var isFlushPending = false;var queue$1 = [];var flushIndex = 0;var pendingPostFlushCbs = [];var activePostFlushCbs = null;var postFlushIndex = 0;var resolvedPromise = /* @__PURE__ */Promise.resolve();var currentFlushPromise = null;var RECURSION_LIMIT = 100;function nextTick$1(fn) {
|
||
var p2 = currentFlushPromise || resolvedPromise;
|
||
return fn ? p2.then(this ? fn.bind(this) : fn) : p2;
|
||
}function findInsertionIndex(id) {
|
||
var start = flushIndex + 1;
|
||
var end = queue$1.length;
|
||
while (start < end) {
|
||
var middle = start + end >>> 1;
|
||
var middleJob = queue$1[middle];
|
||
var middleJobId = getId(middleJob);
|
||
if (middleJobId < id || middleJobId === id && middleJob.pre) {
|
||
start = middle + 1;
|
||
} else {
|
||
end = middle;
|
||
}
|
||
}
|
||
return start;
|
||
}function queueJob(job) {
|
||
if (!queue$1.length || !queue$1.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
||
if (job.id == null) {
|
||
queue$1.push(job);
|
||
} else {
|
||
queue$1.splice(findInsertionIndex(job.id), 0, job);
|
||
}
|
||
queueFlush();
|
||
}
|
||
}function queueFlush() {
|
||
if (!isFlushing && !isFlushPending) {
|
||
isFlushPending = true;
|
||
currentFlushPromise = resolvedPromise.then(flushJobs);
|
||
}
|
||
}function hasQueueJob(job) {
|
||
return queue$1.indexOf(job) > -1;
|
||
}function invalidateJob(job) {
|
||
var i = queue$1.indexOf(job);
|
||
if (i > flushIndex) {
|
||
queue$1.splice(i, 1);
|
||
}
|
||
}function queuePostFlushCb(cb) {
|
||
if (!isArray(cb)) {
|
||
if (!activePostFlushCbs || !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
||
pendingPostFlushCbs.push(cb);
|
||
}
|
||
} else {
|
||
pendingPostFlushCbs.push.apply(pendingPostFlushCbs, _toConsumableArray2(cb));
|
||
}
|
||
queueFlush();
|
||
}function flushPreFlushCbs(instance, seen) {
|
||
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : isFlushing ? flushIndex + 1 : 0;
|
||
{
|
||
seen = seen || /* @__PURE__ */new Map();
|
||
}
|
||
for (; i < queue$1.length; i++) {
|
||
var cb = queue$1[i];
|
||
if (cb && cb.pre) {
|
||
if (checkRecursiveUpdates(seen, cb)) {
|
||
continue;
|
||
}
|
||
queue$1.splice(i, 1);
|
||
i--;
|
||
cb();
|
||
}
|
||
}
|
||
}function flushPostFlushCbs(seen) {
|
||
if (pendingPostFlushCbs.length) {
|
||
var deduped = _toConsumableArray2(new Set(pendingPostFlushCbs)).sort(function (a, b) {
|
||
return getId(a) - getId(b);
|
||
});
|
||
pendingPostFlushCbs.length = 0;
|
||
if (activePostFlushCbs) {
|
||
var _activePostFlushCbs;
|
||
(_activePostFlushCbs = activePostFlushCbs).push.apply(_activePostFlushCbs, _toConsumableArray2(deduped));
|
||
return;
|
||
}
|
||
activePostFlushCbs = deduped;
|
||
{
|
||
seen = seen || /* @__PURE__ */new Map();
|
||
}
|
||
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
||
if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
|
||
continue;
|
||
}
|
||
activePostFlushCbs[postFlushIndex]();
|
||
}
|
||
activePostFlushCbs = null;
|
||
postFlushIndex = 0;
|
||
}
|
||
}var getId = function getId(job) {
|
||
return job.id == null ? Infinity : job.id;
|
||
};var comparator = function comparator(a, b) {
|
||
var diff2 = getId(a) - getId(b);
|
||
if (diff2 === 0) {
|
||
if (a.pre && !b.pre) return -1;
|
||
if (b.pre && !a.pre) return 1;
|
||
}
|
||
return diff2;
|
||
};function flushJobs(seen) {
|
||
isFlushPending = false;
|
||
isFlushing = true;
|
||
{
|
||
seen = seen || /* @__PURE__ */new Map();
|
||
}
|
||
queue$1.sort(comparator);
|
||
var check = function check(job) {
|
||
return checkRecursiveUpdates(seen, job);
|
||
};
|
||
try {
|
||
for (flushIndex = 0; flushIndex < queue$1.length; flushIndex++) {
|
||
var job = queue$1[flushIndex];
|
||
if (job && job.active !== false) {
|
||
if (check(job)) {
|
||
continue;
|
||
}
|
||
callWithErrorHandling(job, null, 14);
|
||
}
|
||
}
|
||
} finally {
|
||
flushIndex = 0;
|
||
queue$1.length = 0;
|
||
flushPostFlushCbs(seen);
|
||
isFlushing = false;
|
||
currentFlushPromise = null;
|
||
if (queue$1.length || pendingPostFlushCbs.length) {
|
||
flushJobs(seen);
|
||
}
|
||
}
|
||
}function checkRecursiveUpdates(seen, fn) {
|
||
if (!seen.has(fn)) {
|
||
seen.set(fn, 1);
|
||
} else {
|
||
var count = seen.get(fn);
|
||
if (count > RECURSION_LIMIT) {
|
||
var instance = fn.ownerInstance;
|
||
var componentName = instance && getComponentName(instance.type);
|
||
handleError("Maximum recursive updates exceeded".concat(componentName ? " in component <".concat(componentName, ">") : "", ". This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function."), null, 10);
|
||
return true;
|
||
} else {
|
||
seen.set(fn, count + 1);
|
||
}
|
||
}
|
||
}var devtools;var buffer = [];var devtoolsNotInstalled = false;function emit$1(event) {
|
||
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key7 = 1; _key7 < _len6; _key7++) {
|
||
args[_key7 - 1] = arguments[_key7];
|
||
}
|
||
if (devtools) {
|
||
var _devtools;
|
||
(_devtools = devtools).emit.apply(_devtools, [event].concat(args));
|
||
} else if (!devtoolsNotInstalled) {
|
||
buffer.push({
|
||
event: event,
|
||
args: args
|
||
});
|
||
}
|
||
}function setDevtoolsHook(hook, target) {
|
||
var _a, _b;
|
||
devtools = hook;
|
||
if (devtools) {
|
||
devtools.enabled = true;
|
||
buffer.forEach(function (_ref5) {
|
||
var _devtools2;
|
||
var event = _ref5.event,
|
||
args = _ref5.args;
|
||
return (_devtools2 = devtools).emit.apply(_devtools2, [event].concat(_toConsumableArray2(args)));
|
||
});
|
||
buffer = [];
|
||
} else if (
|
||
// handle late devtools injection - only do this if we are in an actual
|
||
// browser environment to avoid the timer handle stalling test runner exit
|
||
// (#4815)
|
||
typeof window !== "undefined" &&
|
||
// some envs mock window but not fully
|
||
window.HTMLElement &&
|
||
// also exclude jsdom
|
||
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))) {
|
||
var replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
||
replay.push(function (newHook) {
|
||
setDevtoolsHook(newHook, target);
|
||
});
|
||
setTimeout(function () {
|
||
if (!devtools) {
|
||
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
||
devtoolsNotInstalled = true;
|
||
buffer = [];
|
||
}
|
||
}, 3e3);
|
||
} else {
|
||
devtoolsNotInstalled = true;
|
||
buffer = [];
|
||
}
|
||
}function devtoolsInitApp(app, version2) {
|
||
emit$1("app:init", app, version2, {
|
||
Fragment: Fragment,
|
||
Text: Text,
|
||
Comment: Comment,
|
||
Static: Static
|
||
});
|
||
}var devtoolsComponentAdded = /* @__PURE__ */createDevtoolsComponentHook("component:added"
|
||
/* COMPONENT_ADDED */);var devtoolsComponentUpdated = /* @__PURE__ */createDevtoolsComponentHook("component:updated"
|
||
/* COMPONENT_UPDATED */);var _devtoolsComponentRemoved = /* @__PURE__ */createDevtoolsComponentHook("component:removed"
|
||
/* COMPONENT_REMOVED */);var devtoolsComponentRemoved = function devtoolsComponentRemoved(component) {
|
||
if (devtools && typeof devtools.cleanupBuffer === "function" &&
|
||
// remove the component if it wasn't buffered
|
||
!devtools.cleanupBuffer(component)) {
|
||
_devtoolsComponentRemoved(component);
|
||
}
|
||
};function createDevtoolsComponentHook(hook) {
|
||
return function (component) {
|
||
emit$1(hook, component.appContext.app, component.uid,
|
||
// fixed by xxxxxx
|
||
// 为 0 是 App,无 parent 是 Page 指向 App
|
||
component.uid === 0 ? void 0 : component.parent ? component.parent.uid : 0, component);
|
||
};
|
||
}var devtoolsPerfStart = /* @__PURE__ */createDevtoolsPerformanceHook("perf:start"
|
||
/* PERFORMANCE_START */);var devtoolsPerfEnd = /* @__PURE__ */createDevtoolsPerformanceHook("perf:end"
|
||
/* PERFORMANCE_END */);function createDevtoolsPerformanceHook(hook) {
|
||
return function (component, type, time) {
|
||
emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
||
};
|
||
}function devtoolsComponentEmit(component, event, params) {
|
||
emit$1("component:emit", component.appContext.app, component, event, params);
|
||
}function emit(instance, event) {
|
||
if (instance.isUnmounted) return;
|
||
var props = instance.vnode.props || EMPTY_OBJ;
|
||
for (var _len7 = arguments.length, rawArgs = new Array(_len7 > 2 ? _len7 - 2 : 0), _key8 = 2; _key8 < _len7; _key8++) {
|
||
rawArgs[_key8 - 2] = arguments[_key8];
|
||
}
|
||
{
|
||
var emitsOptions = instance.emitsOptions,
|
||
_instance$propsOption = _slicedToArray2(instance.propsOptions, 1),
|
||
propsOptions = _instance$propsOption[0];
|
||
if (emitsOptions) {
|
||
if (!(event in emitsOptions) && true) {
|
||
if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
||
warn$1("Component emitted event \"".concat(event, "\" but it is neither declared in the emits option nor as an \"").concat(toHandlerKey(event), "\" prop."));
|
||
}
|
||
} else {
|
||
var validator = emitsOptions[event];
|
||
if (isFunction(validator)) {
|
||
var isValid = validator.apply(void 0, rawArgs);
|
||
if (!isValid) {
|
||
warn$1("Invalid event arguments: event validation failed for event \"".concat(event, "\"."));
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
var args = rawArgs;
|
||
var isModelListener2 = event.startsWith("update:");
|
||
var modelArg = isModelListener2 && event.slice(7);
|
||
if (modelArg && modelArg in props) {
|
||
var modifiersKey = "".concat(modelArg === "modelValue" ? "model" : modelArg, "Modifiers");
|
||
var _ref6 = props[modifiersKey] || EMPTY_OBJ,
|
||
number = _ref6.number,
|
||
trim = _ref6.trim;
|
||
if (trim) {
|
||
args = rawArgs.map(function (a) {
|
||
return isString(a) ? a.trim() : a;
|
||
});
|
||
}
|
||
if (number) {
|
||
args = rawArgs.map(looseToNumber);
|
||
}
|
||
}
|
||
{
|
||
devtoolsComponentEmit(instance, event, args);
|
||
}
|
||
{
|
||
var lowerCaseEvent = event.toLowerCase();
|
||
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
||
warn$1("Event \"".concat(lowerCaseEvent, "\" is emitted in component ").concat(formatComponentName(instance, instance.type), " but the handler is registered for \"").concat(event, "\". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use \"").concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
|
||
}
|
||
}
|
||
var handlerName;
|
||
var handler = props[handlerName = toHandlerKey(event)] ||
|
||
// also try camelCase event handler (#2249)
|
||
props[handlerName = toHandlerKey(camelize(event))];
|
||
if (!handler && isModelListener2) {
|
||
handler = props[handlerName = toHandlerKey(hyphenate(event))];
|
||
}
|
||
if (handler) {
|
||
callWithAsyncErrorHandling(handler, instance, 6, args);
|
||
}
|
||
var onceHandler = props[handlerName + "Once"];
|
||
if (onceHandler) {
|
||
if (!instance.emitted) {
|
||
instance.emitted = {};
|
||
} else if (instance.emitted[handlerName]) {
|
||
return;
|
||
}
|
||
instance.emitted[handlerName] = true;
|
||
callWithAsyncErrorHandling(onceHandler, instance, 6, args);
|
||
}
|
||
}function normalizeEmitsOptions(comp, appContext) {
|
||
var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var cache = appContext.emitsCache;
|
||
var cached = cache.get(comp);
|
||
if (cached !== void 0) {
|
||
return cached;
|
||
}
|
||
var raw = comp.emits;
|
||
var normalized = {};
|
||
var hasExtends = false;
|
||
if (!isFunction(comp)) {
|
||
var extendEmits = function extendEmits(raw2) {
|
||
var normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
||
if (normalizedFromExtend) {
|
||
hasExtends = true;
|
||
extend(normalized, normalizedFromExtend);
|
||
}
|
||
};
|
||
if (!asMixin && appContext.mixins.length) {
|
||
appContext.mixins.forEach(extendEmits);
|
||
}
|
||
if (comp.extends) {
|
||
extendEmits(comp.extends);
|
||
}
|
||
if (comp.mixins) {
|
||
comp.mixins.forEach(extendEmits);
|
||
}
|
||
}
|
||
if (!raw && !hasExtends) {
|
||
if (isObject(comp)) {
|
||
cache.set(comp, null);
|
||
}
|
||
return null;
|
||
}
|
||
if (isArray(raw)) {
|
||
raw.forEach(function (key) {
|
||
return normalized[key] = null;
|
||
});
|
||
} else {
|
||
extend(normalized, raw);
|
||
}
|
||
if (isObject(comp)) {
|
||
cache.set(comp, normalized);
|
||
}
|
||
return normalized;
|
||
}function isEmitListener(options, key) {
|
||
if (!options || !isOn(key)) {
|
||
return false;
|
||
}
|
||
key = key.slice(2).replace(/Once$/, "");
|
||
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
|
||
}var currentRenderingInstance = null;function setCurrentRenderingInstance(instance) {
|
||
var prev = currentRenderingInstance;
|
||
currentRenderingInstance = instance;
|
||
instance && instance.type.__scopeId || null;
|
||
return prev;
|
||
}var INITIAL_WATCHER_VALUE = {};function watch(source, cb, options) {
|
||
if (!isFunction(cb)) {
|
||
warn$1("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature.");
|
||
}
|
||
return doWatch(source, cb, options);
|
||
}function doWatch(source, cb) {
|
||
var _ref7 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EMPTY_OBJ,
|
||
immediate = _ref7.immediate,
|
||
deep = _ref7.deep,
|
||
flush = _ref7.flush,
|
||
once2 = _ref7.once,
|
||
onTrack = _ref7.onTrack,
|
||
onTrigger = _ref7.onTrigger;
|
||
if (cb && once2) {
|
||
var _cb = cb;
|
||
cb = function cb() {
|
||
_cb.apply(void 0, arguments);
|
||
unwatch();
|
||
};
|
||
}
|
||
if (deep !== void 0 && typeof deep === "number") {
|
||
warn$1("watch() \"deep\" option with number value will be used as watch depth in future versions. Please use a boolean instead to avoid potential breakage.");
|
||
}
|
||
if (!cb) {
|
||
if (immediate !== void 0) {
|
||
warn$1("watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature.");
|
||
}
|
||
if (deep !== void 0) {
|
||
warn$1("watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature.");
|
||
}
|
||
if (once2 !== void 0) {
|
||
warn$1("watch() \"once\" option is only respected when using the watch(source, callback, options?) signature.");
|
||
}
|
||
}
|
||
var warnInvalidSource = function warnInvalidSource(s2) {
|
||
warn$1("Invalid watch source: ", s2, "A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");
|
||
};
|
||
var instance = currentInstance;
|
||
var reactiveGetter = function reactiveGetter(source2) {
|
||
return deep === true ? source2 :
|
||
// for deep: false, only traverse root-level properties
|
||
traverse(source2, deep === false ? 1 : void 0);
|
||
};
|
||
var getter;
|
||
var forceTrigger = false;
|
||
var isMultiSource = false;
|
||
if (isRef(source)) {
|
||
getter = function getter() {
|
||
return source.value;
|
||
};
|
||
forceTrigger = isShallow(source);
|
||
} else if (isReactive(source)) {
|
||
getter = function getter() {
|
||
return reactiveGetter(source);
|
||
};
|
||
forceTrigger = true;
|
||
} else if (isArray(source)) {
|
||
isMultiSource = true;
|
||
forceTrigger = source.some(function (s2) {
|
||
return isReactive(s2) || isShallow(s2);
|
||
});
|
||
getter = function getter() {
|
||
return source.map(function (s2) {
|
||
if (isRef(s2)) {
|
||
return s2.value;
|
||
} else if (isReactive(s2)) {
|
||
return reactiveGetter(s2);
|
||
} else if (isFunction(s2)) {
|
||
return callWithErrorHandling(s2, instance, 2);
|
||
} else {
|
||
warnInvalidSource(s2);
|
||
}
|
||
});
|
||
};
|
||
} else if (isFunction(source)) {
|
||
if (cb) {
|
||
getter = function getter() {
|
||
return callWithErrorHandling(source, instance, 2);
|
||
};
|
||
} else {
|
||
getter = function getter() {
|
||
if (cleanup) {
|
||
cleanup();
|
||
}
|
||
return callWithAsyncErrorHandling(source, instance, 3, [onCleanup]);
|
||
};
|
||
}
|
||
} else {
|
||
getter = NOOP;
|
||
warnInvalidSource(source);
|
||
}
|
||
if (cb && deep) {
|
||
var baseGetter = getter;
|
||
getter = function getter() {
|
||
return traverse(baseGetter());
|
||
};
|
||
}
|
||
var cleanup;
|
||
var onCleanup = function onCleanup(fn) {
|
||
cleanup = effect2.onStop = function () {
|
||
callWithErrorHandling(fn, instance, 4);
|
||
cleanup = effect2.onStop = void 0;
|
||
};
|
||
};
|
||
var oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
||
var job = function job() {
|
||
if (!effect2.active || !effect2.dirty) {
|
||
return;
|
||
}
|
||
if (cb) {
|
||
var newValue = effect2.run();
|
||
if (deep || forceTrigger || (isMultiSource ? newValue.some(function (v, i) {
|
||
return hasChanged(v, oldValue[i]);
|
||
}) : hasChanged(newValue, oldValue)) || false) {
|
||
if (cleanup) {
|
||
cleanup();
|
||
}
|
||
callWithAsyncErrorHandling(cb, instance, 3, [newValue,
|
||
// pass undefined as the old value when it's changed for the first time
|
||
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, onCleanup]);
|
||
oldValue = newValue;
|
||
}
|
||
} else {
|
||
effect2.run();
|
||
}
|
||
};
|
||
job.allowRecurse = !!cb;
|
||
var scheduler;
|
||
if (flush === "sync") {
|
||
scheduler = job;
|
||
} else if (flush === "post") {
|
||
scheduler = function scheduler() {
|
||
return queuePostRenderEffect$1(job, instance && instance.suspense);
|
||
};
|
||
} else {
|
||
job.pre = true;
|
||
if (instance) job.id = instance.uid;
|
||
scheduler = function scheduler() {
|
||
return queueJob(job);
|
||
};
|
||
}
|
||
var effect2 = new ReactiveEffect(getter, NOOP, scheduler);
|
||
var scope = getCurrentScope();
|
||
var unwatch = function unwatch() {
|
||
effect2.stop();
|
||
if (scope) {
|
||
remove(scope.effects, effect2);
|
||
}
|
||
};
|
||
{
|
||
effect2.onTrack = onTrack;
|
||
effect2.onTrigger = onTrigger;
|
||
}
|
||
if (cb) {
|
||
if (immediate) {
|
||
job();
|
||
} else {
|
||
oldValue = effect2.run();
|
||
}
|
||
} else if (flush === "post") {
|
||
queuePostRenderEffect$1(effect2.run.bind(effect2), instance && instance.suspense);
|
||
} else {
|
||
effect2.run();
|
||
}
|
||
return unwatch;
|
||
}function instanceWatch(source, value, options) {
|
||
var publicThis = this.proxy;
|
||
var getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : function () {
|
||
return publicThis[source];
|
||
} : source.bind(publicThis, publicThis);
|
||
var cb;
|
||
if (isFunction(value)) {
|
||
cb = value;
|
||
} else {
|
||
cb = value.handler;
|
||
options = value;
|
||
}
|
||
var reset = setCurrentInstance(this);
|
||
var res = doWatch(getter, cb.bind(publicThis), options);
|
||
reset();
|
||
return res;
|
||
}function createPathGetter(ctx, path) {
|
||
var segments = path.split(".");
|
||
return function () {
|
||
var cur = ctx;
|
||
for (var i = 0; i < segments.length && cur; i++) {
|
||
cur = cur[segments[i]];
|
||
}
|
||
return cur;
|
||
};
|
||
}function traverse(value, depth) {
|
||
var currentDepth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||
var seen = arguments.length > 3 ? arguments[3] : undefined;
|
||
if (!isObject(value) || value["__v_skip"]) {
|
||
return value;
|
||
}
|
||
if (depth && depth > 0) {
|
||
if (currentDepth >= depth) {
|
||
return value;
|
||
}
|
||
currentDepth++;
|
||
}
|
||
seen = seen || /* @__PURE__ */new Set();
|
||
if (seen.has(value)) {
|
||
return value;
|
||
}
|
||
seen.add(value);
|
||
if (isRef(value)) {
|
||
traverse(value.value, depth, currentDepth, seen);
|
||
} else if (isArray(value)) {
|
||
for (var i = 0; i < value.length; i++) {
|
||
traverse(value[i], depth, currentDepth, seen);
|
||
}
|
||
} else if (isSet(value) || isMap(value)) {
|
||
value.forEach(function (v) {
|
||
traverse(v, depth, currentDepth, seen);
|
||
});
|
||
} else if (isPlainObject(value)) {
|
||
for (var key in value) {
|
||
traverse(value[key], depth, currentDepth, seen);
|
||
}
|
||
}
|
||
return value;
|
||
}function validateDirectiveName(name) {
|
||
if (isBuiltInDirective(name)) {
|
||
warn$1("Do not use built-in directive ids as custom directive id: " + name);
|
||
}
|
||
}function createAppContext() {
|
||
return {
|
||
app: null,
|
||
config: {
|
||
isNativeTag: NO,
|
||
performance: false,
|
||
globalProperties: {},
|
||
optionMergeStrategies: {},
|
||
errorHandler: void 0,
|
||
warnHandler: void 0,
|
||
compilerOptions: {}
|
||
},
|
||
mixins: [],
|
||
components: {},
|
||
directives: {},
|
||
provides: /* @__PURE__ */Object.create(null),
|
||
optionsCache: /* @__PURE__ */new WeakMap(),
|
||
propsCache: /* @__PURE__ */new WeakMap(),
|
||
emitsCache: /* @__PURE__ */new WeakMap()
|
||
};
|
||
}var uid$1 = 0;function createAppAPI(render, hydrate) {
|
||
return function createApp2(rootComponent) {
|
||
var rootProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
if (!isFunction(rootComponent)) {
|
||
rootComponent = extend({}, rootComponent);
|
||
}
|
||
if (rootProps != null && !isObject(rootProps)) {
|
||
warn$1("root props passed to app.mount() must be an object.");
|
||
rootProps = null;
|
||
}
|
||
var context = createAppContext();
|
||
var installedPlugins = /* @__PURE__ */new WeakSet();
|
||
var app = context.app = {
|
||
_uid: uid$1++,
|
||
_component: rootComponent,
|
||
_props: rootProps,
|
||
_container: null,
|
||
_context: context,
|
||
_instance: null,
|
||
version: version,
|
||
get config() {
|
||
return context.config;
|
||
},
|
||
set config(v) {
|
||
{
|
||
warn$1("app.config cannot be replaced. Modify individual options instead.");
|
||
}
|
||
},
|
||
use: function use(plugin2) {
|
||
for (var _len8 = arguments.length, options = new Array(_len8 > 1 ? _len8 - 1 : 0), _key9 = 1; _key9 < _len8; _key9++) {
|
||
options[_key9 - 1] = arguments[_key9];
|
||
}
|
||
if (installedPlugins.has(plugin2)) {
|
||
warn$1("Plugin has already been applied to target app.");
|
||
} else if (plugin2 && isFunction(plugin2.install)) {
|
||
installedPlugins.add(plugin2);
|
||
plugin2.install.apply(plugin2, [app].concat(options));
|
||
} else if (isFunction(plugin2)) {
|
||
installedPlugins.add(plugin2);
|
||
plugin2.apply(void 0, [app].concat(options));
|
||
} else {
|
||
warn$1("A plugin must either be a function or an object with an \"install\" function.");
|
||
}
|
||
return app;
|
||
},
|
||
mixin: function mixin(_mixin) {
|
||
{
|
||
if (!context.mixins.includes(_mixin)) {
|
||
context.mixins.push(_mixin);
|
||
} else {
|
||
warn$1("Mixin has already been applied to target app" + (_mixin.name ? ": ".concat(_mixin.name) : ""));
|
||
}
|
||
}
|
||
return app;
|
||
},
|
||
component: function component(name, _component) {
|
||
{
|
||
validateComponentName(name, context.config);
|
||
}
|
||
if (!_component) {
|
||
return context.components[name];
|
||
}
|
||
if (context.components[name]) {
|
||
warn$1("Component \"".concat(name, "\" has already been registered in target app."));
|
||
}
|
||
context.components[name] = _component;
|
||
return app;
|
||
},
|
||
directive: function directive(name, _directive) {
|
||
{
|
||
validateDirectiveName(name);
|
||
}
|
||
if (!_directive) {
|
||
return context.directives[name];
|
||
}
|
||
if (context.directives[name]) {
|
||
warn$1("Directive \"".concat(name, "\" has already been registered in target app."));
|
||
}
|
||
context.directives[name] = _directive;
|
||
return app;
|
||
},
|
||
// fixed by xxxxxx
|
||
mount: function mount() {},
|
||
// fixed by xxxxxx
|
||
unmount: function unmount() {},
|
||
provide: function provide(key, value) {
|
||
if (key in context.provides) {
|
||
warn$1("App already provides property with key \"".concat(String(key), "\". It will be overwritten with the new value."));
|
||
}
|
||
context.provides[key] = value;
|
||
return app;
|
||
},
|
||
runWithContext: function runWithContext(fn) {
|
||
var lastApp = currentApp;
|
||
currentApp = app;
|
||
try {
|
||
return fn();
|
||
} finally {
|
||
currentApp = lastApp;
|
||
}
|
||
}
|
||
};
|
||
return app;
|
||
};
|
||
}var currentApp = null;function provide(key, value) {
|
||
if (!currentInstance) {
|
||
{
|
||
warn$1("provide() can only be used inside setup().");
|
||
}
|
||
} else {
|
||
var provides = currentInstance.provides;
|
||
var parentProvides = currentInstance.parent && currentInstance.parent.provides;
|
||
if (parentProvides === provides) {
|
||
provides = currentInstance.provides = Object.create(parentProvides);
|
||
}
|
||
provides[key] = value;
|
||
if (currentInstance.type.mpType === "app") {
|
||
currentInstance.appContext.app.provide(key, value);
|
||
}
|
||
}
|
||
}function inject(key, defaultValue) {
|
||
var treatDefaultAsFactory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var instance = currentInstance || currentRenderingInstance;
|
||
if (instance || currentApp) {
|
||
var provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides;
|
||
if (provides && key in provides) {
|
||
return provides[key];
|
||
} else if (arguments.length > 1) {
|
||
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
||
} else {
|
||
warn$1("injection \"".concat(String(key), "\" not found."));
|
||
}
|
||
} else {
|
||
warn$1("inject() can only be used inside setup() or functional components.");
|
||
}
|
||
}var isKeepAlive = function isKeepAlive(vnode) {
|
||
return vnode.type.__isKeepAlive;
|
||
};function onActivated(hook, target) {
|
||
registerKeepAliveHook(hook, "a", target);
|
||
}function onDeactivated(hook, target) {
|
||
registerKeepAliveHook(hook, "da", target);
|
||
}function registerKeepAliveHook(hook, type) {
|
||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
|
||
var wrappedHook = hook.__wdc || (hook.__wdc = function () {
|
||
var current = target;
|
||
while (current) {
|
||
if (current.isDeactivated) {
|
||
return;
|
||
}
|
||
current = current.parent;
|
||
}
|
||
return hook();
|
||
});
|
||
injectHook(type, wrappedHook, target);
|
||
if (target) {
|
||
var current = target.parent;
|
||
while (current && current.parent) {
|
||
if (isKeepAlive(current.parent.vnode)) {
|
||
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
||
}
|
||
current = current.parent;
|
||
}
|
||
}
|
||
}function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
||
var injected = injectHook(type, hook, keepAliveRoot, true
|
||
/* prepend */);
|
||
|
||
onUnmounted(function () {
|
||
remove(keepAliveRoot[type], injected);
|
||
}, target);
|
||
}function injectHook(type, hook) {
|
||
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentInstance;
|
||
var prepend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
if (target) {
|
||
if (isRootHook(type)) {
|
||
target = target.root;
|
||
}
|
||
var hooks = target[type] || (target[type] = []);
|
||
var wrappedHook = hook.__weh || (hook.__weh = function () {
|
||
if (target.isUnmounted) {
|
||
return;
|
||
}
|
||
pauseTracking();
|
||
var reset = setCurrentInstance(target);
|
||
for (var _len9 = arguments.length, args = new Array(_len9), _key10 = 0; _key10 < _len9; _key10++) {
|
||
args[_key10] = arguments[_key10];
|
||
}
|
||
var res = callWithAsyncErrorHandling(hook, target, type, args);
|
||
reset();
|
||
resetTracking();
|
||
return res;
|
||
});
|
||
if (prepend) {
|
||
hooks.unshift(wrappedHook);
|
||
} else {
|
||
hooks.push(wrappedHook);
|
||
}
|
||
return wrappedHook;
|
||
} else {
|
||
var apiName = toHandlerKey((ErrorTypeStrings[type] || type.replace(/^on/, "")).replace(/ hook$/, ""));
|
||
warn$1("".concat(apiName, " is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup()."));
|
||
}
|
||
}var createHook = function createHook(lifecycle) {
|
||
return function (hook) {
|
||
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
|
||
return (
|
||
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
||
(!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, function () {
|
||
return hook.apply(void 0, arguments);
|
||
}, target)
|
||
);
|
||
};
|
||
};var onBeforeMount = createHook("bm");var onMounted = createHook("m");var onBeforeUpdate = createHook("bu");var onUpdated = createHook("u");var onBeforeUnmount = createHook("bum");var onUnmounted = createHook("um");var onServerPrefetch = createHook("sp");var onRenderTriggered = createHook("rtg");var onRenderTracked = createHook("rtc");function onErrorCaptured(hook) {
|
||
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentInstance;
|
||
injectHook("ec", hook, target);
|
||
}var getPublicInstance = function getPublicInstance(i) {
|
||
if (!i) return null;
|
||
if (isStatefulComponent(i)) return getExposeProxy(i) || i.proxy;
|
||
return getPublicInstance(i.parent);
|
||
};function getComponentInternalInstance(i) {
|
||
return i;
|
||
}var publicPropertiesMap =
|
||
// Move PURE marker to new line to workaround compiler discarding it
|
||
// due to type annotation
|
||
/* @__PURE__ */
|
||
extend( /* @__PURE__ */Object.create(null), {
|
||
// fixed by xxxxxx
|
||
$: getComponentInternalInstance,
|
||
// fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的
|
||
// $el: i => i.vnode.el,
|
||
$el: function $el(i) {
|
||
return i.__$el || (i.__$el = {});
|
||
},
|
||
$data: function $data(i) {
|
||
return i.data;
|
||
},
|
||
$props: function $props(i) {
|
||
return shallowReadonly(i.props);
|
||
},
|
||
$attrs: function $attrs(i) {
|
||
return shallowReadonly(i.attrs);
|
||
},
|
||
$slots: function $slots(i) {
|
||
return shallowReadonly(i.slots);
|
||
},
|
||
$refs: function $refs(i) {
|
||
return shallowReadonly(i.refs);
|
||
},
|
||
$parent: function $parent(i) {
|
||
return getPublicInstance(i.parent);
|
||
},
|
||
$root: function $root(i) {
|
||
return getPublicInstance(i.root);
|
||
},
|
||
$emit: function $emit(i) {
|
||
return i.emit;
|
||
},
|
||
$options: function $options(i) {
|
||
return resolveMergedOptions(i);
|
||
},
|
||
$forceUpdate: function $forceUpdate(i) {
|
||
return i.f || (i.f = function () {
|
||
i.effect.dirty = true;
|
||
queueJob(i.update);
|
||
});
|
||
},
|
||
// $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx
|
||
$watch: function $watch(i) {
|
||
return instanceWatch.bind(i);
|
||
}
|
||
});var isReservedPrefix = function isReservedPrefix(key) {
|
||
return key === "_" || key === "$";
|
||
};var hasSetupBinding = function hasSetupBinding(state, key) {
|
||
return state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
||
};var PublicInstanceProxyHandlers = {
|
||
get: function get(_ref8, key) {
|
||
var instance = _ref8._;
|
||
var ctx = instance.ctx,
|
||
setupState = instance.setupState,
|
||
data = instance.data,
|
||
props = instance.props,
|
||
accessCache = instance.accessCache,
|
||
type = instance.type,
|
||
appContext = instance.appContext;
|
||
if (key === "__isVue") {
|
||
return true;
|
||
}
|
||
var normalizedProps;
|
||
if (key[0] !== "$") {
|
||
var n2 = accessCache[key];
|
||
if (n2 !== void 0) {
|
||
switch (n2) {
|
||
case 1:
|
||
return setupState[key];
|
||
case 2:
|
||
return data[key];
|
||
case 4:
|
||
return ctx[key];
|
||
case 3:
|
||
return props[key];
|
||
}
|
||
} else if (hasSetupBinding(setupState, key)) {
|
||
accessCache[key] = 1;
|
||
return setupState[key];
|
||
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||
accessCache[key] = 2;
|
||
return data[key];
|
||
} else if (
|
||
// only cache other properties when instance has declared (thus stable)
|
||
// props
|
||
(normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) {
|
||
accessCache[key] = 3;
|
||
return props[key];
|
||
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
||
accessCache[key] = 4;
|
||
return ctx[key];
|
||
} else if (shouldCacheAccess) {
|
||
accessCache[key] = 0;
|
||
}
|
||
}
|
||
var publicGetter = publicPropertiesMap[key];
|
||
var cssModule, globalProperties;
|
||
if (publicGetter) {
|
||
if (key === "$attrs") {
|
||
track(instance, "get", key);
|
||
} else if (key === "$slots") {
|
||
track(instance, "get", key);
|
||
}
|
||
return publicGetter(instance);
|
||
} else if (
|
||
// css module (injected by vue-loader)
|
||
(cssModule = type.__cssModules) && (cssModule = cssModule[key])) {
|
||
return cssModule;
|
||
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
||
accessCache[key] = 4;
|
||
return ctx[key];
|
||
} else if (
|
||
// global properties
|
||
globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) {
|
||
{
|
||
return globalProperties[key];
|
||
}
|
||
} else if (currentRenderingInstance && (!isString(key) ||
|
||
// #1091 avoid internal isRef/isVNode checks on component instance leading
|
||
// to infinite warning loop
|
||
key.indexOf("__v") !== 0)) {
|
||
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
||
warn$1("Property ".concat(JSON.stringify(key), " must be accessed via $data because it starts with a reserved character (\"$\" or \"_\") and is not proxied on the render context."));
|
||
} else if (instance === currentRenderingInstance) {
|
||
warn$1("Property ".concat(JSON.stringify(key), " was accessed during render but is not defined on instance."));
|
||
}
|
||
}
|
||
},
|
||
set: function set(_ref9, key, value) {
|
||
var instance = _ref9._;
|
||
var data = instance.data,
|
||
setupState = instance.setupState,
|
||
ctx = instance.ctx;
|
||
if (hasSetupBinding(setupState, key)) {
|
||
setupState[key] = value;
|
||
return true;
|
||
} else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
||
warn$1("Cannot mutate <script setup> binding \"".concat(key, "\" from Options API."));
|
||
return false;
|
||
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||
data[key] = value;
|
||
return true;
|
||
} else if (hasOwn(instance.props, key)) {
|
||
warn$1("Attempting to mutate prop \"".concat(key, "\". Props are readonly."));
|
||
return false;
|
||
}
|
||
if (key[0] === "$" && key.slice(1) in instance) {
|
||
warn$1("Attempting to mutate public property \"".concat(key, "\". Properties starting with $ are reserved and readonly."));
|
||
return false;
|
||
} else {
|
||
if (key in instance.appContext.config.globalProperties) {
|
||
Object.defineProperty(ctx, key, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
value: value
|
||
});
|
||
} else {
|
||
ctx[key] = value;
|
||
}
|
||
}
|
||
return true;
|
||
},
|
||
has: function has(_ref10, key) {
|
||
var _ref10$_ = _ref10._,
|
||
data = _ref10$_.data,
|
||
setupState = _ref10$_.setupState,
|
||
accessCache = _ref10$_.accessCache,
|
||
ctx = _ref10$_.ctx,
|
||
appContext = _ref10$_.appContext,
|
||
propsOptions = _ref10$_.propsOptions;
|
||
var normalizedProps;
|
||
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
|
||
},
|
||
defineProperty: function defineProperty(target, key, descriptor) {
|
||
if (descriptor.get != null) {
|
||
target._.accessCache[key] = 0;
|
||
} else if (hasOwn(descriptor, "value")) {
|
||
this.set(target, key, descriptor.value, null);
|
||
}
|
||
return Reflect.defineProperty(target, key, descriptor);
|
||
}
|
||
};{
|
||
PublicInstanceProxyHandlers.ownKeys = function (target) {
|
||
warn$1("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.");
|
||
return Reflect.ownKeys(target);
|
||
};
|
||
}function createDevRenderContext(instance) {
|
||
var target = {};
|
||
Object.defineProperty(target, "_", {
|
||
configurable: true,
|
||
enumerable: false,
|
||
get: function get() {
|
||
return instance;
|
||
}
|
||
});
|
||
Object.keys(publicPropertiesMap).forEach(function (key) {
|
||
Object.defineProperty(target, key, {
|
||
configurable: true,
|
||
enumerable: false,
|
||
get: function get() {
|
||
return publicPropertiesMap[key](instance);
|
||
},
|
||
// intercepted by the proxy so no need for implementation,
|
||
// but needed to prevent set errors
|
||
set: NOOP
|
||
});
|
||
});
|
||
return target;
|
||
}function exposePropsOnRenderContext(instance) {
|
||
var ctx = instance.ctx,
|
||
_instance$propsOption2 = _slicedToArray2(instance.propsOptions, 1),
|
||
propsOptions = _instance$propsOption2[0];
|
||
if (propsOptions) {
|
||
Object.keys(propsOptions).forEach(function (key) {
|
||
Object.defineProperty(ctx, key, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function get() {
|
||
return instance.props[key];
|
||
},
|
||
set: NOOP
|
||
});
|
||
});
|
||
}
|
||
}function exposeSetupStateOnRenderContext(instance) {
|
||
var ctx = instance.ctx,
|
||
setupState = instance.setupState;
|
||
Object.keys(toRaw(setupState)).forEach(function (key) {
|
||
if (!setupState.__isScriptSetup) {
|
||
if (isReservedPrefix(key[0])) {
|
||
warn$1("setup() return property ".concat(JSON.stringify(key), " should not start with \"$\" or \"_\" which are reserved prefixes for Vue internals."));
|
||
return;
|
||
}
|
||
Object.defineProperty(ctx, key, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function get() {
|
||
return setupState[key];
|
||
},
|
||
set: NOOP
|
||
});
|
||
}
|
||
});
|
||
}function normalizePropsOrEmits(props) {
|
||
return isArray(props) ? props.reduce(function (normalized, p2) {
|
||
return normalized[p2] = null, normalized;
|
||
}, {}) : props;
|
||
}function createDuplicateChecker() {
|
||
var cache = /* @__PURE__ */Object.create(null);
|
||
return function (type, key) {
|
||
if (cache[key]) {
|
||
warn$1("".concat(type, " property \"").concat(key, "\" is already defined in ").concat(cache[key], "."));
|
||
} else {
|
||
cache[key] = type;
|
||
}
|
||
};
|
||
}var shouldCacheAccess = true;function applyOptions$1(instance) {
|
||
var options = resolveMergedOptions(instance);
|
||
var publicThis = instance.proxy;
|
||
var ctx = instance.ctx;
|
||
shouldCacheAccess = false;
|
||
if (options.beforeCreate) {
|
||
callHook$1(options.beforeCreate, instance, "bc");
|
||
}
|
||
var dataOptions = options.data,
|
||
computedOptions = options.computed,
|
||
methods = options.methods,
|
||
watchOptions = options.watch,
|
||
provideOptions = options.provide,
|
||
injectOptions = options.inject,
|
||
created = options.created,
|
||
beforeMount = options.beforeMount,
|
||
mounted = options.mounted,
|
||
beforeUpdate = options.beforeUpdate,
|
||
updated = options.updated,
|
||
activated = options.activated,
|
||
deactivated = options.deactivated,
|
||
beforeDestroy = options.beforeDestroy,
|
||
beforeUnmount = options.beforeUnmount,
|
||
destroyed = options.destroyed,
|
||
unmounted = options.unmounted,
|
||
render = options.render,
|
||
renderTracked = options.renderTracked,
|
||
renderTriggered = options.renderTriggered,
|
||
errorCaptured = options.errorCaptured,
|
||
serverPrefetch = options.serverPrefetch,
|
||
expose = options.expose,
|
||
inheritAttrs = options.inheritAttrs,
|
||
components = options.components,
|
||
directives = options.directives,
|
||
filters = options.filters;
|
||
var checkDuplicateProperties = createDuplicateChecker();
|
||
{
|
||
var _instance$propsOption3 = _slicedToArray2(instance.propsOptions, 1),
|
||
propsOptions = _instance$propsOption3[0];
|
||
if (propsOptions) {
|
||
for (var key in propsOptions) {
|
||
checkDuplicateProperties("Props", key);
|
||
}
|
||
}
|
||
}
|
||
function initInjections() {
|
||
if (injectOptions) {
|
||
resolveInjections(injectOptions, ctx, checkDuplicateProperties);
|
||
}
|
||
}
|
||
{
|
||
initInjections();
|
||
}
|
||
if (methods) {
|
||
for (var _key11 in methods) {
|
||
var methodHandler = methods[_key11];
|
||
if (isFunction(methodHandler)) {
|
||
{
|
||
Object.defineProperty(ctx, _key11, {
|
||
value: methodHandler.bind(publicThis),
|
||
configurable: true,
|
||
enumerable: true,
|
||
writable: true
|
||
});
|
||
}
|
||
{
|
||
checkDuplicateProperties("Methods", _key11);
|
||
}
|
||
} else {
|
||
warn$1("Method \"".concat(_key11, "\" has type \"").concat(_typeof2(methodHandler), "\" in the component definition. Did you reference the function correctly?"));
|
||
}
|
||
}
|
||
}
|
||
if (dataOptions) {
|
||
if (!isFunction(dataOptions)) {
|
||
warn$1("The data option must be a function. Plain object usage is no longer supported.");
|
||
}
|
||
var data = dataOptions.call(publicThis, publicThis);
|
||
if (isPromise(data)) {
|
||
warn$1("data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.");
|
||
}
|
||
if (!isObject(data)) {
|
||
warn$1("data() should return an object.");
|
||
} else {
|
||
instance.data = reactive(data);
|
||
{
|
||
var _loop = function _loop(_key12) {
|
||
checkDuplicateProperties("Data", _key12);
|
||
if (!isReservedPrefix(_key12[0])) {
|
||
Object.defineProperty(ctx, _key12, {
|
||
configurable: true,
|
||
enumerable: true,
|
||
get: function get() {
|
||
return data[_key12];
|
||
},
|
||
set: NOOP
|
||
});
|
||
}
|
||
};
|
||
for (var _key12 in data) {
|
||
_loop(_key12);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
shouldCacheAccess = true;
|
||
if (computedOptions) {
|
||
var _loop2 = function _loop2(_key13) {
|
||
var opt = computedOptions[_key13];
|
||
var get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
|
||
if (get2 === NOOP) {
|
||
warn$1("Computed property \"".concat(_key13, "\" has no getter."));
|
||
}
|
||
var set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : function () {
|
||
warn$1("Write operation failed: computed property \"".concat(_key13, "\" is readonly."));
|
||
};
|
||
var c2 = computed({
|
||
get: get2,
|
||
set: set2
|
||
});
|
||
Object.defineProperty(ctx, _key13, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function get() {
|
||
return c2.value;
|
||
},
|
||
set: function set(v) {
|
||
return c2.value = v;
|
||
}
|
||
});
|
||
{
|
||
checkDuplicateProperties("Computed", _key13);
|
||
}
|
||
};
|
||
for (var _key13 in computedOptions) {
|
||
_loop2(_key13);
|
||
}
|
||
}
|
||
if (watchOptions) {
|
||
for (var _key14 in watchOptions) {
|
||
createWatcher(watchOptions[_key14], ctx, publicThis, _key14);
|
||
}
|
||
}
|
||
function initProvides() {
|
||
if (provideOptions) {
|
||
var provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
|
||
Reflect.ownKeys(provides).forEach(function (key) {
|
||
provide(key, provides[key]);
|
||
});
|
||
}
|
||
}
|
||
{
|
||
initProvides();
|
||
}
|
||
{
|
||
if (created) {
|
||
callHook$1(created, instance, "c");
|
||
}
|
||
}
|
||
function registerLifecycleHook(register, hook) {
|
||
if (isArray(hook)) {
|
||
hook.forEach(function (_hook) {
|
||
return register(_hook.bind(publicThis));
|
||
});
|
||
} else if (hook) {
|
||
register(hook.bind(publicThis));
|
||
}
|
||
}
|
||
registerLifecycleHook(onBeforeMount, beforeMount);
|
||
registerLifecycleHook(onMounted, mounted);
|
||
registerLifecycleHook(onBeforeUpdate, beforeUpdate);
|
||
registerLifecycleHook(onUpdated, updated);
|
||
registerLifecycleHook(onActivated, activated);
|
||
registerLifecycleHook(onDeactivated, deactivated);
|
||
registerLifecycleHook(onErrorCaptured, errorCaptured);
|
||
registerLifecycleHook(onRenderTracked, renderTracked);
|
||
registerLifecycleHook(onRenderTriggered, renderTriggered);
|
||
registerLifecycleHook(onBeforeUnmount, beforeUnmount);
|
||
registerLifecycleHook(onUnmounted, unmounted);
|
||
registerLifecycleHook(onServerPrefetch, serverPrefetch);
|
||
if (isArray(expose)) {
|
||
if (expose.length) {
|
||
var exposed = instance.exposed || (instance.exposed = {});
|
||
expose.forEach(function (key) {
|
||
Object.defineProperty(exposed, key, {
|
||
get: function get() {
|
||
return publicThis[key];
|
||
},
|
||
set: function set(val) {
|
||
return publicThis[key] = val;
|
||
}
|
||
});
|
||
});
|
||
} else if (!instance.exposed) {
|
||
instance.exposed = {};
|
||
}
|
||
}
|
||
if (render && instance.render === NOOP) {
|
||
instance.render = render;
|
||
}
|
||
if (inheritAttrs != null) {
|
||
instance.inheritAttrs = inheritAttrs;
|
||
}
|
||
if (components) instance.components = components;
|
||
if (directives) instance.directives = directives;
|
||
if (instance.ctx.$onApplyOptions) {
|
||
instance.ctx.$onApplyOptions(options, instance, publicThis);
|
||
}
|
||
}function resolveInjections(injectOptions, ctx) {
|
||
var checkDuplicateProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : NOOP;
|
||
if (isArray(injectOptions)) {
|
||
injectOptions = normalizeInject(injectOptions);
|
||
}
|
||
var _loop3 = function _loop3() {
|
||
var opt = injectOptions[key];
|
||
var injected;
|
||
if (isObject(opt)) {
|
||
if ("default" in opt) {
|
||
injected = inject(opt.from || key, opt.default, true);
|
||
} else {
|
||
injected = inject(opt.from || key);
|
||
}
|
||
} else {
|
||
injected = inject(opt);
|
||
}
|
||
if (isRef(injected)) {
|
||
Object.defineProperty(ctx, key, {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function get() {
|
||
return injected.value;
|
||
},
|
||
set: function set(v) {
|
||
return injected.value = v;
|
||
}
|
||
});
|
||
} else {
|
||
ctx[key] = injected;
|
||
}
|
||
{
|
||
checkDuplicateProperties("Inject", key);
|
||
}
|
||
};
|
||
for (var key in injectOptions) {
|
||
_loop3();
|
||
}
|
||
}function callHook$1(hook, instance, type) {
|
||
callWithAsyncErrorHandling(isArray(hook) ? hook.map(function (h2) {
|
||
return h2.bind(instance.proxy);
|
||
}) : hook.bind(instance.proxy), instance, type);
|
||
}function createWatcher(raw, ctx, publicThis, key) {
|
||
var getter = key.includes(".") ? createPathGetter(publicThis, key) : function () {
|
||
return publicThis[key];
|
||
};
|
||
if (isString(raw)) {
|
||
var handler = ctx[raw];
|
||
if (isFunction(handler)) {
|
||
watch(getter, handler);
|
||
} else {
|
||
warn$1("Invalid watch handler specified by key \"".concat(raw, "\""), handler);
|
||
}
|
||
} else if (isFunction(raw)) {
|
||
watch(getter, raw.bind(publicThis));
|
||
} else if (isObject(raw)) {
|
||
if (isArray(raw)) {
|
||
raw.forEach(function (r2) {
|
||
return createWatcher(r2, ctx, publicThis, key);
|
||
});
|
||
} else {
|
||
var _handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
|
||
if (isFunction(_handler)) {
|
||
watch(getter, _handler, raw);
|
||
} else {
|
||
warn$1("Invalid watch handler specified by key \"".concat(raw.handler, "\""), _handler);
|
||
}
|
||
}
|
||
} else {
|
||
warn$1("Invalid watch option: \"".concat(key, "\""), raw);
|
||
}
|
||
}function resolveMergedOptions(instance) {
|
||
var base = instance.type;
|
||
var mixins = base.mixins,
|
||
extendsOptions = base.extends;
|
||
var _instance$appContext = instance.appContext,
|
||
globalMixins = _instance$appContext.mixins,
|
||
cache = _instance$appContext.optionsCache,
|
||
optionMergeStrategies = _instance$appContext.config.optionMergeStrategies;
|
||
var cached = cache.get(base);
|
||
var resolved;
|
||
if (cached) {
|
||
resolved = cached;
|
||
} else if (!globalMixins.length && !mixins && !extendsOptions) {
|
||
{
|
||
resolved = base;
|
||
}
|
||
} else {
|
||
resolved = {};
|
||
if (globalMixins.length) {
|
||
globalMixins.forEach(function (m2) {
|
||
return mergeOptions(resolved, m2, optionMergeStrategies, true);
|
||
});
|
||
}
|
||
mergeOptions(resolved, base, optionMergeStrategies);
|
||
}
|
||
if (isObject(base)) {
|
||
cache.set(base, resolved);
|
||
}
|
||
return resolved;
|
||
}function mergeOptions(to, from, strats) {
|
||
var asMixin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
var mixins = from.mixins,
|
||
extendsOptions = from.extends;
|
||
if (extendsOptions) {
|
||
mergeOptions(to, extendsOptions, strats, true);
|
||
}
|
||
if (mixins) {
|
||
mixins.forEach(function (m2) {
|
||
return mergeOptions(to, m2, strats, true);
|
||
});
|
||
}
|
||
for (var key in from) {
|
||
if (asMixin && key === "expose") {
|
||
warn$1("\"expose\" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.");
|
||
} else {
|
||
var strat = internalOptionMergeStrats[key] || strats && strats[key];
|
||
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
||
}
|
||
}
|
||
return to;
|
||
}var internalOptionMergeStrats = {
|
||
data: mergeDataFn,
|
||
props: mergeEmitsOrPropsOptions,
|
||
emits: mergeEmitsOrPropsOptions,
|
||
// objects
|
||
methods: mergeObjectOptions,
|
||
computed: mergeObjectOptions,
|
||
// lifecycle
|
||
beforeCreate: mergeAsArray$1,
|
||
created: mergeAsArray$1,
|
||
beforeMount: mergeAsArray$1,
|
||
mounted: mergeAsArray$1,
|
||
beforeUpdate: mergeAsArray$1,
|
||
updated: mergeAsArray$1,
|
||
beforeDestroy: mergeAsArray$1,
|
||
beforeUnmount: mergeAsArray$1,
|
||
destroyed: mergeAsArray$1,
|
||
unmounted: mergeAsArray$1,
|
||
activated: mergeAsArray$1,
|
||
deactivated: mergeAsArray$1,
|
||
errorCaptured: mergeAsArray$1,
|
||
serverPrefetch: mergeAsArray$1,
|
||
// assets
|
||
components: mergeObjectOptions,
|
||
directives: mergeObjectOptions,
|
||
// watch
|
||
watch: mergeWatchOptions,
|
||
// provide / inject
|
||
provide: mergeDataFn,
|
||
inject: mergeInject
|
||
};function mergeDataFn(to, from) {
|
||
if (!from) {
|
||
return to;
|
||
}
|
||
if (!to) {
|
||
return from;
|
||
}
|
||
return function mergedDataFn() {
|
||
return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
||
};
|
||
}function mergeInject(to, from) {
|
||
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
||
}function normalizeInject(raw) {
|
||
if (isArray(raw)) {
|
||
var res = {};
|
||
for (var i = 0; i < raw.length; i++) {
|
||
res[raw[i]] = raw[i];
|
||
}
|
||
return res;
|
||
}
|
||
return raw;
|
||
}function mergeAsArray$1(to, from) {
|
||
return to ? _toConsumableArray2(new Set([].concat(to, from))) : from;
|
||
}function mergeObjectOptions(to, from) {
|
||
return to ? extend( /* @__PURE__ */Object.create(null), to, from) : from;
|
||
}function mergeEmitsOrPropsOptions(to, from) {
|
||
if (to) {
|
||
if (isArray(to) && isArray(from)) {
|
||
return _toConsumableArray2( /* @__PURE__ */new Set([].concat(_toConsumableArray2(to), _toConsumableArray2(from))));
|
||
}
|
||
return extend( /* @__PURE__ */Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from != null ? from : {}));
|
||
} else {
|
||
return from;
|
||
}
|
||
}function mergeWatchOptions(to, from) {
|
||
if (!to) return from;
|
||
if (!from) return to;
|
||
var merged = extend( /* @__PURE__ */Object.create(null), to);
|
||
for (var key in from) {
|
||
merged[key] = mergeAsArray$1(to[key], from[key]);
|
||
}
|
||
return merged;
|
||
}function initProps$1(instance, rawProps, isStateful) {
|
||
var isSSR = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
var props = {};
|
||
var attrs = {};
|
||
instance.propsDefaults = /* @__PURE__ */Object.create(null);
|
||
setFullProps(instance, rawProps, props, attrs);
|
||
for (var key in instance.propsOptions[0]) {
|
||
if (!(key in props)) {
|
||
props[key] = void 0;
|
||
}
|
||
}
|
||
{
|
||
validateProps(rawProps || {}, props, instance);
|
||
}
|
||
if (isStateful) {
|
||
instance.props = isSSR ? props : shallowReactive(props);
|
||
} else {
|
||
if (!instance.type.props) {
|
||
instance.props = attrs;
|
||
} else {
|
||
instance.props = props;
|
||
}
|
||
}
|
||
instance.attrs = attrs;
|
||
}function isInHmrContext(instance) {}function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
||
var props = instance.props,
|
||
attrs = instance.attrs,
|
||
patchFlag = instance.vnode.patchFlag;
|
||
var rawCurrentProps = toRaw(props);
|
||
var _instance$propsOption4 = _slicedToArray2(instance.propsOptions, 1),
|
||
options = _instance$propsOption4[0];
|
||
var hasAttrsChanged = false;
|
||
if (
|
||
// always force full diff in dev
|
||
// - #1942 if hmr is enabled with sfc component
|
||
// - vite#872 non-sfc component used by sfc component
|
||
!isInHmrContext() && (optimized || patchFlag > 0) && !(patchFlag & 16)) {
|
||
if (patchFlag & 8) {
|
||
var propsToUpdate = instance.vnode.dynamicProps;
|
||
for (var i = 0; i < propsToUpdate.length; i++) {
|
||
var key = propsToUpdate[i];
|
||
if (isEmitListener(instance.emitsOptions, key)) {
|
||
continue;
|
||
}
|
||
var value = rawProps[key];
|
||
if (options) {
|
||
if (hasOwn(attrs, key)) {
|
||
if (value !== attrs[key]) {
|
||
attrs[key] = value;
|
||
hasAttrsChanged = true;
|
||
}
|
||
} else {
|
||
var camelizedKey = camelize(key);
|
||
props[camelizedKey] = resolvePropValue$1(options, rawCurrentProps, camelizedKey, value, instance, false);
|
||
}
|
||
} else {
|
||
if (value !== attrs[key]) {
|
||
attrs[key] = value;
|
||
hasAttrsChanged = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
if (setFullProps(instance, rawProps, props, attrs)) {
|
||
hasAttrsChanged = true;
|
||
}
|
||
var kebabKey;
|
||
for (var _key15 in rawCurrentProps) {
|
||
if (!rawProps ||
|
||
// for camelCase
|
||
!hasOwn(rawProps, _key15) && (
|
||
// it's possible the original props was passed in as kebab-case
|
||
// and converted to camelCase (#955)
|
||
(kebabKey = hyphenate(_key15)) === _key15 || !hasOwn(rawProps, kebabKey))) {
|
||
if (options) {
|
||
if (rawPrevProps && (
|
||
// for camelCase
|
||
rawPrevProps[_key15] !== void 0 ||
|
||
// for kebab-case
|
||
rawPrevProps[kebabKey] !== void 0)) {
|
||
props[_key15] = resolvePropValue$1(options, rawCurrentProps, _key15, void 0, instance, true);
|
||
}
|
||
} else {
|
||
delete props[_key15];
|
||
}
|
||
}
|
||
}
|
||
if (attrs !== rawCurrentProps) {
|
||
for (var _key16 in attrs) {
|
||
if (!rawProps || !hasOwn(rawProps, _key16) && true) {
|
||
delete attrs[_key16];
|
||
hasAttrsChanged = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (hasAttrsChanged) {
|
||
trigger(instance, "set", "$attrs");
|
||
}
|
||
{
|
||
validateProps(rawProps || {}, props, instance);
|
||
}
|
||
}function setFullProps(instance, rawProps, props, attrs) {
|
||
var _instance$propsOption5 = _slicedToArray2(instance.propsOptions, 2),
|
||
options = _instance$propsOption5[0],
|
||
needCastKeys = _instance$propsOption5[1];
|
||
var hasAttrsChanged = false;
|
||
var rawCastValues;
|
||
if (rawProps) {
|
||
for (var key in rawProps) {
|
||
if (isReservedProp(key)) {
|
||
continue;
|
||
}
|
||
var value = rawProps[key];
|
||
var camelKey = void 0;
|
||
if (options && hasOwn(options, camelKey = camelize(key))) {
|
||
if (!needCastKeys || !needCastKeys.includes(camelKey)) {
|
||
props[camelKey] = value;
|
||
} else {
|
||
(rawCastValues || (rawCastValues = {}))[camelKey] = value;
|
||
}
|
||
} else if (!isEmitListener(instance.emitsOptions, key)) {
|
||
if (!(key in attrs) || value !== attrs[key]) {
|
||
attrs[key] = value;
|
||
hasAttrsChanged = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (needCastKeys) {
|
||
var rawCurrentProps = toRaw(props);
|
||
var castValues = rawCastValues || EMPTY_OBJ;
|
||
for (var i = 0; i < needCastKeys.length; i++) {
|
||
var _key17 = needCastKeys[i];
|
||
props[_key17] = resolvePropValue$1(options, rawCurrentProps, _key17, castValues[_key17], instance, !hasOwn(castValues, _key17));
|
||
}
|
||
}
|
||
return hasAttrsChanged;
|
||
}function resolvePropValue$1(options, props, key, value, instance, isAbsent) {
|
||
var opt = options[key];
|
||
if (opt != null) {
|
||
var hasDefault = hasOwn(opt, "default");
|
||
if (hasDefault && value === void 0) {
|
||
var defaultValue = opt.default;
|
||
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) {
|
||
var propsDefaults = instance.propsDefaults;
|
||
if (key in propsDefaults) {
|
||
value = propsDefaults[key];
|
||
} else {
|
||
var reset = setCurrentInstance(instance);
|
||
value = propsDefaults[key] = defaultValue.call(null, props);
|
||
reset();
|
||
}
|
||
} else {
|
||
value = defaultValue;
|
||
}
|
||
}
|
||
if (opt[0
|
||
/* shouldCast */]) {
|
||
if (isAbsent && !hasDefault) {
|
||
value = false;
|
||
} else if (opt[1
|
||
/* shouldCastTrue */] && (value === "" || value === hyphenate(key))) {
|
||
value = true;
|
||
}
|
||
}
|
||
}
|
||
return value;
|
||
}function normalizePropsOptions(comp, appContext) {
|
||
var asMixin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var cache = appContext.propsCache;
|
||
var cached = cache.get(comp);
|
||
if (cached) {
|
||
return cached;
|
||
}
|
||
var raw = comp.props;
|
||
var normalized = {};
|
||
var needCastKeys = [];
|
||
var hasExtends = false;
|
||
if (!isFunction(comp)) {
|
||
var extendProps = function extendProps(raw2) {
|
||
hasExtends = true;
|
||
var _normalizePropsOption = normalizePropsOptions(raw2, appContext, true),
|
||
_normalizePropsOption2 = _slicedToArray2(_normalizePropsOption, 2),
|
||
props = _normalizePropsOption2[0],
|
||
keys = _normalizePropsOption2[1];
|
||
extend(normalized, props);
|
||
if (keys) needCastKeys.push.apply(needCastKeys, _toConsumableArray2(keys));
|
||
};
|
||
if (!asMixin && appContext.mixins.length) {
|
||
appContext.mixins.forEach(extendProps);
|
||
}
|
||
if (comp.extends) {
|
||
extendProps(comp.extends);
|
||
}
|
||
if (comp.mixins) {
|
||
comp.mixins.forEach(extendProps);
|
||
}
|
||
}
|
||
if (!raw && !hasExtends) {
|
||
if (isObject(comp)) {
|
||
cache.set(comp, EMPTY_ARR);
|
||
}
|
||
return EMPTY_ARR;
|
||
}
|
||
if (isArray(raw)) {
|
||
for (var i = 0; i < raw.length; i++) {
|
||
if (!isString(raw[i])) {
|
||
warn$1("props must be strings when using array syntax.", raw[i]);
|
||
}
|
||
var normalizedKey = camelize(raw[i]);
|
||
if (validatePropName(normalizedKey)) {
|
||
normalized[normalizedKey] = EMPTY_OBJ;
|
||
}
|
||
}
|
||
} else if (raw) {
|
||
if (!isObject(raw)) {
|
||
warn$1("invalid props options", raw);
|
||
}
|
||
for (var key in raw) {
|
||
var _normalizedKey = camelize(key);
|
||
if (validatePropName(_normalizedKey)) {
|
||
var opt = raw[key];
|
||
var prop = normalized[_normalizedKey] = isArray(opt) || isFunction(opt) ? {
|
||
type: opt
|
||
} : extend({}, opt);
|
||
if (prop) {
|
||
var booleanIndex = getTypeIndex(Boolean, prop.type);
|
||
var stringIndex = getTypeIndex(String, prop.type);
|
||
prop[0
|
||
/* shouldCast */] = booleanIndex > -1;
|
||
prop[1
|
||
/* shouldCastTrue */] = stringIndex < 0 || booleanIndex < stringIndex;
|
||
if (booleanIndex > -1 || hasOwn(prop, "default")) {
|
||
needCastKeys.push(_normalizedKey);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
var res = [normalized, needCastKeys];
|
||
if (isObject(comp)) {
|
||
cache.set(comp, res);
|
||
}
|
||
return res;
|
||
}function validatePropName(key) {
|
||
if (key[0] !== "$" && !isReservedProp(key)) {
|
||
return true;
|
||
} else {
|
||
warn$1("Invalid prop name: \"".concat(key, "\" is a reserved property."));
|
||
}
|
||
return false;
|
||
}function getType$1(ctor) {
|
||
if (ctor === null) {
|
||
return "null";
|
||
}
|
||
if (typeof ctor === "function") {
|
||
return ctor.name || "";
|
||
} else if (_typeof2(ctor) === "object") {
|
||
var name = ctor.constructor && ctor.constructor.name;
|
||
return name || "";
|
||
}
|
||
return "";
|
||
}function isSameType(a, b) {
|
||
return getType$1(a) === getType$1(b);
|
||
}function getTypeIndex(type, expectedTypes) {
|
||
if (isArray(expectedTypes)) {
|
||
return expectedTypes.findIndex(function (t2) {
|
||
return isSameType(t2, type);
|
||
});
|
||
} else if (isFunction(expectedTypes)) {
|
||
return isSameType(expectedTypes, type) ? 0 : -1;
|
||
}
|
||
return -1;
|
||
}function validateProps(rawProps, props, instance) {
|
||
var resolvedValues = toRaw(props);
|
||
var options = instance.propsOptions[0];
|
||
for (var key in options) {
|
||
var opt = options[key];
|
||
if (opt == null) continue;
|
||
validateProp$1(key, resolvedValues[key], opt, shallowReadonly(resolvedValues), !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
|
||
}
|
||
}function validateProp$1(name, value, prop, props, isAbsent) {
|
||
var type = prop.type,
|
||
required = prop.required,
|
||
validator = prop.validator,
|
||
skipCheck = prop.skipCheck;
|
||
if (required && isAbsent) {
|
||
warn$1('Missing required prop: "' + name + '"');
|
||
return;
|
||
}
|
||
if (value == null && !required) {
|
||
return;
|
||
}
|
||
if (type != null && type !== true && !skipCheck) {
|
||
var isValid = false;
|
||
var types = isArray(type) ? type : [type];
|
||
var expectedTypes = [];
|
||
for (var i = 0; i < types.length && !isValid; i++) {
|
||
var _assertType$ = assertType$1(value, types[i]),
|
||
valid = _assertType$.valid,
|
||
expectedType = _assertType$.expectedType;
|
||
expectedTypes.push(expectedType || "");
|
||
isValid = valid;
|
||
}
|
||
if (!isValid) {
|
||
warn$1(getInvalidTypeMessage$1(name, value, expectedTypes));
|
||
return;
|
||
}
|
||
}
|
||
if (validator && !validator(value, props)) {
|
||
warn$1('Invalid prop: custom validator check failed for prop "' + name + '".');
|
||
}
|
||
}var isSimpleType$1 = /* @__PURE__ */makeMap("String,Number,Boolean,Function,Symbol,BigInt");function assertType$1(value, type) {
|
||
var valid;
|
||
var expectedType = getType$1(type);
|
||
if (isSimpleType$1(expectedType)) {
|
||
var t2 = _typeof2(value);
|
||
valid = t2 === expectedType.toLowerCase();
|
||
if (!valid && t2 === "object") {
|
||
valid = value instanceof type;
|
||
}
|
||
} else if (expectedType === "Object") {
|
||
valid = isObject(value);
|
||
} else if (expectedType === "Array") {
|
||
valid = isArray(value);
|
||
} else if (expectedType === "null") {
|
||
valid = value === null;
|
||
} else {
|
||
valid = value instanceof type;
|
||
}
|
||
return {
|
||
valid: valid,
|
||
expectedType: expectedType
|
||
};
|
||
}function getInvalidTypeMessage$1(name, value, expectedTypes) {
|
||
if (expectedTypes.length === 0) {
|
||
return "Prop type [] for prop \"".concat(name, "\" won't match anything. Did you mean to use type Array instead?");
|
||
}
|
||
var message = "Invalid prop: type check failed for prop \"".concat(name, "\". Expected ").concat(expectedTypes.map(capitalize).join(" | "));
|
||
var expectedType = expectedTypes[0];
|
||
var receivedType = toRawType(value);
|
||
var expectedValue = styleValue$1(value, expectedType);
|
||
var receivedValue = styleValue$1(value, receivedType);
|
||
if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$1(expectedType, receivedType)) {
|
||
message += " with value ".concat(expectedValue);
|
||
}
|
||
message += ", got ".concat(receivedType, " ");
|
||
if (isExplicable$1(receivedType)) {
|
||
message += "with value ".concat(receivedValue, ".");
|
||
}
|
||
return message;
|
||
}function styleValue$1(value, type) {
|
||
if (type === "String") {
|
||
return "\"".concat(value, "\"");
|
||
} else if (type === "Number") {
|
||
return "".concat(Number(value));
|
||
} else {
|
||
return "".concat(value);
|
||
}
|
||
}function isExplicable$1(type) {
|
||
var explicitTypes = ["string", "number", "boolean"];
|
||
return explicitTypes.some(function (elem) {
|
||
return type.toLowerCase() === elem;
|
||
});
|
||
}function isBoolean$1() {
|
||
for (var _len10 = arguments.length, args = new Array(_len10), _key18 = 0; _key18 < _len10; _key18++) {
|
||
args[_key18] = arguments[_key18];
|
||
}
|
||
return args.some(function (elem) {
|
||
return elem.toLowerCase() === "boolean";
|
||
});
|
||
}var supported;var perf;function startMeasure(instance, type) {
|
||
if (instance.appContext.config.performance && isSupported()) {
|
||
perf.mark("vue-".concat(type, "-").concat(instance.uid));
|
||
}
|
||
{
|
||
devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
|
||
}
|
||
}function endMeasure(instance, type) {
|
||
if (instance.appContext.config.performance && isSupported()) {
|
||
var startTag = "vue-".concat(type, "-").concat(instance.uid);
|
||
var endTag = startTag + ":end";
|
||
perf.mark(endTag);
|
||
perf.measure("<".concat(formatComponentName(instance, instance.type), "> ").concat(type), startTag, endTag);
|
||
perf.clearMarks(startTag);
|
||
perf.clearMarks(endTag);
|
||
}
|
||
{
|
||
devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
|
||
}
|
||
}function isSupported() {
|
||
if (supported !== void 0) {
|
||
return supported;
|
||
}
|
||
if (typeof window !== "undefined" && window.performance) {
|
||
supported = true;
|
||
perf = window.performance;
|
||
} else {
|
||
supported = false;
|
||
}
|
||
return supported;
|
||
}var queuePostRenderEffect$1 = queuePostFlushCb;var Fragment = Symbol.for("v-fgt");var Text = Symbol.for("v-txt");var Comment = Symbol.for("v-cmt");var Static = Symbol.for("v-stc");function isVNode(value) {
|
||
return value ? value.__v_isVNode === true : false;
|
||
}var emptyAppContext = createAppContext();var uid = 0;function createComponentInstance(vnode, parent, suspense) {
|
||
var type = vnode.type;
|
||
var appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
||
var instance = {
|
||
uid: uid++,
|
||
vnode: vnode,
|
||
type: type,
|
||
parent: parent,
|
||
appContext: appContext,
|
||
root: null,
|
||
// to be immediately set
|
||
next: null,
|
||
subTree: null,
|
||
// will be set synchronously right after creation
|
||
effect: null,
|
||
update: null,
|
||
// will be set synchronously right after creation
|
||
scope: new EffectScope(true
|
||
/* detached */),
|
||
|
||
render: null,
|
||
proxy: null,
|
||
exposed: null,
|
||
exposeProxy: null,
|
||
withProxy: null,
|
||
provides: parent ? parent.provides : Object.create(appContext.provides),
|
||
accessCache: null,
|
||
renderCache: [],
|
||
// local resolved assets
|
||
components: null,
|
||
directives: null,
|
||
// resolved props and emits options
|
||
propsOptions: normalizePropsOptions(type, appContext),
|
||
emitsOptions: normalizeEmitsOptions(type, appContext),
|
||
// emit
|
||
emit: null,
|
||
// to be set immediately
|
||
emitted: null,
|
||
// props default value
|
||
propsDefaults: EMPTY_OBJ,
|
||
// inheritAttrs
|
||
inheritAttrs: type.inheritAttrs,
|
||
// state
|
||
ctx: EMPTY_OBJ,
|
||
data: EMPTY_OBJ,
|
||
props: EMPTY_OBJ,
|
||
attrs: EMPTY_OBJ,
|
||
slots: EMPTY_OBJ,
|
||
refs: EMPTY_OBJ,
|
||
setupState: EMPTY_OBJ,
|
||
setupContext: null,
|
||
attrsProxy: null,
|
||
slotsProxy: null,
|
||
// suspense related
|
||
suspense: suspense,
|
||
suspenseId: suspense ? suspense.pendingId : 0,
|
||
asyncDep: null,
|
||
asyncResolved: false,
|
||
// lifecycle hooks
|
||
// not using enums here because it results in computed properties
|
||
isMounted: false,
|
||
isUnmounted: false,
|
||
isDeactivated: false,
|
||
bc: null,
|
||
c: null,
|
||
bm: null,
|
||
m: null,
|
||
bu: null,
|
||
u: null,
|
||
um: null,
|
||
bum: null,
|
||
da: null,
|
||
a: null,
|
||
rtg: null,
|
||
rtc: null,
|
||
ec: null,
|
||
sp: null,
|
||
// fixed by xxxxxx 用于存储uni-app的元素缓存
|
||
$uniElements: /* @__PURE__ */new Map(),
|
||
$templateUniElementRefs: [],
|
||
$templateUniElementStyles: {},
|
||
$eS: {},
|
||
$eA: {}
|
||
};
|
||
{
|
||
instance.ctx = createDevRenderContext(instance);
|
||
}
|
||
instance.root = parent ? parent.root : instance;
|
||
instance.emit = emit.bind(null, instance);
|
||
if (vnode.ce) {
|
||
vnode.ce(instance);
|
||
}
|
||
return instance;
|
||
}var currentInstance = null;var getCurrentInstance = function getCurrentInstance() {
|
||
return currentInstance || currentRenderingInstance;
|
||
};var internalSetCurrentInstance;var setInSSRSetupState;{
|
||
internalSetCurrentInstance = function internalSetCurrentInstance(i) {
|
||
currentInstance = i;
|
||
};
|
||
setInSSRSetupState = function setInSSRSetupState(v) {
|
||
isInSSRComponentSetup = v;
|
||
};
|
||
}var setCurrentInstance = function setCurrentInstance(instance) {
|
||
var prev = currentInstance;
|
||
internalSetCurrentInstance(instance);
|
||
instance.scope.on();
|
||
return function () {
|
||
instance.scope.off();
|
||
internalSetCurrentInstance(prev);
|
||
};
|
||
};var unsetCurrentInstance = function unsetCurrentInstance() {
|
||
currentInstance && currentInstance.scope.off();
|
||
internalSetCurrentInstance(null);
|
||
};var isBuiltInTag = /* @__PURE__ */makeMap("slot,component");function validateComponentName(name, _ref11) {
|
||
var isNativeTag = _ref11.isNativeTag;
|
||
if (isBuiltInTag(name) || isNativeTag(name)) {
|
||
warn$1("Do not use built-in or reserved HTML elements as component id: " + name);
|
||
}
|
||
}function isStatefulComponent(instance) {
|
||
return instance.vnode.shapeFlag & 4;
|
||
}var isInSSRComponentSetup = false;function setupComponent(instance) {
|
||
var isSSR = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
isSSR && setInSSRSetupState(isSSR);
|
||
var props = instance.vnode.props;
|
||
var isStateful = isStatefulComponent(instance);
|
||
initProps$1(instance, props, isStateful, isSSR);
|
||
var setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
||
isSSR && setInSSRSetupState(false);
|
||
return setupResult;
|
||
}function setupStatefulComponent(instance, isSSR) {
|
||
var Component2 = instance.type;
|
||
{
|
||
if (Component2.name) {
|
||
validateComponentName(Component2.name, instance.appContext.config);
|
||
}
|
||
if (Component2.components) {
|
||
var names = Object.keys(Component2.components);
|
||
for (var i = 0; i < names.length; i++) {
|
||
validateComponentName(names[i], instance.appContext.config);
|
||
}
|
||
}
|
||
if (Component2.directives) {
|
||
var _names = Object.keys(Component2.directives);
|
||
for (var _i = 0; _i < _names.length; _i++) {
|
||
validateDirectiveName(_names[_i]);
|
||
}
|
||
}
|
||
if (Component2.compilerOptions && isRuntimeOnly()) {
|
||
warn$1("\"compilerOptions\" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.");
|
||
}
|
||
}
|
||
instance.accessCache = /* @__PURE__ */Object.create(null);
|
||
instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
|
||
{
|
||
exposePropsOnRenderContext(instance);
|
||
}
|
||
var setup = Component2.setup;
|
||
if (setup) {
|
||
var setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
|
||
var reset = setCurrentInstance(instance);
|
||
pauseTracking();
|
||
var setupResult = callWithErrorHandling(setup, instance, 0, [shallowReadonly(instance.props), setupContext]);
|
||
resetTracking();
|
||
reset();
|
||
if (isPromise(setupResult)) {
|
||
setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
|
||
{
|
||
warn$1("setup() returned a Promise, but the version of Vue you are using does not support it yet.");
|
||
}
|
||
} else {
|
||
handleSetupResult(instance, setupResult, isSSR);
|
||
}
|
||
} else {
|
||
finishComponentSetup(instance, isSSR);
|
||
}
|
||
}function handleSetupResult(instance, setupResult, isSSR) {
|
||
if (isFunction(setupResult)) {
|
||
{
|
||
instance.render = setupResult;
|
||
}
|
||
} else if (isObject(setupResult)) {
|
||
if (isVNode(setupResult)) {
|
||
warn$1("setup() should not return VNodes directly - return a render function instead.");
|
||
}
|
||
{
|
||
instance.devtoolsRawSetupState = setupResult;
|
||
}
|
||
instance.setupState = proxyRefs(setupResult);
|
||
{
|
||
exposeSetupStateOnRenderContext(instance);
|
||
}
|
||
} else if (setupResult !== void 0) {
|
||
warn$1("setup() should return an object. Received: ".concat(setupResult === null ? "null" : _typeof2(setupResult)));
|
||
}
|
||
finishComponentSetup(instance, isSSR);
|
||
}var compile;var isRuntimeOnly = function isRuntimeOnly() {
|
||
return !compile;
|
||
};function finishComponentSetup(instance, isSSR, skipOptions) {
|
||
var Component2 = instance.type;
|
||
if (!instance.render) {
|
||
instance.render = Component2.render || NOOP;
|
||
}
|
||
{
|
||
var reset = setCurrentInstance(instance);
|
||
pauseTracking();
|
||
try {
|
||
applyOptions$1(instance);
|
||
} finally {
|
||
resetTracking();
|
||
reset();
|
||
}
|
||
}
|
||
if (!Component2.render && instance.render === NOOP && !isSSR) {
|
||
if (Component2.template) {
|
||
warn$1("Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias \"vue\" to \"vue/dist/vue.esm-bundler.js\".");
|
||
} else {
|
||
warn$1("Component is missing template or render function.");
|
||
}
|
||
}
|
||
}function getAttrsProxy(instance) {
|
||
return instance.attrsProxy || (instance.attrsProxy = new Proxy(instance.attrs, {
|
||
get: function get(target, key) {
|
||
track(instance, "get", "$attrs");
|
||
return target[key];
|
||
},
|
||
set: function set() {
|
||
warn$1("setupContext.attrs is readonly.");
|
||
return false;
|
||
},
|
||
deleteProperty: function deleteProperty() {
|
||
warn$1("setupContext.attrs is readonly.");
|
||
return false;
|
||
}
|
||
}));
|
||
}function getSlotsProxy(instance) {
|
||
return instance.slotsProxy || (instance.slotsProxy = new Proxy(instance.slots, {
|
||
get: function get(target, key) {
|
||
track(instance, "get", "$slots");
|
||
return target[key];
|
||
}
|
||
}));
|
||
}function createSetupContext(instance) {
|
||
var expose = function expose(exposed) {
|
||
{
|
||
if (instance.exposed) {
|
||
warn$1("expose() should be called only once per setup().");
|
||
}
|
||
if (exposed != null) {
|
||
var exposedType = _typeof2(exposed);
|
||
if (exposedType === "object") {
|
||
if (isArray(exposed)) {
|
||
exposedType = "array";
|
||
} else if (isRef(exposed)) {
|
||
exposedType = "ref";
|
||
}
|
||
}
|
||
if (exposedType !== "object") {
|
||
warn$1("expose() should be passed a plain object, received ".concat(exposedType, "."));
|
||
}
|
||
}
|
||
}
|
||
instance.exposed = exposed || {};
|
||
};
|
||
{
|
||
return Object.freeze({
|
||
get attrs() {
|
||
return getAttrsProxy(instance);
|
||
},
|
||
get slots() {
|
||
return getSlotsProxy(instance);
|
||
},
|
||
get emit() {
|
||
return function (event) {
|
||
for (var _len11 = arguments.length, args = new Array(_len11 > 1 ? _len11 - 1 : 0), _key19 = 1; _key19 < _len11; _key19++) {
|
||
args[_key19 - 1] = arguments[_key19];
|
||
}
|
||
return instance.emit.apply(instance, [event].concat(args));
|
||
};
|
||
},
|
||
expose: expose
|
||
});
|
||
}
|
||
}function getExposeProxy(instance) {
|
||
if (instance.exposed) {
|
||
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
||
get: function get(target, key) {
|
||
if (key in target) {
|
||
return target[key];
|
||
}
|
||
return instance.proxy[key];
|
||
},
|
||
has: function has(target, key) {
|
||
return key in target || key in publicPropertiesMap;
|
||
}
|
||
}));
|
||
}
|
||
}var classifyRE = /(?:^|[-_])(\w)/g;var classify = function classify(str) {
|
||
return str.replace(classifyRE, function (c2) {
|
||
return c2.toUpperCase();
|
||
}).replace(/[-_]/g, "");
|
||
};function getComponentName(Component2) {
|
||
var includeInferred = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||
return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
|
||
}function formatComponentName(instance, Component2) {
|
||
var isRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
var name = getComponentName(Component2);
|
||
if (!name && Component2.__file) {
|
||
var match = Component2.__file.match(/([^/\\]+)\.\w+$/);
|
||
if (match) {
|
||
name = match[1];
|
||
}
|
||
}
|
||
if (!name && instance && instance.parent) {
|
||
var inferFromRegistry = function inferFromRegistry(registry) {
|
||
for (var key in registry) {
|
||
if (registry[key] === Component2) {
|
||
return key;
|
||
}
|
||
}
|
||
};
|
||
name = inferFromRegistry(instance.components || instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
||
}
|
||
return name ? classify(name) : isRoot ? "App" : "Anonymous";
|
||
}var computed = function computed(getterOrOptions, debugOptions) {
|
||
var c2 = computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
||
{
|
||
var i = getCurrentInstance();
|
||
if (i && i.appContext.config.warnRecursiveComputed) {
|
||
c2._warnRecursive = true;
|
||
}
|
||
}
|
||
return c2;
|
||
};var version = "3.4.21";var warn = warn$1;function unwrapper(target) {
|
||
return unref(target);
|
||
}var ARRAYTYPE = "[object Array]";var OBJECTTYPE = "[object Object]";function diff(current, pre) {
|
||
var result = {};
|
||
syncKeys(current, pre);
|
||
_diff(current, pre, "", result);
|
||
return result;
|
||
}function syncKeys(current, pre) {
|
||
current = unwrapper(current);
|
||
if (current === pre) return;
|
||
var rootCurrentType = toTypeString(current);
|
||
var rootPreType = toTypeString(pre);
|
||
if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
|
||
for (var key in pre) {
|
||
var currentValue = current[key];
|
||
if (currentValue === void 0) {
|
||
current[key] = null;
|
||
} else {
|
||
syncKeys(currentValue, pre[key]);
|
||
}
|
||
}
|
||
} else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
|
||
if (current.length >= pre.length) {
|
||
pre.forEach(function (item, index2) {
|
||
syncKeys(current[index2], item);
|
||
});
|
||
}
|
||
}
|
||
}function _diff(current, pre, path, result) {
|
||
current = unwrapper(current);
|
||
if (current === pre) return;
|
||
var rootCurrentType = toTypeString(current);
|
||
var rootPreType = toTypeString(pre);
|
||
if (rootCurrentType == OBJECTTYPE) {
|
||
if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
|
||
setResult(result, path, current);
|
||
} else {
|
||
var _loop4 = function _loop4(key) {
|
||
var currentValue = unwrapper(current[key]);
|
||
var preValue = pre[key];
|
||
var currentType = toTypeString(currentValue);
|
||
var preType = toTypeString(preValue);
|
||
if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
|
||
if (currentValue != preValue) {
|
||
setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
|
||
}
|
||
} else if (currentType == ARRAYTYPE) {
|
||
if (preType != ARRAYTYPE) {
|
||
setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
|
||
} else {
|
||
if (currentValue.length < preValue.length) {
|
||
setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
|
||
} else {
|
||
currentValue.forEach(function (item, index2) {
|
||
_diff(item, preValue[index2], (path == "" ? "" : path + ".") + key + "[" + index2 + "]", result);
|
||
});
|
||
}
|
||
}
|
||
} else if (currentType == OBJECTTYPE) {
|
||
if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
|
||
setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
|
||
} else {
|
||
for (var subKey in currentValue) {
|
||
_diff(currentValue[subKey], preValue[subKey], (path == "" ? "" : path + ".") + key + "." + subKey, result);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
for (var key in current) {
|
||
_loop4(key);
|
||
}
|
||
}
|
||
} else if (rootCurrentType == ARRAYTYPE) {
|
||
if (rootPreType != ARRAYTYPE) {
|
||
setResult(result, path, current);
|
||
} else {
|
||
if (current.length < pre.length) {
|
||
setResult(result, path, current);
|
||
} else {
|
||
current.forEach(function (item, index2) {
|
||
_diff(item, pre[index2], path + "[" + index2 + "]", result);
|
||
});
|
||
}
|
||
}
|
||
} else {
|
||
setResult(result, path, current);
|
||
}
|
||
}function setResult(result, k, v) {
|
||
result[k] = v;
|
||
}function hasComponentEffect(instance) {
|
||
return queue$1.includes(instance.update);
|
||
}function flushCallbacks(instance) {
|
||
var ctx = instance.ctx;
|
||
var callbacks = ctx.__next_tick_callbacks;
|
||
if (callbacks && callbacks.length) {
|
||
var copies = callbacks.slice(0);
|
||
callbacks.length = 0;
|
||
for (var i = 0; i < copies.length; i++) {
|
||
copies[i]();
|
||
}
|
||
}
|
||
}function nextTick(instance, fn) {
|
||
var ctx = instance.ctx;
|
||
if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
|
||
return nextTick$1(fn && fn.bind(instance.proxy));
|
||
}
|
||
var _resolve;
|
||
if (!ctx.__next_tick_callbacks) {
|
||
ctx.__next_tick_callbacks = [];
|
||
}
|
||
ctx.__next_tick_callbacks.push(function () {
|
||
if (fn) {
|
||
callWithErrorHandling(fn.bind(instance.proxy), instance, 14);
|
||
} else if (_resolve) {
|
||
_resolve(instance.proxy);
|
||
}
|
||
});
|
||
return new Promise(function (resolve2) {
|
||
_resolve = resolve2;
|
||
});
|
||
}function clone(src, seen) {
|
||
src = unwrapper(src);
|
||
var type = _typeof2(src);
|
||
if (type === "object" && src !== null) {
|
||
var copy = seen.get(src);
|
||
if (typeof copy !== "undefined") {
|
||
return copy;
|
||
}
|
||
if (isArray(src)) {
|
||
var len = src.length;
|
||
copy = new Array(len);
|
||
seen.set(src, copy);
|
||
for (var i = 0; i < len; i++) {
|
||
copy[i] = clone(src[i], seen);
|
||
}
|
||
} else {
|
||
copy = {};
|
||
seen.set(src, copy);
|
||
for (var name in src) {
|
||
if (hasOwn(src, name)) {
|
||
copy[name] = clone(src[name], seen);
|
||
}
|
||
}
|
||
}
|
||
return copy;
|
||
}
|
||
if (type !== "symbol") {
|
||
return src;
|
||
}
|
||
}function deepCopy(src) {
|
||
return clone(src, typeof WeakMap !== "undefined" ? /* @__PURE__ */new WeakMap() : /* @__PURE__ */new Map());
|
||
}function getMPInstanceData(instance, keys) {
|
||
var data = instance.data;
|
||
var ret = /* @__PURE__ */Object.create(null);
|
||
keys.forEach(function (key) {
|
||
ret[key] = data[key];
|
||
});
|
||
return ret;
|
||
}function patch(instance, data, oldData) {
|
||
if (!data) {
|
||
return;
|
||
}
|
||
data = deepCopy(data);
|
||
data.$eS = instance.$eS || {};
|
||
data.$eA = instance.$eA || {};
|
||
var ctx = instance.ctx;
|
||
var mpType = ctx.mpType;
|
||
if (mpType === "page" || mpType === "component") {
|
||
data.r0 = 1;
|
||
var mpInstance = ctx.$scope;
|
||
var keys = Object.keys(data);
|
||
var diffData = diff(data, oldData || getMPInstanceData(mpInstance, keys));
|
||
if (Object.keys(diffData).length) {
|
||
ctx.__next_tick_pending = true;
|
||
mpInstance.setData(diffData, function () {
|
||
ctx.__next_tick_pending = false;
|
||
flushCallbacks(instance);
|
||
});
|
||
flushPreFlushCbs();
|
||
} else {
|
||
flushCallbacks(instance);
|
||
}
|
||
}
|
||
}function initAppConfig(appConfig) {
|
||
appConfig.globalProperties.$nextTick = function $nextTick(fn) {
|
||
return nextTick(this.$, fn);
|
||
};
|
||
}function onApplyOptions(options, instance, publicThis) {
|
||
instance.appContext.config.globalProperties.$applyOptions(options, instance, publicThis);
|
||
var computedOptions = options.computed;
|
||
if (computedOptions) {
|
||
var keys = Object.keys(computedOptions);
|
||
if (keys.length) {
|
||
var _ctx$$computedKeys;
|
||
var ctx = instance.ctx;
|
||
if (!ctx.$computedKeys) {
|
||
ctx.$computedKeys = [];
|
||
}
|
||
(_ctx$$computedKeys = ctx.$computedKeys).push.apply(_ctx$$computedKeys, keys);
|
||
}
|
||
}
|
||
delete instance.ctx.$onApplyOptions;
|
||
}function setRef$1(instance) {
|
||
var isUnmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
var setupState = instance.setupState,
|
||
$templateRefs = instance.$templateRefs,
|
||
$templateUniElementRefs = instance.$templateUniElementRefs,
|
||
_instance$ctx = instance.ctx,
|
||
$scope = _instance$ctx.$scope,
|
||
$mpPlatform = _instance$ctx.$mpPlatform;
|
||
if ($mpPlatform === "mp-alipay") {
|
||
return;
|
||
}
|
||
if (!$scope || !$templateRefs && !$templateUniElementRefs) {
|
||
return;
|
||
}
|
||
if (isUnmount) {
|
||
$templateRefs && $templateRefs.forEach(function (templateRef) {
|
||
return setTemplateRef(templateRef, null, setupState);
|
||
});
|
||
$templateUniElementRefs && $templateUniElementRefs.forEach(function (templateRef) {
|
||
return setTemplateRef(templateRef, null, setupState);
|
||
});
|
||
return;
|
||
}
|
||
var check = $mpPlatform === "mp-baidu" || $mpPlatform === "mp-toutiao";
|
||
var doSetByRefs = function doSetByRefs(refs) {
|
||
if (refs.length === 0) {
|
||
return [];
|
||
}
|
||
var mpComponents =
|
||
// 字节小程序 selectAllComponents 可能返回 null
|
||
// https://github.com/dcloudio/uni-app/issues/3954
|
||
($scope.selectAllComponents(".r") || []).concat($scope.selectAllComponents(".r-i-f") || []);
|
||
return refs.filter(function (templateRef) {
|
||
var refValue = findComponentPublicInstance(mpComponents, templateRef.i);
|
||
if (check && refValue === null) {
|
||
return true;
|
||
}
|
||
setTemplateRef(templateRef, refValue, setupState);
|
||
return false;
|
||
});
|
||
};
|
||
var doSet = function doSet() {
|
||
if ($templateRefs) {
|
||
var refs = doSetByRefs($templateRefs);
|
||
if (refs.length && instance.proxy && instance.proxy.$scope) {
|
||
instance.proxy.$scope.setData({
|
||
r1: 1
|
||
}, function () {
|
||
doSetByRefs(refs);
|
||
});
|
||
}
|
||
}
|
||
};
|
||
if ($templateUniElementRefs && $templateUniElementRefs.length) {
|
||
nextTick(instance, function () {
|
||
$templateUniElementRefs.forEach(function (templateRef) {
|
||
if (isArray(templateRef.v)) {
|
||
templateRef.v.forEach(function (v) {
|
||
setTemplateRef(templateRef, v, setupState);
|
||
});
|
||
} else {
|
||
setTemplateRef(templateRef, templateRef.v, setupState);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
if ($scope._$setRef) {
|
||
$scope._$setRef(doSet);
|
||
} else {
|
||
nextTick(instance, doSet);
|
||
}
|
||
}function toSkip(value) {
|
||
if (isObject(value)) {
|
||
markRaw(value);
|
||
}
|
||
return value;
|
||
}function findComponentPublicInstance(mpComponents, id) {
|
||
var mpInstance = mpComponents.find(function (com) {
|
||
return com && (com.properties || com.props).uI === id;
|
||
});
|
||
if (mpInstance) {
|
||
var vm = mpInstance.$vm;
|
||
if (vm) {
|
||
return getExposeProxy(vm.$) || vm;
|
||
}
|
||
return toSkip(mpInstance);
|
||
}
|
||
return null;
|
||
}function setTemplateRef(_ref12, refValue, setupState) {
|
||
var r2 = _ref12.r,
|
||
f2 = _ref12.f;
|
||
if (isFunction(r2)) {
|
||
r2(refValue, {});
|
||
} else {
|
||
var _isString = isString(r2);
|
||
var _isRef = isRef(r2);
|
||
if (_isString || _isRef) {
|
||
if (f2) {
|
||
if (!_isRef) {
|
||
return;
|
||
}
|
||
if (!isArray(r2.value)) {
|
||
r2.value = [];
|
||
}
|
||
var existing = r2.value;
|
||
if (existing.indexOf(refValue) === -1) {
|
||
existing.push(refValue);
|
||
if (!refValue) {
|
||
return;
|
||
}
|
||
if (refValue.$) {
|
||
onBeforeUnmount(function () {
|
||
return remove(existing, refValue);
|
||
}, refValue.$);
|
||
}
|
||
}
|
||
} else if (_isString) {
|
||
if (hasOwn(setupState, r2)) {
|
||
setupState[r2] = refValue;
|
||
}
|
||
} else if (isRef(r2)) {
|
||
r2.value = refValue;
|
||
} else {
|
||
warnRef(r2);
|
||
}
|
||
} else {
|
||
warnRef(r2);
|
||
}
|
||
}
|
||
}function warnRef(ref2) {
|
||
warn("Invalid template ref type:", ref2, "(".concat(_typeof2(ref2), ")"));
|
||
}var queuePostRenderEffect = queuePostFlushCb;function mountComponent(initialVNode, options) {
|
||
var instance = initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null);
|
||
instance.renderer = options.mpType ? options.mpType : "component";
|
||
{
|
||
instance.ctx.$onApplyOptions = onApplyOptions;
|
||
instance.ctx.$children = [];
|
||
}
|
||
if (options.mpType === "app") {
|
||
instance.render = NOOP;
|
||
}
|
||
if (options.onBeforeSetup) {
|
||
options.onBeforeSetup(instance, options);
|
||
}
|
||
{
|
||
pushWarningContext(initialVNode);
|
||
startMeasure(instance, "mount");
|
||
}
|
||
{
|
||
startMeasure(instance, "init");
|
||
}
|
||
setupComponent(instance);
|
||
{
|
||
endMeasure(instance, "init");
|
||
}
|
||
{
|
||
if (options.parentComponent && instance.proxy) {
|
||
options.parentComponent.ctx.$children.push(getExposeProxy(instance) || instance.proxy);
|
||
}
|
||
}
|
||
setupRenderEffect(instance);
|
||
{
|
||
popWarningContext();
|
||
endMeasure(instance, "mount");
|
||
}
|
||
return instance.proxy;
|
||
}var getFunctionalFallthrough = function getFunctionalFallthrough(attrs) {
|
||
var res;
|
||
for (var key in attrs) {
|
||
if (key === "class" || key === "style" || isOn(key)) {
|
||
(res || (res = {}))[key] = attrs[key];
|
||
}
|
||
}
|
||
return res;
|
||
};function renderComponentRoot(instance) {
|
||
var Component2 = instance.type,
|
||
vnode = instance.vnode,
|
||
proxy = instance.proxy,
|
||
withProxy = instance.withProxy,
|
||
props = instance.props,
|
||
_instance$propsOption6 = _slicedToArray2(instance.propsOptions, 1),
|
||
propsOptions = _instance$propsOption6[0],
|
||
slots = instance.slots,
|
||
attrs = instance.attrs,
|
||
emit2 = instance.emit,
|
||
render = instance.render,
|
||
renderCache = instance.renderCache,
|
||
data = instance.data,
|
||
setupState = instance.setupState,
|
||
ctx = instance.ctx,
|
||
uid2 = instance.uid,
|
||
pruneComponentPropsCache2 = instance.appContext.app.config.globalProperties.pruneComponentPropsCache,
|
||
inheritAttrs = instance.inheritAttrs;
|
||
instance.$uniElementIds = /* @__PURE__ */new Map();
|
||
instance.$templateRefs = [];
|
||
instance.$templateUniElementRefs = [];
|
||
instance.$templateUniElementStyles = {};
|
||
instance.$ei = 0;
|
||
pruneComponentPropsCache2(uid2);
|
||
instance.__counter = instance.__counter === 0 ? 1 : 0;
|
||
var result;
|
||
var prev = setCurrentRenderingInstance(instance);
|
||
try {
|
||
if (vnode.shapeFlag & 4) {
|
||
fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
|
||
var proxyToUse = withProxy || proxy;
|
||
result = render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx);
|
||
} else {
|
||
fallthroughAttrs(inheritAttrs, props, propsOptions, Component2.props ? attrs : getFunctionalFallthrough(attrs));
|
||
var render2 = Component2;
|
||
result = render2.length > 1 ? render2(props, {
|
||
attrs: attrs,
|
||
slots: slots,
|
||
emit: emit2
|
||
}) : render2(props, null
|
||
/* we know it doesn't need it */);
|
||
}
|
||
} catch (err) {
|
||
handleError(err, instance, 1);
|
||
result = false;
|
||
}
|
||
setRef$1(instance);
|
||
setCurrentRenderingInstance(prev);
|
||
return result;
|
||
}function fallthroughAttrs(inheritAttrs, props, propsOptions, fallthroughAttrs2) {
|
||
if (props && fallthroughAttrs2 && inheritAttrs !== false) {
|
||
var keys = Object.keys(fallthroughAttrs2).filter(function (key) {
|
||
return key !== "class" && key !== "style";
|
||
});
|
||
if (!keys.length) {
|
||
return;
|
||
}
|
||
if (propsOptions && keys.some(isModelListener)) {
|
||
keys.forEach(function (key) {
|
||
if (!isModelListener(key) || !(key.slice(9) in propsOptions)) {
|
||
props[key] = fallthroughAttrs2[key];
|
||
}
|
||
});
|
||
} else {
|
||
keys.forEach(function (key) {
|
||
return props[key] = fallthroughAttrs2[key];
|
||
});
|
||
}
|
||
}
|
||
}var updateComponentPreRender = function updateComponentPreRender(instance) {
|
||
pauseTracking();
|
||
flushPreFlushCbs();
|
||
resetTracking();
|
||
};function componentUpdateScopedSlotsFn() {
|
||
var scopedSlotsData = this.$scopedSlotsData;
|
||
if (!scopedSlotsData || scopedSlotsData.length === 0) {
|
||
return;
|
||
}
|
||
var mpInstance = this.ctx.$scope;
|
||
var oldData = mpInstance.data;
|
||
var diffData = /* @__PURE__ */Object.create(null);
|
||
scopedSlotsData.forEach(function (_ref13) {
|
||
var path = _ref13.path,
|
||
index2 = _ref13.index,
|
||
data = _ref13.data;
|
||
var oldScopedSlotData = getValueByDataPath(oldData, path);
|
||
var diffPath = isString(index2) ? "".concat(path, ".").concat(index2) : "".concat(path, "[").concat(index2, "]");
|
||
if (typeof oldScopedSlotData === "undefined" || typeof oldScopedSlotData[index2] === "undefined") {
|
||
diffData[diffPath] = data;
|
||
} else {
|
||
var diffScopedSlotData = diff(data, oldScopedSlotData[index2]);
|
||
Object.keys(diffScopedSlotData).forEach(function (name) {
|
||
diffData[diffPath + "." + name] = diffScopedSlotData[name];
|
||
});
|
||
}
|
||
});
|
||
scopedSlotsData.length = 0;
|
||
if (Object.keys(diffData).length) {
|
||
mpInstance.setData(diffData);
|
||
}
|
||
}function toggleRecurse(_ref14, allowed) {
|
||
var effect2 = _ref14.effect,
|
||
update = _ref14.update;
|
||
effect2.allowRecurse = update.allowRecurse = allowed;
|
||
}function setupRenderEffect(instance) {
|
||
var updateScopedSlots = componentUpdateScopedSlotsFn.bind(instance);
|
||
instance.$updateScopedSlots = function () {
|
||
return nextTick$1(function () {
|
||
return queueJob(updateScopedSlots);
|
||
});
|
||
};
|
||
var componentUpdateFn = function componentUpdateFn() {
|
||
if (!instance.isMounted) {
|
||
onBeforeUnmount(function () {
|
||
setRef$1(instance, true);
|
||
}, instance);
|
||
{
|
||
startMeasure(instance, "patch");
|
||
}
|
||
patch(instance, renderComponentRoot(instance));
|
||
{
|
||
endMeasure(instance, "patch");
|
||
}
|
||
{
|
||
devtoolsComponentAdded(instance);
|
||
}
|
||
} else {
|
||
var next = instance.next,
|
||
bu = instance.bu,
|
||
u = instance.u;
|
||
{
|
||
pushWarningContext(next || instance.vnode);
|
||
}
|
||
toggleRecurse(instance, false);
|
||
updateComponentPreRender();
|
||
if (bu) {
|
||
invokeArrayFns$1(bu);
|
||
}
|
||
toggleRecurse(instance, true);
|
||
{
|
||
startMeasure(instance, "patch");
|
||
}
|
||
patch(instance, renderComponentRoot(instance));
|
||
{
|
||
endMeasure(instance, "patch");
|
||
}
|
||
if (u) {
|
||
queuePostRenderEffect(u);
|
||
}
|
||
{
|
||
devtoolsComponentUpdated(instance);
|
||
}
|
||
{
|
||
popWarningContext();
|
||
}
|
||
}
|
||
};
|
||
var effect2 = instance.effect = new ReactiveEffect(componentUpdateFn, NOOP, function () {
|
||
return queueJob(update);
|
||
}, instance.scope
|
||
// track it in component's effect scope
|
||
);
|
||
|
||
var update = instance.update = function () {
|
||
if (effect2.dirty) {
|
||
effect2.run();
|
||
}
|
||
};
|
||
update.id = instance.uid;
|
||
toggleRecurse(instance, true);
|
||
{
|
||
effect2.onTrack = instance.rtc ? function (e2) {
|
||
return invokeArrayFns$1(instance.rtc, e2);
|
||
} : void 0;
|
||
effect2.onTrigger = instance.rtg ? function (e2) {
|
||
return invokeArrayFns$1(instance.rtg, e2);
|
||
} : void 0;
|
||
update.ownerInstance = instance;
|
||
}
|
||
{
|
||
update();
|
||
}
|
||
}function unmountComponent(instance) {
|
||
var bum = instance.bum,
|
||
scope = instance.scope,
|
||
update = instance.update,
|
||
um = instance.um;
|
||
if (bum) {
|
||
invokeArrayFns$1(bum);
|
||
}
|
||
{
|
||
var parentInstance = instance.parent;
|
||
if (parentInstance) {
|
||
var $children = parentInstance.ctx.$children;
|
||
var target = getExposeProxy(instance) || instance.proxy;
|
||
var index2 = $children.indexOf(target);
|
||
if (index2 > -1) {
|
||
$children.splice(index2, 1);
|
||
}
|
||
}
|
||
}
|
||
scope.stop();
|
||
if (update) {
|
||
update.active = false;
|
||
}
|
||
if (um) {
|
||
queuePostRenderEffect(um);
|
||
}
|
||
queuePostRenderEffect(function () {
|
||
instance.isUnmounted = true;
|
||
});
|
||
{
|
||
devtoolsComponentRemoved(instance);
|
||
}
|
||
}var oldCreateApp = createAppAPI();function getTarget() {
|
||
if (typeof window !== "undefined") {
|
||
return window;
|
||
}
|
||
if (typeof globalThis !== "undefined") {
|
||
return globalThis;
|
||
}
|
||
if (typeof global !== "undefined") {
|
||
return global;
|
||
}
|
||
if (typeof my !== "undefined") {
|
||
return my;
|
||
}
|
||
}function createVueApp(rootComponent) {
|
||
var rootProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
var target = getTarget();
|
||
target.__VUE__ = true;
|
||
{
|
||
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
||
}
|
||
var app = oldCreateApp(rootComponent, rootProps);
|
||
var appContext = app._context;
|
||
initAppConfig(appContext.config);
|
||
var createVNode2 = function createVNode2(initialVNode) {
|
||
initialVNode.appContext = appContext;
|
||
initialVNode.shapeFlag = 6;
|
||
return initialVNode;
|
||
};
|
||
var createComponent2 = function createComponent22(initialVNode, options) {
|
||
return mountComponent(createVNode2(initialVNode), options);
|
||
};
|
||
var destroyComponent = function destroyComponent2(component) {
|
||
return component && unmountComponent(component.$);
|
||
};
|
||
app.mount = function mount() {
|
||
rootComponent.render = NOOP;
|
||
var instance = mountComponent(createVNode2({
|
||
type: rootComponent
|
||
}), {
|
||
mpType: "app",
|
||
mpInstance: null,
|
||
parentComponent: null,
|
||
slots: [],
|
||
props: null
|
||
});
|
||
app._instance = instance.$;
|
||
{
|
||
devtoolsInitApp(app, version);
|
||
}
|
||
instance.$app = app;
|
||
instance.$createComponent = createComponent2;
|
||
instance.$destroyComponent = destroyComponent;
|
||
appContext.$appInstance = instance;
|
||
return instance;
|
||
};
|
||
app.unmount = function unmount() {
|
||
warn("Cannot unmount an app.");
|
||
};
|
||
return app;
|
||
}function injectLifecycleHook(name, hook, publicThis, instance) {
|
||
if (isFunction(hook)) {
|
||
injectHook(name, hook.bind(publicThis), instance);
|
||
}
|
||
}function initHooks$1(options, instance, publicThis) {
|
||
var mpType = options.mpType || publicThis.$mpType;
|
||
if (!mpType || mpType === "component" ||
|
||
// instance.renderer 标识页面是否作为组件渲染
|
||
mpType === "page" && instance.renderer === "component") {
|
||
return;
|
||
}
|
||
Object.keys(options).forEach(function (name) {
|
||
if (isUniLifecycleHook(name, options[name], false)) {
|
||
var hooks = options[name];
|
||
if (isArray(hooks)) {
|
||
hooks.forEach(function (hook) {
|
||
return injectLifecycleHook(name, hook, publicThis, instance);
|
||
});
|
||
} else {
|
||
injectLifecycleHook(name, hooks, publicThis, instance);
|
||
}
|
||
}
|
||
});
|
||
}function applyOptions$2(options, instance, publicThis) {
|
||
initHooks$1(options, instance, publicThis);
|
||
}function set(target, key, val) {
|
||
return target[key] = val;
|
||
}function $callMethod(method) {
|
||
var fn = this[method];
|
||
if (fn) {
|
||
for (var _len12 = arguments.length, args = new Array(_len12 > 1 ? _len12 - 1 : 0), _key20 = 1; _key20 < _len12; _key20++) {
|
||
args[_key20 - 1] = arguments[_key20];
|
||
}
|
||
return fn.apply(void 0, args);
|
||
}
|
||
console.error("method ".concat(method, " not found"));
|
||
return null;
|
||
}function createErrorHandler(app) {
|
||
var userErrorHandler = app.config.errorHandler;
|
||
return function errorHandler(err, instance, info) {
|
||
if (userErrorHandler) {
|
||
userErrorHandler(err, instance, info);
|
||
}
|
||
var appInstance = app._instance;
|
||
if (!appInstance || !appInstance.proxy) {
|
||
throw err;
|
||
}
|
||
if (appInstance[ON_ERROR]) {
|
||
{
|
||
appInstance.proxy.$callHook(ON_ERROR, err);
|
||
}
|
||
} else {
|
||
logError(err, info, instance ? instance.$.vnode : null, false);
|
||
}
|
||
};
|
||
}function mergeAsArray(to, from) {
|
||
return to ? _toConsumableArray2(new Set([].concat(to, from))) : from;
|
||
}function initOptionMergeStrategies(optionMergeStrategies) {
|
||
UniLifecycleHooks.forEach(function (name) {
|
||
optionMergeStrategies[name] = mergeAsArray;
|
||
});
|
||
}var realAtob;var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;if (typeof atob !== "function") {
|
||
realAtob = function realAtob(str) {
|
||
str = String(str).replace(/[\t\n\f\r ]+/g, "");
|
||
if (!b64re.test(str)) {
|
||
throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
||
}
|
||
str += "==".slice(2 - (str.length & 3));
|
||
var bitmap;
|
||
var result = "";
|
||
var r1;
|
||
var r2;
|
||
var i = 0;
|
||
for (; i < str.length;) {
|
||
bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 | (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
|
||
result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
|
||
}
|
||
return result;
|
||
};
|
||
} else {
|
||
realAtob = atob;
|
||
}function b64DecodeUnicode(str) {
|
||
return decodeURIComponent(realAtob(str).split("").map(function (c2) {
|
||
return "%" + ("00" + c2.charCodeAt(0).toString(16)).slice(-2);
|
||
}).join(""));
|
||
}function getCurrentUserInfo() {
|
||
var token = index.getStorageSync("uni_id_token") || "";
|
||
var tokenArr = token.split(".");
|
||
if (!token || tokenArr.length !== 3) {
|
||
return {
|
||
uid: null,
|
||
role: [],
|
||
permission: [],
|
||
tokenExpired: 0
|
||
};
|
||
}
|
||
var userInfo;
|
||
try {
|
||
userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
|
||
} catch (error) {
|
||
throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
|
||
}
|
||
userInfo.tokenExpired = userInfo.exp * 1e3;
|
||
delete userInfo.exp;
|
||
delete userInfo.iat;
|
||
return userInfo;
|
||
}function uniIdMixin(globalProperties) {
|
||
globalProperties.uniIDHasRole = function (roleId) {
|
||
var _getCurrentUserInfo = getCurrentUserInfo(),
|
||
role = _getCurrentUserInfo.role;
|
||
return role.indexOf(roleId) > -1;
|
||
};
|
||
globalProperties.uniIDHasPermission = function (permissionId) {
|
||
var _getCurrentUserInfo2 = getCurrentUserInfo(),
|
||
permission = _getCurrentUserInfo2.permission;
|
||
return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
|
||
};
|
||
globalProperties.uniIDTokenValid = function () {
|
||
var _getCurrentUserInfo3 = getCurrentUserInfo(),
|
||
tokenExpired = _getCurrentUserInfo3.tokenExpired;
|
||
return tokenExpired > Date.now();
|
||
};
|
||
}function initApp(app) {
|
||
var appConfig = app.config;
|
||
appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
|
||
initOptionMergeStrategies(appConfig.optionMergeStrategies);
|
||
var globalProperties = appConfig.globalProperties;
|
||
{
|
||
uniIdMixin(globalProperties);
|
||
}
|
||
{
|
||
globalProperties.$set = set;
|
||
globalProperties.$applyOptions = applyOptions$2;
|
||
globalProperties.$callMethod = $callMethod;
|
||
}
|
||
{
|
||
index.invokeCreateVueAppHook(app);
|
||
}
|
||
}var propsCaches = /* @__PURE__ */Object.create(null);function pruneComponentPropsCache(uid2) {
|
||
delete propsCaches[uid2];
|
||
}function findComponentPropsData(up) {
|
||
if (!up) {
|
||
return;
|
||
}
|
||
var _up$split = up.split(","),
|
||
_up$split2 = _slicedToArray2(_up$split, 2),
|
||
uid2 = _up$split2[0],
|
||
propsId = _up$split2[1];
|
||
if (!propsCaches[uid2]) {
|
||
return;
|
||
}
|
||
return propsCaches[uid2][parseInt(propsId)];
|
||
}var plugin = {
|
||
install: function install(app) {
|
||
initApp(app);
|
||
app.config.globalProperties.pruneComponentPropsCache = pruneComponentPropsCache;
|
||
var oldMount = app.mount;
|
||
app.mount = function mount(rootContainer) {
|
||
var instance = oldMount.call(app, rootContainer);
|
||
var createApp2 = getCreateApp();
|
||
if (createApp2) {
|
||
createApp2(instance);
|
||
} else {
|
||
if (typeof createMiniProgramApp !== "undefined") {
|
||
createMiniProgramApp(instance);
|
||
}
|
||
}
|
||
return instance;
|
||
};
|
||
}
|
||
};function getCreateApp() {
|
||
var method = "createApp";
|
||
if (typeof global !== "undefined" && typeof global[method] !== "undefined") {
|
||
return global[method];
|
||
} else if (typeof my !== "undefined") {
|
||
return my[method];
|
||
}
|
||
}function vOn(value, key) {
|
||
var instance = getCurrentInstance();
|
||
var ctx = instance.ctx;
|
||
var extraKey = typeof key !== "undefined" && (ctx.$mpPlatform === "mp-weixin" || ctx.$mpPlatform === "mp-qq" || ctx.$mpPlatform === "mp-xhs") && (isString(key) || typeof key === "number") ? "_" + key : "";
|
||
var name = "e" + instance.$ei++ + extraKey;
|
||
var mpInstance = ctx.$scope;
|
||
if (!value) {
|
||
delete mpInstance[name];
|
||
return name;
|
||
}
|
||
var existingInvoker = mpInstance[name];
|
||
if (existingInvoker) {
|
||
existingInvoker.value = value;
|
||
} else {
|
||
mpInstance[name] = createInvoker(value, instance);
|
||
}
|
||
return name;
|
||
}function createInvoker(initialValue, instance) {
|
||
var invoker = function invoker(e2) {
|
||
patchMPEvent(e2);
|
||
var args = [e2];
|
||
if (instance && instance.ctx.$getTriggerEventDetail) {
|
||
if (typeof e2.detail === "number") {
|
||
e2.detail = instance.ctx.$getTriggerEventDetail(e2.detail);
|
||
}
|
||
}
|
||
if (e2.detail && e2.detail.__args__) {
|
||
args = e2.detail.__args__;
|
||
}
|
||
var eventValue = invoker.value;
|
||
var invoke = function invoke() {
|
||
return callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, eventValue), instance, 5, args);
|
||
};
|
||
var eventTarget = e2.target;
|
||
var eventSync = eventTarget ? eventTarget.dataset ? String(eventTarget.dataset.eventsync) === "true" : false : false;
|
||
if (bubbles.includes(e2.type) && !eventSync) {
|
||
setTimeout(invoke);
|
||
} else {
|
||
var res = invoke();
|
||
if (e2.type === "input" && (isArray(res) || isPromise(res))) {
|
||
return;
|
||
}
|
||
return res;
|
||
}
|
||
};
|
||
invoker.value = initialValue;
|
||
return invoker;
|
||
}var bubbles = [
|
||
// touch事件暂不做延迟,否则在 Android 上会影响性能,比如一些拖拽跟手手势等
|
||
// 'touchstart',
|
||
// 'touchmove',
|
||
// 'touchcancel',
|
||
// 'touchend',
|
||
"tap", "longpress", "longtap", "transitionend", "animationstart", "animationiteration", "animationend", "touchforcechange"];function patchMPEvent(event, instance) {
|
||
if (event.type && event.target) {
|
||
event.preventDefault = NOOP;
|
||
event.stopPropagation = NOOP;
|
||
event.stopImmediatePropagation = NOOP;
|
||
if (!hasOwn(event, "detail")) {
|
||
event.detail = {};
|
||
}
|
||
if (hasOwn(event, "markerId")) {
|
||
event.detail = _typeof2(event.detail) === "object" ? event.detail : {};
|
||
event.detail.markerId = event.markerId;
|
||
}
|
||
if (isPlainObject(event.detail) && hasOwn(event.detail, "checked") && !hasOwn(event.detail, "value")) {
|
||
event.detail.value = event.detail.checked;
|
||
}
|
||
if (isPlainObject(event.detail)) {
|
||
event.target = extend({}, event.target, event.detail);
|
||
}
|
||
}
|
||
}function patchStopImmediatePropagation(e2, value) {
|
||
if (isArray(value)) {
|
||
var originalStop = e2.stopImmediatePropagation;
|
||
e2.stopImmediatePropagation = function () {
|
||
originalStop && originalStop.call(e2);
|
||
e2._stopped = true;
|
||
};
|
||
return value.map(function (fn) {
|
||
return function (e3) {
|
||
return !e3._stopped && fn(e3);
|
||
};
|
||
});
|
||
} else {
|
||
return value;
|
||
}
|
||
}var o = function o(value, key) {
|
||
return vOn(value, key);
|
||
};var e = function e(target) {
|
||
for (var _len13 = arguments.length, sources = new Array(_len13 > 1 ? _len13 - 1 : 0), _key21 = 1; _key21 < _len13; _key21++) {
|
||
sources[_key21 - 1] = arguments[_key21];
|
||
}
|
||
return extend.apply(void 0, [target].concat(sources));
|
||
};var t = function t(val) {
|
||
return toDisplayString(val);
|
||
};function createApp$1(rootComponent) {
|
||
var rootProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
rootComponent && (rootComponent.mpType = "app");
|
||
return createVueApp(rootComponent, rootProps).use(plugin);
|
||
}var createSSRApp = createApp$1;function getLocaleLanguage$1() {
|
||
var _a;
|
||
var localeLanguage = "";
|
||
{
|
||
var appBaseInfo = ((_a = wx.getAppBaseInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
|
||
var language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
|
||
localeLanguage = normalizeLocale(language) || LOCALE_EN;
|
||
}
|
||
return localeLanguage;
|
||
}function validateProtocolFail(name, msg) {
|
||
console.warn("".concat(name, ": ").concat(msg));
|
||
}function validateProtocol(name, data, protocol, onFail) {
|
||
if (!onFail) {
|
||
onFail = validateProtocolFail;
|
||
}
|
||
for (var key in protocol) {
|
||
var errMsg = validateProp(key, data[key], protocol[key], !hasOwn(data, key));
|
||
if (isString(errMsg)) {
|
||
onFail(name, errMsg);
|
||
}
|
||
}
|
||
}function validateProtocols(name, args, protocol, onFail) {
|
||
if (!protocol) {
|
||
return;
|
||
}
|
||
if (!isArray(protocol)) {
|
||
return validateProtocol(name, args[0] || /* @__PURE__ */Object.create(null), protocol, onFail);
|
||
}
|
||
var len = protocol.length;
|
||
var argsLen = args.length;
|
||
for (var i = 0; i < len; i++) {
|
||
var opts = protocol[i];
|
||
var data = /* @__PURE__ */Object.create(null);
|
||
if (argsLen > i) {
|
||
data[opts.name] = args[i];
|
||
}
|
||
validateProtocol(name, data, _defineProperty2({}, opts.name, opts), onFail);
|
||
}
|
||
}function validateProp(name, value, prop, isAbsent) {
|
||
if (!isPlainObject(prop)) {
|
||
prop = {
|
||
type: prop
|
||
};
|
||
}
|
||
var _prop = prop,
|
||
type = _prop.type,
|
||
required = _prop.required,
|
||
validator = _prop.validator;
|
||
if (required && isAbsent) {
|
||
return 'Missing required args: "' + name + '"';
|
||
}
|
||
if (value == null && !required) {
|
||
return;
|
||
}
|
||
if (type != null) {
|
||
var isValid = false;
|
||
var types = isArray(type) ? type : [type];
|
||
var expectedTypes = [];
|
||
for (var i = 0; i < types.length && !isValid; i++) {
|
||
var _assertType = assertType(value, types[i]),
|
||
valid = _assertType.valid,
|
||
expectedType = _assertType.expectedType;
|
||
expectedTypes.push(expectedType || "");
|
||
isValid = valid;
|
||
}
|
||
if (!isValid) {
|
||
return getInvalidTypeMessage(name, value, expectedTypes);
|
||
}
|
||
}
|
||
if (validator) {
|
||
return validator(value);
|
||
}
|
||
}var isSimpleType = /* @__PURE__ */makeMap("String,Number,Boolean,Function,Symbol");function assertType(value, type) {
|
||
var valid;
|
||
var expectedType = getType(type);
|
||
if (isSimpleType(expectedType)) {
|
||
var t2 = _typeof2(value);
|
||
valid = t2 === expectedType.toLowerCase();
|
||
if (!valid && t2 === "object") {
|
||
valid = value instanceof type;
|
||
}
|
||
} else if (expectedType === "Object") {
|
||
valid = isObject(value);
|
||
} else if (expectedType === "Array") {
|
||
valid = isArray(value);
|
||
} else {
|
||
{
|
||
valid = value instanceof type;
|
||
}
|
||
}
|
||
return {
|
||
valid: valid,
|
||
expectedType: expectedType
|
||
};
|
||
}function getInvalidTypeMessage(name, value, expectedTypes) {
|
||
var message = "Invalid args: type check failed for args \"".concat(name, "\". Expected ").concat(expectedTypes.map(capitalize).join(", "));
|
||
var expectedType = expectedTypes[0];
|
||
var receivedType = toRawType(value);
|
||
var expectedValue = styleValue(value, expectedType);
|
||
var receivedValue = styleValue(value, receivedType);
|
||
if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
|
||
message += " with value ".concat(expectedValue);
|
||
}
|
||
message += ", got ".concat(receivedType, " ");
|
||
if (isExplicable(receivedType)) {
|
||
message += "with value ".concat(receivedValue, ".");
|
||
}
|
||
return message;
|
||
}function getType(ctor) {
|
||
var match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
||
return match ? match[1] : "";
|
||
}function styleValue(value, type) {
|
||
if (type === "String") {
|
||
return "\"".concat(value, "\"");
|
||
} else if (type === "Number") {
|
||
return "".concat(Number(value));
|
||
} else {
|
||
return "".concat(value);
|
||
}
|
||
}function isExplicable(type) {
|
||
var explicitTypes = ["string", "number", "boolean"];
|
||
return explicitTypes.some(function (elem) {
|
||
return type.toLowerCase() === elem;
|
||
});
|
||
}function isBoolean() {
|
||
for (var _len14 = arguments.length, args = new Array(_len14), _key22 = 0; _key22 < _len14; _key22++) {
|
||
args[_key22] = arguments[_key22];
|
||
}
|
||
return args.some(function (elem) {
|
||
return elem.toLowerCase() === "boolean";
|
||
});
|
||
}function tryCatch(fn) {
|
||
return function () {
|
||
try {
|
||
return fn.apply(fn, arguments);
|
||
} catch (e2) {
|
||
console.error(e2);
|
||
}
|
||
};
|
||
}var invokeCallbackId = 1;var invokeCallbacks = {};function addInvokeCallback(id, name, callback) {
|
||
var keepAlive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
invokeCallbacks[id] = {
|
||
name: name,
|
||
keepAlive: keepAlive,
|
||
callback: callback
|
||
};
|
||
return id;
|
||
}function invokeCallback(id, res, extras) {
|
||
if (typeof id === "number") {
|
||
var opts = invokeCallbacks[id];
|
||
if (opts) {
|
||
if (!opts.keepAlive) {
|
||
delete invokeCallbacks[id];
|
||
}
|
||
return opts.callback(res, extras);
|
||
}
|
||
}
|
||
return res;
|
||
}var API_SUCCESS = "success";var API_FAIL = "fail";var API_COMPLETE = "complete";function getApiCallbacks(args) {
|
||
var apiCallbacks = {};
|
||
for (var name in args) {
|
||
var fn = args[name];
|
||
if (isFunction(fn)) {
|
||
apiCallbacks[name] = tryCatch(fn);
|
||
delete args[name];
|
||
}
|
||
}
|
||
return apiCallbacks;
|
||
}function normalizeErrMsg(errMsg, name) {
|
||
if (!errMsg || errMsg.indexOf(":fail") === -1) {
|
||
return name + ":ok";
|
||
}
|
||
return name + errMsg.substring(errMsg.indexOf(":fail"));
|
||
}function createAsyncApiCallback(name) {
|
||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
var _ref15 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
||
beforeAll = _ref15.beforeAll,
|
||
beforeSuccess = _ref15.beforeSuccess;
|
||
if (!isPlainObject(args)) {
|
||
args = {};
|
||
}
|
||
var _getApiCallbacks = getApiCallbacks(args),
|
||
success = _getApiCallbacks.success,
|
||
fail = _getApiCallbacks.fail,
|
||
complete = _getApiCallbacks.complete;
|
||
var hasSuccess = isFunction(success);
|
||
var hasFail = isFunction(fail);
|
||
var hasComplete = isFunction(complete);
|
||
var callbackId = invokeCallbackId++;
|
||
addInvokeCallback(callbackId, name, function (res) {
|
||
res = res || {};
|
||
res.errMsg = normalizeErrMsg(res.errMsg, name);
|
||
isFunction(beforeAll) && beforeAll(res);
|
||
if (res.errMsg === name + ":ok") {
|
||
isFunction(beforeSuccess) && beforeSuccess(res, args);
|
||
hasSuccess && success(res);
|
||
} else {
|
||
hasFail && fail(res);
|
||
}
|
||
hasComplete && complete(res);
|
||
});
|
||
return callbackId;
|
||
}var HOOK_SUCCESS = "success";var HOOK_FAIL = "fail";var HOOK_COMPLETE = "complete";var globalInterceptors = {};var scopedInterceptors = {};function wrapperHook(hook, params) {
|
||
return function (data) {
|
||
return hook(data, params) || data;
|
||
};
|
||
}function queue(hooks, data, params) {
|
||
var promise = false;
|
||
for (var i = 0; i < hooks.length; i++) {
|
||
var hook = hooks[i];
|
||
if (promise) {
|
||
promise = Promise.resolve(wrapperHook(hook, params));
|
||
} else {
|
||
var res = hook(data, params);
|
||
if (isPromise(res)) {
|
||
promise = Promise.resolve(res);
|
||
}
|
||
if (res === false) {
|
||
return {
|
||
then: function then() {},
|
||
catch: function _catch() {}
|
||
};
|
||
}
|
||
}
|
||
}
|
||
return promise || {
|
||
then: function then(callback) {
|
||
return callback(data);
|
||
},
|
||
catch: function _catch() {}
|
||
};
|
||
}function wrapperOptions(interceptors2) {
|
||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
[HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach(function (name) {
|
||
var hooks = interceptors2[name];
|
||
if (!isArray(hooks)) {
|
||
return;
|
||
}
|
||
var oldCallback = options[name];
|
||
options[name] = function callbackInterceptor(res) {
|
||
queue(hooks, res, options).then(function (res2) {
|
||
return isFunction(oldCallback) && oldCallback(res2) || res2;
|
||
});
|
||
};
|
||
});
|
||
return options;
|
||
}function wrapperReturnValue(method, returnValue) {
|
||
var returnValueHooks = [];
|
||
if (isArray(globalInterceptors.returnValue)) {
|
||
returnValueHooks.push.apply(returnValueHooks, _toConsumableArray2(globalInterceptors.returnValue));
|
||
}
|
||
var interceptor = scopedInterceptors[method];
|
||
if (interceptor && isArray(interceptor.returnValue)) {
|
||
returnValueHooks.push.apply(returnValueHooks, _toConsumableArray2(interceptor.returnValue));
|
||
}
|
||
returnValueHooks.forEach(function (hook) {
|
||
returnValue = hook(returnValue) || returnValue;
|
||
});
|
||
return returnValue;
|
||
}function getApiInterceptorHooks(method) {
|
||
var interceptor = /* @__PURE__ */Object.create(null);
|
||
Object.keys(globalInterceptors).forEach(function (hook) {
|
||
if (hook !== "returnValue") {
|
||
interceptor[hook] = globalInterceptors[hook].slice();
|
||
}
|
||
});
|
||
var scopedInterceptor = scopedInterceptors[method];
|
||
if (scopedInterceptor) {
|
||
Object.keys(scopedInterceptor).forEach(function (hook) {
|
||
if (hook !== "returnValue") {
|
||
interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
|
||
}
|
||
});
|
||
}
|
||
return interceptor;
|
||
}function invokeApi(method, api, options, params) {
|
||
var interceptor = getApiInterceptorHooks(method);
|
||
if (interceptor && Object.keys(interceptor).length) {
|
||
if (isArray(interceptor.invoke)) {
|
||
var res = queue(interceptor.invoke, options);
|
||
return res.then(function (options2) {
|
||
return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options2)].concat(_toConsumableArray2(params)));
|
||
});
|
||
} else {
|
||
return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(_toConsumableArray2(params)));
|
||
}
|
||
}
|
||
return api.apply(void 0, [options].concat(_toConsumableArray2(params)));
|
||
}function hasCallback(args) {
|
||
if (isPlainObject(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find(function (cb) {
|
||
return isFunction(args[cb]);
|
||
})) {
|
||
return true;
|
||
}
|
||
return false;
|
||
}function handlePromise(promise) {
|
||
return promise;
|
||
}function promisify$1(name, fn) {
|
||
return function () {
|
||
var args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
for (var _len15 = arguments.length, rest = new Array(_len15 > 1 ? _len15 - 1 : 0), _key23 = 1; _key23 < _len15; _key23++) {
|
||
rest[_key23 - 1] = arguments[_key23];
|
||
}
|
||
if (hasCallback(args)) {
|
||
return wrapperReturnValue(name, invokeApi(name, fn, extend({}, args), rest));
|
||
}
|
||
return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
|
||
invokeApi(name, fn, extend({}, args, {
|
||
success: resolve,
|
||
fail: reject
|
||
}), rest);
|
||
})));
|
||
};
|
||
}function formatApiArgs(args, options) {
|
||
args[0];
|
||
{
|
||
return;
|
||
}
|
||
}function invokeSuccess(id, name, res) {
|
||
var result = {
|
||
errMsg: name + ":ok"
|
||
};
|
||
return invokeCallback(id, extend(res || {}, result));
|
||
}function invokeFail(id, name, errMsg) {
|
||
var errRes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||
var errMsgPrefix = name + ":fail";
|
||
var apiErrMsg = "";
|
||
if (!errMsg) {
|
||
apiErrMsg = errMsgPrefix;
|
||
} else if (errMsg.indexOf(errMsgPrefix) === 0) {
|
||
apiErrMsg = errMsg;
|
||
} else {
|
||
apiErrMsg = errMsgPrefix + " " + errMsg;
|
||
}
|
||
{
|
||
delete errRes.errCode;
|
||
}
|
||
var res = extend({
|
||
errMsg: apiErrMsg
|
||
}, errRes);
|
||
return invokeCallback(id, res);
|
||
}function beforeInvokeApi(name, args, protocol, options) {
|
||
{
|
||
validateProtocols(name, args, protocol);
|
||
}
|
||
var errMsg = formatApiArgs(args);
|
||
if (errMsg) {
|
||
return errMsg;
|
||
}
|
||
}function parseErrMsg(errMsg) {
|
||
if (!errMsg || isString(errMsg)) {
|
||
return errMsg;
|
||
}
|
||
if (errMsg.stack) {
|
||
if (typeof globalThis === "undefined" || !globalThis.harmonyChannel) {
|
||
console.error(errMsg.message + "\n" + errMsg.stack);
|
||
}
|
||
return errMsg.message;
|
||
}
|
||
return errMsg;
|
||
}function wrapperTaskApi(name, fn, protocol, options) {
|
||
return function (args) {
|
||
var id = createAsyncApiCallback(name, args, options);
|
||
var errMsg = beforeInvokeApi(name, [args], protocol);
|
||
if (errMsg) {
|
||
return invokeFail(id, name, errMsg);
|
||
}
|
||
return fn(args, {
|
||
resolve: function resolve(res) {
|
||
return invokeSuccess(id, name, res);
|
||
},
|
||
reject: function reject(errMsg2, errRes) {
|
||
return invokeFail(id, name, parseErrMsg(errMsg2), errRes);
|
||
}
|
||
});
|
||
};
|
||
}function wrapperSyncApi(name, fn, protocol, options) {
|
||
return function () {
|
||
for (var _len16 = arguments.length, args = new Array(_len16), _key24 = 0; _key24 < _len16; _key24++) {
|
||
args[_key24] = arguments[_key24];
|
||
}
|
||
var errMsg = beforeInvokeApi(name, args, protocol);
|
||
if (errMsg) {
|
||
throw new Error(errMsg);
|
||
}
|
||
return fn.apply(null, args);
|
||
};
|
||
}function wrapperAsyncApi(name, fn, protocol, options) {
|
||
return wrapperTaskApi(name, fn, protocol, options);
|
||
}function defineSyncApi(name, fn, protocol, options) {
|
||
return wrapperSyncApi(name, fn, protocol);
|
||
}function defineAsyncApi(name, fn, protocol, options) {
|
||
return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options));
|
||
}var API_UPX2PX = "upx2px";var Upx2pxProtocol = [{
|
||
name: "upx",
|
||
type: [Number, String],
|
||
required: true
|
||
}];var EPS = 1e-4;var BASE_DEVICE_WIDTH = 750;var isIOS = false;var deviceWidth = 0;var deviceDPR = 0;function checkDeviceWidth() {
|
||
var _a, _b;
|
||
var windowWidth, pixelRatio, platform;
|
||
{
|
||
var windowInfo = ((_a = wx.getWindowInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
|
||
var deviceInfo = ((_b = wx.getDeviceInfo) === null || _b === void 0 ? void 0 : _b.call(wx)) || wx.getSystemInfoSync();
|
||
windowWidth = windowInfo.windowWidth;
|
||
pixelRatio = windowInfo.pixelRatio;
|
||
platform = deviceInfo.platform;
|
||
}
|
||
deviceWidth = windowWidth;
|
||
deviceDPR = pixelRatio;
|
||
isIOS = platform === "ios";
|
||
}var upx2px = defineSyncApi(API_UPX2PX, function (number, newDeviceWidth) {
|
||
if (deviceWidth === 0) {
|
||
checkDeviceWidth();
|
||
}
|
||
number = Number(number);
|
||
if (number === 0) {
|
||
return 0;
|
||
}
|
||
var width = newDeviceWidth || deviceWidth;
|
||
var result = number / BASE_DEVICE_WIDTH * width;
|
||
if (result < 0) {
|
||
result = -result;
|
||
}
|
||
result = Math.floor(result + EPS);
|
||
if (result === 0) {
|
||
if (deviceDPR === 1 || !isIOS) {
|
||
result = 1;
|
||
} else {
|
||
result = 0.5;
|
||
}
|
||
}
|
||
return number < 0 ? -result : result;
|
||
}, Upx2pxProtocol);function __f__(type, filename) {
|
||
for (var _len17 = arguments.length, args = new Array(_len17 > 2 ? _len17 - 2 : 0), _key25 = 2; _key25 < _len17; _key25++) {
|
||
args[_key25 - 2] = arguments[_key25];
|
||
}
|
||
if (filename) {
|
||
args.push(filename);
|
||
}
|
||
console[type].apply(console, args);
|
||
}var API_ADD_INTERCEPTOR = "addInterceptor";var API_REMOVE_INTERCEPTOR = "removeInterceptor";var AddInterceptorProtocol = [{
|
||
name: "method",
|
||
type: [String, Object],
|
||
required: true
|
||
}];var RemoveInterceptorProtocol = AddInterceptorProtocol;function mergeInterceptorHook(interceptors2, interceptor) {
|
||
Object.keys(interceptor).forEach(function (hook) {
|
||
if (isFunction(interceptor[hook])) {
|
||
interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]);
|
||
}
|
||
});
|
||
}function removeInterceptorHook(interceptors2, interceptor) {
|
||
if (!interceptors2 || !interceptor) {
|
||
return;
|
||
}
|
||
Object.keys(interceptor).forEach(function (name) {
|
||
var hooks = interceptors2[name];
|
||
var hook = interceptor[name];
|
||
if (isArray(hooks) && isFunction(hook)) {
|
||
remove(hooks, hook);
|
||
}
|
||
});
|
||
}function mergeHook(parentVal, childVal) {
|
||
var res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
|
||
return res ? dedupeHooks(res) : res;
|
||
}function dedupeHooks(hooks) {
|
||
var res = [];
|
||
for (var i = 0; i < hooks.length; i++) {
|
||
if (res.indexOf(hooks[i]) === -1) {
|
||
res.push(hooks[i]);
|
||
}
|
||
}
|
||
return res;
|
||
}var addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, function (method, interceptor) {
|
||
if (isString(method) && isPlainObject(interceptor)) {
|
||
mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
|
||
} else if (isPlainObject(method)) {
|
||
mergeInterceptorHook(globalInterceptors, method);
|
||
}
|
||
}, AddInterceptorProtocol);var removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, function (method, interceptor) {
|
||
if (isString(method)) {
|
||
if (isPlainObject(interceptor)) {
|
||
removeInterceptorHook(scopedInterceptors[method], interceptor);
|
||
} else {
|
||
delete scopedInterceptors[method];
|
||
}
|
||
} else if (isPlainObject(method)) {
|
||
removeInterceptorHook(globalInterceptors, method);
|
||
}
|
||
}, RemoveInterceptorProtocol);var interceptors = {};var API_ON = "$on";var OnProtocol = [{
|
||
name: "event",
|
||
type: String,
|
||
required: true
|
||
}, {
|
||
name: "callback",
|
||
type: Function,
|
||
required: true
|
||
}];var API_ONCE = "$once";var OnceProtocol = OnProtocol;var API_OFF = "$off";var OffProtocol = [{
|
||
name: "event",
|
||
type: [String, Array]
|
||
}, {
|
||
name: "callback",
|
||
type: [Function, Number]
|
||
}];var API_EMIT = "$emit";var EmitProtocol = [{
|
||
name: "event",
|
||
type: String,
|
||
required: true
|
||
}];var EventBus = /*#__PURE__*/function () {
|
||
function EventBus() {
|
||
_classCallCheck2(this, EventBus);
|
||
this.$emitter = new E$1();
|
||
}
|
||
_createClass2(EventBus, [{
|
||
key: "on",
|
||
value: function on(name, callback) {
|
||
return this.$emitter.on(name, callback);
|
||
}
|
||
}, {
|
||
key: "once",
|
||
value: function once(name, callback) {
|
||
return this.$emitter.once(name, callback);
|
||
}
|
||
}, {
|
||
key: "off",
|
||
value: function off(name, callback) {
|
||
if (!name) {
|
||
this.$emitter.e = {};
|
||
return;
|
||
}
|
||
this.$emitter.off(name, callback);
|
||
}
|
||
}, {
|
||
key: "emit",
|
||
value: function emit(name) {
|
||
var _this$$emitter;
|
||
for (var _len18 = arguments.length, args = new Array(_len18 > 1 ? _len18 - 1 : 0), _key26 = 1; _key26 < _len18; _key26++) {
|
||
args[_key26 - 1] = arguments[_key26];
|
||
}
|
||
(_this$$emitter = this.$emitter).emit.apply(_this$$emitter, [name].concat(args));
|
||
}
|
||
}]);
|
||
return EventBus;
|
||
}();var eventBus = new EventBus();var $on = defineSyncApi(API_ON, function (name, callback) {
|
||
eventBus.on(name, callback);
|
||
return function () {
|
||
return eventBus.off(name, callback);
|
||
};
|
||
}, OnProtocol);var $once = defineSyncApi(API_ONCE, function (name, callback) {
|
||
eventBus.once(name, callback);
|
||
return function () {
|
||
return eventBus.off(name, callback);
|
||
};
|
||
}, OnceProtocol);var $off = defineSyncApi(API_OFF, function (name, callback) {
|
||
if (!isArray(name)) name = name ? [name] : [];
|
||
name.forEach(function (n) {
|
||
eventBus.off(n, callback);
|
||
});
|
||
}, OffProtocol);var $emit = defineSyncApi(API_EMIT, function (name) {
|
||
for (var _len19 = arguments.length, args = new Array(_len19 > 1 ? _len19 - 1 : 0), _key27 = 1; _key27 < _len19; _key27++) {
|
||
args[_key27 - 1] = arguments[_key27];
|
||
}
|
||
eventBus.emit.apply(eventBus, [name].concat(args));
|
||
}, EmitProtocol);var cid;var cidErrMsg;var enabled;function normalizePushMessage(message) {
|
||
try {
|
||
return JSON.parse(message);
|
||
} catch (e2) {}
|
||
return message;
|
||
}function invokePushCallback(args) {
|
||
if (args.type === "enabled") {
|
||
enabled = true;
|
||
} else if (args.type === "clientId") {
|
||
cid = args.cid;
|
||
cidErrMsg = args.errMsg;
|
||
invokeGetPushCidCallbacks(cid, args.errMsg);
|
||
} else if (args.type === "pushMsg") {
|
||
var message = {
|
||
type: "receive",
|
||
data: normalizePushMessage(args.message)
|
||
};
|
||
for (var i = 0; i < onPushMessageCallbacks.length; i++) {
|
||
var callback = onPushMessageCallbacks[i];
|
||
callback(message);
|
||
if (message.stopped) {
|
||
break;
|
||
}
|
||
}
|
||
} else if (args.type === "click") {
|
||
onPushMessageCallbacks.forEach(function (callback) {
|
||
callback({
|
||
type: "click",
|
||
data: normalizePushMessage(args.message)
|
||
});
|
||
});
|
||
}
|
||
}var getPushCidCallbacks = [];function invokeGetPushCidCallbacks(cid2, errMsg) {
|
||
getPushCidCallbacks.forEach(function (callback) {
|
||
callback(cid2, errMsg);
|
||
});
|
||
getPushCidCallbacks.length = 0;
|
||
}var API_GET_PUSH_CLIENT_ID = "getPushClientId";var getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, function (_, _ref16) {
|
||
var resolve = _ref16.resolve,
|
||
reject = _ref16.reject;
|
||
Promise.resolve().then(function () {
|
||
if (typeof enabled === "undefined") {
|
||
enabled = false;
|
||
cid = "";
|
||
cidErrMsg = "uniPush is not enabled";
|
||
}
|
||
getPushCidCallbacks.push(function (cid2, errMsg) {
|
||
if (cid2) {
|
||
resolve({
|
||
cid: cid2
|
||
});
|
||
} else {
|
||
reject(errMsg);
|
||
}
|
||
});
|
||
if (typeof cid !== "undefined") {
|
||
invokeGetPushCidCallbacks(cid, cidErrMsg);
|
||
}
|
||
});
|
||
});var onPushMessageCallbacks = [];var onPushMessage = function onPushMessage(fn) {
|
||
if (onPushMessageCallbacks.indexOf(fn) === -1) {
|
||
onPushMessageCallbacks.push(fn);
|
||
}
|
||
};var offPushMessage = function offPushMessage(fn) {
|
||
if (!fn) {
|
||
onPushMessageCallbacks.length = 0;
|
||
} else {
|
||
var index2 = onPushMessageCallbacks.indexOf(fn);
|
||
if (index2 > -1) {
|
||
onPushMessageCallbacks.splice(index2, 1);
|
||
}
|
||
}
|
||
};var SYNC_API_RE = /^\$|__f__|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|rpx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/;var CONTEXT_API_RE = /^create|Manager$/;var CONTEXT_API_RE_EXC = ["createBLEConnection"];var TASK_APIS = ["request", "downloadFile", "uploadFile", "connectSocket"];var ASYNC_API = ["createBLEConnection"];var CALLBACK_API_RE = /^on|^off/;function isContextApi(name) {
|
||
return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
|
||
}function isSyncApi(name) {
|
||
return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
|
||
}function isCallbackApi(name) {
|
||
return CALLBACK_API_RE.test(name) && name !== "onPush";
|
||
}function isTaskApi(name) {
|
||
return TASK_APIS.indexOf(name) !== -1;
|
||
}function shouldPromise(name) {
|
||
if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}if (!Promise.prototype.finally) {
|
||
Promise.prototype.finally = function (onfinally) {
|
||
var promise = this.constructor;
|
||
return this.then(function (value) {
|
||
return promise.resolve(onfinally && onfinally()).then(function () {
|
||
return value;
|
||
});
|
||
}, function (reason) {
|
||
return promise.resolve(onfinally && onfinally()).then(function () {
|
||
throw reason;
|
||
});
|
||
});
|
||
};
|
||
}function promisify(name, api) {
|
||
if (!shouldPromise(name)) {
|
||
return api;
|
||
}
|
||
if (!isFunction(api)) {
|
||
return api;
|
||
}
|
||
return function promiseApi() {
|
||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
for (var _len20 = arguments.length, rest = new Array(_len20 > 1 ? _len20 - 1 : 0), _key28 = 1; _key28 < _len20; _key28++) {
|
||
rest[_key28 - 1] = arguments[_key28];
|
||
}
|
||
if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) {
|
||
return wrapperReturnValue(name, invokeApi(name, api, extend({}, options), rest));
|
||
}
|
||
return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
|
||
invokeApi(name, api, extend({}, options, {
|
||
success: resolve,
|
||
fail: reject
|
||
}), rest);
|
||
})));
|
||
};
|
||
}var CALLBACKS = ["success", "fail", "cancel", "complete"];function initWrapper(protocols2) {
|
||
function processCallback(methodName, method, returnValue) {
|
||
return function (res) {
|
||
return method(processReturnValue(methodName, res, returnValue));
|
||
};
|
||
}
|
||
function processArgs(methodName, fromArgs) {
|
||
var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||
var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||
var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
||
if (isPlainObject(fromArgs)) {
|
||
var toArgs = keepFromArgs === true ? fromArgs : {};
|
||
if (isFunction(argsOption)) {
|
||
argsOption = argsOption(fromArgs, toArgs) || {};
|
||
}
|
||
for (var key in fromArgs) {
|
||
if (hasOwn(argsOption, key)) {
|
||
var keyOption = argsOption[key];
|
||
if (isFunction(keyOption)) {
|
||
keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
|
||
}
|
||
if (!keyOption) {
|
||
console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, " \u6682\u4E0D\u652F\u6301 ").concat(key));
|
||
} else if (isString(keyOption)) {
|
||
toArgs[keyOption] = fromArgs[key];
|
||
} else if (isPlainObject(keyOption)) {
|
||
toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
|
||
}
|
||
} else if (CALLBACKS.indexOf(key) !== -1) {
|
||
var callback = fromArgs[key];
|
||
if (isFunction(callback)) {
|
||
toArgs[key] = processCallback(methodName, callback, returnValue);
|
||
}
|
||
} else {
|
||
if (!keepFromArgs && !hasOwn(toArgs, key)) {
|
||
toArgs[key] = fromArgs[key];
|
||
}
|
||
}
|
||
}
|
||
return toArgs;
|
||
} else if (isFunction(fromArgs)) {
|
||
if (isFunction(argsOption)) {
|
||
argsOption(fromArgs, {});
|
||
}
|
||
fromArgs = processCallback(methodName, fromArgs, returnValue);
|
||
}
|
||
return fromArgs;
|
||
}
|
||
function processReturnValue(methodName, res, returnValue) {
|
||
var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||
if (isFunction(protocols2.returnValue)) {
|
||
res = protocols2.returnValue(methodName, res);
|
||
}
|
||
var realKeepReturnValue = keepReturnValue || false;
|
||
return processArgs(methodName, res, returnValue, {}, realKeepReturnValue);
|
||
}
|
||
return function wrapper(methodName, method) {
|
||
var hasProtocol = hasOwn(protocols2, methodName);
|
||
if (!hasProtocol && typeof wx[methodName] !== "function") {
|
||
return method;
|
||
}
|
||
var needWrapper = hasProtocol || isFunction(protocols2.returnValue) || isContextApi(methodName) || isTaskApi(methodName);
|
||
var hasMethod = hasProtocol || isFunction(method);
|
||
if (!hasProtocol && !method) {
|
||
return function () {
|
||
console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
|
||
};
|
||
}
|
||
if (!needWrapper || !hasMethod) {
|
||
return method;
|
||
}
|
||
var protocol = protocols2[methodName];
|
||
return function (arg1, arg2) {
|
||
var options = protocol || {};
|
||
if (isFunction(protocol)) {
|
||
options = protocol(arg1);
|
||
}
|
||
arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
|
||
var args = [arg1];
|
||
if (typeof arg2 !== "undefined") {
|
||
args.push(arg2);
|
||
}
|
||
var returnValue = wx[options.name || methodName].apply(wx, args);
|
||
if (isContextApi(methodName) || isTaskApi(methodName)) {
|
||
if (returnValue && !returnValue.__v_skip) {
|
||
returnValue.__v_skip = true;
|
||
}
|
||
}
|
||
if (isSyncApi(methodName)) {
|
||
return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
|
||
}
|
||
return returnValue;
|
||
};
|
||
};
|
||
}var getLocale = function getLocale() {
|
||
var app = isFunction(getApp) && getApp({
|
||
allowDefault: true
|
||
});
|
||
if (app && app.$vm) {
|
||
return app.$vm.$locale;
|
||
}
|
||
return getLocaleLanguage$1();
|
||
};var setLocale = function setLocale(locale) {
|
||
var app = isFunction(getApp) && getApp();
|
||
if (!app) {
|
||
return false;
|
||
}
|
||
var oldLocale = app.$vm.$locale;
|
||
if (oldLocale !== locale) {
|
||
app.$vm.$locale = locale;
|
||
onLocaleChangeCallbacks.forEach(function (fn) {
|
||
return fn({
|
||
locale: locale
|
||
});
|
||
});
|
||
return true;
|
||
}
|
||
return false;
|
||
};var onLocaleChangeCallbacks = [];var onLocaleChange = function onLocaleChange(fn) {
|
||
if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
|
||
onLocaleChangeCallbacks.push(fn);
|
||
}
|
||
};if (typeof global !== "undefined") {
|
||
global.getLocale = getLocale;
|
||
}var UUID_KEY = "__DC_STAT_UUID";var deviceId;function useDeviceId() {
|
||
var global2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wx;
|
||
return function addDeviceId(_, toRes) {
|
||
deviceId = deviceId || global2.getStorageSync(UUID_KEY);
|
||
if (!deviceId) {
|
||
deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
|
||
wx.setStorage({
|
||
key: UUID_KEY,
|
||
data: deviceId
|
||
});
|
||
}
|
||
toRes.deviceId = deviceId;
|
||
};
|
||
}function addSafeAreaInsets(fromRes, toRes) {
|
||
if (fromRes.safeArea) {
|
||
var safeArea = fromRes.safeArea;
|
||
toRes.safeAreaInsets = {
|
||
top: safeArea.top,
|
||
left: safeArea.left,
|
||
right: fromRes.windowWidth - safeArea.right,
|
||
bottom: fromRes.screenHeight - safeArea.bottom
|
||
};
|
||
}
|
||
}function getOSInfo(system, platform) {
|
||
var osName = "";
|
||
var osVersion = "";
|
||
if (platform && false) {
|
||
osName = platform;
|
||
osVersion = system;
|
||
} else {
|
||
osName = system.split(" ")[0] || platform;
|
||
osVersion = system.split(" ")[1] || "";
|
||
}
|
||
osName = osName.toLowerCase();
|
||
switch (osName) {
|
||
case "harmony":
|
||
case "ohos":
|
||
case "openharmony":
|
||
osName = "harmonyos";
|
||
break;
|
||
case "iphone os":
|
||
osName = "ios";
|
||
break;
|
||
case "mac":
|
||
case "darwin":
|
||
osName = "macos";
|
||
break;
|
||
case "windows_nt":
|
||
osName = "windows";
|
||
break;
|
||
}
|
||
return {
|
||
osName: osName,
|
||
osVersion: osVersion
|
||
};
|
||
}function populateParameters(fromRes, toRes) {
|
||
var _fromRes$brand = fromRes.brand,
|
||
brand = _fromRes$brand === void 0 ? "" : _fromRes$brand,
|
||
_fromRes$model = fromRes.model,
|
||
model = _fromRes$model === void 0 ? "" : _fromRes$model,
|
||
_fromRes$system = fromRes.system,
|
||
system = _fromRes$system === void 0 ? "" : _fromRes$system,
|
||
_fromRes$language = fromRes.language,
|
||
language = _fromRes$language === void 0 ? "" : _fromRes$language,
|
||
theme = fromRes.theme,
|
||
version2 = fromRes.version,
|
||
platform = fromRes.platform,
|
||
fontSizeSetting = fromRes.fontSizeSetting,
|
||
SDKVersion = fromRes.SDKVersion,
|
||
pixelRatio = fromRes.pixelRatio,
|
||
deviceOrientation = fromRes.deviceOrientation;
|
||
var _getOSInfo = getOSInfo(system, platform),
|
||
osName = _getOSInfo.osName,
|
||
osVersion = _getOSInfo.osVersion;
|
||
var hostVersion = version2;
|
||
var deviceType = getGetDeviceType(fromRes, model);
|
||
var deviceBrand = getDeviceBrand(brand);
|
||
var _hostName = getHostName(fromRes);
|
||
var _deviceOrientation = deviceOrientation;
|
||
var _devicePixelRatio = pixelRatio;
|
||
var _SDKVersion = SDKVersion;
|
||
var hostLanguage = (language || "").replace(/_/g, "-");
|
||
var parameters = {
|
||
appId: "__UNI__FCA33A9",
|
||
appName: "舞蹈",
|
||
appVersion: "1.0.0",
|
||
appVersionCode: "100",
|
||
appLanguage: getAppLanguage(hostLanguage),
|
||
uniCompileVersion: "4.76",
|
||
uniCompilerVersion: "4.76",
|
||
uniRuntimeVersion: "4.76",
|
||
uniPlatform: "mp-weixin",
|
||
deviceBrand: deviceBrand,
|
||
deviceModel: model,
|
||
deviceType: deviceType,
|
||
devicePixelRatio: _devicePixelRatio,
|
||
deviceOrientation: _deviceOrientation,
|
||
osName: osName,
|
||
osVersion: osVersion,
|
||
hostTheme: theme,
|
||
hostVersion: hostVersion,
|
||
hostLanguage: hostLanguage,
|
||
hostName: _hostName,
|
||
hostSDKVersion: _SDKVersion,
|
||
hostFontSizeSetting: fontSizeSetting,
|
||
windowTop: 0,
|
||
windowBottom: 0,
|
||
// TODO
|
||
osLanguage: void 0,
|
||
osTheme: void 0,
|
||
ua: void 0,
|
||
hostPackageName: void 0,
|
||
browserName: void 0,
|
||
browserVersion: void 0,
|
||
isUniAppX: false
|
||
};
|
||
extend(toRes, parameters);
|
||
}function getGetDeviceType(fromRes, model) {
|
||
var deviceType = fromRes.deviceType || "phone";
|
||
{
|
||
var deviceTypeMaps = {
|
||
ipad: "pad",
|
||
windows: "pc",
|
||
mac: "pc"
|
||
};
|
||
var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
|
||
var _model = model.toLowerCase();
|
||
for (var index2 = 0; index2 < deviceTypeMapsKeys.length; index2++) {
|
||
var _m = deviceTypeMapsKeys[index2];
|
||
if (_model.indexOf(_m) !== -1) {
|
||
deviceType = deviceTypeMaps[_m];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return deviceType;
|
||
}function getDeviceBrand(brand) {
|
||
var deviceBrand = brand;
|
||
if (deviceBrand) {
|
||
deviceBrand = deviceBrand.toLowerCase();
|
||
}
|
||
return deviceBrand;
|
||
}function getAppLanguage(defaultLanguage) {
|
||
return getLocale ? getLocale() : defaultLanguage;
|
||
}function getHostName(fromRes) {
|
||
var _platform = "WeChat";
|
||
var _hostName = fromRes.hostName || _platform;
|
||
{
|
||
if (fromRes.environment) {
|
||
_hostName = fromRes.environment;
|
||
} else if (fromRes.host && fromRes.host.env) {
|
||
_hostName = fromRes.host.env;
|
||
}
|
||
}
|
||
return _hostName;
|
||
}var getSystemInfo = {
|
||
returnValue: function returnValue(fromRes, toRes) {
|
||
addSafeAreaInsets(fromRes, toRes);
|
||
useDeviceId()(fromRes, toRes);
|
||
populateParameters(fromRes, toRes);
|
||
}
|
||
};var getSystemInfoSync = getSystemInfo;var redirectTo = {};var previewImage = {
|
||
args: function args(fromArgs, toArgs) {
|
||
var currentIndex = parseInt(fromArgs.current);
|
||
if (isNaN(currentIndex)) {
|
||
return;
|
||
}
|
||
var urls = fromArgs.urls;
|
||
if (!isArray(urls)) {
|
||
return;
|
||
}
|
||
var len = urls.length;
|
||
if (!len) {
|
||
return;
|
||
}
|
||
if (currentIndex < 0) {
|
||
currentIndex = 0;
|
||
} else if (currentIndex >= len) {
|
||
currentIndex = len - 1;
|
||
}
|
||
if (currentIndex > 0) {
|
||
toArgs.current = urls[currentIndex];
|
||
toArgs.urls = urls.filter(function (item, index2) {
|
||
return index2 < currentIndex ? item !== urls[currentIndex] : true;
|
||
});
|
||
} else {
|
||
toArgs.current = urls[0];
|
||
}
|
||
return {
|
||
indicator: false,
|
||
loop: false
|
||
};
|
||
}
|
||
};var showActionSheet = {
|
||
args: function args(fromArgs, toArgs) {
|
||
toArgs.alertText = fromArgs.title;
|
||
}
|
||
};var getDeviceInfo = {
|
||
returnValue: function returnValue(fromRes, toRes) {
|
||
var brand = fromRes.brand,
|
||
model = fromRes.model,
|
||
_fromRes$system2 = fromRes.system,
|
||
system = _fromRes$system2 === void 0 ? "" : _fromRes$system2,
|
||
_fromRes$platform = fromRes.platform,
|
||
platform = _fromRes$platform === void 0 ? "" : _fromRes$platform;
|
||
var deviceType = getGetDeviceType(fromRes, model);
|
||
var deviceBrand = getDeviceBrand(brand);
|
||
useDeviceId()(fromRes, toRes);
|
||
var _getOSInfo2 = getOSInfo(system, platform),
|
||
osName = _getOSInfo2.osName,
|
||
osVersion = _getOSInfo2.osVersion;
|
||
toRes = sortObject(extend(toRes, {
|
||
deviceType: deviceType,
|
||
deviceBrand: deviceBrand,
|
||
deviceModel: model,
|
||
osName: osName,
|
||
osVersion: osVersion
|
||
}));
|
||
}
|
||
};var getAppBaseInfo = {
|
||
returnValue: function returnValue(fromRes, toRes) {
|
||
var version2 = fromRes.version,
|
||
language = fromRes.language,
|
||
SDKVersion = fromRes.SDKVersion,
|
||
theme = fromRes.theme;
|
||
var _hostName = getHostName(fromRes);
|
||
var hostLanguage = (language || "").replace(/_/g, "-");
|
||
var parameters = {
|
||
hostVersion: version2,
|
||
hostLanguage: hostLanguage,
|
||
hostName: _hostName,
|
||
hostSDKVersion: SDKVersion,
|
||
hostTheme: theme,
|
||
appId: "__UNI__FCA33A9",
|
||
appName: "舞蹈",
|
||
appVersion: "1.0.0",
|
||
appVersionCode: "100",
|
||
appLanguage: getAppLanguage(hostLanguage),
|
||
isUniAppX: false,
|
||
uniPlatform: "mp-weixin",
|
||
uniCompileVersion: "4.76",
|
||
uniCompilerVersion: "4.76",
|
||
uniRuntimeVersion: "4.76"
|
||
};
|
||
extend(toRes, parameters);
|
||
}
|
||
};var getWindowInfo = {
|
||
returnValue: function returnValue(fromRes, toRes) {
|
||
addSafeAreaInsets(fromRes, toRes);
|
||
toRes = sortObject(extend(toRes, {
|
||
windowTop: 0,
|
||
windowBottom: 0
|
||
}));
|
||
}
|
||
};var getAppAuthorizeSetting = {
|
||
returnValue: function returnValue(fromRes, toRes) {
|
||
var locationReducedAccuracy = fromRes.locationReducedAccuracy;
|
||
toRes.locationAccuracy = "unsupported";
|
||
if (locationReducedAccuracy === true) {
|
||
toRes.locationAccuracy = "reduced";
|
||
} else if (locationReducedAccuracy === false) {
|
||
toRes.locationAccuracy = "full";
|
||
}
|
||
}
|
||
};var onError = {
|
||
args: function args(fromArgs) {
|
||
var app = getApp({
|
||
allowDefault: true
|
||
}) || {};
|
||
if (!app.$vm) {
|
||
if (!wx.$onErrorHandlers) {
|
||
wx.$onErrorHandlers = [];
|
||
}
|
||
wx.$onErrorHandlers.push(fromArgs);
|
||
} else {
|
||
injectHook(ON_ERROR, fromArgs, app.$vm.$);
|
||
}
|
||
}
|
||
};var offError = {
|
||
args: function args(fromArgs) {
|
||
var app = getApp({
|
||
allowDefault: true
|
||
}) || {};
|
||
if (!app.$vm) {
|
||
if (!wx.$onErrorHandlers) {
|
||
return;
|
||
}
|
||
var index2 = wx.$onErrorHandlers.findIndex(function (fn) {
|
||
return fn === fromArgs;
|
||
});
|
||
if (index2 !== -1) {
|
||
wx.$onErrorHandlers.splice(index2, 1);
|
||
}
|
||
} else if (fromArgs.__weh) {
|
||
var onErrors = app.$vm.$[ON_ERROR];
|
||
if (onErrors) {
|
||
var _index = onErrors.indexOf(fromArgs.__weh);
|
||
if (_index > -1) {
|
||
onErrors.splice(_index, 1);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};var onSocketOpen = {
|
||
args: function args() {
|
||
if (wx.__uni_console__) {
|
||
if (wx.__uni_console_warned__) {
|
||
return;
|
||
}
|
||
wx.__uni_console_warned__ = true;
|
||
console.warn("\u5F00\u53D1\u6A21\u5F0F\u4E0B\u5C0F\u7A0B\u5E8F\u65E5\u5FD7\u56DE\u663E\u4F1A\u4F7F\u7528 socket \u8FDE\u63A5\uFF0C\u4E3A\u4E86\u907F\u514D\u51B2\u7A81\uFF0C\u5EFA\u8BAE\u4F7F\u7528 SocketTask \u7684\u65B9\u5F0F\u53BB\u7BA1\u7406 WebSocket \u6216\u624B\u52A8\u5173\u95ED\u65E5\u5FD7\u56DE\u663E\u529F\u80FD\u3002[\u8BE6\u60C5](https://uniapp.dcloud.net.cn/tutorial/run/mp-log.html)");
|
||
}
|
||
}
|
||
};var onSocketMessage = onSocketOpen;var baseApis = {
|
||
$on: $on,
|
||
$off: $off,
|
||
$once: $once,
|
||
$emit: $emit,
|
||
upx2px: upx2px,
|
||
rpx2px: upx2px,
|
||
interceptors: interceptors,
|
||
addInterceptor: addInterceptor,
|
||
removeInterceptor: removeInterceptor,
|
||
onCreateVueApp: onCreateVueApp,
|
||
invokeCreateVueAppHook: invokeCreateVueAppHook,
|
||
getLocale: getLocale,
|
||
setLocale: setLocale,
|
||
onLocaleChange: onLocaleChange,
|
||
getPushClientId: getPushClientId,
|
||
onPushMessage: onPushMessage,
|
||
offPushMessage: offPushMessage,
|
||
invokePushCallback: invokePushCallback,
|
||
__f__: __f__
|
||
};function initUni(api, protocols2) {
|
||
var platform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : wx;
|
||
var wrapper = initWrapper(protocols2);
|
||
var UniProxyHandlers = {
|
||
get: function get(target, key) {
|
||
if (hasOwn(target, key)) {
|
||
return target[key];
|
||
}
|
||
if (hasOwn(api, key)) {
|
||
return promisify(key, api[key]);
|
||
}
|
||
if (hasOwn(baseApis, key)) {
|
||
return promisify(key, baseApis[key]);
|
||
}
|
||
return promisify(key, wrapper(key, platform[key]));
|
||
}
|
||
};
|
||
return new Proxy({}, UniProxyHandlers);
|
||
}function initGetProvider(providers) {
|
||
return function getProvider2(_ref17) {
|
||
var service = _ref17.service,
|
||
success = _ref17.success,
|
||
fail = _ref17.fail,
|
||
complete = _ref17.complete;
|
||
var res;
|
||
if (providers[service]) {
|
||
res = {
|
||
errMsg: "getProvider:ok",
|
||
service: service,
|
||
provider: providers[service]
|
||
};
|
||
isFunction(success) && success(res);
|
||
} else {
|
||
res = {
|
||
errMsg: "getProvider:fail:服务[" + service + "]不存在"
|
||
};
|
||
isFunction(fail) && fail(res);
|
||
}
|
||
isFunction(complete) && complete(res);
|
||
};
|
||
}var objectKeys = ["qy", "env", "error", "version", "lanDebug", "cloud", "serviceMarket", "router", "worklet", "__webpack_require_UNI_MP_PLUGIN__"];var singlePageDisableKey = ["lanDebug", "router", "worklet"];var launchOption = wx.getLaunchOptionsSync ? wx.getLaunchOptionsSync() : null;function isWxKey(key) {
|
||
if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
|
||
return false;
|
||
}
|
||
return objectKeys.indexOf(key) > -1 || typeof wx[key] === "function";
|
||
}function initWx() {
|
||
var newWx = {};
|
||
for (var key in wx) {
|
||
if (isWxKey(key)) {
|
||
newWx[key] = wx[key];
|
||
}
|
||
}
|
||
if (typeof globalThis !== "undefined" && typeof requireMiniProgram === "undefined") {
|
||
globalThis.wx = newWx;
|
||
}
|
||
return newWx;
|
||
}var mocks$1 = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];var getProvider = initGetProvider({
|
||
oauth: ["weixin"],
|
||
share: ["weixin"],
|
||
payment: ["wxpay"],
|
||
push: ["weixin"]
|
||
});function initComponentMocks(component) {
|
||
var res = /* @__PURE__ */Object.create(null);
|
||
mocks$1.forEach(function (name) {
|
||
res[name] = component[name];
|
||
});
|
||
return res;
|
||
}function createSelectorQuery() {
|
||
var query = wx$2.createSelectorQuery();
|
||
var oldIn = query.in;
|
||
query.in = function newIn(component) {
|
||
if (component.$scope) {
|
||
return oldIn.call(this, component.$scope);
|
||
}
|
||
return oldIn.call(this, initComponentMocks(component));
|
||
};
|
||
return query;
|
||
}var wx$2 = initWx();if (!wx$2.canIUse("getAppBaseInfo")) {
|
||
wx$2.getAppBaseInfo = wx$2.getSystemInfoSync;
|
||
}if (!wx$2.canIUse("getWindowInfo")) {
|
||
wx$2.getWindowInfo = wx$2.getSystemInfoSync;
|
||
}if (!wx$2.canIUse("getDeviceInfo")) {
|
||
wx$2.getDeviceInfo = wx$2.getSystemInfoSync;
|
||
}var baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();if (!baseInfo) {
|
||
baseInfo = wx$2.getSystemInfoSync();
|
||
}var host = baseInfo ? baseInfo.host : null;var shareVideoMessage = host && host.env === "SAAASDK" ? wx$2.miniapp.shareVideoMessage : wx$2.shareVideoMessage;var shims = /* @__PURE__ */Object.freeze({
|
||
__proto__: null,
|
||
createSelectorQuery: createSelectorQuery,
|
||
getProvider: getProvider,
|
||
shareVideoMessage: shareVideoMessage
|
||
});var compressImage = {
|
||
args: function args(fromArgs, toArgs) {
|
||
if (fromArgs.compressedHeight && !toArgs.compressHeight) {
|
||
toArgs.compressHeight = fromArgs.compressedHeight;
|
||
}
|
||
if (fromArgs.compressedWidth && !toArgs.compressWidth) {
|
||
toArgs.compressWidth = fromArgs.compressedWidth;
|
||
}
|
||
}
|
||
};var protocols = /* @__PURE__ */Object.freeze({
|
||
__proto__: null,
|
||
compressImage: compressImage,
|
||
getAppAuthorizeSetting: getAppAuthorizeSetting,
|
||
getAppBaseInfo: getAppBaseInfo,
|
||
getDeviceInfo: getDeviceInfo,
|
||
getSystemInfo: getSystemInfo,
|
||
getSystemInfoSync: getSystemInfoSync,
|
||
getWindowInfo: getWindowInfo,
|
||
offError: offError,
|
||
onError: onError,
|
||
onSocketMessage: onSocketMessage,
|
||
onSocketOpen: onSocketOpen,
|
||
previewImage: previewImage,
|
||
redirectTo: redirectTo,
|
||
showActionSheet: showActionSheet
|
||
});var wx$1 = initWx();var index = initUni(shims, protocols, wx$1);function initRuntimeSocket(hosts, port, id) {
|
||
if (hosts == "" || port == "" || id == "") return Promise.resolve(null);
|
||
return hosts.split(",").reduce(function (promise, host2) {
|
||
return promise.then(function (socket) {
|
||
if (socket != null) return Promise.resolve(socket);
|
||
return tryConnectSocket(host2, port, id);
|
||
});
|
||
}, Promise.resolve(null));
|
||
}var SOCKET_TIMEOUT = 500;function tryConnectSocket(host2, port, id) {
|
||
return new Promise(function (resolve, reject) {
|
||
var socket = index.connectSocket({
|
||
url: "ws://".concat(host2, ":").concat(port, "/").concat(id),
|
||
multiple: true,
|
||
// 支付宝小程序 是否开启多实例
|
||
fail: function fail() {
|
||
resolve(null);
|
||
}
|
||
});
|
||
var timer = setTimeout(function () {
|
||
socket.close({
|
||
code: 1006,
|
||
reason: "connect timeout"
|
||
});
|
||
resolve(null);
|
||
}, SOCKET_TIMEOUT);
|
||
socket.onOpen(function (e2) {
|
||
clearTimeout(timer);
|
||
resolve(socket);
|
||
});
|
||
socket.onClose(function (e2) {
|
||
clearTimeout(timer);
|
||
resolve(null);
|
||
});
|
||
socket.onError(function (e2) {
|
||
clearTimeout(timer);
|
||
resolve(null);
|
||
});
|
||
});
|
||
}var CONSOLE_TYPES = ["log", "warn", "error", "info", "debug"];var originalConsole = /* @__PURE__ */CONSOLE_TYPES.reduce(function (methods, type) {
|
||
methods[type] = console[type].bind(console);
|
||
return methods;
|
||
}, {});var sendError = null;var errorQueue = /* @__PURE__ */new Set();var errorExtra = {};function sendErrorMessages(errors) {
|
||
if (sendError == null) {
|
||
errors.forEach(function (error) {
|
||
errorQueue.add(error);
|
||
});
|
||
return;
|
||
}
|
||
var data = errors.map(function (err) {
|
||
if (typeof err === "string") {
|
||
return err;
|
||
}
|
||
var isPromiseRejection = err && "promise" in err && "reason" in err;
|
||
var prefix = isPromiseRejection ? "UnhandledPromiseRejection: " : "";
|
||
if (isPromiseRejection) {
|
||
err = err.reason;
|
||
}
|
||
if (err instanceof Error && err.stack) {
|
||
if (err.message && !err.stack.includes(err.message)) {
|
||
return "".concat(prefix).concat(err.message, "\n").concat(err.stack);
|
||
}
|
||
return "".concat(prefix).concat(err.stack);
|
||
}
|
||
if (_typeof2(err) === "object" && err !== null) {
|
||
try {
|
||
return prefix + JSON.stringify(err);
|
||
} catch (err2) {
|
||
return prefix + String(err2);
|
||
}
|
||
}
|
||
return prefix + String(err);
|
||
}).filter(Boolean);
|
||
if (data.length > 0) {
|
||
sendError(JSON.stringify(Object.assign({
|
||
type: "error",
|
||
data: data
|
||
}, errorExtra)));
|
||
}
|
||
}function setSendError(value) {
|
||
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
sendError = value;
|
||
Object.assign(errorExtra, extra);
|
||
if (value != null && errorQueue.size > 0) {
|
||
var errors = Array.from(errorQueue);
|
||
errorQueue.clear();
|
||
sendErrorMessages(errors);
|
||
}
|
||
}function initOnError() {
|
||
function onError2(error) {
|
||
try {
|
||
if (typeof PromiseRejectionEvent !== "undefined" && error instanceof PromiseRejectionEvent && error.reason instanceof Error && error.reason.message && error.reason.message.includes("Cannot create property 'errMsg' on string 'taskId")) {
|
||
return;
|
||
}
|
||
if (true) {
|
||
originalConsole.error(error);
|
||
}
|
||
sendErrorMessages([error]);
|
||
} catch (err) {
|
||
originalConsole.error(err);
|
||
}
|
||
}
|
||
if (typeof index.onError === "function") {
|
||
index.onError(onError2);
|
||
}
|
||
if (typeof index.onUnhandledRejection === "function") {
|
||
index.onUnhandledRejection(onError2);
|
||
}
|
||
return function offError2() {
|
||
if (typeof index.offError === "function") {
|
||
index.offError(onError2);
|
||
}
|
||
if (typeof index.offUnhandledRejection === "function") {
|
||
index.offUnhandledRejection(onError2);
|
||
}
|
||
};
|
||
}function formatMessage(type, args) {
|
||
try {
|
||
return {
|
||
type: type,
|
||
args: formatArgs(args)
|
||
};
|
||
} catch (e2) {}
|
||
return {
|
||
type: type,
|
||
args: []
|
||
};
|
||
}function formatArgs(args) {
|
||
return args.map(function (arg) {
|
||
return formatArg(arg);
|
||
});
|
||
}function formatArg(arg) {
|
||
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||
if (depth >= 7) {
|
||
return {
|
||
type: "object",
|
||
value: "[Maximum depth reached]"
|
||
};
|
||
}
|
||
var type = _typeof2(arg);
|
||
switch (type) {
|
||
case "string":
|
||
return formatString(arg);
|
||
case "number":
|
||
return formatNumber(arg);
|
||
case "boolean":
|
||
return formatBoolean(arg);
|
||
case "object":
|
||
try {
|
||
return formatObject(arg, depth);
|
||
} catch (e2) {
|
||
return {
|
||
type: "object",
|
||
value: {
|
||
properties: []
|
||
}
|
||
};
|
||
}
|
||
case "undefined":
|
||
return formatUndefined();
|
||
case "function":
|
||
return formatFunction(arg);
|
||
case "symbol":
|
||
{
|
||
return formatSymbol(arg);
|
||
}
|
||
case "bigint":
|
||
return formatBigInt(arg);
|
||
}
|
||
}function formatFunction(value) {
|
||
return {
|
||
type: "function",
|
||
value: "function ".concat(value.name, "() {}")
|
||
};
|
||
}function formatUndefined() {
|
||
return {
|
||
type: "undefined"
|
||
};
|
||
}function formatBoolean(value) {
|
||
return {
|
||
type: "boolean",
|
||
value: String(value)
|
||
};
|
||
}function formatNumber(value) {
|
||
return {
|
||
type: "number",
|
||
value: String(value)
|
||
};
|
||
}function formatBigInt(value) {
|
||
return {
|
||
type: "bigint",
|
||
value: String(value)
|
||
};
|
||
}function formatString(value) {
|
||
return {
|
||
type: "string",
|
||
value: value
|
||
};
|
||
}function formatSymbol(value) {
|
||
return {
|
||
type: "symbol",
|
||
value: value.description
|
||
};
|
||
}function formatObject(value, depth) {
|
||
if (value === null) {
|
||
return {
|
||
type: "null"
|
||
};
|
||
}
|
||
{
|
||
if (isComponentPublicInstance(value)) {
|
||
return formatComponentPublicInstance(value, depth);
|
||
}
|
||
if (isComponentInternalInstance(value)) {
|
||
return formatComponentInternalInstance(value, depth);
|
||
}
|
||
if (isUniElement(value)) {
|
||
return formatUniElement(value, depth);
|
||
}
|
||
if (isCSSStyleDeclaration(value)) {
|
||
return formatCSSStyleDeclaration(value, depth);
|
||
}
|
||
}
|
||
if (Array.isArray(value)) {
|
||
return {
|
||
type: "object",
|
||
subType: "array",
|
||
value: {
|
||
properties: value.map(function (v, i) {
|
||
return formatArrayElement(v, i, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}
|
||
if (value instanceof Set) {
|
||
return {
|
||
type: "object",
|
||
subType: "set",
|
||
className: "Set",
|
||
description: "Set(".concat(value.size, ")"),
|
||
value: {
|
||
entries: Array.from(value).map(function (v) {
|
||
return formatSetEntry(v, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}
|
||
if (value instanceof Map) {
|
||
return {
|
||
type: "object",
|
||
subType: "map",
|
||
className: "Map",
|
||
description: "Map(".concat(value.size, ")"),
|
||
value: {
|
||
entries: Array.from(value.entries()).map(function (v) {
|
||
return formatMapEntry(v, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}
|
||
if (value instanceof Promise) {
|
||
return {
|
||
type: "object",
|
||
subType: "promise",
|
||
value: {
|
||
properties: []
|
||
}
|
||
};
|
||
}
|
||
if (value instanceof RegExp) {
|
||
return {
|
||
type: "object",
|
||
subType: "regexp",
|
||
value: String(value),
|
||
className: "Regexp"
|
||
};
|
||
}
|
||
if (value instanceof Date) {
|
||
return {
|
||
type: "object",
|
||
subType: "date",
|
||
value: String(value),
|
||
className: "Date"
|
||
};
|
||
}
|
||
if (value instanceof Error) {
|
||
return {
|
||
type: "object",
|
||
subType: "error",
|
||
value: value.message || String(value),
|
||
className: value.name || "Error"
|
||
};
|
||
}
|
||
var className = void 0;
|
||
{
|
||
var _constructor = value.constructor;
|
||
if (_constructor) {
|
||
if (_constructor.get$UTSMetadata$) {
|
||
className = _constructor.get$UTSMetadata$().name;
|
||
}
|
||
}
|
||
}
|
||
var entries = Object.entries(value);
|
||
if (isHarmonyBuilderParams(value)) {
|
||
entries = entries.filter(function (_ref18) {
|
||
var _ref19 = _slicedToArray2(_ref18, 1),
|
||
key = _ref19[0];
|
||
return key !== "modifier" && key !== "nodeContent";
|
||
});
|
||
}
|
||
return {
|
||
type: "object",
|
||
className: className,
|
||
value: {
|
||
properties: entries.map(function (entry) {
|
||
return formatObjectProperty(entry[0], entry[1], depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}function isHarmonyBuilderParams(value) {
|
||
return value.modifier && value.modifier._attribute && value.nodeContent;
|
||
}function isComponentPublicInstance(value) {
|
||
return value.$ && isComponentInternalInstance(value.$);
|
||
}function isComponentInternalInstance(value) {
|
||
return value.type && value.uid != null && value.appContext;
|
||
}function formatComponentPublicInstance(value, depth) {
|
||
return {
|
||
type: "object",
|
||
className: "ComponentPublicInstance",
|
||
value: {
|
||
properties: Object.entries(value.$.type).map(function (_ref20) {
|
||
var _ref21 = _slicedToArray2(_ref20, 2),
|
||
name = _ref21[0],
|
||
value2 = _ref21[1];
|
||
return formatObjectProperty(name, value2, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}function formatComponentInternalInstance(value, depth) {
|
||
return {
|
||
type: "object",
|
||
className: "ComponentInternalInstance",
|
||
value: {
|
||
properties: Object.entries(value.type).map(function (_ref22) {
|
||
var _ref23 = _slicedToArray2(_ref22, 2),
|
||
name = _ref23[0],
|
||
value2 = _ref23[1];
|
||
return formatObjectProperty(name, value2, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}function isUniElement(value) {
|
||
return value.style && value.tagName != null && value.nodeName != null;
|
||
}function formatUniElement(value, depth) {
|
||
return {
|
||
type: "object",
|
||
// 非 x 没有 UniElement 的概念
|
||
// className: 'UniElement',
|
||
value: {
|
||
properties: Object.entries(value).filter(function (_ref24) {
|
||
var _ref25 = _slicedToArray2(_ref24, 1),
|
||
name = _ref25[0];
|
||
return ["id", "tagName", "nodeName", "dataset", "offsetTop", "offsetLeft", "style"].includes(name);
|
||
}).map(function (_ref26) {
|
||
var _ref27 = _slicedToArray2(_ref26, 2),
|
||
name = _ref27[0],
|
||
value2 = _ref27[1];
|
||
return formatObjectProperty(name, value2, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}function isCSSStyleDeclaration(value) {
|
||
return typeof value.getPropertyValue === "function" && typeof value.setProperty === "function" && value.$styles;
|
||
}function formatCSSStyleDeclaration(style, depth) {
|
||
return {
|
||
type: "object",
|
||
value: {
|
||
properties: Object.entries(style.$styles).map(function (_ref28) {
|
||
var _ref29 = _slicedToArray2(_ref28, 2),
|
||
name = _ref29[0],
|
||
value = _ref29[1];
|
||
return formatObjectProperty(name, value, depth + 1);
|
||
})
|
||
}
|
||
};
|
||
}function formatObjectProperty(name, value, depth) {
|
||
var result = formatArg(value, depth);
|
||
result.name = name;
|
||
return result;
|
||
}function formatArrayElement(value, index2, depth) {
|
||
var result = formatArg(value, depth);
|
||
result.name = "".concat(index2);
|
||
return result;
|
||
}function formatSetEntry(value, depth) {
|
||
return {
|
||
value: formatArg(value, depth)
|
||
};
|
||
}function formatMapEntry(value, depth) {
|
||
return {
|
||
key: formatArg(value[0], depth),
|
||
value: formatArg(value[1], depth)
|
||
};
|
||
}var sendConsole = null;var messageQueue = [];var messageExtra = {};var EXCEPTION_BEGIN_MARK = "---BEGIN:EXCEPTION---";var EXCEPTION_END_MARK = "---END:EXCEPTION---";function sendConsoleMessages(messages) {
|
||
if (sendConsole == null) {
|
||
messageQueue.push.apply(messageQueue, _toConsumableArray2(messages));
|
||
return;
|
||
}
|
||
sendConsole(JSON.stringify(Object.assign({
|
||
type: "console",
|
||
data: messages
|
||
}, messageExtra)));
|
||
}function setSendConsole(value) {
|
||
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||
sendConsole = value;
|
||
Object.assign(messageExtra, extra);
|
||
if (value != null && messageQueue.length > 0) {
|
||
var messages = messageQueue.slice();
|
||
messageQueue.length = 0;
|
||
sendConsoleMessages(messages);
|
||
}
|
||
}var atFileRegex = /^\s*at\s+[\w/./-]+:\d+$/;function rewriteConsole() {
|
||
function wrapConsole(type) {
|
||
return function () {
|
||
for (var _len21 = arguments.length, args = new Array(_len21), _key29 = 0; _key29 < _len21; _key29++) {
|
||
args[_key29] = arguments[_key29];
|
||
}
|
||
{
|
||
var originalArgs = [].concat(args);
|
||
if (originalArgs.length) {
|
||
var maybeAtFile = originalArgs[originalArgs.length - 1];
|
||
if (typeof maybeAtFile === "string" && atFileRegex.test(maybeAtFile)) {
|
||
originalArgs.pop();
|
||
}
|
||
}
|
||
originalConsole[type].apply(originalConsole, _toConsumableArray2(originalArgs));
|
||
}
|
||
if (type === "error" && args.length === 1) {
|
||
var arg = args[0];
|
||
if (typeof arg === "string" && arg.startsWith(EXCEPTION_BEGIN_MARK)) {
|
||
var startIndex = EXCEPTION_BEGIN_MARK.length;
|
||
var endIndex = arg.length - EXCEPTION_END_MARK.length;
|
||
sendErrorMessages([arg.slice(startIndex, endIndex)]);
|
||
return;
|
||
} else if (arg instanceof Error) {
|
||
sendErrorMessages([arg]);
|
||
return;
|
||
}
|
||
}
|
||
sendConsoleMessages([formatMessage(type, args)]);
|
||
};
|
||
}
|
||
if (isConsoleWritable()) {
|
||
CONSOLE_TYPES.forEach(function (type) {
|
||
console[type] = wrapConsole(type);
|
||
});
|
||
return function restoreConsole() {
|
||
CONSOLE_TYPES.forEach(function (type) {
|
||
console[type] = originalConsole[type];
|
||
});
|
||
};
|
||
} else {
|
||
{
|
||
if (typeof index !== "undefined" && index.__f__) {
|
||
var oldLog = index.__f__;
|
||
if (oldLog) {
|
||
index.__f__ = function () {
|
||
for (var _len22 = arguments.length, args = new Array(_len22), _key30 = 0; _key30 < _len22; _key30++) {
|
||
args[_key30] = arguments[_key30];
|
||
}
|
||
var type = args[0],
|
||
filename = args[1],
|
||
rest = args.slice(2);
|
||
oldLog.apply(void 0, [type, ""].concat(_toConsumableArray2(rest)));
|
||
sendConsoleMessages([formatMessage(type, [].concat(_toConsumableArray2(rest), [filename]))]);
|
||
};
|
||
return function restoreConsole() {
|
||
index.__f__ = oldLog;
|
||
};
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return function restoreConsole() {};
|
||
}function isConsoleWritable() {
|
||
var value = console.log;
|
||
var sym = Symbol();
|
||
try {
|
||
console.log = sym;
|
||
} catch (ex) {
|
||
return false;
|
||
}
|
||
var isWritable = console.log === sym;
|
||
console.log = value;
|
||
return isWritable;
|
||
}function initRuntimeSocketService() {
|
||
// 禁用开发模式下的日志 WebSocket 连接(按需关闭 ws 功能)
|
||
var hosts = "";
|
||
var port = "";
|
||
var id = "";
|
||
// 若未配置 socket 参数,直接跳过所有处理,避免与开发者工具内部机制冲突
|
||
if (!hosts || !port || !id) {
|
||
return Promise.resolve(false);
|
||
}
|
||
var lazy = typeof swan !== "undefined";
|
||
var restoreError = lazy ? function () {} : initOnError();
|
||
var restoreConsole = lazy ? function () {} : rewriteConsole();
|
||
return Promise.resolve().then(function () {
|
||
if (lazy) {
|
||
restoreError = initOnError();
|
||
restoreConsole = rewriteConsole();
|
||
}
|
||
return initRuntimeSocket(hosts, port, id).then(function (socket) {
|
||
if (!socket) {
|
||
// 禁用 ws 功能时,直接恢复错误与控制台并安静返回,不打印 ws 相关错误日志
|
||
restoreError();
|
||
restoreConsole();
|
||
return false;
|
||
}
|
||
{
|
||
initMiniProgramGlobalFlag();
|
||
}
|
||
socket.onClose(function () {
|
||
{
|
||
originalConsole.error(wrapError("开发模式下日志通道 socket 连接关闭,请在 HBuilderX 中重新运行。"));
|
||
}
|
||
restoreError();
|
||
restoreConsole();
|
||
});
|
||
setSendConsole(function (data) {
|
||
socket.send({
|
||
data: data
|
||
});
|
||
});
|
||
setSendError(function (data) {
|
||
socket.send({
|
||
data: data
|
||
});
|
||
});
|
||
return true;
|
||
});
|
||
});
|
||
}var ERROR_CHAR = "";function wrapError(error) {
|
||
return "".concat(ERROR_CHAR).concat(error).concat(ERROR_CHAR);
|
||
}function initMiniProgramGlobalFlag() {
|
||
if (typeof wx$1 !== "undefined") {
|
||
wx$1.__uni_console__ = true;
|
||
} else if (typeof my !== "undefined") {
|
||
my.__uni_console__ = true;
|
||
} else if (typeof tt !== "undefined") {
|
||
tt.__uni_console__ = true;
|
||
} else if (typeof swan !== "undefined") {
|
||
swan.__uni_console__ = true;
|
||
} else if (typeof qq !== "undefined") {
|
||
qq.__uni_console__ = true;
|
||
} else if (typeof ks !== "undefined") {
|
||
ks.__uni_console__ = true;
|
||
} else if (typeof jd !== "undefined") {
|
||
jd.__uni_console__ = true;
|
||
} else if (typeof xhs !== "undefined") {
|
||
xhs.__uni_console__ = true;
|
||
} else if (typeof has !== "undefined") {
|
||
has.__uni_console__ = true;
|
||
} else if (typeof qa !== "undefined") {
|
||
qa.__uni_console__ = true;
|
||
}
|
||
}initRuntimeSocketService();function initVueIds(vueIds, mpInstance) {
|
||
if (!vueIds) {
|
||
return;
|
||
}
|
||
var ids = vueIds.split(",");
|
||
var len = ids.length;
|
||
if (len === 1) {
|
||
mpInstance._$vueId = ids[0];
|
||
} else if (len === 2) {
|
||
mpInstance._$vueId = ids[0];
|
||
mpInstance._$vuePid = ids[1];
|
||
}
|
||
}var EXTRAS = ["externalClasses"];function initExtraOptions(miniProgramComponentOptions, vueOptions) {
|
||
EXTRAS.forEach(function (name) {
|
||
if (hasOwn(vueOptions, name)) {
|
||
miniProgramComponentOptions[name] = vueOptions[name];
|
||
}
|
||
});
|
||
}var WORKLET_RE = /_(.*)_worklet_factory_/;function initWorkletMethods(mpMethods, vueMethods) {
|
||
if (vueMethods) {
|
||
Object.keys(vueMethods).forEach(function (name) {
|
||
var matches = name.match(WORKLET_RE);
|
||
if (matches) {
|
||
var workletName = matches[1];
|
||
mpMethods[name] = vueMethods[name];
|
||
mpMethods[workletName] = vueMethods[workletName];
|
||
}
|
||
});
|
||
}
|
||
}function initWxsCallMethods(methods, wxsCallMethods) {
|
||
if (!isArray(wxsCallMethods)) {
|
||
return;
|
||
}
|
||
wxsCallMethods.forEach(function (callMethod) {
|
||
methods[callMethod] = function (args) {
|
||
return this.$vm[callMethod](args);
|
||
};
|
||
});
|
||
}function selectAllComponents(mpInstance, selector, $refs) {
|
||
var components = mpInstance.selectAllComponents(selector);
|
||
components.forEach(function (component) {
|
||
var ref2 = component.properties.uR;
|
||
$refs[ref2] = component.$vm || component;
|
||
});
|
||
}function initRefs(instance, mpInstance) {
|
||
Object.defineProperty(instance, "refs", {
|
||
get: function get() {
|
||
var $refs = {};
|
||
selectAllComponents(mpInstance, ".r", $refs);
|
||
var forComponents = mpInstance.selectAllComponents(".r-i-f");
|
||
forComponents.forEach(function (component) {
|
||
var ref2 = component.properties.uR;
|
||
if (!ref2) {
|
||
return;
|
||
}
|
||
if (!$refs[ref2]) {
|
||
$refs[ref2] = [];
|
||
}
|
||
$refs[ref2].push(component.$vm || component);
|
||
});
|
||
return $refs;
|
||
}
|
||
});
|
||
}function findVmByVueId(instance, vuePid) {
|
||
var $children = instance.$children;
|
||
for (var i = $children.length - 1; i >= 0; i--) {
|
||
var childVm = $children[i];
|
||
if (childVm.$scope._$vueId === vuePid) {
|
||
return childVm;
|
||
}
|
||
}
|
||
var parentVm;
|
||
for (var _i2 = $children.length - 1; _i2 >= 0; _i2--) {
|
||
parentVm = findVmByVueId($children[_i2], vuePid);
|
||
if (parentVm) {
|
||
return parentVm;
|
||
}
|
||
}
|
||
}function getLocaleLanguage() {
|
||
var _a;
|
||
var localeLanguage = "";
|
||
{
|
||
var appBaseInfo = ((_a = wx.getAppBaseInfo) === null || _a === void 0 ? void 0 : _a.call(wx)) || wx.getSystemInfoSync();
|
||
var language = appBaseInfo && appBaseInfo.language ? appBaseInfo.language : LOCALE_EN;
|
||
localeLanguage = normalizeLocale(language) || LOCALE_EN;
|
||
}
|
||
return localeLanguage;
|
||
}var MP_METHODS = ["createSelectorQuery", "createIntersectionObserver", "selectAllComponents", "selectComponent"];function createEmitFn(oldEmit, ctx) {
|
||
return function emit2(event) {
|
||
var scope = ctx.$scope;
|
||
for (var _len23 = arguments.length, args = new Array(_len23 > 1 ? _len23 - 1 : 0), _key31 = 1; _key31 < _len23; _key31++) {
|
||
args[_key31 - 1] = arguments[_key31];
|
||
}
|
||
if (scope && event) {
|
||
var detail = {
|
||
__args__: args
|
||
};
|
||
{
|
||
scope.triggerEvent(event, detail);
|
||
}
|
||
}
|
||
return oldEmit.apply(this, [event].concat(args));
|
||
};
|
||
}function initBaseInstance(instance, options) {
|
||
var ctx = instance.ctx;
|
||
ctx.mpType = options.mpType;
|
||
ctx.$mpType = options.mpType;
|
||
ctx.$mpPlatform = "mp-weixin";
|
||
ctx.$scope = options.mpInstance;
|
||
{
|
||
Object.defineProperties(ctx, _defineProperty2({}, VIRTUAL_HOST_ID, {
|
||
get: function get() {
|
||
var id = this.$scope.data[VIRTUAL_HOST_ID];
|
||
return id === void 0 ? "" : id;
|
||
}
|
||
}));
|
||
}
|
||
ctx.$mp = {};
|
||
{
|
||
ctx._self = {};
|
||
}
|
||
instance.slots = {};
|
||
if (isArray(options.slots) && options.slots.length) {
|
||
options.slots.forEach(function (name) {
|
||
instance.slots[name] = true;
|
||
});
|
||
if (instance.slots[SLOT_DEFAULT_NAME]) {
|
||
instance.slots.default = true;
|
||
}
|
||
}
|
||
ctx.getOpenerEventChannel = function () {
|
||
{
|
||
return options.mpInstance.getOpenerEventChannel();
|
||
}
|
||
};
|
||
ctx.$hasHook = hasHook;
|
||
ctx.$callHook = callHook;
|
||
instance.emit = createEmitFn(instance.emit, ctx);
|
||
}function initComponentInstance(instance, options) {
|
||
initBaseInstance(instance, options);
|
||
var ctx = instance.ctx;
|
||
MP_METHODS.forEach(function (method) {
|
||
ctx[method] = function () {
|
||
var mpInstance = ctx.$scope;
|
||
if (mpInstance && mpInstance[method]) {
|
||
for (var _len24 = arguments.length, args = new Array(_len24), _key32 = 0; _key32 < _len24; _key32++) {
|
||
args[_key32] = arguments[_key32];
|
||
}
|
||
return mpInstance[method].apply(mpInstance, args);
|
||
}
|
||
};
|
||
});
|
||
}function initMocks(instance, mpInstance, mocks2) {
|
||
var ctx = instance.ctx;
|
||
mocks2.forEach(function (mock) {
|
||
if (hasOwn(mpInstance, mock)) {
|
||
instance[mock] = ctx[mock] = mpInstance[mock];
|
||
}
|
||
});
|
||
}function hasHook(name) {
|
||
var hooks = this.$[name];
|
||
if (hooks && hooks.length) {
|
||
return true;
|
||
}
|
||
return false;
|
||
}function callHook(name, args) {
|
||
if (name === "mounted") {
|
||
callHook.call(this, "bm");
|
||
this.$.isMounted = true;
|
||
name = "m";
|
||
}
|
||
var hooks = this.$[name];
|
||
return hooks && invokeArrayFns(hooks, args);
|
||
}var PAGE_INIT_HOOKS = [ON_LOAD, ON_SHOW, ON_HIDE, ON_UNLOAD, ON_RESIZE, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_ADD_TO_FAVORITES
|
||
// 'onReady', // lifetimes.ready
|
||
// 'onPageScroll', // 影响性能,开发者手动注册
|
||
// 'onShareTimeline', // 右上角菜单,开发者手动注册
|
||
// 'onShareAppMessage' // 右上角菜单,开发者手动注册
|
||
];function findHooks(vueOptions) {
|
||
var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /* @__PURE__ */new Set();
|
||
if (vueOptions) {
|
||
Object.keys(vueOptions).forEach(function (name) {
|
||
if (isUniLifecycleHook(name, vueOptions[name])) {
|
||
hooks.add(name);
|
||
}
|
||
});
|
||
{
|
||
var extendsOptions = vueOptions.extends,
|
||
mixins = vueOptions.mixins;
|
||
if (mixins) {
|
||
mixins.forEach(function (mixin) {
|
||
return findHooks(mixin, hooks);
|
||
});
|
||
}
|
||
if (extendsOptions) {
|
||
findHooks(extendsOptions, hooks);
|
||
}
|
||
}
|
||
}
|
||
return hooks;
|
||
}function initHook(mpOptions, hook, excludes) {
|
||
if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
|
||
mpOptions[hook] = function (args) {
|
||
return this.$vm && this.$vm.$callHook(hook, args);
|
||
};
|
||
}
|
||
}var EXCLUDE_HOOKS = [ON_READY];function initHooks(mpOptions, hooks) {
|
||
var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EXCLUDE_HOOKS;
|
||
hooks.forEach(function (hook) {
|
||
return initHook(mpOptions, hook, excludes);
|
||
});
|
||
}function initUnknownHooks(mpOptions, vueOptions) {
|
||
var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EXCLUDE_HOOKS;
|
||
findHooks(vueOptions).forEach(function (hook) {
|
||
return initHook(mpOptions, hook, excludes);
|
||
});
|
||
}function initRuntimeHooks(mpOptions, runtimeHooks) {
|
||
if (!runtimeHooks) {
|
||
return;
|
||
}
|
||
var hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
|
||
hooks.forEach(function (hook) {
|
||
if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
|
||
initHook(mpOptions, hook, []);
|
||
}
|
||
});
|
||
}var findMixinRuntimeHooks = /* @__PURE__ */once(function () {
|
||
var runtimeHooks = [];
|
||
var app = isFunction(getApp) && getApp({
|
||
allowDefault: true
|
||
});
|
||
if (app && app.$vm && app.$vm.$) {
|
||
var mixins = app.$vm.$.appContext.mixins;
|
||
if (isArray(mixins)) {
|
||
var hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
|
||
mixins.forEach(function (mixin) {
|
||
hooks.forEach(function (hook) {
|
||
if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
|
||
runtimeHooks.push(hook);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
}
|
||
return runtimeHooks;
|
||
});function initMixinRuntimeHooks(mpOptions) {
|
||
initHooks(mpOptions, findMixinRuntimeHooks());
|
||
}var HOOKS = [ON_SHOW, ON_HIDE, ON_ERROR, ON_THEME_CHANGE, ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION];function parseApp(instance, parseAppOptions) {
|
||
var internalInstance = instance.$;
|
||
var appOptions = {
|
||
globalData: instance.$options && instance.$options.globalData || {},
|
||
$vm: instance,
|
||
// mp-alipay 组件 data 初始化比 onLaunch 早,提前挂载
|
||
onLaunch: function onLaunch(options) {
|
||
this.$vm = instance;
|
||
var ctx = internalInstance.ctx;
|
||
if (this.$vm && ctx.$scope && ctx.$callHook) {
|
||
return;
|
||
}
|
||
initBaseInstance(internalInstance, {
|
||
mpType: "app",
|
||
mpInstance: this,
|
||
slots: []
|
||
});
|
||
ctx.globalData = this.globalData;
|
||
instance.$callHook(ON_LAUNCH, options);
|
||
}
|
||
};
|
||
var onErrorHandlers = wx.$onErrorHandlers;
|
||
if (onErrorHandlers) {
|
||
onErrorHandlers.forEach(function (fn) {
|
||
injectHook(ON_ERROR, fn, internalInstance);
|
||
});
|
||
onErrorHandlers.length = 0;
|
||
}
|
||
initLocale(instance);
|
||
var vueOptions = instance.$.type;
|
||
initHooks(appOptions, HOOKS);
|
||
initUnknownHooks(appOptions, vueOptions);
|
||
{
|
||
var methods = vueOptions.methods;
|
||
methods && extend(appOptions, methods);
|
||
}
|
||
return appOptions;
|
||
}function initCreateApp(parseAppOptions) {
|
||
return function createApp2(vm) {
|
||
return App(parseApp(vm));
|
||
};
|
||
}function initCreateSubpackageApp(parseAppOptions) {
|
||
return function createApp2(vm) {
|
||
var appOptions = parseApp(vm);
|
||
var app = isFunction(getApp) && getApp({
|
||
allowDefault: true
|
||
});
|
||
if (!app) return;
|
||
vm.$.ctx.$scope = app;
|
||
var globalData = app.globalData;
|
||
if (globalData) {
|
||
Object.keys(appOptions.globalData).forEach(function (name) {
|
||
if (!hasOwn(globalData, name)) {
|
||
globalData[name] = appOptions.globalData[name];
|
||
}
|
||
});
|
||
}
|
||
Object.keys(appOptions).forEach(function (name) {
|
||
if (!hasOwn(app, name)) {
|
||
app[name] = appOptions[name];
|
||
}
|
||
});
|
||
initAppLifecycle(appOptions, vm);
|
||
};
|
||
}function initAppLifecycle(appOptions, vm) {
|
||
if (isFunction(appOptions.onLaunch)) {
|
||
var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
|
||
appOptions.onLaunch(args);
|
||
}
|
||
if (isFunction(appOptions.onShow) && wx.onAppShow) {
|
||
wx.onAppShow(function (args) {
|
||
vm.$callHook("onShow", args);
|
||
});
|
||
}
|
||
if (isFunction(appOptions.onHide) && wx.onAppHide) {
|
||
wx.onAppHide(function (args) {
|
||
vm.$callHook("onHide", args);
|
||
});
|
||
}
|
||
}function initLocale(appVm) {
|
||
var locale = ref(getLocaleLanguage());
|
||
Object.defineProperty(appVm, "$locale", {
|
||
get: function get() {
|
||
return locale.value;
|
||
},
|
||
set: function set(v) {
|
||
locale.value = v;
|
||
}
|
||
});
|
||
}var builtInProps = [
|
||
// 百度小程序,快手小程序自定义组件不支持绑定动态事件,动态dataset,故通过props传递事件信息
|
||
// event-opts
|
||
"eO",
|
||
// 组件 ref
|
||
"uR",
|
||
// 组件 ref-in-for
|
||
"uRIF",
|
||
// 组件 id
|
||
"uI",
|
||
// 组件类型 m: 小程序组件
|
||
"uT",
|
||
// 组件 props
|
||
"uP",
|
||
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
|
||
"uS"];function initDefaultProps(options) {
|
||
var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||
var properties = {};
|
||
if (!isBehavior) {
|
||
var observerSlots = function observerSlots(newVal) {
|
||
var $slots = /* @__PURE__ */Object.create(null);
|
||
newVal && newVal.forEach(function (slotName) {
|
||
$slots[slotName] = true;
|
||
});
|
||
this.setData({
|
||
$slots: $slots
|
||
});
|
||
};
|
||
builtInProps.forEach(function (name) {
|
||
properties[name] = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
});
|
||
properties.uS = {
|
||
type: null,
|
||
value: []
|
||
};
|
||
{
|
||
properties.uS.observer = observerSlots;
|
||
}
|
||
}
|
||
if (options.behaviors) {
|
||
if (options.behaviors.includes("wx://form-field")) {
|
||
if (!options.properties || !options.properties.name) {
|
||
properties.name = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
}
|
||
if (!options.properties || !options.properties.value) {
|
||
properties.value = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
}
|
||
}
|
||
}
|
||
return properties;
|
||
}function initVirtualHostProps(options) {
|
||
var properties = {};
|
||
{
|
||
if (options && options.virtualHost) {
|
||
properties[VIRTUAL_HOST_STYLE] = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
properties[VIRTUAL_HOST_CLASS] = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
properties[VIRTUAL_HOST_HIDDEN] = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
properties[VIRTUAL_HOST_ID] = {
|
||
type: null,
|
||
value: ""
|
||
};
|
||
}
|
||
}
|
||
return properties;
|
||
}function initProps(mpComponentOptions) {
|
||
if (!mpComponentOptions.properties) {
|
||
mpComponentOptions.properties = {};
|
||
}
|
||
extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
|
||
}var PROP_TYPES = [String, Number, Boolean, Object, Array, null];function parsePropType(type, defaultValue) {
|
||
if (isArray(type) && type.length === 1) {
|
||
return type[0];
|
||
}
|
||
return type;
|
||
}function normalizePropType(type, defaultValue) {
|
||
var res = parsePropType(type);
|
||
return PROP_TYPES.indexOf(res) !== -1 ? res : null;
|
||
}function initPageProps(_ref30, rawProps) {
|
||
var properties = _ref30.properties;
|
||
if (isArray(rawProps)) {
|
||
rawProps.forEach(function (key) {
|
||
properties[key] = {
|
||
type: String,
|
||
value: ""
|
||
};
|
||
});
|
||
} else if (isPlainObject(rawProps)) {
|
||
Object.keys(rawProps).forEach(function (key) {
|
||
var opts = rawProps[key];
|
||
if (isPlainObject(opts)) {
|
||
var value = opts.default;
|
||
if (isFunction(value)) {
|
||
value = value();
|
||
}
|
||
var type = opts.type;
|
||
opts.type = normalizePropType(type);
|
||
properties[key] = {
|
||
type: opts.type,
|
||
value: value
|
||
};
|
||
} else {
|
||
properties[key] = {
|
||
type: normalizePropType(opts)
|
||
};
|
||
}
|
||
});
|
||
}
|
||
}function findPropsData(properties, isPage2) {
|
||
return (isPage2 ? findPagePropsData(properties) : findComponentPropsData(resolvePropValue(properties.uP))) || {};
|
||
}function findPagePropsData(properties) {
|
||
var propsData = {};
|
||
if (isPlainObject(properties)) {
|
||
Object.keys(properties).forEach(function (name) {
|
||
if (builtInProps.indexOf(name) === -1) {
|
||
propsData[name] = resolvePropValue(properties[name]);
|
||
}
|
||
});
|
||
}
|
||
return propsData;
|
||
}function initFormField(vm) {
|
||
var vueOptions = vm.$options;
|
||
if (isArray(vueOptions.behaviors) && vueOptions.behaviors.includes("uni://form-field")) {
|
||
vm.$watch("modelValue", function () {
|
||
vm.$scope && vm.$scope.setData({
|
||
name: vm.name,
|
||
value: vm.modelValue
|
||
});
|
||
}, {
|
||
immediate: true
|
||
});
|
||
}
|
||
}function resolvePropValue(prop) {
|
||
return prop;
|
||
}function initData(_) {
|
||
return {};
|
||
}function initPropsObserver(componentOptions) {
|
||
var observe = function observe2() {
|
||
var up = this.properties.uP;
|
||
if (!up) {
|
||
return;
|
||
}
|
||
if (this.$vm) {
|
||
updateComponentProps(resolvePropValue(up), this.$vm.$);
|
||
} else if (resolvePropValue(this.properties.uT) === "m") {
|
||
updateMiniProgramComponentProperties(resolvePropValue(up), this);
|
||
}
|
||
};
|
||
{
|
||
if (!componentOptions.observers) {
|
||
componentOptions.observers = {};
|
||
}
|
||
componentOptions.observers.uP = observe;
|
||
}
|
||
}function updateMiniProgramComponentProperties(up, mpInstance) {
|
||
var prevProps = mpInstance.properties;
|
||
var nextProps = findComponentPropsData(up) || {};
|
||
if (hasPropsChanged(prevProps, nextProps, false)) {
|
||
mpInstance.setData(nextProps);
|
||
}
|
||
}function updateComponentProps(up, instance) {
|
||
var prevProps = toRaw(instance.props);
|
||
var nextProps = findComponentPropsData(up) || {};
|
||
if (hasPropsChanged(prevProps, nextProps)) {
|
||
updateProps(instance, nextProps, prevProps, false);
|
||
if (hasQueueJob(instance.update)) {
|
||
invalidateJob(instance.update);
|
||
}
|
||
{
|
||
instance.update();
|
||
}
|
||
}
|
||
}function hasPropsChanged(prevProps, nextProps) {
|
||
var checkLen = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||
var nextKeys = Object.keys(nextProps);
|
||
if (checkLen && nextKeys.length !== Object.keys(prevProps).length) {
|
||
return true;
|
||
}
|
||
for (var i = 0; i < nextKeys.length; i++) {
|
||
var key = nextKeys[i];
|
||
if (nextProps[key] !== prevProps[key]) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
}function initBehaviors(vueOptions) {
|
||
var vueBehaviors = vueOptions.behaviors;
|
||
var vueProps = vueOptions.props;
|
||
if (!vueProps) {
|
||
vueOptions.props = vueProps = [];
|
||
}
|
||
var behaviors = [];
|
||
if (isArray(vueBehaviors)) {
|
||
vueBehaviors.forEach(function (behavior) {
|
||
behaviors.push(behavior.replace("uni://", "wx://"));
|
||
if (behavior === "uni://form-field") {
|
||
if (isArray(vueProps)) {
|
||
vueProps.push("name");
|
||
vueProps.push("modelValue");
|
||
} else {
|
||
vueProps.name = {
|
||
type: String,
|
||
default: ""
|
||
};
|
||
vueProps.modelValue = {
|
||
type: [String, Number, Boolean, Array, Object, Date],
|
||
default: ""
|
||
};
|
||
}
|
||
}
|
||
});
|
||
}
|
||
return behaviors;
|
||
}function applyOptions(componentOptions, vueOptions) {
|
||
componentOptions.data = initData();
|
||
componentOptions.behaviors = initBehaviors(vueOptions);
|
||
}function parseComponent(vueOptions, _ref31) {
|
||
var parse = _ref31.parse,
|
||
mocks2 = _ref31.mocks,
|
||
isPage2 = _ref31.isPage,
|
||
isPageInProject = _ref31.isPageInProject,
|
||
initRelation2 = _ref31.initRelation,
|
||
handleLink2 = _ref31.handleLink,
|
||
initLifetimes2 = _ref31.initLifetimes;
|
||
vueOptions = vueOptions.default || vueOptions;
|
||
var options = {
|
||
multipleSlots: true,
|
||
// styleIsolation: 'apply-shared',
|
||
addGlobalClass: true,
|
||
pureDataPattern: /^uP$/
|
||
};
|
||
if (isArray(vueOptions.mixins)) {
|
||
vueOptions.mixins.forEach(function (item) {
|
||
if (isObject(item.options)) {
|
||
extend(options, item.options);
|
||
}
|
||
});
|
||
}
|
||
if (vueOptions.options) {
|
||
extend(options, vueOptions.options);
|
||
}
|
||
var mpComponentOptions = {
|
||
options: options,
|
||
lifetimes: initLifetimes2({
|
||
mocks: mocks2,
|
||
isPage: isPage2,
|
||
initRelation: initRelation2,
|
||
vueOptions: vueOptions
|
||
}),
|
||
pageLifetimes: {
|
||
show: function show() {
|
||
this.$vm && this.$vm.$callHook("onPageShow");
|
||
},
|
||
hide: function hide() {
|
||
this.$vm && this.$vm.$callHook("onPageHide");
|
||
},
|
||
resize: function resize(size2) {
|
||
this.$vm && this.$vm.$callHook("onPageResize", size2);
|
||
}
|
||
},
|
||
methods: {
|
||
__l: handleLink2
|
||
}
|
||
};
|
||
{
|
||
applyOptions(mpComponentOptions, vueOptions);
|
||
}
|
||
initProps(mpComponentOptions);
|
||
initPropsObserver(mpComponentOptions);
|
||
initExtraOptions(mpComponentOptions, vueOptions);
|
||
initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
|
||
{
|
||
initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
|
||
}
|
||
if (parse) {
|
||
parse(mpComponentOptions, {
|
||
handleLink: handleLink2
|
||
});
|
||
}
|
||
return mpComponentOptions;
|
||
}function initCreateComponent(parseOptions2) {
|
||
return function createComponent2(vueComponentOptions) {
|
||
return Component(parseComponent(vueComponentOptions, parseOptions2));
|
||
};
|
||
}var $createComponentFn;var $destroyComponentFn;function getAppVm() {
|
||
return getApp().$vm;
|
||
}function $createComponent(initialVNode, options) {
|
||
if (!$createComponentFn) {
|
||
$createComponentFn = getAppVm().$createComponent;
|
||
}
|
||
var proxy = $createComponentFn(initialVNode, options);
|
||
return getExposeProxy(proxy.$) || proxy;
|
||
}function $destroyComponent(instance) {
|
||
if (!$destroyComponentFn) {
|
||
$destroyComponentFn = getAppVm().$destroyComponent;
|
||
}
|
||
return $destroyComponentFn(instance);
|
||
}function parsePage(vueOptions, parseOptions2) {
|
||
var parse = parseOptions2.parse,
|
||
mocks2 = parseOptions2.mocks,
|
||
isPage2 = parseOptions2.isPage,
|
||
initRelation2 = parseOptions2.initRelation,
|
||
handleLink2 = parseOptions2.handleLink,
|
||
initLifetimes2 = parseOptions2.initLifetimes;
|
||
var miniProgramPageOptions = parseComponent(vueOptions, {
|
||
mocks: mocks2,
|
||
isPage: isPage2,
|
||
isPageInProject: true,
|
||
initRelation: initRelation2,
|
||
handleLink: handleLink2,
|
||
initLifetimes: initLifetimes2
|
||
});
|
||
initPageProps(miniProgramPageOptions, (vueOptions.default || vueOptions).props);
|
||
var methods = miniProgramPageOptions.methods;
|
||
methods.onLoad = function (query) {
|
||
{
|
||
this.options = query;
|
||
}
|
||
this.$page = {
|
||
fullPath: addLeadingSlash(this.route + stringifyQuery(query))
|
||
};
|
||
return this.$vm && this.$vm.$callHook(ON_LOAD, query);
|
||
};
|
||
initHooks(methods, PAGE_INIT_HOOKS);
|
||
{
|
||
initUnknownHooks(methods, vueOptions);
|
||
}
|
||
initRuntimeHooks(methods, vueOptions.__runtimeHooks);
|
||
initMixinRuntimeHooks(methods);
|
||
parse && parse(miniProgramPageOptions, {
|
||
handleLink: handleLink2
|
||
});
|
||
return miniProgramPageOptions;
|
||
}function initCreatePage(parseOptions2) {
|
||
return function createPage2(vuePageOptions) {
|
||
return Component(parsePage(vuePageOptions, parseOptions2));
|
||
};
|
||
}function initCreatePluginApp(parseAppOptions) {
|
||
return function createApp2(vm) {
|
||
initAppLifecycle(parseApp(vm), vm);
|
||
};
|
||
}var MPPage = Page;var MPComponent = Component;function initTriggerEvent(mpInstance) {
|
||
var oldTriggerEvent = mpInstance.triggerEvent;
|
||
var newTriggerEvent = function newTriggerEvent(event) {
|
||
for (var _len25 = arguments.length, args = new Array(_len25 > 1 ? _len25 - 1 : 0), _key33 = 1; _key33 < _len25; _key33++) {
|
||
args[_key33 - 1] = arguments[_key33];
|
||
}
|
||
return oldTriggerEvent.apply(mpInstance, [customizeEvent(event)].concat(args));
|
||
};
|
||
try {
|
||
mpInstance.triggerEvent = newTriggerEvent;
|
||
} catch (error) {
|
||
mpInstance._triggerEvent = newTriggerEvent;
|
||
}
|
||
}function initMiniProgramHook(name, options, isComponent) {
|
||
var oldHook = options[name];
|
||
if (!oldHook) {
|
||
options[name] = function () {
|
||
initTriggerEvent(this);
|
||
};
|
||
} else {
|
||
options[name] = function () {
|
||
initTriggerEvent(this);
|
||
for (var _len26 = arguments.length, args = new Array(_len26), _key34 = 0; _key34 < _len26; _key34++) {
|
||
args[_key34] = arguments[_key34];
|
||
}
|
||
return oldHook.apply(this, args);
|
||
};
|
||
}
|
||
}Page = function Page(options) {
|
||
initMiniProgramHook(ON_LOAD, options);
|
||
return MPPage(options);
|
||
};Component = function Component(options) {
|
||
initMiniProgramHook("created", options);
|
||
var isVueComponent = options.properties && options.properties.uP;
|
||
if (!isVueComponent) {
|
||
initProps(options);
|
||
initPropsObserver(options);
|
||
}
|
||
return MPComponent(options);
|
||
};function initLifetimes(_ref32) {
|
||
var mocks2 = _ref32.mocks,
|
||
isPage2 = _ref32.isPage,
|
||
initRelation2 = _ref32.initRelation,
|
||
vueOptions = _ref32.vueOptions;
|
||
return {
|
||
attached: function attached() {
|
||
var properties = this.properties;
|
||
initVueIds(properties.uI, this);
|
||
var relationOptions = {
|
||
vuePid: this._$vuePid
|
||
};
|
||
initRelation2(this, relationOptions);
|
||
var mpInstance = this;
|
||
var isMiniProgramPage = isPage2(mpInstance);
|
||
var propsData = properties;
|
||
this.$vm = $createComponent({
|
||
type: vueOptions,
|
||
props: findPropsData(propsData, isMiniProgramPage)
|
||
}, {
|
||
mpType: isMiniProgramPage ? "page" : "component",
|
||
mpInstance: mpInstance,
|
||
slots: properties.uS || {},
|
||
// vueSlots
|
||
parentComponent: relationOptions.parent && relationOptions.parent.$,
|
||
onBeforeSetup: function onBeforeSetup(instance, options) {
|
||
initRefs(instance, mpInstance);
|
||
initMocks(instance, mpInstance, mocks2);
|
||
initComponentInstance(instance, options);
|
||
}
|
||
});
|
||
if (!isMiniProgramPage) {
|
||
initFormField(this.$vm);
|
||
}
|
||
},
|
||
ready: function ready() {
|
||
if (this.$vm) {
|
||
{
|
||
this.$vm.$callHook("mounted");
|
||
this.$vm.$callHook(ON_READY);
|
||
}
|
||
}
|
||
},
|
||
detached: function detached() {
|
||
if (this.$vm) {
|
||
pruneComponentPropsCache(this.$vm.$.uid);
|
||
$destroyComponent(this.$vm);
|
||
}
|
||
}
|
||
};
|
||
}var mocks = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];function isPage(mpInstance) {
|
||
return !!mpInstance.route;
|
||
}function initRelation(mpInstance, detail) {
|
||
mpInstance.triggerEvent("__l", detail);
|
||
}function handleLink(event) {
|
||
var detail = event.detail || event.value;
|
||
var vuePid = detail.vuePid;
|
||
var parentVm;
|
||
if (vuePid) {
|
||
parentVm = findVmByVueId(this.$vm, vuePid);
|
||
}
|
||
if (!parentVm) {
|
||
parentVm = this.$vm;
|
||
}
|
||
detail.parent = parentVm;
|
||
}var parseOptions = /* @__PURE__ */Object.freeze({
|
||
__proto__: null,
|
||
handleLink: handleLink,
|
||
initLifetimes: initLifetimes,
|
||
initRelation: initRelation,
|
||
isPage: isPage,
|
||
mocks: mocks
|
||
});var createApp = initCreateApp();var createPage = initCreatePage(parseOptions);var createComponent = initCreateComponent(parseOptions);var createPluginApp = initCreatePluginApp();var createSubpackageApp = initCreateSubpackageApp();{
|
||
wx.createApp = global.createApp = createApp;
|
||
wx.createPage = createPage;
|
||
wx.createComponent = createComponent;
|
||
wx.createPluginApp = global.createPluginApp = createPluginApp;
|
||
wx.createSubpackageApp = global.createSubpackageApp = createSubpackageApp;
|
||
}var createLifeCycleHook = function createLifeCycleHook(lifecycle) {
|
||
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||
return function (hook) {
|
||
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstance();
|
||
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
|
||
};
|
||
};var onLoad = /* @__PURE__ */createLifeCycleHook(ON_LOAD, 2
|
||
/* HookFlags.PAGE */);exports.createSSRApp = createSSRApp;exports.e = e;exports.index = index;exports.o = o;exports.onLoad = onLoad;exports.ref = ref;exports.t = t; |