You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8111 lines
238 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. "use strict";
  2. const _export_sfc = (sfc, props) => {
  3. const target = sfc.__vccOpts || sfc;
  4. for (const [key, val] of props) {
  5. target[key] = val;
  6. }
  7. return target;
  8. };
  9. function makeMap(str, expectsLowerCase) {
  10. const map = /* @__PURE__ */ Object.create(null);
  11. const list = str.split(",");
  12. for (let i = 0; i < list.length; i++) {
  13. map[list[i]] = true;
  14. }
  15. return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
  16. }
  17. function normalizeStyle(value) {
  18. if (isArray(value)) {
  19. const res = {};
  20. for (let i = 0; i < value.length; i++) {
  21. const item = value[i];
  22. const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
  23. if (normalized) {
  24. for (const key in normalized) {
  25. res[key] = normalized[key];
  26. }
  27. }
  28. }
  29. return res;
  30. } else if (isString(value)) {
  31. return value;
  32. } else if (isObject(value)) {
  33. return value;
  34. }
  35. }
  36. const listDelimiterRE = /;(?![^(]*\))/g;
  37. const propertyDelimiterRE = /:([^]+)/;
  38. const styleCommentRE = /\/\*.*?\*\//gs;
  39. function parseStringStyle(cssText) {
  40. const ret = {};
  41. cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
  42. if (item) {
  43. const tmp = item.split(propertyDelimiterRE);
  44. tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
  45. }
  46. });
  47. return ret;
  48. }
  49. function normalizeClass(value) {
  50. let res = "";
  51. if (isString(value)) {
  52. res = value;
  53. } else if (isArray(value)) {
  54. for (let i = 0; i < value.length; i++) {
  55. const normalized = normalizeClass(value[i]);
  56. if (normalized) {
  57. res += normalized + " ";
  58. }
  59. }
  60. } else if (isObject(value)) {
  61. for (const name in value) {
  62. if (value[name]) {
  63. res += name + " ";
  64. }
  65. }
  66. }
  67. return res.trim();
  68. }
  69. const toDisplayString = (val) => {
  70. return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
  71. };
  72. const replacer = (_key, val) => {
  73. if (val && val.__v_isRef) {
  74. return replacer(_key, val.value);
  75. } else if (isMap(val)) {
  76. return {
  77. [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
  78. entries[`${key} =>`] = val2;
  79. return entries;
  80. }, {})
  81. };
  82. } else if (isSet(val)) {
  83. return {
  84. [`Set(${val.size})`]: [...val.values()]
  85. };
  86. } else if (isObject(val) && !isArray(val) && !isPlainObject$1(val)) {
  87. return String(val);
  88. }
  89. return val;
  90. };
  91. const EMPTY_OBJ = Object.freeze({});
  92. const EMPTY_ARR = Object.freeze([]);
  93. const NOOP = () => {
  94. };
  95. const NO = () => false;
  96. const onRE = /^on[^a-z]/;
  97. const isOn = (key) => onRE.test(key);
  98. const isModelListener = (key) => key.startsWith("onUpdate:");
  99. const extend = Object.assign;
  100. const remove = (arr, el) => {
  101. const i = arr.indexOf(el);
  102. if (i > -1) {
  103. arr.splice(i, 1);
  104. }
  105. };
  106. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  107. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  108. const isArray = Array.isArray;
  109. const isMap = (val) => toTypeString(val) === "[object Map]";
  110. const isSet = (val) => toTypeString(val) === "[object Set]";
  111. const isFunction = (val) => typeof val === "function";
  112. const isString = (val) => typeof val === "string";
  113. const isSymbol = (val) => typeof val === "symbol";
  114. const isObject = (val) => val !== null && typeof val === "object";
  115. const isPromise = (val) => {
  116. return isObject(val) && isFunction(val.then) && isFunction(val.catch);
  117. };
  118. const objectToString = Object.prototype.toString;
  119. const toTypeString = (value) => objectToString.call(value);
  120. const toRawType = (value) => {
  121. return toTypeString(value).slice(8, -1);
  122. };
  123. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  124. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  125. const isReservedProp = /* @__PURE__ */ makeMap(
  126. // the leading comma is intentional so empty string "" is also included
  127. ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
  128. );
  129. const isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
  130. const cacheStringFunction = (fn) => {
  131. const cache = /* @__PURE__ */ Object.create(null);
  132. return (str) => {
  133. const hit = cache[str];
  134. return hit || (cache[str] = fn(str));
  135. };
  136. };
  137. const camelizeRE = /-(\w)/g;
  138. const camelize = cacheStringFunction((str) => {
  139. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  140. });
  141. const hyphenateRE = /\B([A-Z])/g;
  142. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  143. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  144. const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
  145. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  146. const invokeArrayFns$1 = (fns, arg) => {
  147. for (let i = 0; i < fns.length; i++) {
  148. fns[i](arg);
  149. }
  150. };
  151. const def = (obj, key, value) => {
  152. Object.defineProperty(obj, key, {
  153. configurable: true,
  154. enumerable: false,
  155. value
  156. });
  157. };
  158. const looseToNumber = (val) => {
  159. const n2 = parseFloat(val);
  160. return isNaN(n2) ? val : n2;
  161. };
  162. const LINEFEED = "\n";
  163. const SLOT_DEFAULT_NAME = "d";
  164. const ON_SHOW = "onShow";
  165. const ON_HIDE = "onHide";
  166. const ON_LAUNCH = "onLaunch";
  167. const ON_ERROR = "onError";
  168. const ON_THEME_CHANGE = "onThemeChange";
  169. const ON_PAGE_NOT_FOUND = "onPageNotFound";
  170. const ON_UNHANDLE_REJECTION = "onUnhandledRejection";
  171. const ON_LOAD = "onLoad";
  172. const ON_READY = "onReady";
  173. const ON_UNLOAD = "onUnload";
  174. const ON_INIT = "onInit";
  175. const ON_SAVE_EXIT_STATE = "onSaveExitState";
  176. const ON_RESIZE = "onResize";
  177. const ON_BACK_PRESS = "onBackPress";
  178. const ON_PAGE_SCROLL = "onPageScroll";
  179. const ON_TAB_ITEM_TAP = "onTabItemTap";
  180. const ON_REACH_BOTTOM = "onReachBottom";
  181. const ON_PULL_DOWN_REFRESH = "onPullDownRefresh";
  182. const ON_SHARE_TIMELINE = "onShareTimeline";
  183. const ON_ADD_TO_FAVORITES = "onAddToFavorites";
  184. const ON_SHARE_APP_MESSAGE = "onShareAppMessage";
  185. const ON_NAVIGATION_BAR_BUTTON_TAP = "onNavigationBarButtonTap";
  186. const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = "onNavigationBarSearchInputClicked";
  187. const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = "onNavigationBarSearchInputChanged";
  188. const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = "onNavigationBarSearchInputConfirmed";
  189. const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = "onNavigationBarSearchInputFocusChanged";
  190. const customizeRE = /:/g;
  191. function customizeEvent(str) {
  192. return camelize(str.replace(customizeRE, "-"));
  193. }
  194. function hasLeadingSlash(str) {
  195. return str.indexOf("/") === 0;
  196. }
  197. function addLeadingSlash(str) {
  198. return hasLeadingSlash(str) ? str : "/" + str;
  199. }
  200. const invokeArrayFns = (fns, arg) => {
  201. let ret;
  202. for (let i = 0; i < fns.length; i++) {
  203. ret = fns[i](arg);
  204. }
  205. return ret;
  206. };
  207. function once(fn, ctx = null) {
  208. let res;
  209. return (...args) => {
  210. if (fn) {
  211. res = fn.apply(ctx, args);
  212. fn = null;
  213. }
  214. return res;
  215. };
  216. }
  217. function getValueByDataPath(obj, path) {
  218. if (!isString(path)) {
  219. return;
  220. }
  221. path = path.replace(/\[(\d+)\]/g, ".$1");
  222. const parts = path.split(".");
  223. let key = parts[0];
  224. if (!obj) {
  225. obj = {};
  226. }
  227. if (parts.length === 1) {
  228. return obj[key];
  229. }
  230. return getValueByDataPath(obj[key], parts.slice(1).join("."));
  231. }
  232. function sortObject(obj) {
  233. let sortObj = {};
  234. if (isPlainObject$1(obj)) {
  235. Object.keys(obj).sort().forEach((key) => {
  236. const _key = key;
  237. sortObj[_key] = obj[_key];
  238. });
  239. }
  240. return !Object.keys(sortObj) ? obj : sortObj;
  241. }
  242. const encode = encodeURIComponent;
  243. function stringifyQuery(obj, encodeStr = encode) {
  244. const res = obj ? Object.keys(obj).map((key) => {
  245. let val = obj[key];
  246. if (typeof val === void 0 || val === null) {
  247. val = "";
  248. } else if (isPlainObject$1(val)) {
  249. val = JSON.stringify(val);
  250. }
  251. return encodeStr(key) + "=" + encodeStr(val);
  252. }).filter((x) => x.length > 0).join("&") : null;
  253. return res ? `?${res}` : "";
  254. }
  255. const PAGE_HOOKS = [
  256. ON_INIT,
  257. ON_LOAD,
  258. ON_SHOW,
  259. ON_HIDE,
  260. ON_UNLOAD,
  261. ON_BACK_PRESS,
  262. ON_PAGE_SCROLL,
  263. ON_TAB_ITEM_TAP,
  264. ON_REACH_BOTTOM,
  265. ON_PULL_DOWN_REFRESH,
  266. ON_SHARE_TIMELINE,
  267. ON_SHARE_APP_MESSAGE,
  268. ON_ADD_TO_FAVORITES,
  269. ON_SAVE_EXIT_STATE,
  270. ON_NAVIGATION_BAR_BUTTON_TAP,
  271. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  272. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  273. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  274. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  275. ];
  276. function isRootHook(name) {
  277. return PAGE_HOOKS.indexOf(name) > -1;
  278. }
  279. const UniLifecycleHooks = [
  280. ON_SHOW,
  281. ON_HIDE,
  282. ON_LAUNCH,
  283. ON_ERROR,
  284. ON_THEME_CHANGE,
  285. ON_PAGE_NOT_FOUND,
  286. ON_UNHANDLE_REJECTION,
  287. ON_INIT,
  288. ON_LOAD,
  289. ON_READY,
  290. ON_UNLOAD,
  291. ON_RESIZE,
  292. ON_BACK_PRESS,
  293. ON_PAGE_SCROLL,
  294. ON_TAB_ITEM_TAP,
  295. ON_REACH_BOTTOM,
  296. ON_PULL_DOWN_REFRESH,
  297. ON_SHARE_TIMELINE,
  298. ON_ADD_TO_FAVORITES,
  299. ON_SHARE_APP_MESSAGE,
  300. ON_SAVE_EXIT_STATE,
  301. ON_NAVIGATION_BAR_BUTTON_TAP,
  302. ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
  303. ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
  304. ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
  305. ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
  306. ];
  307. const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /* @__PURE__ */ (() => {
  308. return {
  309. onPageScroll: 1,
  310. onShareAppMessage: 1 << 1,
  311. onShareTimeline: 1 << 2
  312. };
  313. })();
  314. function isUniLifecycleHook(name, value, checkType = true) {
  315. if (checkType && !isFunction(value)) {
  316. return false;
  317. }
  318. if (UniLifecycleHooks.indexOf(name) > -1) {
  319. return true;
  320. } else if (name.indexOf("on") === 0) {
  321. return true;
  322. }
  323. return false;
  324. }
  325. let vueApp;
  326. const createVueAppHooks = [];
  327. function onCreateVueApp(hook) {
  328. if (vueApp) {
  329. return hook(vueApp);
  330. }
  331. createVueAppHooks.push(hook);
  332. }
  333. function invokeCreateVueAppHook(app) {
  334. vueApp = app;
  335. createVueAppHooks.forEach((hook) => hook(app));
  336. }
  337. const invokeCreateErrorHandler = once((app, createErrorHandler2) => {
  338. if (isFunction(app._component.onError)) {
  339. return createErrorHandler2(app);
  340. }
  341. });
  342. const E = function() {
  343. };
  344. E.prototype = {
  345. on: function(name, callback, ctx) {
  346. var e2 = this.e || (this.e = {});
  347. (e2[name] || (e2[name] = [])).push({
  348. fn: callback,
  349. ctx
  350. });
  351. return this;
  352. },
  353. once: function(name, callback, ctx) {
  354. var self2 = this;
  355. function listener() {
  356. self2.off(name, listener);
  357. callback.apply(ctx, arguments);
  358. }
  359. listener._ = callback;
  360. return this.on(name, listener, ctx);
  361. },
  362. emit: function(name) {
  363. var data = [].slice.call(arguments, 1);
  364. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  365. var i = 0;
  366. var len = evtArr.length;
  367. for (i; i < len; i++) {
  368. evtArr[i].fn.apply(evtArr[i].ctx, data);
  369. }
  370. return this;
  371. },
  372. off: function(name, callback) {
  373. var e2 = this.e || (this.e = {});
  374. var evts = e2[name];
  375. var liveEvents = [];
  376. if (evts && callback) {
  377. for (var i = 0, len = evts.length; i < len; i++) {
  378. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  379. liveEvents.push(evts[i]);
  380. }
  381. }
  382. liveEvents.length ? e2[name] = liveEvents : delete e2[name];
  383. return this;
  384. }
  385. };
  386. var E$1 = E;
  387. const LOCALE_ZH_HANS = "zh-Hans";
  388. const LOCALE_ZH_HANT = "zh-Hant";
  389. const LOCALE_EN = "en";
  390. const LOCALE_FR = "fr";
  391. const LOCALE_ES = "es";
  392. function include(str, parts) {
  393. return !!parts.find((part) => str.indexOf(part) !== -1);
  394. }
  395. function startsWith(str, parts) {
  396. return parts.find((part) => str.indexOf(part) === 0);
  397. }
  398. function normalizeLocale(locale, messages) {
  399. if (!locale) {
  400. return;
  401. }
  402. locale = locale.trim().replace(/_/g, "-");
  403. if (messages && messages[locale]) {
  404. return locale;
  405. }
  406. locale = locale.toLowerCase();
  407. if (locale === "chinese") {
  408. return LOCALE_ZH_HANS;
  409. }
  410. if (locale.indexOf("zh") === 0) {
  411. if (locale.indexOf("-hans") > -1) {
  412. return LOCALE_ZH_HANS;
  413. }
  414. if (locale.indexOf("-hant") > -1) {
  415. return LOCALE_ZH_HANT;
  416. }
  417. if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
  418. return LOCALE_ZH_HANT;
  419. }
  420. return LOCALE_ZH_HANS;
  421. }
  422. const lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  423. if (lang) {
  424. return lang;
  425. }
  426. }
  427. function getBaseSystemInfo() {
  428. return wx.getSystemInfoSync();
  429. }
  430. function validateProtocolFail(name, msg) {
  431. console.warn(`${name}: ${msg}`);
  432. }
  433. function validateProtocol(name, data, protocol, onFail) {
  434. if (!onFail) {
  435. onFail = validateProtocolFail;
  436. }
  437. for (const key in protocol) {
  438. const errMsg = validateProp$1(key, data[key], protocol[key], !hasOwn(data, key));
  439. if (isString(errMsg)) {
  440. onFail(name, errMsg);
  441. }
  442. }
  443. }
  444. function validateProtocols(name, args, protocol, onFail) {
  445. if (!protocol) {
  446. return;
  447. }
  448. if (!isArray(protocol)) {
  449. return validateProtocol(name, args[0] || /* @__PURE__ */ Object.create(null), protocol, onFail);
  450. }
  451. const len = protocol.length;
  452. const argsLen = args.length;
  453. for (let i = 0; i < len; i++) {
  454. const opts = protocol[i];
  455. const data = /* @__PURE__ */ Object.create(null);
  456. if (argsLen > i) {
  457. data[opts.name] = args[i];
  458. }
  459. validateProtocol(name, data, { [opts.name]: opts }, onFail);
  460. }
  461. }
  462. function validateProp$1(name, value, prop, isAbsent) {
  463. if (!isPlainObject$1(prop)) {
  464. prop = { type: prop };
  465. }
  466. const { type, required, validator } = prop;
  467. if (required && isAbsent) {
  468. return 'Missing required args: "' + name + '"';
  469. }
  470. if (value == null && !required) {
  471. return;
  472. }
  473. if (type != null) {
  474. let isValid = false;
  475. const types = isArray(type) ? type : [type];
  476. const expectedTypes = [];
  477. for (let i = 0; i < types.length && !isValid; i++) {
  478. const { valid, expectedType } = assertType$1(value, types[i]);
  479. expectedTypes.push(expectedType || "");
  480. isValid = valid;
  481. }
  482. if (!isValid) {
  483. return getInvalidTypeMessage$1(name, value, expectedTypes);
  484. }
  485. }
  486. if (validator) {
  487. return validator(value);
  488. }
  489. }
  490. const isSimpleType$1 = /* @__PURE__ */ makeMap("String,Number,Boolean,Function,Symbol");
  491. function assertType$1(value, type) {
  492. let valid;
  493. const expectedType = getType$1(type);
  494. if (isSimpleType$1(expectedType)) {
  495. const t2 = typeof value;
  496. valid = t2 === expectedType.toLowerCase();
  497. if (!valid && t2 === "object") {
  498. valid = value instanceof type;
  499. }
  500. } else if (expectedType === "Object") {
  501. valid = isObject(value);
  502. } else if (expectedType === "Array") {
  503. valid = isArray(value);
  504. } else {
  505. {
  506. valid = value instanceof type;
  507. }
  508. }
  509. return {
  510. valid,
  511. expectedType
  512. };
  513. }
  514. function getInvalidTypeMessage$1(name, value, expectedTypes) {
  515. let message = `Invalid args: type check failed for args "${name}". Expected ${expectedTypes.map(capitalize).join(", ")}`;
  516. const expectedType = expectedTypes[0];
  517. const receivedType = toRawType(value);
  518. const expectedValue = styleValue$1(value, expectedType);
  519. const receivedValue = styleValue$1(value, receivedType);
  520. if (expectedTypes.length === 1 && isExplicable$1(expectedType) && !isBoolean$1(expectedType, receivedType)) {
  521. message += ` with value ${expectedValue}`;
  522. }
  523. message += `, got ${receivedType} `;
  524. if (isExplicable$1(receivedType)) {
  525. message += `with value ${receivedValue}.`;
  526. }
  527. return message;
  528. }
  529. function getType$1(ctor) {
  530. const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
  531. return match ? match[1] : "";
  532. }
  533. function styleValue$1(value, type) {
  534. if (type === "String") {
  535. return `"${value}"`;
  536. } else if (type === "Number") {
  537. return `${Number(value)}`;
  538. } else {
  539. return `${value}`;
  540. }
  541. }
  542. function isExplicable$1(type) {
  543. const explicitTypes = ["string", "number", "boolean"];
  544. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  545. }
  546. function isBoolean$1(...args) {
  547. return args.some((elem) => elem.toLowerCase() === "boolean");
  548. }
  549. function tryCatch(fn) {
  550. return function() {
  551. try {
  552. return fn.apply(fn, arguments);
  553. } catch (e2) {
  554. console.error(e2);
  555. }
  556. };
  557. }
  558. let invokeCallbackId = 1;
  559. const invokeCallbacks = {};
  560. function addInvokeCallback(id, name, callback, keepAlive = false) {
  561. invokeCallbacks[id] = {
  562. name,
  563. keepAlive,
  564. callback
  565. };
  566. return id;
  567. }
  568. function invokeCallback(id, res, extras) {
  569. if (typeof id === "number") {
  570. const opts = invokeCallbacks[id];
  571. if (opts) {
  572. if (!opts.keepAlive) {
  573. delete invokeCallbacks[id];
  574. }
  575. return opts.callback(res, extras);
  576. }
  577. }
  578. return res;
  579. }
  580. const API_SUCCESS = "success";
  581. const API_FAIL = "fail";
  582. const API_COMPLETE = "complete";
  583. function getApiCallbacks(args) {
  584. const apiCallbacks = {};
  585. for (const name in args) {
  586. const fn = args[name];
  587. if (isFunction(fn)) {
  588. apiCallbacks[name] = tryCatch(fn);
  589. delete args[name];
  590. }
  591. }
  592. return apiCallbacks;
  593. }
  594. function normalizeErrMsg$1(errMsg, name) {
  595. if (!errMsg || errMsg.indexOf(":fail") === -1) {
  596. return name + ":ok";
  597. }
  598. return name + errMsg.substring(errMsg.indexOf(":fail"));
  599. }
  600. function createAsyncApiCallback(name, args = {}, { beforeAll, beforeSuccess } = {}) {
  601. if (!isPlainObject$1(args)) {
  602. args = {};
  603. }
  604. const { success, fail, complete } = getApiCallbacks(args);
  605. const hasSuccess = isFunction(success);
  606. const hasFail = isFunction(fail);
  607. const hasComplete = isFunction(complete);
  608. const callbackId = invokeCallbackId++;
  609. addInvokeCallback(callbackId, name, (res) => {
  610. res = res || {};
  611. res.errMsg = normalizeErrMsg$1(res.errMsg, name);
  612. isFunction(beforeAll) && beforeAll(res);
  613. if (res.errMsg === name + ":ok") {
  614. isFunction(beforeSuccess) && beforeSuccess(res, args);
  615. hasSuccess && success(res);
  616. } else {
  617. hasFail && fail(res);
  618. }
  619. hasComplete && complete(res);
  620. });
  621. return callbackId;
  622. }
  623. const HOOK_SUCCESS = "success";
  624. const HOOK_FAIL = "fail";
  625. const HOOK_COMPLETE = "complete";
  626. const globalInterceptors = {};
  627. const scopedInterceptors = {};
  628. function wrapperHook(hook, params) {
  629. return function(data) {
  630. return hook(data, params) || data;
  631. };
  632. }
  633. function queue$1(hooks, data, params) {
  634. let promise = false;
  635. for (let i = 0; i < hooks.length; i++) {
  636. const hook = hooks[i];
  637. if (promise) {
  638. promise = Promise.resolve(wrapperHook(hook, params));
  639. } else {
  640. const res = hook(data, params);
  641. if (isPromise(res)) {
  642. promise = Promise.resolve(res);
  643. }
  644. if (res === false) {
  645. return {
  646. then() {
  647. },
  648. catch() {
  649. }
  650. };
  651. }
  652. }
  653. }
  654. return promise || {
  655. then(callback) {
  656. return callback(data);
  657. },
  658. catch() {
  659. }
  660. };
  661. }
  662. function wrapperOptions(interceptors2, options = {}) {
  663. [HOOK_SUCCESS, HOOK_FAIL, HOOK_COMPLETE].forEach((name) => {
  664. const hooks = interceptors2[name];
  665. if (!isArray(hooks)) {
  666. return;
  667. }
  668. const oldCallback = options[name];
  669. options[name] = function callbackInterceptor(res) {
  670. queue$1(hooks, res, options).then((res2) => {
  671. return isFunction(oldCallback) && oldCallback(res2) || res2;
  672. });
  673. };
  674. });
  675. return options;
  676. }
  677. function wrapperReturnValue(method, returnValue) {
  678. const returnValueHooks = [];
  679. if (isArray(globalInterceptors.returnValue)) {
  680. returnValueHooks.push(...globalInterceptors.returnValue);
  681. }
  682. const interceptor = scopedInterceptors[method];
  683. if (interceptor && isArray(interceptor.returnValue)) {
  684. returnValueHooks.push(...interceptor.returnValue);
  685. }
  686. returnValueHooks.forEach((hook) => {
  687. returnValue = hook(returnValue) || returnValue;
  688. });
  689. return returnValue;
  690. }
  691. function getApiInterceptorHooks(method) {
  692. const interceptor = /* @__PURE__ */ Object.create(null);
  693. Object.keys(globalInterceptors).forEach((hook) => {
  694. if (hook !== "returnValue") {
  695. interceptor[hook] = globalInterceptors[hook].slice();
  696. }
  697. });
  698. const scopedInterceptor = scopedInterceptors[method];
  699. if (scopedInterceptor) {
  700. Object.keys(scopedInterceptor).forEach((hook) => {
  701. if (hook !== "returnValue") {
  702. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  703. }
  704. });
  705. }
  706. return interceptor;
  707. }
  708. function invokeApi(method, api, options, params) {
  709. const interceptor = getApiInterceptorHooks(method);
  710. if (interceptor && Object.keys(interceptor).length) {
  711. if (isArray(interceptor.invoke)) {
  712. const res = queue$1(interceptor.invoke, options);
  713. return res.then((options2) => {
  714. return api(wrapperOptions(getApiInterceptorHooks(method), options2), ...params);
  715. });
  716. } else {
  717. return api(wrapperOptions(interceptor, options), ...params);
  718. }
  719. }
  720. return api(options, ...params);
  721. }
  722. function hasCallback(args) {
  723. if (isPlainObject$1(args) && [API_SUCCESS, API_FAIL, API_COMPLETE].find((cb) => isFunction(args[cb]))) {
  724. return true;
  725. }
  726. return false;
  727. }
  728. function handlePromise(promise) {
  729. return promise;
  730. }
  731. function promisify$1(name, fn) {
  732. return (args = {}, ...rest) => {
  733. if (hasCallback(args)) {
  734. return wrapperReturnValue(name, invokeApi(name, fn, args, rest));
  735. }
  736. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  737. invokeApi(name, fn, extend(args, { success: resolve2, fail: reject }), rest);
  738. })));
  739. };
  740. }
  741. function formatApiArgs(args, options) {
  742. const params = args[0];
  743. if (!options || !isPlainObject$1(options.formatArgs) && isPlainObject$1(params)) {
  744. return;
  745. }
  746. const formatArgs = options.formatArgs;
  747. const keys = Object.keys(formatArgs);
  748. for (let i = 0; i < keys.length; i++) {
  749. const name = keys[i];
  750. const formatterOrDefaultValue = formatArgs[name];
  751. if (isFunction(formatterOrDefaultValue)) {
  752. const errMsg = formatterOrDefaultValue(args[0][name], params);
  753. if (isString(errMsg)) {
  754. return errMsg;
  755. }
  756. } else {
  757. if (!hasOwn(params, name)) {
  758. params[name] = formatterOrDefaultValue;
  759. }
  760. }
  761. }
  762. }
  763. function invokeSuccess(id, name, res) {
  764. return invokeCallback(id, extend(res || {}, { errMsg: name + ":ok" }));
  765. }
  766. function invokeFail(id, name, errMsg, errRes) {
  767. return invokeCallback(id, extend({ errMsg: name + ":fail" + (errMsg ? " " + errMsg : "") }, errRes));
  768. }
  769. function beforeInvokeApi(name, args, protocol, options) {
  770. {
  771. validateProtocols(name, args, protocol);
  772. }
  773. if (options && options.beforeInvoke) {
  774. const errMsg2 = options.beforeInvoke(args);
  775. if (isString(errMsg2)) {
  776. return errMsg2;
  777. }
  778. }
  779. const errMsg = formatApiArgs(args, options);
  780. if (errMsg) {
  781. return errMsg;
  782. }
  783. }
  784. function normalizeErrMsg(errMsg) {
  785. if (!errMsg || isString(errMsg)) {
  786. return errMsg;
  787. }
  788. if (errMsg.stack) {
  789. console.error(errMsg.message + LINEFEED + errMsg.stack);
  790. return errMsg.message;
  791. }
  792. return errMsg;
  793. }
  794. function wrapperTaskApi(name, fn, protocol, options) {
  795. return (args) => {
  796. const id = createAsyncApiCallback(name, args, options);
  797. const errMsg = beforeInvokeApi(name, [args], protocol, options);
  798. if (errMsg) {
  799. return invokeFail(id, name, errMsg);
  800. }
  801. return fn(args, {
  802. resolve: (res) => invokeSuccess(id, name, res),
  803. reject: (errMsg2, errRes) => invokeFail(id, name, normalizeErrMsg(errMsg2), errRes)
  804. });
  805. };
  806. }
  807. function wrapperSyncApi(name, fn, protocol, options) {
  808. return (...args) => {
  809. const errMsg = beforeInvokeApi(name, args, protocol, options);
  810. if (errMsg) {
  811. throw new Error(errMsg);
  812. }
  813. return fn.apply(null, args);
  814. };
  815. }
  816. function wrapperAsyncApi(name, fn, protocol, options) {
  817. return wrapperTaskApi(name, fn, protocol, options);
  818. }
  819. function defineSyncApi(name, fn, protocol, options) {
  820. return wrapperSyncApi(name, fn, protocol, options);
  821. }
  822. function defineAsyncApi(name, fn, protocol, options) {
  823. return promisify$1(name, wrapperAsyncApi(name, fn, protocol, options));
  824. }
  825. const API_UPX2PX = "upx2px";
  826. const Upx2pxProtocol = [
  827. {
  828. name: "upx",
  829. type: [Number, String],
  830. required: true
  831. }
  832. ];
  833. const EPS = 1e-4;
  834. const BASE_DEVICE_WIDTH = 750;
  835. let isIOS = false;
  836. let deviceWidth = 0;
  837. let deviceDPR = 0;
  838. function checkDeviceWidth() {
  839. const { platform, pixelRatio, windowWidth } = getBaseSystemInfo();
  840. deviceWidth = windowWidth;
  841. deviceDPR = pixelRatio;
  842. isIOS = platform === "ios";
  843. }
  844. const upx2px = defineSyncApi(API_UPX2PX, (number, newDeviceWidth) => {
  845. if (deviceWidth === 0) {
  846. checkDeviceWidth();
  847. }
  848. number = Number(number);
  849. if (number === 0) {
  850. return 0;
  851. }
  852. let width = newDeviceWidth || deviceWidth;
  853. let result = number / BASE_DEVICE_WIDTH * width;
  854. if (result < 0) {
  855. result = -result;
  856. }
  857. result = Math.floor(result + EPS);
  858. if (result === 0) {
  859. if (deviceDPR === 1 || !isIOS) {
  860. result = 1;
  861. } else {
  862. result = 0.5;
  863. }
  864. }
  865. return number < 0 ? -result : result;
  866. }, Upx2pxProtocol);
  867. const API_ADD_INTERCEPTOR = "addInterceptor";
  868. const API_REMOVE_INTERCEPTOR = "removeInterceptor";
  869. const AddInterceptorProtocol = [
  870. {
  871. name: "method",
  872. type: [String, Object],
  873. required: true
  874. }
  875. ];
  876. const RemoveInterceptorProtocol = AddInterceptorProtocol;
  877. function mergeInterceptorHook(interceptors2, interceptor) {
  878. Object.keys(interceptor).forEach((hook) => {
  879. if (isFunction(interceptor[hook])) {
  880. interceptors2[hook] = mergeHook(interceptors2[hook], interceptor[hook]);
  881. }
  882. });
  883. }
  884. function removeInterceptorHook(interceptors2, interceptor) {
  885. if (!interceptors2 || !interceptor) {
  886. return;
  887. }
  888. Object.keys(interceptor).forEach((name) => {
  889. const hooks = interceptors2[name];
  890. const hook = interceptor[name];
  891. if (isArray(hooks) && isFunction(hook)) {
  892. remove(hooks, hook);
  893. }
  894. });
  895. }
  896. function mergeHook(parentVal, childVal) {
  897. const res = childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  898. return res ? dedupeHooks(res) : res;
  899. }
  900. function dedupeHooks(hooks) {
  901. const res = [];
  902. for (let i = 0; i < hooks.length; i++) {
  903. if (res.indexOf(hooks[i]) === -1) {
  904. res.push(hooks[i]);
  905. }
  906. }
  907. return res;
  908. }
  909. const addInterceptor = defineSyncApi(API_ADD_INTERCEPTOR, (method, interceptor) => {
  910. if (isString(method) && isPlainObject$1(interceptor)) {
  911. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), interceptor);
  912. } else if (isPlainObject$1(method)) {
  913. mergeInterceptorHook(globalInterceptors, method);
  914. }
  915. }, AddInterceptorProtocol);
  916. const removeInterceptor = defineSyncApi(API_REMOVE_INTERCEPTOR, (method, interceptor) => {
  917. if (isString(method)) {
  918. if (isPlainObject$1(interceptor)) {
  919. removeInterceptorHook(scopedInterceptors[method], interceptor);
  920. } else {
  921. delete scopedInterceptors[method];
  922. }
  923. } else if (isPlainObject$1(method)) {
  924. removeInterceptorHook(globalInterceptors, method);
  925. }
  926. }, RemoveInterceptorProtocol);
  927. const interceptors = {};
  928. const API_ON = "$on";
  929. const OnProtocol = [
  930. {
  931. name: "event",
  932. type: String,
  933. required: true
  934. },
  935. {
  936. name: "callback",
  937. type: Function,
  938. required: true
  939. }
  940. ];
  941. const API_ONCE = "$once";
  942. const OnceProtocol = OnProtocol;
  943. const API_OFF = "$off";
  944. const OffProtocol = [
  945. {
  946. name: "event",
  947. type: [String, Array]
  948. },
  949. {
  950. name: "callback",
  951. type: Function
  952. }
  953. ];
  954. const API_EMIT = "$emit";
  955. const EmitProtocol = [
  956. {
  957. name: "event",
  958. type: String,
  959. required: true
  960. }
  961. ];
  962. const emitter = new E$1();
  963. const $on = defineSyncApi(API_ON, (name, callback) => {
  964. emitter.on(name, callback);
  965. return () => emitter.off(name, callback);
  966. }, OnProtocol);
  967. const $once = defineSyncApi(API_ONCE, (name, callback) => {
  968. emitter.once(name, callback);
  969. return () => emitter.off(name, callback);
  970. }, OnceProtocol);
  971. const $off = defineSyncApi(API_OFF, (name, callback) => {
  972. if (!name) {
  973. emitter.e = {};
  974. return;
  975. }
  976. if (!isArray(name))
  977. name = [name];
  978. name.forEach((n2) => emitter.off(n2, callback));
  979. }, OffProtocol);
  980. const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
  981. emitter.emit(name, ...args);
  982. }, EmitProtocol);
  983. let cid;
  984. let cidErrMsg;
  985. let enabled;
  986. function normalizePushMessage(message) {
  987. try {
  988. return JSON.parse(message);
  989. } catch (e2) {
  990. }
  991. return message;
  992. }
  993. function invokePushCallback(args) {
  994. if (args.type === "enabled") {
  995. enabled = true;
  996. } else if (args.type === "clientId") {
  997. cid = args.cid;
  998. cidErrMsg = args.errMsg;
  999. invokeGetPushCidCallbacks(cid, args.errMsg);
  1000. } else if (args.type === "pushMsg") {
  1001. const message = {
  1002. type: "receive",
  1003. data: normalizePushMessage(args.message)
  1004. };
  1005. for (let i = 0; i < onPushMessageCallbacks.length; i++) {
  1006. const callback = onPushMessageCallbacks[i];
  1007. callback(message);
  1008. if (message.stopped) {
  1009. break;
  1010. }
  1011. }
  1012. } else if (args.type === "click") {
  1013. onPushMessageCallbacks.forEach((callback) => {
  1014. callback({
  1015. type: "click",
  1016. data: normalizePushMessage(args.message)
  1017. });
  1018. });
  1019. }
  1020. }
  1021. const getPushCidCallbacks = [];
  1022. function invokeGetPushCidCallbacks(cid2, errMsg) {
  1023. getPushCidCallbacks.forEach((callback) => {
  1024. callback(cid2, errMsg);
  1025. });
  1026. getPushCidCallbacks.length = 0;
  1027. }
  1028. const API_GET_PUSH_CLIENT_ID = "getPushClientId";
  1029. const getPushClientId = defineAsyncApi(API_GET_PUSH_CLIENT_ID, (_, { resolve: resolve2, reject }) => {
  1030. Promise.resolve().then(() => {
  1031. if (typeof enabled === "undefined") {
  1032. enabled = false;
  1033. cid = "";
  1034. cidErrMsg = "uniPush is not enabled";
  1035. }
  1036. getPushCidCallbacks.push((cid2, errMsg) => {
  1037. if (cid2) {
  1038. resolve2({ cid: cid2 });
  1039. } else {
  1040. reject(errMsg);
  1041. }
  1042. });
  1043. if (typeof cid !== "undefined") {
  1044. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1045. }
  1046. });
  1047. });
  1048. const onPushMessageCallbacks = [];
  1049. const onPushMessage = (fn) => {
  1050. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1051. onPushMessageCallbacks.push(fn);
  1052. }
  1053. };
  1054. const offPushMessage = (fn) => {
  1055. if (!fn) {
  1056. onPushMessageCallbacks.length = 0;
  1057. } else {
  1058. const index2 = onPushMessageCallbacks.indexOf(fn);
  1059. if (index2 > -1) {
  1060. onPushMessageCallbacks.splice(index2, 1);
  1061. }
  1062. }
  1063. };
  1064. const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo|getSystemSetting|getAppAuthorizeSetting/;
  1065. const CONTEXT_API_RE = /^create|Manager$/;
  1066. const CONTEXT_API_RE_EXC = ["createBLEConnection"];
  1067. const ASYNC_API = ["createBLEConnection"];
  1068. const CALLBACK_API_RE = /^on|^off/;
  1069. function isContextApi(name) {
  1070. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  1071. }
  1072. function isSyncApi(name) {
  1073. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  1074. }
  1075. function isCallbackApi(name) {
  1076. return CALLBACK_API_RE.test(name) && name !== "onPush";
  1077. }
  1078. function shouldPromise(name) {
  1079. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  1080. return false;
  1081. }
  1082. return true;
  1083. }
  1084. if (!Promise.prototype.finally) {
  1085. Promise.prototype.finally = function(onfinally) {
  1086. const promise = this.constructor;
  1087. return this.then((value) => promise.resolve(onfinally && onfinally()).then(() => value), (reason) => promise.resolve(onfinally && onfinally()).then(() => {
  1088. throw reason;
  1089. }));
  1090. };
  1091. }
  1092. function promisify(name, api) {
  1093. if (!shouldPromise(name)) {
  1094. return api;
  1095. }
  1096. if (!isFunction(api)) {
  1097. return api;
  1098. }
  1099. return function promiseApi(options = {}, ...rest) {
  1100. if (isFunction(options.success) || isFunction(options.fail) || isFunction(options.complete)) {
  1101. return wrapperReturnValue(name, invokeApi(name, api, options, rest));
  1102. }
  1103. return wrapperReturnValue(name, handlePromise(new Promise((resolve2, reject) => {
  1104. invokeApi(name, api, extend({}, options, {
  1105. success: resolve2,
  1106. fail: reject
  1107. }), rest);
  1108. })));
  1109. };
  1110. }
  1111. const CALLBACKS = ["success", "fail", "cancel", "complete"];
  1112. function initWrapper(protocols2) {
  1113. function processCallback(methodName, method, returnValue) {
  1114. return function(res) {
  1115. return method(processReturnValue(methodName, res, returnValue));
  1116. };
  1117. }
  1118. function processArgs(methodName, fromArgs, argsOption = {}, returnValue = {}, keepFromArgs = false) {
  1119. if (isPlainObject$1(fromArgs)) {
  1120. const toArgs = keepFromArgs === true ? fromArgs : {};
  1121. if (isFunction(argsOption)) {
  1122. argsOption = argsOption(fromArgs, toArgs) || {};
  1123. }
  1124. for (const key in fromArgs) {
  1125. if (hasOwn(argsOption, key)) {
  1126. let keyOption = argsOption[key];
  1127. if (isFunction(keyOption)) {
  1128. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  1129. }
  1130. if (!keyOption) {
  1131. console.warn(`微信小程序 ${methodName} 暂不支持 ${key}`);
  1132. } else if (isString(keyOption)) {
  1133. toArgs[keyOption] = fromArgs[key];
  1134. } else if (isPlainObject$1(keyOption)) {
  1135. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  1136. }
  1137. } else if (CALLBACKS.indexOf(key) !== -1) {
  1138. const callback = fromArgs[key];
  1139. if (isFunction(callback)) {
  1140. toArgs[key] = processCallback(methodName, callback, returnValue);
  1141. }
  1142. } else {
  1143. if (!keepFromArgs && !hasOwn(toArgs, key)) {
  1144. toArgs[key] = fromArgs[key];
  1145. }
  1146. }
  1147. }
  1148. return toArgs;
  1149. } else if (isFunction(fromArgs)) {
  1150. fromArgs = processCallback(methodName, fromArgs, returnValue);
  1151. }
  1152. return fromArgs;
  1153. }
  1154. function processReturnValue(methodName, res, returnValue, keepReturnValue = false) {
  1155. if (isFunction(protocols2.returnValue)) {
  1156. res = protocols2.returnValue(methodName, res);
  1157. }
  1158. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  1159. }
  1160. return function wrapper(methodName, method) {
  1161. if (!hasOwn(protocols2, methodName)) {
  1162. return method;
  1163. }
  1164. const protocol = protocols2[methodName];
  1165. if (!protocol) {
  1166. return function() {
  1167. console.error(`微信小程序 暂不支持${methodName}`);
  1168. };
  1169. }
  1170. return function(arg1, arg2) {
  1171. let options = protocol;
  1172. if (isFunction(protocol)) {
  1173. options = protocol(arg1);
  1174. }
  1175. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  1176. const args = [arg1];
  1177. if (typeof arg2 !== "undefined") {
  1178. args.push(arg2);
  1179. }
  1180. const returnValue = wx[options.name || methodName].apply(wx, args);
  1181. if (isSyncApi(methodName)) {
  1182. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  1183. }
  1184. return returnValue;
  1185. };
  1186. };
  1187. }
  1188. const getLocale = () => {
  1189. const app = isFunction(getApp) && getApp({ allowDefault: true });
  1190. if (app && app.$vm) {
  1191. return app.$vm.$locale;
  1192. }
  1193. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1194. };
  1195. const setLocale = (locale) => {
  1196. const app = isFunction(getApp) && getApp();
  1197. if (!app) {
  1198. return false;
  1199. }
  1200. const oldLocale = app.$vm.$locale;
  1201. if (oldLocale !== locale) {
  1202. app.$vm.$locale = locale;
  1203. onLocaleChangeCallbacks.forEach((fn) => fn({ locale }));
  1204. return true;
  1205. }
  1206. return false;
  1207. };
  1208. const onLocaleChangeCallbacks = [];
  1209. const onLocaleChange = (fn) => {
  1210. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  1211. onLocaleChangeCallbacks.push(fn);
  1212. }
  1213. };
  1214. if (typeof global !== "undefined") {
  1215. global.getLocale = getLocale;
  1216. }
  1217. const UUID_KEY = "__DC_STAT_UUID";
  1218. let deviceId;
  1219. function useDeviceId(global2 = wx) {
  1220. return function addDeviceId(_, toRes) {
  1221. deviceId = deviceId || global2.getStorageSync(UUID_KEY);
  1222. if (!deviceId) {
  1223. deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
  1224. wx.setStorage({
  1225. key: UUID_KEY,
  1226. data: deviceId
  1227. });
  1228. }
  1229. toRes.deviceId = deviceId;
  1230. };
  1231. }
  1232. function addSafeAreaInsets(fromRes, toRes) {
  1233. if (fromRes.safeArea) {
  1234. const safeArea = fromRes.safeArea;
  1235. toRes.safeAreaInsets = {
  1236. top: safeArea.top,
  1237. left: safeArea.left,
  1238. right: fromRes.windowWidth - safeArea.right,
  1239. bottom: fromRes.screenHeight - safeArea.bottom
  1240. };
  1241. }
  1242. }
  1243. function populateParameters(fromRes, toRes) {
  1244. const { brand = "", model = "", system = "", language = "", theme, version: version2, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation } = fromRes;
  1245. let osName = "";
  1246. let osVersion = "";
  1247. {
  1248. osName = system.split(" ")[0] || "";
  1249. osVersion = system.split(" ")[1] || "";
  1250. }
  1251. let hostVersion = version2;
  1252. let deviceType = getGetDeviceType(fromRes, model);
  1253. let deviceBrand = getDeviceBrand(brand);
  1254. let _hostName = getHostName(fromRes);
  1255. let _deviceOrientation = deviceOrientation;
  1256. let _devicePixelRatio = pixelRatio;
  1257. let _SDKVersion = SDKVersion;
  1258. const hostLanguage = language.replace(/_/g, "-");
  1259. const parameters = {
  1260. appId: "__UNI__445D057",
  1261. appName: "新疆小程序",
  1262. appVersion: "1.0.0",
  1263. appVersionCode: "100",
  1264. appLanguage: getAppLanguage(hostLanguage),
  1265. uniCompileVersion: "3.7.11",
  1266. uniRuntimeVersion: "3.7.11",
  1267. uniPlatform: "mp-weixin",
  1268. deviceBrand,
  1269. deviceModel: model,
  1270. deviceType,
  1271. devicePixelRatio: _devicePixelRatio,
  1272. deviceOrientation: _deviceOrientation,
  1273. osName: osName.toLocaleLowerCase(),
  1274. osVersion,
  1275. hostTheme: theme,
  1276. hostVersion,
  1277. hostLanguage,
  1278. hostName: _hostName,
  1279. hostSDKVersion: _SDKVersion,
  1280. hostFontSizeSetting: fontSizeSetting,
  1281. windowTop: 0,
  1282. windowBottom: 0,
  1283. // TODO
  1284. osLanguage: void 0,
  1285. osTheme: void 0,
  1286. ua: void 0,
  1287. hostPackageName: void 0,
  1288. browserName: void 0,
  1289. browserVersion: void 0
  1290. };
  1291. extend(toRes, parameters);
  1292. }
  1293. function getGetDeviceType(fromRes, model) {
  1294. let deviceType = fromRes.deviceType || "phone";
  1295. {
  1296. const deviceTypeMaps = {
  1297. ipad: "pad",
  1298. windows: "pc",
  1299. mac: "pc"
  1300. };
  1301. const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  1302. const _model = model.toLocaleLowerCase();
  1303. for (let index2 = 0; index2 < deviceTypeMapsKeys.length; index2++) {
  1304. const _m = deviceTypeMapsKeys[index2];
  1305. if (_model.indexOf(_m) !== -1) {
  1306. deviceType = deviceTypeMaps[_m];
  1307. break;
  1308. }
  1309. }
  1310. }
  1311. return deviceType;
  1312. }
  1313. function getDeviceBrand(brand) {
  1314. let deviceBrand = brand;
  1315. if (deviceBrand) {
  1316. deviceBrand = deviceBrand.toLocaleLowerCase();
  1317. }
  1318. return deviceBrand;
  1319. }
  1320. function getAppLanguage(defaultLanguage) {
  1321. return getLocale ? getLocale() : defaultLanguage;
  1322. }
  1323. function getHostName(fromRes) {
  1324. const _platform = "WeChat";
  1325. let _hostName = fromRes.hostName || _platform;
  1326. {
  1327. if (fromRes.environment) {
  1328. _hostName = fromRes.environment;
  1329. } else if (fromRes.host && fromRes.host.env) {
  1330. _hostName = fromRes.host.env;
  1331. }
  1332. }
  1333. return _hostName;
  1334. }
  1335. const getSystemInfo = {
  1336. returnValue: (fromRes, toRes) => {
  1337. addSafeAreaInsets(fromRes, toRes);
  1338. useDeviceId()(fromRes, toRes);
  1339. populateParameters(fromRes, toRes);
  1340. }
  1341. };
  1342. const getSystemInfoSync = getSystemInfo;
  1343. const redirectTo = {};
  1344. const previewImage = {
  1345. args(fromArgs, toArgs) {
  1346. let currentIndex = parseInt(fromArgs.current);
  1347. if (isNaN(currentIndex)) {
  1348. return;
  1349. }
  1350. const urls = fromArgs.urls;
  1351. if (!isArray(urls)) {
  1352. return;
  1353. }
  1354. const len = urls.length;
  1355. if (!len) {
  1356. return;
  1357. }
  1358. if (currentIndex < 0) {
  1359. currentIndex = 0;
  1360. } else if (currentIndex >= len) {
  1361. currentIndex = len - 1;
  1362. }
  1363. if (currentIndex > 0) {
  1364. toArgs.current = urls[currentIndex];
  1365. toArgs.urls = urls.filter((item, index2) => index2 < currentIndex ? item !== urls[currentIndex] : true);
  1366. } else {
  1367. toArgs.current = urls[0];
  1368. }
  1369. return {
  1370. indicator: false,
  1371. loop: false
  1372. };
  1373. }
  1374. };
  1375. const showActionSheet = {
  1376. args(fromArgs, toArgs) {
  1377. toArgs.alertText = fromArgs.title;
  1378. }
  1379. };
  1380. const getDeviceInfo = {
  1381. returnValue: (fromRes, toRes) => {
  1382. const { brand, model } = fromRes;
  1383. let deviceType = getGetDeviceType(fromRes, model);
  1384. let deviceBrand = getDeviceBrand(brand);
  1385. useDeviceId()(fromRes, toRes);
  1386. toRes = sortObject(extend(toRes, {
  1387. deviceType,
  1388. deviceBrand,
  1389. deviceModel: model
  1390. }));
  1391. }
  1392. };
  1393. const getAppBaseInfo = {
  1394. returnValue: (fromRes, toRes) => {
  1395. const { version: version2, language, SDKVersion, theme } = fromRes;
  1396. let _hostName = getHostName(fromRes);
  1397. let hostLanguage = language.replace(/_/g, "-");
  1398. toRes = sortObject(extend(toRes, {
  1399. hostVersion: version2,
  1400. hostLanguage,
  1401. hostName: _hostName,
  1402. hostSDKVersion: SDKVersion,
  1403. hostTheme: theme,
  1404. appId: "__UNI__445D057",
  1405. appName: "新疆小程序",
  1406. appVersion: "1.0.0",
  1407. appVersionCode: "100",
  1408. appLanguage: getAppLanguage(hostLanguage)
  1409. }));
  1410. }
  1411. };
  1412. const getWindowInfo = {
  1413. returnValue: (fromRes, toRes) => {
  1414. addSafeAreaInsets(fromRes, toRes);
  1415. toRes = sortObject(extend(toRes, {
  1416. windowTop: 0,
  1417. windowBottom: 0
  1418. }));
  1419. }
  1420. };
  1421. const getAppAuthorizeSetting = {
  1422. returnValue: function(fromRes, toRes) {
  1423. const { locationReducedAccuracy } = fromRes;
  1424. toRes.locationAccuracy = "unsupported";
  1425. if (locationReducedAccuracy === true) {
  1426. toRes.locationAccuracy = "reduced";
  1427. } else if (locationReducedAccuracy === false) {
  1428. toRes.locationAccuracy = "full";
  1429. }
  1430. }
  1431. };
  1432. const baseApis = {
  1433. $on,
  1434. $off,
  1435. $once,
  1436. $emit,
  1437. upx2px,
  1438. interceptors,
  1439. addInterceptor,
  1440. removeInterceptor,
  1441. onCreateVueApp,
  1442. invokeCreateVueAppHook,
  1443. getLocale,
  1444. setLocale,
  1445. onLocaleChange,
  1446. getPushClientId,
  1447. onPushMessage,
  1448. offPushMessage,
  1449. invokePushCallback
  1450. };
  1451. function initUni(api, protocols2, platform = wx) {
  1452. const wrapper = initWrapper(protocols2);
  1453. const UniProxyHandlers = {
  1454. get(target, key) {
  1455. if (hasOwn(target, key)) {
  1456. return target[key];
  1457. }
  1458. if (hasOwn(api, key)) {
  1459. return promisify(key, api[key]);
  1460. }
  1461. if (hasOwn(baseApis, key)) {
  1462. return promisify(key, baseApis[key]);
  1463. }
  1464. return promisify(key, wrapper(key, platform[key]));
  1465. }
  1466. };
  1467. return new Proxy({}, UniProxyHandlers);
  1468. }
  1469. function initGetProvider(providers) {
  1470. return function getProvider2({ service, success, fail, complete }) {
  1471. let res;
  1472. if (providers[service]) {
  1473. res = {
  1474. errMsg: "getProvider:ok",
  1475. service,
  1476. provider: providers[service]
  1477. };
  1478. isFunction(success) && success(res);
  1479. } else {
  1480. res = {
  1481. errMsg: "getProvider:fail:服务[" + service + "]不存在"
  1482. };
  1483. isFunction(fail) && fail(res);
  1484. }
  1485. isFunction(complete) && complete(res);
  1486. };
  1487. }
  1488. const objectKeys = [
  1489. "qy",
  1490. "env",
  1491. "error",
  1492. "version",
  1493. "lanDebug",
  1494. "cloud",
  1495. "serviceMarket",
  1496. "router",
  1497. "worklet"
  1498. ];
  1499. const singlePageDisableKey = ["lanDebug", "router", "worklet"];
  1500. const launchOption = wx.getLaunchOptionsSync ? wx.getLaunchOptionsSync() : null;
  1501. function isWxKey(key) {
  1502. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  1503. return false;
  1504. }
  1505. return objectKeys.indexOf(key) > -1 || typeof wx[key] === "function";
  1506. }
  1507. function initWx() {
  1508. const newWx = {};
  1509. for (const key in wx) {
  1510. if (isWxKey(key)) {
  1511. newWx[key] = wx[key];
  1512. }
  1513. }
  1514. if (typeof globalThis !== "undefined") {
  1515. globalThis.wx = newWx;
  1516. }
  1517. return newWx;
  1518. }
  1519. const mocks$1 = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  1520. const getProvider = initGetProvider({
  1521. oauth: ["weixin"],
  1522. share: ["weixin"],
  1523. payment: ["wxpay"],
  1524. push: ["weixin"]
  1525. });
  1526. function initComponentMocks(component) {
  1527. const res = /* @__PURE__ */ Object.create(null);
  1528. mocks$1.forEach((name) => {
  1529. res[name] = component[name];
  1530. });
  1531. return res;
  1532. }
  1533. function createSelectorQuery() {
  1534. const query = wx$2.createSelectorQuery();
  1535. const oldIn = query.in;
  1536. query.in = function newIn(component) {
  1537. return oldIn.call(this, initComponentMocks(component));
  1538. };
  1539. return query;
  1540. }
  1541. const wx$2 = initWx();
  1542. let baseInfo = wx$2.getAppBaseInfo && wx$2.getAppBaseInfo();
  1543. if (!baseInfo) {
  1544. baseInfo = wx$2.getSystemInfoSync();
  1545. }
  1546. const host = baseInfo ? baseInfo.host : null;
  1547. const shareVideoMessage = host && host.env === "SAAASDK" ? wx$2.miniapp.shareVideoMessage : wx$2.shareVideoMessage;
  1548. var shims = /* @__PURE__ */ Object.freeze({
  1549. __proto__: null,
  1550. createSelectorQuery,
  1551. getProvider,
  1552. shareVideoMessage
  1553. });
  1554. const compressImage = {
  1555. args(fromArgs, toArgs) {
  1556. if (fromArgs.compressedHeight && !toArgs.compressHeight) {
  1557. toArgs.compressHeight = fromArgs.compressedHeight;
  1558. }
  1559. if (fromArgs.compressedWidth && !toArgs.compressWidth) {
  1560. toArgs.compressWidth = fromArgs.compressedWidth;
  1561. }
  1562. }
  1563. };
  1564. var protocols = /* @__PURE__ */ Object.freeze({
  1565. __proto__: null,
  1566. compressImage,
  1567. getAppAuthorizeSetting,
  1568. getAppBaseInfo,
  1569. getDeviceInfo,
  1570. getSystemInfo,
  1571. getSystemInfoSync,
  1572. getWindowInfo,
  1573. previewImage,
  1574. redirectTo,
  1575. showActionSheet
  1576. });
  1577. const wx$1 = initWx();
  1578. var index = initUni(shims, protocols, wx$1);
  1579. function warn$1(msg, ...args) {
  1580. console.warn(`[Vue warn] ${msg}`, ...args);
  1581. }
  1582. let activeEffectScope;
  1583. class EffectScope {
  1584. constructor(detached = false) {
  1585. this.detached = detached;
  1586. this._active = true;
  1587. this.effects = [];
  1588. this.cleanups = [];
  1589. this.parent = activeEffectScope;
  1590. if (!detached && activeEffectScope) {
  1591. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
  1592. }
  1593. }
  1594. get active() {
  1595. return this._active;
  1596. }
  1597. run(fn) {
  1598. if (this._active) {
  1599. const currentEffectScope = activeEffectScope;
  1600. try {
  1601. activeEffectScope = this;
  1602. return fn();
  1603. } finally {
  1604. activeEffectScope = currentEffectScope;
  1605. }
  1606. } else {
  1607. warn$1(`cannot run an inactive effect scope.`);
  1608. }
  1609. }
  1610. /**
  1611. * This should only be called on non-detached scopes
  1612. * @internal
  1613. */
  1614. on() {
  1615. activeEffectScope = this;
  1616. }
  1617. /**
  1618. * This should only be called on non-detached scopes
  1619. * @internal
  1620. */
  1621. off() {
  1622. activeEffectScope = this.parent;
  1623. }
  1624. stop(fromParent) {
  1625. if (this._active) {
  1626. let i, l;
  1627. for (i = 0, l = this.effects.length; i < l; i++) {
  1628. this.effects[i].stop();
  1629. }
  1630. for (i = 0, l = this.cleanups.length; i < l; i++) {
  1631. this.cleanups[i]();
  1632. }
  1633. if (this.scopes) {
  1634. for (i = 0, l = this.scopes.length; i < l; i++) {
  1635. this.scopes[i].stop(true);
  1636. }
  1637. }
  1638. if (!this.detached && this.parent && !fromParent) {
  1639. const last = this.parent.scopes.pop();
  1640. if (last && last !== this) {
  1641. this.parent.scopes[this.index] = last;
  1642. last.index = this.index;
  1643. }
  1644. }
  1645. this.parent = void 0;
  1646. this._active = false;
  1647. }
  1648. }
  1649. }
  1650. function effectScope(detached) {
  1651. return new EffectScope(detached);
  1652. }
  1653. function recordEffectScope(effect, scope = activeEffectScope) {
  1654. if (scope && scope.active) {
  1655. scope.effects.push(effect);
  1656. }
  1657. }
  1658. function getCurrentScope() {
  1659. return activeEffectScope;
  1660. }
  1661. function onScopeDispose(fn) {
  1662. if (activeEffectScope) {
  1663. activeEffectScope.cleanups.push(fn);
  1664. } else {
  1665. warn$1(`onScopeDispose() is called when there is no active effect scope to be associated with.`);
  1666. }
  1667. }
  1668. const createDep = (effects) => {
  1669. const dep = new Set(effects);
  1670. dep.w = 0;
  1671. dep.n = 0;
  1672. return dep;
  1673. };
  1674. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  1675. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  1676. const initDepMarkers = ({ deps }) => {
  1677. if (deps.length) {
  1678. for (let i = 0; i < deps.length; i++) {
  1679. deps[i].w |= trackOpBit;
  1680. }
  1681. }
  1682. };
  1683. const finalizeDepMarkers = (effect) => {
  1684. const { deps } = effect;
  1685. if (deps.length) {
  1686. let ptr = 0;
  1687. for (let i = 0; i < deps.length; i++) {
  1688. const dep = deps[i];
  1689. if (wasTracked(dep) && !newTracked(dep)) {
  1690. dep.delete(effect);
  1691. } else {
  1692. deps[ptr++] = dep;
  1693. }
  1694. dep.w &= ~trackOpBit;
  1695. dep.n &= ~trackOpBit;
  1696. }
  1697. deps.length = ptr;
  1698. }
  1699. };
  1700. const targetMap = /* @__PURE__ */ new WeakMap();
  1701. let effectTrackDepth = 0;
  1702. let trackOpBit = 1;
  1703. const maxMarkerBits = 30;
  1704. let activeEffect;
  1705. const ITERATE_KEY = Symbol("iterate");
  1706. const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
  1707. class ReactiveEffect {
  1708. constructor(fn, scheduler = null, scope) {
  1709. this.fn = fn;
  1710. this.scheduler = scheduler;
  1711. this.active = true;
  1712. this.deps = [];
  1713. this.parent = void 0;
  1714. recordEffectScope(this, scope);
  1715. }
  1716. run() {
  1717. if (!this.active) {
  1718. return this.fn();
  1719. }
  1720. let parent = activeEffect;
  1721. let lastShouldTrack = shouldTrack;
  1722. while (parent) {
  1723. if (parent === this) {
  1724. return;
  1725. }
  1726. parent = parent.parent;
  1727. }
  1728. try {
  1729. this.parent = activeEffect;
  1730. activeEffect = this;
  1731. shouldTrack = true;
  1732. trackOpBit = 1 << ++effectTrackDepth;
  1733. if (effectTrackDepth <= maxMarkerBits) {
  1734. initDepMarkers(this);
  1735. } else {
  1736. cleanupEffect(this);
  1737. }
  1738. return this.fn();
  1739. } finally {
  1740. if (effectTrackDepth <= maxMarkerBits) {
  1741. finalizeDepMarkers(this);
  1742. }
  1743. trackOpBit = 1 << --effectTrackDepth;
  1744. activeEffect = this.parent;
  1745. shouldTrack = lastShouldTrack;
  1746. this.parent = void 0;
  1747. if (this.deferStop) {
  1748. this.stop();
  1749. }
  1750. }
  1751. }
  1752. stop() {
  1753. if (activeEffect === this) {
  1754. this.deferStop = true;
  1755. } else if (this.active) {
  1756. cleanupEffect(this);
  1757. if (this.onStop) {
  1758. this.onStop();
  1759. }
  1760. this.active = false;
  1761. }
  1762. }
  1763. }
  1764. function cleanupEffect(effect) {
  1765. const { deps } = effect;
  1766. if (deps.length) {
  1767. for (let i = 0; i < deps.length; i++) {
  1768. deps[i].delete(effect);
  1769. }
  1770. deps.length = 0;
  1771. }
  1772. }
  1773. let shouldTrack = true;
  1774. const trackStack = [];
  1775. function pauseTracking() {
  1776. trackStack.push(shouldTrack);
  1777. shouldTrack = false;
  1778. }
  1779. function resetTracking() {
  1780. const last = trackStack.pop();
  1781. shouldTrack = last === void 0 ? true : last;
  1782. }
  1783. function track(target, type, key) {
  1784. if (shouldTrack && activeEffect) {
  1785. let depsMap = targetMap.get(target);
  1786. if (!depsMap) {
  1787. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  1788. }
  1789. let dep = depsMap.get(key);
  1790. if (!dep) {
  1791. depsMap.set(key, dep = createDep());
  1792. }
  1793. const eventInfo = { effect: activeEffect, target, type, key };
  1794. trackEffects(dep, eventInfo);
  1795. }
  1796. }
  1797. function trackEffects(dep, debuggerEventExtraInfo) {
  1798. let shouldTrack2 = false;
  1799. if (effectTrackDepth <= maxMarkerBits) {
  1800. if (!newTracked(dep)) {
  1801. dep.n |= trackOpBit;
  1802. shouldTrack2 = !wasTracked(dep);
  1803. }
  1804. } else {
  1805. shouldTrack2 = !dep.has(activeEffect);
  1806. }
  1807. if (shouldTrack2) {
  1808. dep.add(activeEffect);
  1809. activeEffect.deps.push(dep);
  1810. if (activeEffect.onTrack) {
  1811. activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
  1812. }
  1813. }
  1814. }
  1815. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  1816. const depsMap = targetMap.get(target);
  1817. if (!depsMap) {
  1818. return;
  1819. }
  1820. let deps = [];
  1821. if (type === "clear") {
  1822. deps = [...depsMap.values()];
  1823. } else if (key === "length" && isArray(target)) {
  1824. const newLength = Number(newValue);
  1825. depsMap.forEach((dep, key2) => {
  1826. if (key2 === "length" || key2 >= newLength) {
  1827. deps.push(dep);
  1828. }
  1829. });
  1830. } else {
  1831. if (key !== void 0) {
  1832. deps.push(depsMap.get(key));
  1833. }
  1834. switch (type) {
  1835. case "add":
  1836. if (!isArray(target)) {
  1837. deps.push(depsMap.get(ITERATE_KEY));
  1838. if (isMap(target)) {
  1839. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  1840. }
  1841. } else if (isIntegerKey(key)) {
  1842. deps.push(depsMap.get("length"));
  1843. }
  1844. break;
  1845. case "delete":
  1846. if (!isArray(target)) {
  1847. deps.push(depsMap.get(ITERATE_KEY));
  1848. if (isMap(target)) {
  1849. deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
  1850. }
  1851. }
  1852. break;
  1853. case "set":
  1854. if (isMap(target)) {
  1855. deps.push(depsMap.get(ITERATE_KEY));
  1856. }
  1857. break;
  1858. }
  1859. }
  1860. const eventInfo = { target, type, key, newValue, oldValue, oldTarget };
  1861. if (deps.length === 1) {
  1862. if (deps[0]) {
  1863. {
  1864. triggerEffects(deps[0], eventInfo);
  1865. }
  1866. }
  1867. } else {
  1868. const effects = [];
  1869. for (const dep of deps) {
  1870. if (dep) {
  1871. effects.push(...dep);
  1872. }
  1873. }
  1874. {
  1875. triggerEffects(createDep(effects), eventInfo);
  1876. }
  1877. }
  1878. }
  1879. function triggerEffects(dep, debuggerEventExtraInfo) {
  1880. const effects = isArray(dep) ? dep : [...dep];
  1881. for (const effect of effects) {
  1882. if (effect.computed) {
  1883. triggerEffect(effect, debuggerEventExtraInfo);
  1884. }
  1885. }
  1886. for (const effect of effects) {
  1887. if (!effect.computed) {
  1888. triggerEffect(effect, debuggerEventExtraInfo);
  1889. }
  1890. }
  1891. }
  1892. function triggerEffect(effect, debuggerEventExtraInfo) {
  1893. if (effect !== activeEffect || effect.allowRecurse) {
  1894. if (effect.onTrigger) {
  1895. effect.onTrigger(extend({ effect }, debuggerEventExtraInfo));
  1896. }
  1897. if (effect.scheduler) {
  1898. effect.scheduler();
  1899. } else {
  1900. effect.run();
  1901. }
  1902. }
  1903. }
  1904. function getDepFromReactive(object, key) {
  1905. var _a2;
  1906. return (_a2 = targetMap.get(object)) === null || _a2 === void 0 ? void 0 : _a2.get(key);
  1907. }
  1908. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1909. const builtInSymbols = new Set(
  1910. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1911. );
  1912. const get$1 = /* @__PURE__ */ createGetter();
  1913. const shallowGet = /* @__PURE__ */ createGetter(false, true);
  1914. const readonlyGet = /* @__PURE__ */ createGetter(true);
  1915. const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
  1916. const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
  1917. function createArrayInstrumentations() {
  1918. const instrumentations = {};
  1919. ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
  1920. instrumentations[key] = function(...args) {
  1921. const arr = toRaw(this);
  1922. for (let i = 0, l = this.length; i < l; i++) {
  1923. track(arr, "get", i + "");
  1924. }
  1925. const res = arr[key](...args);
  1926. if (res === -1 || res === false) {
  1927. return arr[key](...args.map(toRaw));
  1928. } else {
  1929. return res;
  1930. }
  1931. };
  1932. });
  1933. ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
  1934. instrumentations[key] = function(...args) {
  1935. pauseTracking();
  1936. const res = toRaw(this)[key].apply(this, args);
  1937. resetTracking();
  1938. return res;
  1939. };
  1940. });
  1941. return instrumentations;
  1942. }
  1943. function hasOwnProperty(key) {
  1944. const obj = toRaw(this);
  1945. track(obj, "has", key);
  1946. return obj.hasOwnProperty(key);
  1947. }
  1948. function createGetter(isReadonly2 = false, shallow = false) {
  1949. return function get2(target, key, receiver) {
  1950. if (key === "__v_isReactive") {
  1951. return !isReadonly2;
  1952. } else if (key === "__v_isReadonly") {
  1953. return isReadonly2;
  1954. } else if (key === "__v_isShallow") {
  1955. return shallow;
  1956. } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
  1957. return target;
  1958. }
  1959. const targetIsArray = isArray(target);
  1960. if (!isReadonly2) {
  1961. if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
  1962. return Reflect.get(arrayInstrumentations, key, receiver);
  1963. }
  1964. if (key === "hasOwnProperty") {
  1965. return hasOwnProperty;
  1966. }
  1967. }
  1968. const res = Reflect.get(target, key, receiver);
  1969. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1970. return res;
  1971. }
  1972. if (!isReadonly2) {
  1973. track(target, "get", key);
  1974. }
  1975. if (shallow) {
  1976. return res;
  1977. }
  1978. if (isRef(res)) {
  1979. return targetIsArray && isIntegerKey(key) ? res : res.value;
  1980. }
  1981. if (isObject(res)) {
  1982. return isReadonly2 ? readonly(res) : reactive(res);
  1983. }
  1984. return res;
  1985. };
  1986. }
  1987. const set$1 = /* @__PURE__ */ createSetter();
  1988. const shallowSet = /* @__PURE__ */ createSetter(true);
  1989. function createSetter(shallow = false) {
  1990. return function set2(target, key, value, receiver) {
  1991. let oldValue = target[key];
  1992. if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
  1993. return false;
  1994. }
  1995. if (!shallow) {
  1996. if (!isShallow(value) && !isReadonly(value)) {
  1997. oldValue = toRaw(oldValue);
  1998. value = toRaw(value);
  1999. }
  2000. if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
  2001. oldValue.value = value;
  2002. return true;
  2003. }
  2004. }
  2005. const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
  2006. const result = Reflect.set(target, key, value, receiver);
  2007. if (target === toRaw(receiver)) {
  2008. if (!hadKey) {
  2009. trigger(target, "add", key, value);
  2010. } else if (hasChanged(value, oldValue)) {
  2011. trigger(target, "set", key, value, oldValue);
  2012. }
  2013. }
  2014. return result;
  2015. };
  2016. }
  2017. function deleteProperty(target, key) {
  2018. const hadKey = hasOwn(target, key);
  2019. const oldValue = target[key];
  2020. const result = Reflect.deleteProperty(target, key);
  2021. if (result && hadKey) {
  2022. trigger(target, "delete", key, void 0, oldValue);
  2023. }
  2024. return result;
  2025. }
  2026. function has$1(target, key) {
  2027. const result = Reflect.has(target, key);
  2028. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  2029. track(target, "has", key);
  2030. }
  2031. return result;
  2032. }
  2033. function ownKeys(target) {
  2034. track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
  2035. return Reflect.ownKeys(target);
  2036. }
  2037. const mutableHandlers = {
  2038. get: get$1,
  2039. set: set$1,
  2040. deleteProperty,
  2041. has: has$1,
  2042. ownKeys
  2043. };
  2044. const readonlyHandlers = {
  2045. get: readonlyGet,
  2046. set(target, key) {
  2047. {
  2048. warn$1(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
  2049. }
  2050. return true;
  2051. },
  2052. deleteProperty(target, key) {
  2053. {
  2054. warn$1(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
  2055. }
  2056. return true;
  2057. }
  2058. };
  2059. const shallowReactiveHandlers = /* @__PURE__ */ extend({}, mutableHandlers, {
  2060. get: shallowGet,
  2061. set: shallowSet
  2062. });
  2063. const shallowReadonlyHandlers = /* @__PURE__ */ extend({}, readonlyHandlers, {
  2064. get: shallowReadonlyGet
  2065. });
  2066. const toShallow = (value) => value;
  2067. const getProto = (v) => Reflect.getPrototypeOf(v);
  2068. function get(target, key, isReadonly2 = false, isShallow2 = false) {
  2069. target = target[
  2070. "__v_raw"
  2071. /* ReactiveFlags.RAW */
  2072. ];
  2073. const rawTarget = toRaw(target);
  2074. const rawKey = toRaw(key);
  2075. if (!isReadonly2) {
  2076. if (key !== rawKey) {
  2077. track(rawTarget, "get", key);
  2078. }
  2079. track(rawTarget, "get", rawKey);
  2080. }
  2081. const { has: has2 } = getProto(rawTarget);
  2082. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2083. if (has2.call(rawTarget, key)) {
  2084. return wrap(target.get(key));
  2085. } else if (has2.call(rawTarget, rawKey)) {
  2086. return wrap(target.get(rawKey));
  2087. } else if (target !== rawTarget) {
  2088. target.get(key);
  2089. }
  2090. }
  2091. function has(key, isReadonly2 = false) {
  2092. const target = this[
  2093. "__v_raw"
  2094. /* ReactiveFlags.RAW */
  2095. ];
  2096. const rawTarget = toRaw(target);
  2097. const rawKey = toRaw(key);
  2098. if (!isReadonly2) {
  2099. if (key !== rawKey) {
  2100. track(rawTarget, "has", key);
  2101. }
  2102. track(rawTarget, "has", rawKey);
  2103. }
  2104. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  2105. }
  2106. function size(target, isReadonly2 = false) {
  2107. target = target[
  2108. "__v_raw"
  2109. /* ReactiveFlags.RAW */
  2110. ];
  2111. !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY);
  2112. return Reflect.get(target, "size", target);
  2113. }
  2114. function add(value) {
  2115. value = toRaw(value);
  2116. const target = toRaw(this);
  2117. const proto = getProto(target);
  2118. const hadKey = proto.has.call(target, value);
  2119. if (!hadKey) {
  2120. target.add(value);
  2121. trigger(target, "add", value, value);
  2122. }
  2123. return this;
  2124. }
  2125. function set$2(key, value) {
  2126. value = toRaw(value);
  2127. const target = toRaw(this);
  2128. const { has: has2, get: get2 } = getProto(target);
  2129. let hadKey = has2.call(target, key);
  2130. if (!hadKey) {
  2131. key = toRaw(key);
  2132. hadKey = has2.call(target, key);
  2133. } else {
  2134. checkIdentityKeys(target, has2, key);
  2135. }
  2136. const oldValue = get2.call(target, key);
  2137. target.set(key, value);
  2138. if (!hadKey) {
  2139. trigger(target, "add", key, value);
  2140. } else if (hasChanged(value, oldValue)) {
  2141. trigger(target, "set", key, value, oldValue);
  2142. }
  2143. return this;
  2144. }
  2145. function deleteEntry(key) {
  2146. const target = toRaw(this);
  2147. const { has: has2, get: get2 } = getProto(target);
  2148. let hadKey = has2.call(target, key);
  2149. if (!hadKey) {
  2150. key = toRaw(key);
  2151. hadKey = has2.call(target, key);
  2152. } else {
  2153. checkIdentityKeys(target, has2, key);
  2154. }
  2155. const oldValue = get2 ? get2.call(target, key) : void 0;
  2156. const result = target.delete(key);
  2157. if (hadKey) {
  2158. trigger(target, "delete", key, void 0, oldValue);
  2159. }
  2160. return result;
  2161. }
  2162. function clear() {
  2163. const target = toRaw(this);
  2164. const hadItems = target.size !== 0;
  2165. const oldTarget = isMap(target) ? new Map(target) : new Set(target);
  2166. const result = target.clear();
  2167. if (hadItems) {
  2168. trigger(target, "clear", void 0, void 0, oldTarget);
  2169. }
  2170. return result;
  2171. }
  2172. function createForEach(isReadonly2, isShallow2) {
  2173. return function forEach(callback, thisArg) {
  2174. const observed = this;
  2175. const target = observed[
  2176. "__v_raw"
  2177. /* ReactiveFlags.RAW */
  2178. ];
  2179. const rawTarget = toRaw(target);
  2180. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2181. !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
  2182. return target.forEach((value, key) => {
  2183. return callback.call(thisArg, wrap(value), wrap(key), observed);
  2184. });
  2185. };
  2186. }
  2187. function createIterableMethod(method, isReadonly2, isShallow2) {
  2188. return function(...args) {
  2189. const target = this[
  2190. "__v_raw"
  2191. /* ReactiveFlags.RAW */
  2192. ];
  2193. const rawTarget = toRaw(target);
  2194. const targetIsMap = isMap(rawTarget);
  2195. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  2196. const isKeyOnly = method === "keys" && targetIsMap;
  2197. const innerIterator = target[method](...args);
  2198. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  2199. !isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
  2200. return {
  2201. // iterator protocol
  2202. next() {
  2203. const { value, done } = innerIterator.next();
  2204. return done ? { value, done } : {
  2205. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  2206. done
  2207. };
  2208. },
  2209. // iterable protocol
  2210. [Symbol.iterator]() {
  2211. return this;
  2212. }
  2213. };
  2214. };
  2215. }
  2216. function createReadonlyMethod(type) {
  2217. return function(...args) {
  2218. {
  2219. const key = args[0] ? `on key "${args[0]}" ` : ``;
  2220. console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
  2221. }
  2222. return type === "delete" ? false : this;
  2223. };
  2224. }
  2225. function createInstrumentations() {
  2226. const mutableInstrumentations2 = {
  2227. get(key) {
  2228. return get(this, key);
  2229. },
  2230. get size() {
  2231. return size(this);
  2232. },
  2233. has,
  2234. add,
  2235. set: set$2,
  2236. delete: deleteEntry,
  2237. clear,
  2238. forEach: createForEach(false, false)
  2239. };
  2240. const shallowInstrumentations2 = {
  2241. get(key) {
  2242. return get(this, key, false, true);
  2243. },
  2244. get size() {
  2245. return size(this);
  2246. },
  2247. has,
  2248. add,
  2249. set: set$2,
  2250. delete: deleteEntry,
  2251. clear,
  2252. forEach: createForEach(false, true)
  2253. };
  2254. const readonlyInstrumentations2 = {
  2255. get(key) {
  2256. return get(this, key, true);
  2257. },
  2258. get size() {
  2259. return size(this, true);
  2260. },
  2261. has(key) {
  2262. return has.call(this, key, true);
  2263. },
  2264. add: createReadonlyMethod(
  2265. "add"
  2266. /* TriggerOpTypes.ADD */
  2267. ),
  2268. set: createReadonlyMethod(
  2269. "set"
  2270. /* TriggerOpTypes.SET */
  2271. ),
  2272. delete: createReadonlyMethod(
  2273. "delete"
  2274. /* TriggerOpTypes.DELETE */
  2275. ),
  2276. clear: createReadonlyMethod(
  2277. "clear"
  2278. /* TriggerOpTypes.CLEAR */
  2279. ),
  2280. forEach: createForEach(true, false)
  2281. };
  2282. const shallowReadonlyInstrumentations2 = {
  2283. get(key) {
  2284. return get(this, key, true, true);
  2285. },
  2286. get size() {
  2287. return size(this, true);
  2288. },
  2289. has(key) {
  2290. return has.call(this, key, true);
  2291. },
  2292. add: createReadonlyMethod(
  2293. "add"
  2294. /* TriggerOpTypes.ADD */
  2295. ),
  2296. set: createReadonlyMethod(
  2297. "set"
  2298. /* TriggerOpTypes.SET */
  2299. ),
  2300. delete: createReadonlyMethod(
  2301. "delete"
  2302. /* TriggerOpTypes.DELETE */
  2303. ),
  2304. clear: createReadonlyMethod(
  2305. "clear"
  2306. /* TriggerOpTypes.CLEAR */
  2307. ),
  2308. forEach: createForEach(true, true)
  2309. };
  2310. const iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
  2311. iteratorMethods.forEach((method) => {
  2312. mutableInstrumentations2[method] = createIterableMethod(method, false, false);
  2313. readonlyInstrumentations2[method] = createIterableMethod(method, true, false);
  2314. shallowInstrumentations2[method] = createIterableMethod(method, false, true);
  2315. shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true);
  2316. });
  2317. return [
  2318. mutableInstrumentations2,
  2319. readonlyInstrumentations2,
  2320. shallowInstrumentations2,
  2321. shallowReadonlyInstrumentations2
  2322. ];
  2323. }
  2324. const [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations();
  2325. function createInstrumentationGetter(isReadonly2, shallow) {
  2326. const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
  2327. return (target, key, receiver) => {
  2328. if (key === "__v_isReactive") {
  2329. return !isReadonly2;
  2330. } else if (key === "__v_isReadonly") {
  2331. return isReadonly2;
  2332. } else if (key === "__v_raw") {
  2333. return target;
  2334. }
  2335. return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
  2336. };
  2337. }
  2338. const mutableCollectionHandlers = {
  2339. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  2340. };
  2341. const shallowCollectionHandlers = {
  2342. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  2343. };
  2344. const readonlyCollectionHandlers = {
  2345. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  2346. };
  2347. const shallowReadonlyCollectionHandlers = {
  2348. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  2349. };
  2350. function checkIdentityKeys(target, has2, key) {
  2351. const rawKey = toRaw(key);
  2352. if (rawKey !== key && has2.call(target, rawKey)) {
  2353. const type = toRawType(target);
  2354. console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${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.`);
  2355. }
  2356. }
  2357. const reactiveMap = /* @__PURE__ */ new WeakMap();
  2358. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  2359. const readonlyMap = /* @__PURE__ */ new WeakMap();
  2360. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  2361. function targetTypeMap(rawType) {
  2362. switch (rawType) {
  2363. case "Object":
  2364. case "Array":
  2365. return 1;
  2366. case "Map":
  2367. case "Set":
  2368. case "WeakMap":
  2369. case "WeakSet":
  2370. return 2;
  2371. default:
  2372. return 0;
  2373. }
  2374. }
  2375. function getTargetType(value) {
  2376. return value[
  2377. "__v_skip"
  2378. /* ReactiveFlags.SKIP */
  2379. ] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
  2380. }
  2381. function reactive(target) {
  2382. if (isReadonly(target)) {
  2383. return target;
  2384. }
  2385. return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
  2386. }
  2387. function shallowReactive(target) {
  2388. return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
  2389. }
  2390. function readonly(target) {
  2391. return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
  2392. }
  2393. function shallowReadonly(target) {
  2394. return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
  2395. }
  2396. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  2397. if (!isObject(target)) {
  2398. {
  2399. console.warn(`value cannot be made reactive: ${String(target)}`);
  2400. }
  2401. return target;
  2402. }
  2403. if (target[
  2404. "__v_raw"
  2405. /* ReactiveFlags.RAW */
  2406. ] && !(isReadonly2 && target[
  2407. "__v_isReactive"
  2408. /* ReactiveFlags.IS_REACTIVE */
  2409. ])) {
  2410. return target;
  2411. }
  2412. const existingProxy = proxyMap.get(target);
  2413. if (existingProxy) {
  2414. return existingProxy;
  2415. }
  2416. const targetType = getTargetType(target);
  2417. if (targetType === 0) {
  2418. return target;
  2419. }
  2420. const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
  2421. proxyMap.set(target, proxy);
  2422. return proxy;
  2423. }
  2424. function isReactive(value) {
  2425. if (isReadonly(value)) {
  2426. return isReactive(value[
  2427. "__v_raw"
  2428. /* ReactiveFlags.RAW */
  2429. ]);
  2430. }
  2431. return !!(value && value[
  2432. "__v_isReactive"
  2433. /* ReactiveFlags.IS_REACTIVE */
  2434. ]);
  2435. }
  2436. function isReadonly(value) {
  2437. return !!(value && value[
  2438. "__v_isReadonly"
  2439. /* ReactiveFlags.IS_READONLY */
  2440. ]);
  2441. }
  2442. function isShallow(value) {
  2443. return !!(value && value[
  2444. "__v_isShallow"
  2445. /* ReactiveFlags.IS_SHALLOW */
  2446. ]);
  2447. }
  2448. function isProxy(value) {
  2449. return isReactive(value) || isReadonly(value);
  2450. }
  2451. function toRaw(observed) {
  2452. const raw = observed && observed[
  2453. "__v_raw"
  2454. /* ReactiveFlags.RAW */
  2455. ];
  2456. return raw ? toRaw(raw) : observed;
  2457. }
  2458. function markRaw(value) {
  2459. def(value, "__v_skip", true);
  2460. return value;
  2461. }
  2462. const toReactive = (value) => isObject(value) ? reactive(value) : value;
  2463. const toReadonly = (value) => isObject(value) ? readonly(value) : value;
  2464. function trackRefValue(ref2) {
  2465. if (shouldTrack && activeEffect) {
  2466. ref2 = toRaw(ref2);
  2467. {
  2468. trackEffects(ref2.dep || (ref2.dep = createDep()), {
  2469. target: ref2,
  2470. type: "get",
  2471. key: "value"
  2472. });
  2473. }
  2474. }
  2475. }
  2476. function triggerRefValue(ref2, newVal) {
  2477. ref2 = toRaw(ref2);
  2478. const dep = ref2.dep;
  2479. if (dep) {
  2480. {
  2481. triggerEffects(dep, {
  2482. target: ref2,
  2483. type: "set",
  2484. key: "value",
  2485. newValue: newVal
  2486. });
  2487. }
  2488. }
  2489. }
  2490. function isRef(r2) {
  2491. return !!(r2 && r2.__v_isRef === true);
  2492. }
  2493. function ref(value) {
  2494. return createRef(value, false);
  2495. }
  2496. function createRef(rawValue, shallow) {
  2497. if (isRef(rawValue)) {
  2498. return rawValue;
  2499. }
  2500. return new RefImpl(rawValue, shallow);
  2501. }
  2502. class RefImpl {
  2503. constructor(value, __v_isShallow) {
  2504. this.__v_isShallow = __v_isShallow;
  2505. this.dep = void 0;
  2506. this.__v_isRef = true;
  2507. this._rawValue = __v_isShallow ? value : toRaw(value);
  2508. this._value = __v_isShallow ? value : toReactive(value);
  2509. }
  2510. get value() {
  2511. trackRefValue(this);
  2512. return this._value;
  2513. }
  2514. set value(newVal) {
  2515. const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
  2516. newVal = useDirectValue ? newVal : toRaw(newVal);
  2517. if (hasChanged(newVal, this._rawValue)) {
  2518. this._rawValue = newVal;
  2519. this._value = useDirectValue ? newVal : toReactive(newVal);
  2520. triggerRefValue(this, newVal);
  2521. }
  2522. }
  2523. }
  2524. function unref(ref2) {
  2525. return isRef(ref2) ? ref2.value : ref2;
  2526. }
  2527. const shallowUnwrapHandlers = {
  2528. get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
  2529. set: (target, key, value, receiver) => {
  2530. const oldValue = target[key];
  2531. if (isRef(oldValue) && !isRef(value)) {
  2532. oldValue.value = value;
  2533. return true;
  2534. } else {
  2535. return Reflect.set(target, key, value, receiver);
  2536. }
  2537. }
  2538. };
  2539. function proxyRefs(objectWithRefs) {
  2540. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  2541. }
  2542. function toRefs(object) {
  2543. if (!isProxy(object)) {
  2544. console.warn(`toRefs() expects a reactive object but received a plain one.`);
  2545. }
  2546. const ret = isArray(object) ? new Array(object.length) : {};
  2547. for (const key in object) {
  2548. ret[key] = toRef(object, key);
  2549. }
  2550. return ret;
  2551. }
  2552. class ObjectRefImpl {
  2553. constructor(_object, _key, _defaultValue) {
  2554. this._object = _object;
  2555. this._key = _key;
  2556. this._defaultValue = _defaultValue;
  2557. this.__v_isRef = true;
  2558. }
  2559. get value() {
  2560. const val = this._object[this._key];
  2561. return val === void 0 ? this._defaultValue : val;
  2562. }
  2563. set value(newVal) {
  2564. this._object[this._key] = newVal;
  2565. }
  2566. get dep() {
  2567. return getDepFromReactive(toRaw(this._object), this._key);
  2568. }
  2569. }
  2570. function toRef(object, key, defaultValue) {
  2571. const val = object[key];
  2572. return isRef(val) ? val : new ObjectRefImpl(object, key, defaultValue);
  2573. }
  2574. var _a;
  2575. class ComputedRefImpl {
  2576. constructor(getter, _setter, isReadonly2, isSSR) {
  2577. this._setter = _setter;
  2578. this.dep = void 0;
  2579. this.__v_isRef = true;
  2580. this[_a] = false;
  2581. this._dirty = true;
  2582. this.effect = new ReactiveEffect(getter, () => {
  2583. if (!this._dirty) {
  2584. this._dirty = true;
  2585. triggerRefValue(this);
  2586. }
  2587. });
  2588. this.effect.computed = this;
  2589. this.effect.active = this._cacheable = !isSSR;
  2590. this[
  2591. "__v_isReadonly"
  2592. /* ReactiveFlags.IS_READONLY */
  2593. ] = isReadonly2;
  2594. }
  2595. get value() {
  2596. const self2 = toRaw(this);
  2597. trackRefValue(self2);
  2598. if (self2._dirty || !self2._cacheable) {
  2599. self2._dirty = false;
  2600. self2._value = self2.effect.run();
  2601. }
  2602. return self2._value;
  2603. }
  2604. set value(newValue) {
  2605. this._setter(newValue);
  2606. }
  2607. }
  2608. _a = "__v_isReadonly";
  2609. function computed$1(getterOrOptions, debugOptions, isSSR = false) {
  2610. let getter;
  2611. let setter;
  2612. const onlyGetter = isFunction(getterOrOptions);
  2613. if (onlyGetter) {
  2614. getter = getterOrOptions;
  2615. setter = () => {
  2616. console.warn("Write operation failed: computed value is readonly");
  2617. };
  2618. } else {
  2619. getter = getterOrOptions.get;
  2620. setter = getterOrOptions.set;
  2621. }
  2622. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  2623. if (debugOptions && !isSSR) {
  2624. cRef.effect.onTrack = debugOptions.onTrack;
  2625. cRef.effect.onTrigger = debugOptions.onTrigger;
  2626. }
  2627. return cRef;
  2628. }
  2629. const stack = [];
  2630. function pushWarningContext(vnode) {
  2631. stack.push(vnode);
  2632. }
  2633. function popWarningContext() {
  2634. stack.pop();
  2635. }
  2636. function warn(msg, ...args) {
  2637. pauseTracking();
  2638. const instance = stack.length ? stack[stack.length - 1].component : null;
  2639. const appWarnHandler = instance && instance.appContext.config.warnHandler;
  2640. const trace = getComponentTrace();
  2641. if (appWarnHandler) {
  2642. callWithErrorHandling(appWarnHandler, instance, 11, [
  2643. msg + args.join(""),
  2644. instance && instance.proxy,
  2645. trace.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`).join("\n"),
  2646. trace
  2647. ]);
  2648. } else {
  2649. const warnArgs = [`[Vue warn]: ${msg}`, ...args];
  2650. if (trace.length && // avoid spamming console during tests
  2651. true) {
  2652. warnArgs.push(`
  2653. `, ...formatTrace(trace));
  2654. }
  2655. console.warn(...warnArgs);
  2656. }
  2657. resetTracking();
  2658. }
  2659. function getComponentTrace() {
  2660. let currentVNode = stack[stack.length - 1];
  2661. if (!currentVNode) {
  2662. return [];
  2663. }
  2664. const normalizedStack = [];
  2665. while (currentVNode) {
  2666. const last = normalizedStack[0];
  2667. if (last && last.vnode === currentVNode) {
  2668. last.recurseCount++;
  2669. } else {
  2670. normalizedStack.push({
  2671. vnode: currentVNode,
  2672. recurseCount: 0
  2673. });
  2674. }
  2675. const parentInstance = currentVNode.component && currentVNode.component.parent;
  2676. currentVNode = parentInstance && parentInstance.vnode;
  2677. }
  2678. return normalizedStack;
  2679. }
  2680. function formatTrace(trace) {
  2681. const logs = [];
  2682. trace.forEach((entry, i) => {
  2683. logs.push(...i === 0 ? [] : [`
  2684. `], ...formatTraceEntry(entry));
  2685. });
  2686. return logs;
  2687. }
  2688. function formatTraceEntry({ vnode, recurseCount }) {
  2689. const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
  2690. const isRoot = vnode.component ? vnode.component.parent == null : false;
  2691. const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
  2692. const close = `>` + postfix;
  2693. return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
  2694. }
  2695. function formatProps(props) {
  2696. const res = [];
  2697. const keys = Object.keys(props);
  2698. keys.slice(0, 3).forEach((key) => {
  2699. res.push(...formatProp(key, props[key]));
  2700. });
  2701. if (keys.length > 3) {
  2702. res.push(` ...`);
  2703. }
  2704. return res;
  2705. }
  2706. function formatProp(key, value, raw) {
  2707. if (isString(value)) {
  2708. value = JSON.stringify(value);
  2709. return raw ? value : [`${key}=${value}`];
  2710. } else if (typeof value === "number" || typeof value === "boolean" || value == null) {
  2711. return raw ? value : [`${key}=${value}`];
  2712. } else if (isRef(value)) {
  2713. value = formatProp(key, toRaw(value.value), true);
  2714. return raw ? value : [`${key}=Ref<`, value, `>`];
  2715. } else if (isFunction(value)) {
  2716. return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
  2717. } else {
  2718. value = toRaw(value);
  2719. return raw ? value : [`${key}=`, value];
  2720. }
  2721. }
  2722. const ErrorTypeStrings = {
  2723. [
  2724. "sp"
  2725. /* LifecycleHooks.SERVER_PREFETCH */
  2726. ]: "serverPrefetch hook",
  2727. [
  2728. "bc"
  2729. /* LifecycleHooks.BEFORE_CREATE */
  2730. ]: "beforeCreate hook",
  2731. [
  2732. "c"
  2733. /* LifecycleHooks.CREATED */
  2734. ]: "created hook",
  2735. [
  2736. "bm"
  2737. /* LifecycleHooks.BEFORE_MOUNT */
  2738. ]: "beforeMount hook",
  2739. [
  2740. "m"
  2741. /* LifecycleHooks.MOUNTED */
  2742. ]: "mounted hook",
  2743. [
  2744. "bu"
  2745. /* LifecycleHooks.BEFORE_UPDATE */
  2746. ]: "beforeUpdate hook",
  2747. [
  2748. "u"
  2749. /* LifecycleHooks.UPDATED */
  2750. ]: "updated",
  2751. [
  2752. "bum"
  2753. /* LifecycleHooks.BEFORE_UNMOUNT */
  2754. ]: "beforeUnmount hook",
  2755. [
  2756. "um"
  2757. /* LifecycleHooks.UNMOUNTED */
  2758. ]: "unmounted hook",
  2759. [
  2760. "a"
  2761. /* LifecycleHooks.ACTIVATED */
  2762. ]: "activated hook",
  2763. [
  2764. "da"
  2765. /* LifecycleHooks.DEACTIVATED */
  2766. ]: "deactivated hook",
  2767. [
  2768. "ec"
  2769. /* LifecycleHooks.ERROR_CAPTURED */
  2770. ]: "errorCaptured hook",
  2771. [
  2772. "rtc"
  2773. /* LifecycleHooks.RENDER_TRACKED */
  2774. ]: "renderTracked hook",
  2775. [
  2776. "rtg"
  2777. /* LifecycleHooks.RENDER_TRIGGERED */
  2778. ]: "renderTriggered hook",
  2779. [
  2780. 0
  2781. /* ErrorCodes.SETUP_FUNCTION */
  2782. ]: "setup function",
  2783. [
  2784. 1
  2785. /* ErrorCodes.RENDER_FUNCTION */
  2786. ]: "render function",
  2787. [
  2788. 2
  2789. /* ErrorCodes.WATCH_GETTER */
  2790. ]: "watcher getter",
  2791. [
  2792. 3
  2793. /* ErrorCodes.WATCH_CALLBACK */
  2794. ]: "watcher callback",
  2795. [
  2796. 4
  2797. /* ErrorCodes.WATCH_CLEANUP */
  2798. ]: "watcher cleanup function",
  2799. [
  2800. 5
  2801. /* ErrorCodes.NATIVE_EVENT_HANDLER */
  2802. ]: "native event handler",
  2803. [
  2804. 6
  2805. /* ErrorCodes.COMPONENT_EVENT_HANDLER */
  2806. ]: "component event handler",
  2807. [
  2808. 7
  2809. /* ErrorCodes.VNODE_HOOK */
  2810. ]: "vnode hook",
  2811. [
  2812. 8
  2813. /* ErrorCodes.DIRECTIVE_HOOK */
  2814. ]: "directive hook",
  2815. [
  2816. 9
  2817. /* ErrorCodes.TRANSITION_HOOK */
  2818. ]: "transition hook",
  2819. [
  2820. 10
  2821. /* ErrorCodes.APP_ERROR_HANDLER */
  2822. ]: "app errorHandler",
  2823. [
  2824. 11
  2825. /* ErrorCodes.APP_WARN_HANDLER */
  2826. ]: "app warnHandler",
  2827. [
  2828. 12
  2829. /* ErrorCodes.FUNCTION_REF */
  2830. ]: "ref function",
  2831. [
  2832. 13
  2833. /* ErrorCodes.ASYNC_COMPONENT_LOADER */
  2834. ]: "async component loader",
  2835. [
  2836. 14
  2837. /* ErrorCodes.SCHEDULER */
  2838. ]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"
  2839. };
  2840. function callWithErrorHandling(fn, instance, type, args) {
  2841. let res;
  2842. try {
  2843. res = args ? fn(...args) : fn();
  2844. } catch (err) {
  2845. handleError(err, instance, type);
  2846. }
  2847. return res;
  2848. }
  2849. function callWithAsyncErrorHandling(fn, instance, type, args) {
  2850. if (isFunction(fn)) {
  2851. const res = callWithErrorHandling(fn, instance, type, args);
  2852. if (res && isPromise(res)) {
  2853. res.catch((err) => {
  2854. handleError(err, instance, type);
  2855. });
  2856. }
  2857. return res;
  2858. }
  2859. const values = [];
  2860. for (let i = 0; i < fn.length; i++) {
  2861. values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
  2862. }
  2863. return values;
  2864. }
  2865. function handleError(err, instance, type, throwInDev = true) {
  2866. const contextVNode = instance ? instance.vnode : null;
  2867. if (instance) {
  2868. let cur = instance.parent;
  2869. const exposedInstance = instance.proxy;
  2870. const errorInfo = ErrorTypeStrings[type] || type;
  2871. while (cur) {
  2872. const errorCapturedHooks = cur.ec;
  2873. if (errorCapturedHooks) {
  2874. for (let i = 0; i < errorCapturedHooks.length; i++) {
  2875. if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
  2876. return;
  2877. }
  2878. }
  2879. }
  2880. cur = cur.parent;
  2881. }
  2882. const appErrorHandler = instance.appContext.config.errorHandler;
  2883. if (appErrorHandler) {
  2884. callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]);
  2885. return;
  2886. }
  2887. }
  2888. logError(err, type, contextVNode, throwInDev);
  2889. }
  2890. function logError(err, type, contextVNode, throwInDev = true) {
  2891. {
  2892. const info = ErrorTypeStrings[type] || type;
  2893. if (contextVNode) {
  2894. pushWarningContext(contextVNode);
  2895. }
  2896. warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
  2897. if (contextVNode) {
  2898. popWarningContext();
  2899. }
  2900. if (throwInDev) {
  2901. console.error(err);
  2902. } else {
  2903. console.error(err);
  2904. }
  2905. }
  2906. }
  2907. let isFlushing = false;
  2908. let isFlushPending = false;
  2909. const queue = [];
  2910. let flushIndex = 0;
  2911. const pendingPostFlushCbs = [];
  2912. let activePostFlushCbs = null;
  2913. let postFlushIndex = 0;
  2914. const resolvedPromise = /* @__PURE__ */ Promise.resolve();
  2915. let currentFlushPromise = null;
  2916. const RECURSION_LIMIT = 100;
  2917. function nextTick$1(fn) {
  2918. const p2 = currentFlushPromise || resolvedPromise;
  2919. return fn ? p2.then(this ? fn.bind(this) : fn) : p2;
  2920. }
  2921. function findInsertionIndex(id) {
  2922. let start = flushIndex + 1;
  2923. let end = queue.length;
  2924. while (start < end) {
  2925. const middle = start + end >>> 1;
  2926. const middleJobId = getId(queue[middle]);
  2927. middleJobId < id ? start = middle + 1 : end = middle;
  2928. }
  2929. return start;
  2930. }
  2931. function queueJob(job) {
  2932. if (!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
  2933. if (job.id == null) {
  2934. queue.push(job);
  2935. } else {
  2936. queue.splice(findInsertionIndex(job.id), 0, job);
  2937. }
  2938. queueFlush();
  2939. }
  2940. }
  2941. function queueFlush() {
  2942. if (!isFlushing && !isFlushPending) {
  2943. isFlushPending = true;
  2944. currentFlushPromise = resolvedPromise.then(flushJobs);
  2945. }
  2946. }
  2947. function hasQueueJob(job) {
  2948. return queue.indexOf(job) > -1;
  2949. }
  2950. function invalidateJob(job) {
  2951. const i = queue.indexOf(job);
  2952. if (i > flushIndex) {
  2953. queue.splice(i, 1);
  2954. }
  2955. }
  2956. function queuePostFlushCb(cb) {
  2957. if (!isArray(cb)) {
  2958. if (!activePostFlushCbs || !activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
  2959. pendingPostFlushCbs.push(cb);
  2960. }
  2961. } else {
  2962. pendingPostFlushCbs.push(...cb);
  2963. }
  2964. queueFlush();
  2965. }
  2966. function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
  2967. {
  2968. seen = seen || /* @__PURE__ */ new Map();
  2969. }
  2970. for (; i < queue.length; i++) {
  2971. const cb = queue[i];
  2972. if (cb && cb.pre) {
  2973. if (checkRecursiveUpdates(seen, cb)) {
  2974. continue;
  2975. }
  2976. queue.splice(i, 1);
  2977. i--;
  2978. cb();
  2979. }
  2980. }
  2981. }
  2982. function flushPostFlushCbs(seen) {
  2983. if (pendingPostFlushCbs.length) {
  2984. const deduped = [...new Set(pendingPostFlushCbs)];
  2985. pendingPostFlushCbs.length = 0;
  2986. if (activePostFlushCbs) {
  2987. activePostFlushCbs.push(...deduped);
  2988. return;
  2989. }
  2990. activePostFlushCbs = deduped;
  2991. {
  2992. seen = seen || /* @__PURE__ */ new Map();
  2993. }
  2994. activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
  2995. for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
  2996. if (checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
  2997. continue;
  2998. }
  2999. activePostFlushCbs[postFlushIndex]();
  3000. }
  3001. activePostFlushCbs = null;
  3002. postFlushIndex = 0;
  3003. }
  3004. }
  3005. const getId = (job) => job.id == null ? Infinity : job.id;
  3006. const comparator = (a, b) => {
  3007. const diff2 = getId(a) - getId(b);
  3008. if (diff2 === 0) {
  3009. if (a.pre && !b.pre)
  3010. return -1;
  3011. if (b.pre && !a.pre)
  3012. return 1;
  3013. }
  3014. return diff2;
  3015. };
  3016. function flushJobs(seen) {
  3017. isFlushPending = false;
  3018. isFlushing = true;
  3019. {
  3020. seen = seen || /* @__PURE__ */ new Map();
  3021. }
  3022. queue.sort(comparator);
  3023. const check = (job) => checkRecursiveUpdates(seen, job);
  3024. try {
  3025. for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
  3026. const job = queue[flushIndex];
  3027. if (job && job.active !== false) {
  3028. if (check(job)) {
  3029. continue;
  3030. }
  3031. callWithErrorHandling(
  3032. job,
  3033. null,
  3034. 14
  3035. /* ErrorCodes.SCHEDULER */
  3036. );
  3037. }
  3038. }
  3039. } finally {
  3040. flushIndex = 0;
  3041. queue.length = 0;
  3042. flushPostFlushCbs(seen);
  3043. isFlushing = false;
  3044. currentFlushPromise = null;
  3045. if (queue.length || pendingPostFlushCbs.length) {
  3046. flushJobs(seen);
  3047. }
  3048. }
  3049. }
  3050. function checkRecursiveUpdates(seen, fn) {
  3051. if (!seen.has(fn)) {
  3052. seen.set(fn, 1);
  3053. } else {
  3054. const count = seen.get(fn);
  3055. if (count > RECURSION_LIMIT) {
  3056. const instance = fn.ownerInstance;
  3057. const componentName = instance && getComponentName(instance.type);
  3058. warn(`Maximum recursive updates exceeded${componentName ? ` in component <${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.`);
  3059. return true;
  3060. } else {
  3061. seen.set(fn, count + 1);
  3062. }
  3063. }
  3064. }
  3065. let devtools;
  3066. let buffer = [];
  3067. let devtoolsNotInstalled = false;
  3068. function emit$1(event, ...args) {
  3069. if (devtools) {
  3070. devtools.emit(event, ...args);
  3071. } else if (!devtoolsNotInstalled) {
  3072. buffer.push({ event, args });
  3073. }
  3074. }
  3075. function setDevtoolsHook(hook, target) {
  3076. var _a2, _b;
  3077. devtools = hook;
  3078. if (devtools) {
  3079. devtools.enabled = true;
  3080. buffer.forEach(({ event, args }) => devtools.emit(event, ...args));
  3081. buffer = [];
  3082. } else if (
  3083. // handle late devtools injection - only do this if we are in an actual
  3084. // browser environment to avoid the timer handle stalling test runner exit
  3085. // (#4815)
  3086. typeof window !== "undefined" && // some envs mock window but not fully
  3087. // eslint-disable-next-line no-restricted-globals
  3088. window.HTMLElement && // also exclude jsdom
  3089. // eslint-disable-next-line no-restricted-globals
  3090. !((_b = (_a2 = window.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent) === null || _b === void 0 ? void 0 : _b.includes("jsdom"))
  3091. ) {
  3092. const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
  3093. replay.push((newHook) => {
  3094. setDevtoolsHook(newHook, target);
  3095. });
  3096. setTimeout(() => {
  3097. if (!devtools) {
  3098. target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
  3099. devtoolsNotInstalled = true;
  3100. buffer = [];
  3101. }
  3102. }, 3e3);
  3103. } else {
  3104. devtoolsNotInstalled = true;
  3105. buffer = [];
  3106. }
  3107. }
  3108. function devtoolsInitApp(app, version2) {
  3109. emit$1("app:init", app, version2, {
  3110. Fragment,
  3111. Text,
  3112. Comment,
  3113. Static
  3114. });
  3115. }
  3116. const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
  3117. "component:added"
  3118. /* DevtoolsHooks.COMPONENT_ADDED */
  3119. );
  3120. const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(
  3121. "component:updated"
  3122. /* DevtoolsHooks.COMPONENT_UPDATED */
  3123. );
  3124. const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(
  3125. "component:removed"
  3126. /* DevtoolsHooks.COMPONENT_REMOVED */
  3127. );
  3128. const devtoolsComponentRemoved = (component) => {
  3129. if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered
  3130. !devtools.cleanupBuffer(component)) {
  3131. _devtoolsComponentRemoved(component);
  3132. }
  3133. };
  3134. function createDevtoolsComponentHook(hook) {
  3135. return (component) => {
  3136. emit$1(
  3137. hook,
  3138. component.appContext.app,
  3139. component.uid,
  3140. // fixed by xxxxxx
  3141. // 为 0 是 App,无 parent 是 Page 指向 App
  3142. component.uid === 0 ? void 0 : component.parent ? component.parent.uid : 0,
  3143. component
  3144. );
  3145. };
  3146. }
  3147. const devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(
  3148. "perf:start"
  3149. /* DevtoolsHooks.PERFORMANCE_START */
  3150. );
  3151. const devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(
  3152. "perf:end"
  3153. /* DevtoolsHooks.PERFORMANCE_END */
  3154. );
  3155. function createDevtoolsPerformanceHook(hook) {
  3156. return (component, type, time) => {
  3157. emit$1(hook, component.appContext.app, component.uid, component, type, time);
  3158. };
  3159. }
  3160. function devtoolsComponentEmit(component, event, params) {
  3161. emit$1("component:emit", component.appContext.app, component, event, params);
  3162. }
  3163. function emit(instance, event, ...rawArgs) {
  3164. if (instance.isUnmounted)
  3165. return;
  3166. const props = instance.vnode.props || EMPTY_OBJ;
  3167. {
  3168. const { emitsOptions, propsOptions: [propsOptions] } = instance;
  3169. if (emitsOptions) {
  3170. if (!(event in emitsOptions) && true) {
  3171. if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
  3172. warn(`Component emitted event "${event}" but it is neither declared in the emits option nor as an "${toHandlerKey(event)}" prop.`);
  3173. }
  3174. } else {
  3175. const validator = emitsOptions[event];
  3176. if (isFunction(validator)) {
  3177. const isValid = validator(...rawArgs);
  3178. if (!isValid) {
  3179. warn(`Invalid event arguments: event validation failed for event "${event}".`);
  3180. }
  3181. }
  3182. }
  3183. }
  3184. }
  3185. let args = rawArgs;
  3186. const isModelListener2 = event.startsWith("update:");
  3187. const modelArg = isModelListener2 && event.slice(7);
  3188. if (modelArg && modelArg in props) {
  3189. const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
  3190. const { number, trim } = props[modifiersKey] || EMPTY_OBJ;
  3191. if (trim) {
  3192. args = rawArgs.map((a) => isString(a) ? a.trim() : a);
  3193. }
  3194. if (number) {
  3195. args = rawArgs.map(looseToNumber);
  3196. }
  3197. }
  3198. {
  3199. devtoolsComponentEmit(instance, event, args);
  3200. }
  3201. {
  3202. const lowerCaseEvent = event.toLowerCase();
  3203. if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
  3204. warn(`Event "${lowerCaseEvent}" is emitted in component ${formatComponentName(instance, instance.type)} but the handler is registered for "${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 "${hyphenate(event)}" instead of "${event}".`);
  3205. }
  3206. }
  3207. let handlerName;
  3208. let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)
  3209. props[handlerName = toHandlerKey(camelize(event))];
  3210. if (!handler && isModelListener2) {
  3211. handler = props[handlerName = toHandlerKey(hyphenate(event))];
  3212. }
  3213. if (handler) {
  3214. callWithAsyncErrorHandling(handler, instance, 6, args);
  3215. }
  3216. const onceHandler = props[handlerName + `Once`];
  3217. if (onceHandler) {
  3218. if (!instance.emitted) {
  3219. instance.emitted = {};
  3220. } else if (instance.emitted[handlerName]) {
  3221. return;
  3222. }
  3223. instance.emitted[handlerName] = true;
  3224. callWithAsyncErrorHandling(onceHandler, instance, 6, args);
  3225. }
  3226. }
  3227. function normalizeEmitsOptions(comp, appContext, asMixin = false) {
  3228. const cache = appContext.emitsCache;
  3229. const cached = cache.get(comp);
  3230. if (cached !== void 0) {
  3231. return cached;
  3232. }
  3233. const raw = comp.emits;
  3234. let normalized = {};
  3235. let hasExtends = false;
  3236. if (!isFunction(comp)) {
  3237. const extendEmits = (raw2) => {
  3238. const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
  3239. if (normalizedFromExtend) {
  3240. hasExtends = true;
  3241. extend(normalized, normalizedFromExtend);
  3242. }
  3243. };
  3244. if (!asMixin && appContext.mixins.length) {
  3245. appContext.mixins.forEach(extendEmits);
  3246. }
  3247. if (comp.extends) {
  3248. extendEmits(comp.extends);
  3249. }
  3250. if (comp.mixins) {
  3251. comp.mixins.forEach(extendEmits);
  3252. }
  3253. }
  3254. if (!raw && !hasExtends) {
  3255. if (isObject(comp)) {
  3256. cache.set(comp, null);
  3257. }
  3258. return null;
  3259. }
  3260. if (isArray(raw)) {
  3261. raw.forEach((key) => normalized[key] = null);
  3262. } else {
  3263. extend(normalized, raw);
  3264. }
  3265. if (isObject(comp)) {
  3266. cache.set(comp, normalized);
  3267. }
  3268. return normalized;
  3269. }
  3270. function isEmitListener(options, key) {
  3271. if (!options || !isOn(key)) {
  3272. return false;
  3273. }
  3274. key = key.slice(2).replace(/Once$/, "");
  3275. return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
  3276. }
  3277. let currentRenderingInstance = null;
  3278. function setCurrentRenderingInstance(instance) {
  3279. const prev = currentRenderingInstance;
  3280. currentRenderingInstance = instance;
  3281. instance && instance.type.__scopeId || null;
  3282. return prev;
  3283. }
  3284. function provide(key, value) {
  3285. if (!currentInstance) {
  3286. {
  3287. warn(`provide() can only be used inside setup().`);
  3288. }
  3289. } else {
  3290. let provides = currentInstance.provides;
  3291. const parentProvides = currentInstance.parent && currentInstance.parent.provides;
  3292. if (parentProvides === provides) {
  3293. provides = currentInstance.provides = Object.create(parentProvides);
  3294. }
  3295. provides[key] = value;
  3296. if (currentInstance.type.mpType === "app") {
  3297. currentInstance.appContext.app.provide(key, value);
  3298. }
  3299. }
  3300. }
  3301. function inject(key, defaultValue, treatDefaultAsFactory = false) {
  3302. const instance = currentInstance || currentRenderingInstance;
  3303. if (instance) {
  3304. const provides = instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides;
  3305. if (provides && key in provides) {
  3306. return provides[key];
  3307. } else if (arguments.length > 1) {
  3308. return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance.proxy) : defaultValue;
  3309. } else {
  3310. warn(`injection "${String(key)}" not found.`);
  3311. }
  3312. } else {
  3313. warn(`inject() can only be used inside setup() or functional components.`);
  3314. }
  3315. }
  3316. const INITIAL_WATCHER_VALUE = {};
  3317. function watch(source, cb, options) {
  3318. if (!isFunction(cb)) {
  3319. warn(`\`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.`);
  3320. }
  3321. return doWatch(source, cb, options);
  3322. }
  3323. function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
  3324. if (!cb) {
  3325. if (immediate !== void 0) {
  3326. warn(`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`);
  3327. }
  3328. if (deep !== void 0) {
  3329. warn(`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`);
  3330. }
  3331. }
  3332. const warnInvalidSource = (s2) => {
  3333. warn(`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.`);
  3334. };
  3335. const instance = getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null;
  3336. let getter;
  3337. let forceTrigger = false;
  3338. let isMultiSource = false;
  3339. if (isRef(source)) {
  3340. getter = () => source.value;
  3341. forceTrigger = isShallow(source);
  3342. } else if (isReactive(source)) {
  3343. getter = () => source;
  3344. deep = true;
  3345. } else if (isArray(source)) {
  3346. isMultiSource = true;
  3347. forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2));
  3348. getter = () => source.map((s2) => {
  3349. if (isRef(s2)) {
  3350. return s2.value;
  3351. } else if (isReactive(s2)) {
  3352. return traverse(s2);
  3353. } else if (isFunction(s2)) {
  3354. return callWithErrorHandling(
  3355. s2,
  3356. instance,
  3357. 2
  3358. /* ErrorCodes.WATCH_GETTER */
  3359. );
  3360. } else {
  3361. warnInvalidSource(s2);
  3362. }
  3363. });
  3364. } else if (isFunction(source)) {
  3365. if (cb) {
  3366. getter = () => callWithErrorHandling(
  3367. source,
  3368. instance,
  3369. 2
  3370. /* ErrorCodes.WATCH_GETTER */
  3371. );
  3372. } else {
  3373. getter = () => {
  3374. if (instance && instance.isUnmounted) {
  3375. return;
  3376. }
  3377. if (cleanup) {
  3378. cleanup();
  3379. }
  3380. return callWithAsyncErrorHandling(source, instance, 3, [onCleanup]);
  3381. };
  3382. }
  3383. } else {
  3384. getter = NOOP;
  3385. warnInvalidSource(source);
  3386. }
  3387. if (cb && deep) {
  3388. const baseGetter = getter;
  3389. getter = () => traverse(baseGetter());
  3390. }
  3391. let cleanup;
  3392. let onCleanup = (fn) => {
  3393. cleanup = effect.onStop = () => {
  3394. callWithErrorHandling(
  3395. fn,
  3396. instance,
  3397. 4
  3398. /* ErrorCodes.WATCH_CLEANUP */
  3399. );
  3400. };
  3401. };
  3402. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  3403. const job = () => {
  3404. if (!effect.active) {
  3405. return;
  3406. }
  3407. if (cb) {
  3408. const newValue = effect.run();
  3409. if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
  3410. if (cleanup) {
  3411. cleanup();
  3412. }
  3413. callWithAsyncErrorHandling(cb, instance, 3, [
  3414. newValue,
  3415. // pass undefined as the old value when it's changed for the first time
  3416. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  3417. onCleanup
  3418. ]);
  3419. oldValue = newValue;
  3420. }
  3421. } else {
  3422. effect.run();
  3423. }
  3424. };
  3425. job.allowRecurse = !!cb;
  3426. let scheduler;
  3427. if (flush === "sync") {
  3428. scheduler = job;
  3429. } else if (flush === "post") {
  3430. scheduler = () => queuePostRenderEffect$1(job, instance && instance.suspense);
  3431. } else {
  3432. job.pre = true;
  3433. if (instance)
  3434. job.id = instance.uid;
  3435. scheduler = () => queueJob(job);
  3436. }
  3437. const effect = new ReactiveEffect(getter, scheduler);
  3438. {
  3439. effect.onTrack = onTrack;
  3440. effect.onTrigger = onTrigger;
  3441. }
  3442. if (cb) {
  3443. if (immediate) {
  3444. job();
  3445. } else {
  3446. oldValue = effect.run();
  3447. }
  3448. } else if (flush === "post") {
  3449. queuePostRenderEffect$1(effect.run.bind(effect), instance && instance.suspense);
  3450. } else {
  3451. effect.run();
  3452. }
  3453. const unwatch = () => {
  3454. effect.stop();
  3455. if (instance && instance.scope) {
  3456. remove(instance.scope.effects, effect);
  3457. }
  3458. };
  3459. return unwatch;
  3460. }
  3461. function instanceWatch(source, value, options) {
  3462. const publicThis = this.proxy;
  3463. const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
  3464. let cb;
  3465. if (isFunction(value)) {
  3466. cb = value;
  3467. } else {
  3468. cb = value.handler;
  3469. options = value;
  3470. }
  3471. const cur = currentInstance;
  3472. setCurrentInstance(this);
  3473. const res = doWatch(getter, cb.bind(publicThis), options);
  3474. if (cur) {
  3475. setCurrentInstance(cur);
  3476. } else {
  3477. unsetCurrentInstance();
  3478. }
  3479. return res;
  3480. }
  3481. function createPathGetter(ctx, path) {
  3482. const segments = path.split(".");
  3483. return () => {
  3484. let cur = ctx;
  3485. for (let i = 0; i < segments.length && cur; i++) {
  3486. cur = cur[segments[i]];
  3487. }
  3488. return cur;
  3489. };
  3490. }
  3491. function traverse(value, seen) {
  3492. if (!isObject(value) || value[
  3493. "__v_skip"
  3494. /* ReactiveFlags.SKIP */
  3495. ]) {
  3496. return value;
  3497. }
  3498. seen = seen || /* @__PURE__ */ new Set();
  3499. if (seen.has(value)) {
  3500. return value;
  3501. }
  3502. seen.add(value);
  3503. if (isRef(value)) {
  3504. traverse(value.value, seen);
  3505. } else if (isArray(value)) {
  3506. for (let i = 0; i < value.length; i++) {
  3507. traverse(value[i], seen);
  3508. }
  3509. } else if (isSet(value) || isMap(value)) {
  3510. value.forEach((v) => {
  3511. traverse(v, seen);
  3512. });
  3513. } else if (isPlainObject$1(value)) {
  3514. for (const key in value) {
  3515. traverse(value[key], seen);
  3516. }
  3517. }
  3518. return value;
  3519. }
  3520. const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
  3521. function onActivated(hook, target) {
  3522. registerKeepAliveHook(hook, "a", target);
  3523. }
  3524. function onDeactivated(hook, target) {
  3525. registerKeepAliveHook(hook, "da", target);
  3526. }
  3527. function registerKeepAliveHook(hook, type, target = currentInstance) {
  3528. const wrappedHook = hook.__wdc || (hook.__wdc = () => {
  3529. let current = target;
  3530. while (current) {
  3531. if (current.isDeactivated) {
  3532. return;
  3533. }
  3534. current = current.parent;
  3535. }
  3536. return hook();
  3537. });
  3538. injectHook(type, wrappedHook, target);
  3539. if (target) {
  3540. let current = target.parent;
  3541. while (current && current.parent) {
  3542. if (isKeepAlive(current.parent.vnode)) {
  3543. injectToKeepAliveRoot(wrappedHook, type, target, current);
  3544. }
  3545. current = current.parent;
  3546. }
  3547. }
  3548. }
  3549. function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
  3550. const injected = injectHook(
  3551. type,
  3552. hook,
  3553. keepAliveRoot,
  3554. true
  3555. /* prepend */
  3556. );
  3557. onUnmounted(() => {
  3558. remove(keepAliveRoot[type], injected);
  3559. }, target);
  3560. }
  3561. function injectHook(type, hook, target = currentInstance, prepend = false) {
  3562. if (target) {
  3563. if (isRootHook(type)) {
  3564. target = target.root;
  3565. }
  3566. const hooks = target[type] || (target[type] = []);
  3567. const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
  3568. if (target.isUnmounted) {
  3569. return;
  3570. }
  3571. pauseTracking();
  3572. setCurrentInstance(target);
  3573. const res = callWithAsyncErrorHandling(hook, target, type, args);
  3574. unsetCurrentInstance();
  3575. resetTracking();
  3576. return res;
  3577. });
  3578. if (prepend) {
  3579. hooks.unshift(wrappedHook);
  3580. } else {
  3581. hooks.push(wrappedHook);
  3582. }
  3583. return wrappedHook;
  3584. } else {
  3585. const apiName = toHandlerKey((ErrorTypeStrings[type] || type.replace(/^on/, "")).replace(/ hook$/, ""));
  3586. warn(`${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().`);
  3587. }
  3588. }
  3589. const createHook$1 = (lifecycle) => (hook, target = currentInstance) => (
  3590. // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
  3591. (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target)
  3592. );
  3593. const onBeforeMount = createHook$1(
  3594. "bm"
  3595. /* LifecycleHooks.BEFORE_MOUNT */
  3596. );
  3597. const onMounted = createHook$1(
  3598. "m"
  3599. /* LifecycleHooks.MOUNTED */
  3600. );
  3601. const onBeforeUpdate = createHook$1(
  3602. "bu"
  3603. /* LifecycleHooks.BEFORE_UPDATE */
  3604. );
  3605. const onUpdated = createHook$1(
  3606. "u"
  3607. /* LifecycleHooks.UPDATED */
  3608. );
  3609. const onBeforeUnmount = createHook$1(
  3610. "bum"
  3611. /* LifecycleHooks.BEFORE_UNMOUNT */
  3612. );
  3613. const onUnmounted = createHook$1(
  3614. "um"
  3615. /* LifecycleHooks.UNMOUNTED */
  3616. );
  3617. const onServerPrefetch = createHook$1(
  3618. "sp"
  3619. /* LifecycleHooks.SERVER_PREFETCH */
  3620. );
  3621. const onRenderTriggered = createHook$1(
  3622. "rtg"
  3623. /* LifecycleHooks.RENDER_TRIGGERED */
  3624. );
  3625. const onRenderTracked = createHook$1(
  3626. "rtc"
  3627. /* LifecycleHooks.RENDER_TRACKED */
  3628. );
  3629. function onErrorCaptured(hook, target = currentInstance) {
  3630. injectHook("ec", hook, target);
  3631. }
  3632. function validateDirectiveName(name) {
  3633. if (isBuiltInDirective(name)) {
  3634. warn("Do not use built-in directive ids as custom directive id: " + name);
  3635. }
  3636. }
  3637. const COMPONENTS = "components";
  3638. function resolveComponent(name, maybeSelfReference) {
  3639. return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
  3640. }
  3641. function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
  3642. const instance = currentRenderingInstance || currentInstance;
  3643. if (instance) {
  3644. const Component2 = instance.type;
  3645. if (type === COMPONENTS) {
  3646. const selfName = getComponentName(
  3647. Component2,
  3648. false
  3649. /* do not include inferred name to avoid breaking existing code */
  3650. );
  3651. if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
  3652. return Component2;
  3653. }
  3654. }
  3655. const res = (
  3656. // local registration
  3657. // check instance[type] first which is resolved for options API
  3658. resolve(instance[type] || Component2[type], name) || // global registration
  3659. resolve(instance.appContext[type], name)
  3660. );
  3661. if (!res && maybeSelfReference) {
  3662. return Component2;
  3663. }
  3664. if (warnMissing && !res) {
  3665. const extra = type === COMPONENTS ? `
  3666. If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
  3667. warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
  3668. }
  3669. return res;
  3670. } else {
  3671. warn(`resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`);
  3672. }
  3673. }
  3674. function resolve(registry, name) {
  3675. return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
  3676. }
  3677. const getPublicInstance = (i) => {
  3678. if (!i)
  3679. return null;
  3680. if (isStatefulComponent(i))
  3681. return getExposeProxy(i) || i.proxy;
  3682. return getPublicInstance(i.parent);
  3683. };
  3684. const publicPropertiesMap = (
  3685. // Move PURE marker to new line to workaround compiler discarding it
  3686. // due to type annotation
  3687. /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
  3688. $: (i) => i,
  3689. // fixed by xxxxxx vue-i18n 在 dev 模式,访问了 $el,故模拟一个假的
  3690. // $el: i => i.vnode.el,
  3691. $el: (i) => i.__$el || (i.__$el = {}),
  3692. $data: (i) => i.data,
  3693. $props: (i) => shallowReadonly(i.props),
  3694. $attrs: (i) => shallowReadonly(i.attrs),
  3695. $slots: (i) => shallowReadonly(i.slots),
  3696. $refs: (i) => shallowReadonly(i.refs),
  3697. $parent: (i) => getPublicInstance(i.parent),
  3698. $root: (i) => getPublicInstance(i.root),
  3699. $emit: (i) => i.emit,
  3700. $options: (i) => resolveMergedOptions(i),
  3701. $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),
  3702. // $nextTick: i => i.n || (i.n = nextTick.bind(i.proxy!)),// fixed by xxxxxx
  3703. $watch: (i) => instanceWatch.bind(i)
  3704. })
  3705. );
  3706. const isReservedPrefix = (key) => key === "_" || key === "$";
  3707. const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
  3708. const PublicInstanceProxyHandlers = {
  3709. get({ _: instance }, key) {
  3710. const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
  3711. if (key === "__isVue") {
  3712. return true;
  3713. }
  3714. let normalizedProps;
  3715. if (key[0] !== "$") {
  3716. const n2 = accessCache[key];
  3717. if (n2 !== void 0) {
  3718. switch (n2) {
  3719. case 1:
  3720. return setupState[key];
  3721. case 2:
  3722. return data[key];
  3723. case 4:
  3724. return ctx[key];
  3725. case 3:
  3726. return props[key];
  3727. }
  3728. } else if (hasSetupBinding(setupState, key)) {
  3729. accessCache[key] = 1;
  3730. return setupState[key];
  3731. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3732. accessCache[key] = 2;
  3733. return data[key];
  3734. } else if (
  3735. // only cache other properties when instance has declared (thus stable)
  3736. // props
  3737. (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)
  3738. ) {
  3739. accessCache[key] = 3;
  3740. return props[key];
  3741. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3742. accessCache[key] = 4;
  3743. return ctx[key];
  3744. } else if (shouldCacheAccess) {
  3745. accessCache[key] = 0;
  3746. }
  3747. }
  3748. const publicGetter = publicPropertiesMap[key];
  3749. let cssModule, globalProperties;
  3750. if (publicGetter) {
  3751. if (key === "$attrs") {
  3752. track(instance, "get", key);
  3753. }
  3754. return publicGetter(instance);
  3755. } else if (
  3756. // css module (injected by vue-loader)
  3757. (cssModule = type.__cssModules) && (cssModule = cssModule[key])
  3758. ) {
  3759. return cssModule;
  3760. } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
  3761. accessCache[key] = 4;
  3762. return ctx[key];
  3763. } else if (
  3764. // global properties
  3765. globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)
  3766. ) {
  3767. {
  3768. return globalProperties[key];
  3769. }
  3770. } else if (currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading
  3771. // to infinite warning loop
  3772. key.indexOf("__v") !== 0)) {
  3773. if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
  3774. warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`);
  3775. } else if (instance === currentRenderingInstance) {
  3776. warn(`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`);
  3777. }
  3778. }
  3779. },
  3780. set({ _: instance }, key, value) {
  3781. const { data, setupState, ctx } = instance;
  3782. if (hasSetupBinding(setupState, key)) {
  3783. setupState[key] = value;
  3784. return true;
  3785. } else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
  3786. warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
  3787. return false;
  3788. } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
  3789. data[key] = value;
  3790. return true;
  3791. } else if (hasOwn(instance.props, key)) {
  3792. warn(`Attempting to mutate prop "${key}". Props are readonly.`);
  3793. return false;
  3794. }
  3795. if (key[0] === "$" && key.slice(1) in instance) {
  3796. warn(`Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`);
  3797. return false;
  3798. } else {
  3799. if (key in instance.appContext.config.globalProperties) {
  3800. Object.defineProperty(ctx, key, {
  3801. enumerable: true,
  3802. configurable: true,
  3803. value
  3804. });
  3805. } else {
  3806. ctx[key] = value;
  3807. }
  3808. }
  3809. return true;
  3810. },
  3811. has({ _: { data, setupState, accessCache, ctx, appContext, propsOptions } }, key) {
  3812. let normalizedProps;
  3813. 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);
  3814. },
  3815. defineProperty(target, key, descriptor) {
  3816. if (descriptor.get != null) {
  3817. target._.accessCache[key] = 0;
  3818. } else if (hasOwn(descriptor, "value")) {
  3819. this.set(target, key, descriptor.value, null);
  3820. }
  3821. return Reflect.defineProperty(target, key, descriptor);
  3822. }
  3823. };
  3824. {
  3825. PublicInstanceProxyHandlers.ownKeys = (target) => {
  3826. warn(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`);
  3827. return Reflect.ownKeys(target);
  3828. };
  3829. }
  3830. function createDevRenderContext(instance) {
  3831. const target = {};
  3832. Object.defineProperty(target, `_`, {
  3833. configurable: true,
  3834. enumerable: false,
  3835. get: () => instance
  3836. });
  3837. Object.keys(publicPropertiesMap).forEach((key) => {
  3838. Object.defineProperty(target, key, {
  3839. configurable: true,
  3840. enumerable: false,
  3841. get: () => publicPropertiesMap[key](instance),
  3842. // intercepted by the proxy so no need for implementation,
  3843. // but needed to prevent set errors
  3844. set: NOOP
  3845. });
  3846. });
  3847. return target;
  3848. }
  3849. function exposePropsOnRenderContext(instance) {
  3850. const { ctx, propsOptions: [propsOptions] } = instance;
  3851. if (propsOptions) {
  3852. Object.keys(propsOptions).forEach((key) => {
  3853. Object.defineProperty(ctx, key, {
  3854. enumerable: true,
  3855. configurable: true,
  3856. get: () => instance.props[key],
  3857. set: NOOP
  3858. });
  3859. });
  3860. }
  3861. }
  3862. function exposeSetupStateOnRenderContext(instance) {
  3863. const { ctx, setupState } = instance;
  3864. Object.keys(toRaw(setupState)).forEach((key) => {
  3865. if (!setupState.__isScriptSetup) {
  3866. if (isReservedPrefix(key[0])) {
  3867. warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);
  3868. return;
  3869. }
  3870. Object.defineProperty(ctx, key, {
  3871. enumerable: true,
  3872. configurable: true,
  3873. get: () => setupState[key],
  3874. set: NOOP
  3875. });
  3876. }
  3877. });
  3878. }
  3879. function createDuplicateChecker() {
  3880. const cache = /* @__PURE__ */ Object.create(null);
  3881. return (type, key) => {
  3882. if (cache[key]) {
  3883. warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
  3884. } else {
  3885. cache[key] = type;
  3886. }
  3887. };
  3888. }
  3889. let shouldCacheAccess = true;
  3890. function applyOptions$1(instance) {
  3891. const options = resolveMergedOptions(instance);
  3892. const publicThis = instance.proxy;
  3893. const ctx = instance.ctx;
  3894. shouldCacheAccess = false;
  3895. if (options.beforeCreate) {
  3896. callHook$1(
  3897. options.beforeCreate,
  3898. instance,
  3899. "bc"
  3900. /* LifecycleHooks.BEFORE_CREATE */
  3901. );
  3902. }
  3903. const {
  3904. // state
  3905. data: dataOptions,
  3906. computed: computedOptions,
  3907. methods,
  3908. watch: watchOptions,
  3909. provide: provideOptions,
  3910. inject: injectOptions,
  3911. // lifecycle
  3912. created,
  3913. beforeMount,
  3914. mounted,
  3915. beforeUpdate,
  3916. updated,
  3917. activated,
  3918. deactivated,
  3919. beforeDestroy,
  3920. beforeUnmount,
  3921. destroyed,
  3922. unmounted,
  3923. render,
  3924. renderTracked,
  3925. renderTriggered,
  3926. errorCaptured,
  3927. serverPrefetch,
  3928. // public API
  3929. expose,
  3930. inheritAttrs,
  3931. // assets
  3932. components,
  3933. directives,
  3934. filters
  3935. } = options;
  3936. const checkDuplicateProperties = createDuplicateChecker();
  3937. {
  3938. const [propsOptions] = instance.propsOptions;
  3939. if (propsOptions) {
  3940. for (const key in propsOptions) {
  3941. checkDuplicateProperties("Props", key);
  3942. }
  3943. }
  3944. }
  3945. if (injectOptions) {
  3946. resolveInjections(injectOptions, ctx, checkDuplicateProperties, instance.appContext.config.unwrapInjectedRef);
  3947. }
  3948. if (methods) {
  3949. for (const key in methods) {
  3950. const methodHandler = methods[key];
  3951. if (isFunction(methodHandler)) {
  3952. {
  3953. Object.defineProperty(ctx, key, {
  3954. value: methodHandler.bind(publicThis),
  3955. configurable: true,
  3956. enumerable: true,
  3957. writable: true
  3958. });
  3959. }
  3960. {
  3961. checkDuplicateProperties("Methods", key);
  3962. }
  3963. } else {
  3964. warn(`Method "${key}" has type "${typeof methodHandler}" in the component definition. Did you reference the function correctly?`);
  3965. }
  3966. }
  3967. }
  3968. if (dataOptions) {
  3969. if (!isFunction(dataOptions)) {
  3970. warn(`The data option must be a function. Plain object usage is no longer supported.`);
  3971. }
  3972. const data = dataOptions.call(publicThis, publicThis);
  3973. if (isPromise(data)) {
  3974. warn(`data() returned a Promise - note data() cannot be async; If you intend to perform data fetching before component renders, use async setup() + <Suspense>.`);
  3975. }
  3976. if (!isObject(data)) {
  3977. warn(`data() should return an object.`);
  3978. } else {
  3979. instance.data = reactive(data);
  3980. {
  3981. for (const key in data) {
  3982. checkDuplicateProperties("Data", key);
  3983. if (!isReservedPrefix(key[0])) {
  3984. Object.defineProperty(ctx, key, {
  3985. configurable: true,
  3986. enumerable: true,
  3987. get: () => data[key],
  3988. set: NOOP
  3989. });
  3990. }
  3991. }
  3992. }
  3993. }
  3994. }
  3995. shouldCacheAccess = true;
  3996. if (computedOptions) {
  3997. for (const key in computedOptions) {
  3998. const opt = computedOptions[key];
  3999. const get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
  4000. if (get2 === NOOP) {
  4001. warn(`Computed property "${key}" has no getter.`);
  4002. }
  4003. const set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : () => {
  4004. warn(`Write operation failed: computed property "${key}" is readonly.`);
  4005. };
  4006. const c = computed({
  4007. get: get2,
  4008. set: set2
  4009. });
  4010. Object.defineProperty(ctx, key, {
  4011. enumerable: true,
  4012. configurable: true,
  4013. get: () => c.value,
  4014. set: (v) => c.value = v
  4015. });
  4016. {
  4017. checkDuplicateProperties("Computed", key);
  4018. }
  4019. }
  4020. }
  4021. if (watchOptions) {
  4022. for (const key in watchOptions) {
  4023. createWatcher(watchOptions[key], ctx, publicThis, key);
  4024. }
  4025. }
  4026. {
  4027. if (provideOptions) {
  4028. const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions;
  4029. Reflect.ownKeys(provides).forEach((key) => {
  4030. provide(key, provides[key]);
  4031. });
  4032. }
  4033. }
  4034. {
  4035. if (created) {
  4036. callHook$1(
  4037. created,
  4038. instance,
  4039. "c"
  4040. /* LifecycleHooks.CREATED */
  4041. );
  4042. }
  4043. }
  4044. function registerLifecycleHook(register, hook) {
  4045. if (isArray(hook)) {
  4046. hook.forEach((_hook) => register(_hook.bind(publicThis)));
  4047. } else if (hook) {
  4048. register(hook.bind(publicThis));
  4049. }
  4050. }
  4051. registerLifecycleHook(onBeforeMount, beforeMount);
  4052. registerLifecycleHook(onMounted, mounted);
  4053. registerLifecycleHook(onBeforeUpdate, beforeUpdate);
  4054. registerLifecycleHook(onUpdated, updated);
  4055. registerLifecycleHook(onActivated, activated);
  4056. registerLifecycleHook(onDeactivated, deactivated);
  4057. registerLifecycleHook(onErrorCaptured, errorCaptured);
  4058. registerLifecycleHook(onRenderTracked, renderTracked);
  4059. registerLifecycleHook(onRenderTriggered, renderTriggered);
  4060. registerLifecycleHook(onBeforeUnmount, beforeUnmount);
  4061. registerLifecycleHook(onUnmounted, unmounted);
  4062. registerLifecycleHook(onServerPrefetch, serverPrefetch);
  4063. if (isArray(expose)) {
  4064. if (expose.length) {
  4065. const exposed = instance.exposed || (instance.exposed = {});
  4066. expose.forEach((key) => {
  4067. Object.defineProperty(exposed, key, {
  4068. get: () => publicThis[key],
  4069. set: (val) => publicThis[key] = val
  4070. });
  4071. });
  4072. } else if (!instance.exposed) {
  4073. instance.exposed = {};
  4074. }
  4075. }
  4076. if (render && instance.render === NOOP) {
  4077. instance.render = render;
  4078. }
  4079. if (inheritAttrs != null) {
  4080. instance.inheritAttrs = inheritAttrs;
  4081. }
  4082. if (components)
  4083. instance.components = components;
  4084. if (directives)
  4085. instance.directives = directives;
  4086. if (instance.ctx.$onApplyOptions) {
  4087. instance.ctx.$onApplyOptions(options, instance, publicThis);
  4088. }
  4089. }
  4090. function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP, unwrapRef = false) {
  4091. if (isArray(injectOptions)) {
  4092. injectOptions = normalizeInject(injectOptions);
  4093. }
  4094. for (const key in injectOptions) {
  4095. const opt = injectOptions[key];
  4096. let injected;
  4097. if (isObject(opt)) {
  4098. if ("default" in opt) {
  4099. injected = inject(
  4100. opt.from || key,
  4101. opt.default,
  4102. true
  4103. /* treat default function as factory */
  4104. );
  4105. } else {
  4106. injected = inject(opt.from || key);
  4107. }
  4108. } else {
  4109. injected = inject(opt);
  4110. }
  4111. if (isRef(injected)) {
  4112. if (unwrapRef) {
  4113. Object.defineProperty(ctx, key, {
  4114. enumerable: true,
  4115. configurable: true,
  4116. get: () => injected.value,
  4117. set: (v) => injected.value = v
  4118. });
  4119. } else {
  4120. {
  4121. warn(`injected property "${key}" is a ref and will be auto-unwrapped and no longer needs \`.value\` in the next minor release. To opt-in to the new behavior now, set \`app.config.unwrapInjectedRef = true\` (this config is temporary and will not be needed in the future.)`);
  4122. }
  4123. ctx[key] = injected;
  4124. }
  4125. } else {
  4126. ctx[key] = injected;
  4127. }
  4128. {
  4129. checkDuplicateProperties("Inject", key);
  4130. }
  4131. }
  4132. }
  4133. function callHook$1(hook, instance, type) {
  4134. callWithAsyncErrorHandling(isArray(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), instance, type);
  4135. }
  4136. function createWatcher(raw, ctx, publicThis, key) {
  4137. const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key];
  4138. if (isString(raw)) {
  4139. const handler = ctx[raw];
  4140. if (isFunction(handler)) {
  4141. watch(getter, handler);
  4142. } else {
  4143. warn(`Invalid watch handler specified by key "${raw}"`, handler);
  4144. }
  4145. } else if (isFunction(raw)) {
  4146. watch(getter, raw.bind(publicThis));
  4147. } else if (isObject(raw)) {
  4148. if (isArray(raw)) {
  4149. raw.forEach((r2) => createWatcher(r2, ctx, publicThis, key));
  4150. } else {
  4151. const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler];
  4152. if (isFunction(handler)) {
  4153. watch(getter, handler, raw);
  4154. } else {
  4155. warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
  4156. }
  4157. }
  4158. } else {
  4159. warn(`Invalid watch option: "${key}"`, raw);
  4160. }
  4161. }
  4162. function resolveMergedOptions(instance) {
  4163. const base = instance.type;
  4164. const { mixins, extends: extendsOptions } = base;
  4165. const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
  4166. const cached = cache.get(base);
  4167. let resolved;
  4168. if (cached) {
  4169. resolved = cached;
  4170. } else if (!globalMixins.length && !mixins && !extendsOptions) {
  4171. {
  4172. resolved = base;
  4173. }
  4174. } else {
  4175. resolved = {};
  4176. if (globalMixins.length) {
  4177. globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));
  4178. }
  4179. mergeOptions(resolved, base, optionMergeStrategies);
  4180. }
  4181. if (isObject(base)) {
  4182. cache.set(base, resolved);
  4183. }
  4184. return resolved;
  4185. }
  4186. function mergeOptions(to, from, strats, asMixin = false) {
  4187. const { mixins, extends: extendsOptions } = from;
  4188. if (extendsOptions) {
  4189. mergeOptions(to, extendsOptions, strats, true);
  4190. }
  4191. if (mixins) {
  4192. mixins.forEach((m) => mergeOptions(to, m, strats, true));
  4193. }
  4194. for (const key in from) {
  4195. if (asMixin && key === "expose") {
  4196. warn(`"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`);
  4197. } else {
  4198. const strat = internalOptionMergeStrats[key] || strats && strats[key];
  4199. to[key] = strat ? strat(to[key], from[key]) : from[key];
  4200. }
  4201. }
  4202. return to;
  4203. }
  4204. const internalOptionMergeStrats = {
  4205. data: mergeDataFn,
  4206. props: mergeObjectOptions,
  4207. emits: mergeObjectOptions,
  4208. // objects
  4209. methods: mergeObjectOptions,
  4210. computed: mergeObjectOptions,
  4211. // lifecycle
  4212. beforeCreate: mergeAsArray$1,
  4213. created: mergeAsArray$1,
  4214. beforeMount: mergeAsArray$1,
  4215. mounted: mergeAsArray$1,
  4216. beforeUpdate: mergeAsArray$1,
  4217. updated: mergeAsArray$1,
  4218. beforeDestroy: mergeAsArray$1,
  4219. beforeUnmount: mergeAsArray$1,
  4220. destroyed: mergeAsArray$1,
  4221. unmounted: mergeAsArray$1,
  4222. activated: mergeAsArray$1,
  4223. deactivated: mergeAsArray$1,
  4224. errorCaptured: mergeAsArray$1,
  4225. serverPrefetch: mergeAsArray$1,
  4226. // assets
  4227. components: mergeObjectOptions,
  4228. directives: mergeObjectOptions,
  4229. // watch
  4230. watch: mergeWatchOptions,
  4231. // provide / inject
  4232. provide: mergeDataFn,
  4233. inject: mergeInject
  4234. };
  4235. function mergeDataFn(to, from) {
  4236. if (!from) {
  4237. return to;
  4238. }
  4239. if (!to) {
  4240. return from;
  4241. }
  4242. return function mergedDataFn() {
  4243. return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
  4244. };
  4245. }
  4246. function mergeInject(to, from) {
  4247. return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
  4248. }
  4249. function normalizeInject(raw) {
  4250. if (isArray(raw)) {
  4251. const res = {};
  4252. for (let i = 0; i < raw.length; i++) {
  4253. res[raw[i]] = raw[i];
  4254. }
  4255. return res;
  4256. }
  4257. return raw;
  4258. }
  4259. function mergeAsArray$1(to, from) {
  4260. return to ? [...new Set([].concat(to, from))] : from;
  4261. }
  4262. function mergeObjectOptions(to, from) {
  4263. return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
  4264. }
  4265. function mergeWatchOptions(to, from) {
  4266. if (!to)
  4267. return from;
  4268. if (!from)
  4269. return to;
  4270. const merged = extend(/* @__PURE__ */ Object.create(null), to);
  4271. for (const key in from) {
  4272. merged[key] = mergeAsArray$1(to[key], from[key]);
  4273. }
  4274. return merged;
  4275. }
  4276. function initProps$1(instance, rawProps, isStateful, isSSR = false) {
  4277. const props = {};
  4278. const attrs = {};
  4279. instance.propsDefaults = /* @__PURE__ */ Object.create(null);
  4280. setFullProps(instance, rawProps, props, attrs);
  4281. for (const key in instance.propsOptions[0]) {
  4282. if (!(key in props)) {
  4283. props[key] = void 0;
  4284. }
  4285. }
  4286. {
  4287. validateProps(rawProps || {}, props, instance);
  4288. }
  4289. if (isStateful) {
  4290. instance.props = isSSR ? props : shallowReactive(props);
  4291. } else {
  4292. if (!instance.type.props) {
  4293. instance.props = attrs;
  4294. } else {
  4295. instance.props = props;
  4296. }
  4297. }
  4298. instance.attrs = attrs;
  4299. }
  4300. function isInHmrContext(instance) {
  4301. while (instance) {
  4302. if (instance.type.__hmrId)
  4303. return true;
  4304. instance = instance.parent;
  4305. }
  4306. }
  4307. function updateProps(instance, rawProps, rawPrevProps, optimized) {
  4308. const { props, attrs, vnode: { patchFlag } } = instance;
  4309. const rawCurrentProps = toRaw(props);
  4310. const [options] = instance.propsOptions;
  4311. let hasAttrsChanged = false;
  4312. if (
  4313. // always force full diff in dev
  4314. // - #1942 if hmr is enabled with sfc component
  4315. // - vite#872 non-sfc component used by sfc component
  4316. !isInHmrContext(instance) && (optimized || patchFlag > 0) && !(patchFlag & 16)
  4317. ) {
  4318. if (patchFlag & 8) {
  4319. const propsToUpdate = instance.vnode.dynamicProps;
  4320. for (let i = 0; i < propsToUpdate.length; i++) {
  4321. let key = propsToUpdate[i];
  4322. if (isEmitListener(instance.emitsOptions, key)) {
  4323. continue;
  4324. }
  4325. const value = rawProps[key];
  4326. if (options) {
  4327. if (hasOwn(attrs, key)) {
  4328. if (value !== attrs[key]) {
  4329. attrs[key] = value;
  4330. hasAttrsChanged = true;
  4331. }
  4332. } else {
  4333. const camelizedKey = camelize(key);
  4334. props[camelizedKey] = resolvePropValue(
  4335. options,
  4336. rawCurrentProps,
  4337. camelizedKey,
  4338. value,
  4339. instance,
  4340. false
  4341. /* isAbsent */
  4342. );
  4343. }
  4344. } else {
  4345. if (value !== attrs[key]) {
  4346. attrs[key] = value;
  4347. hasAttrsChanged = true;
  4348. }
  4349. }
  4350. }
  4351. }
  4352. } else {
  4353. if (setFullProps(instance, rawProps, props, attrs)) {
  4354. hasAttrsChanged = true;
  4355. }
  4356. let kebabKey;
  4357. for (const key in rawCurrentProps) {
  4358. if (!rawProps || // for camelCase
  4359. !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case
  4360. // and converted to camelCase (#955)
  4361. ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) {
  4362. if (options) {
  4363. if (rawPrevProps && // for camelCase
  4364. (rawPrevProps[key] !== void 0 || // for kebab-case
  4365. rawPrevProps[kebabKey] !== void 0)) {
  4366. props[key] = resolvePropValue(
  4367. options,
  4368. rawCurrentProps,
  4369. key,
  4370. void 0,
  4371. instance,
  4372. true
  4373. /* isAbsent */
  4374. );
  4375. }
  4376. } else {
  4377. delete props[key];
  4378. }
  4379. }
  4380. }
  4381. if (attrs !== rawCurrentProps) {
  4382. for (const key in attrs) {
  4383. if (!rawProps || !hasOwn(rawProps, key) && true) {
  4384. delete attrs[key];
  4385. hasAttrsChanged = true;
  4386. }
  4387. }
  4388. }
  4389. }
  4390. if (hasAttrsChanged) {
  4391. trigger(instance, "set", "$attrs");
  4392. }
  4393. {
  4394. validateProps(rawProps || {}, props, instance);
  4395. }
  4396. }
  4397. function setFullProps(instance, rawProps, props, attrs) {
  4398. const [options, needCastKeys] = instance.propsOptions;
  4399. let hasAttrsChanged = false;
  4400. let rawCastValues;
  4401. if (rawProps) {
  4402. for (let key in rawProps) {
  4403. if (isReservedProp(key)) {
  4404. continue;
  4405. }
  4406. const value = rawProps[key];
  4407. let camelKey;
  4408. if (options && hasOwn(options, camelKey = camelize(key))) {
  4409. if (!needCastKeys || !needCastKeys.includes(camelKey)) {
  4410. props[camelKey] = value;
  4411. } else {
  4412. (rawCastValues || (rawCastValues = {}))[camelKey] = value;
  4413. }
  4414. } else if (!isEmitListener(instance.emitsOptions, key)) {
  4415. if (!(key in attrs) || value !== attrs[key]) {
  4416. attrs[key] = value;
  4417. hasAttrsChanged = true;
  4418. }
  4419. }
  4420. }
  4421. }
  4422. if (needCastKeys) {
  4423. const rawCurrentProps = toRaw(props);
  4424. const castValues = rawCastValues || EMPTY_OBJ;
  4425. for (let i = 0; i < needCastKeys.length; i++) {
  4426. const key = needCastKeys[i];
  4427. props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key));
  4428. }
  4429. }
  4430. return hasAttrsChanged;
  4431. }
  4432. function resolvePropValue(options, props, key, value, instance, isAbsent) {
  4433. const opt = options[key];
  4434. if (opt != null) {
  4435. const hasDefault = hasOwn(opt, "default");
  4436. if (hasDefault && value === void 0) {
  4437. const defaultValue = opt.default;
  4438. if (opt.type !== Function && isFunction(defaultValue)) {
  4439. const { propsDefaults } = instance;
  4440. if (key in propsDefaults) {
  4441. value = propsDefaults[key];
  4442. } else {
  4443. setCurrentInstance(instance);
  4444. value = propsDefaults[key] = defaultValue.call(null, props);
  4445. unsetCurrentInstance();
  4446. }
  4447. } else {
  4448. value = defaultValue;
  4449. }
  4450. }
  4451. if (opt[
  4452. 0
  4453. /* BooleanFlags.shouldCast */
  4454. ]) {
  4455. if (isAbsent && !hasDefault) {
  4456. value = false;
  4457. } else if (opt[
  4458. 1
  4459. /* BooleanFlags.shouldCastTrue */
  4460. ] && (value === "" || value === hyphenate(key))) {
  4461. value = true;
  4462. }
  4463. }
  4464. }
  4465. return value;
  4466. }
  4467. function normalizePropsOptions(comp, appContext, asMixin = false) {
  4468. const cache = appContext.propsCache;
  4469. const cached = cache.get(comp);
  4470. if (cached) {
  4471. return cached;
  4472. }
  4473. const raw = comp.props;
  4474. const normalized = {};
  4475. const needCastKeys = [];
  4476. let hasExtends = false;
  4477. if (!isFunction(comp)) {
  4478. const extendProps = (raw2) => {
  4479. hasExtends = true;
  4480. const [props, keys] = normalizePropsOptions(raw2, appContext, true);
  4481. extend(normalized, props);
  4482. if (keys)
  4483. needCastKeys.push(...keys);
  4484. };
  4485. if (!asMixin && appContext.mixins.length) {
  4486. appContext.mixins.forEach(extendProps);
  4487. }
  4488. if (comp.extends) {
  4489. extendProps(comp.extends);
  4490. }
  4491. if (comp.mixins) {
  4492. comp.mixins.forEach(extendProps);
  4493. }
  4494. }
  4495. if (!raw && !hasExtends) {
  4496. if (isObject(comp)) {
  4497. cache.set(comp, EMPTY_ARR);
  4498. }
  4499. return EMPTY_ARR;
  4500. }
  4501. if (isArray(raw)) {
  4502. for (let i = 0; i < raw.length; i++) {
  4503. if (!isString(raw[i])) {
  4504. warn(`props must be strings when using array syntax.`, raw[i]);
  4505. }
  4506. const normalizedKey = camelize(raw[i]);
  4507. if (validatePropName(normalizedKey)) {
  4508. normalized[normalizedKey] = EMPTY_OBJ;
  4509. }
  4510. }
  4511. } else if (raw) {
  4512. if (!isObject(raw)) {
  4513. warn(`invalid props options`, raw);
  4514. }
  4515. for (const key in raw) {
  4516. const normalizedKey = camelize(key);
  4517. if (validatePropName(normalizedKey)) {
  4518. const opt = raw[key];
  4519. const prop = normalized[normalizedKey] = isArray(opt) || isFunction(opt) ? { type: opt } : Object.assign({}, opt);
  4520. if (prop) {
  4521. const booleanIndex = getTypeIndex(Boolean, prop.type);
  4522. const stringIndex = getTypeIndex(String, prop.type);
  4523. prop[
  4524. 0
  4525. /* BooleanFlags.shouldCast */
  4526. ] = booleanIndex > -1;
  4527. prop[
  4528. 1
  4529. /* BooleanFlags.shouldCastTrue */
  4530. ] = stringIndex < 0 || booleanIndex < stringIndex;
  4531. if (booleanIndex > -1 || hasOwn(prop, "default")) {
  4532. needCastKeys.push(normalizedKey);
  4533. }
  4534. }
  4535. }
  4536. }
  4537. }
  4538. const res = [normalized, needCastKeys];
  4539. if (isObject(comp)) {
  4540. cache.set(comp, res);
  4541. }
  4542. return res;
  4543. }
  4544. function validatePropName(key) {
  4545. if (key[0] !== "$") {
  4546. return true;
  4547. } else {
  4548. warn(`Invalid prop name: "${key}" is a reserved property.`);
  4549. }
  4550. return false;
  4551. }
  4552. function getType(ctor) {
  4553. const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
  4554. return match ? match[2] : ctor === null ? "null" : "";
  4555. }
  4556. function isSameType(a, b) {
  4557. return getType(a) === getType(b);
  4558. }
  4559. function getTypeIndex(type, expectedTypes) {
  4560. if (isArray(expectedTypes)) {
  4561. return expectedTypes.findIndex((t2) => isSameType(t2, type));
  4562. } else if (isFunction(expectedTypes)) {
  4563. return isSameType(expectedTypes, type) ? 0 : -1;
  4564. }
  4565. return -1;
  4566. }
  4567. function validateProps(rawProps, props, instance) {
  4568. const resolvedValues = toRaw(props);
  4569. const options = instance.propsOptions[0];
  4570. for (const key in options) {
  4571. let opt = options[key];
  4572. if (opt == null)
  4573. continue;
  4574. validateProp(key, resolvedValues[key], opt, !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)));
  4575. }
  4576. }
  4577. function validateProp(name, value, prop, isAbsent) {
  4578. const { type, required, validator } = prop;
  4579. if (required && isAbsent) {
  4580. warn('Missing required prop: "' + name + '"');
  4581. return;
  4582. }
  4583. if (value == null && !prop.required) {
  4584. return;
  4585. }
  4586. if (type != null && type !== true) {
  4587. let isValid = false;
  4588. const types = isArray(type) ? type : [type];
  4589. const expectedTypes = [];
  4590. for (let i = 0; i < types.length && !isValid; i++) {
  4591. const { valid, expectedType } = assertType(value, types[i]);
  4592. expectedTypes.push(expectedType || "");
  4593. isValid = valid;
  4594. }
  4595. if (!isValid) {
  4596. warn(getInvalidTypeMessage(name, value, expectedTypes));
  4597. return;
  4598. }
  4599. }
  4600. if (validator && !validator(value)) {
  4601. warn('Invalid prop: custom validator check failed for prop "' + name + '".');
  4602. }
  4603. }
  4604. const isSimpleType = /* @__PURE__ */ makeMap("String,Number,Boolean,Function,Symbol,BigInt");
  4605. function assertType(value, type) {
  4606. let valid;
  4607. const expectedType = getType(type);
  4608. if (isSimpleType(expectedType)) {
  4609. const t2 = typeof value;
  4610. valid = t2 === expectedType.toLowerCase();
  4611. if (!valid && t2 === "object") {
  4612. valid = value instanceof type;
  4613. }
  4614. } else if (expectedType === "Object") {
  4615. valid = isObject(value);
  4616. } else if (expectedType === "Array") {
  4617. valid = isArray(value);
  4618. } else if (expectedType === "null") {
  4619. valid = value === null;
  4620. } else {
  4621. valid = value instanceof type;
  4622. }
  4623. return {
  4624. valid,
  4625. expectedType
  4626. };
  4627. }
  4628. function getInvalidTypeMessage(name, value, expectedTypes) {
  4629. let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
  4630. const expectedType = expectedTypes[0];
  4631. const receivedType = toRawType(value);
  4632. const expectedValue = styleValue(value, expectedType);
  4633. const receivedValue = styleValue(value, receivedType);
  4634. if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) {
  4635. message += ` with value ${expectedValue}`;
  4636. }
  4637. message += `, got ${receivedType} `;
  4638. if (isExplicable(receivedType)) {
  4639. message += `with value ${receivedValue}.`;
  4640. }
  4641. return message;
  4642. }
  4643. function styleValue(value, type) {
  4644. if (type === "String") {
  4645. return `"${value}"`;
  4646. } else if (type === "Number") {
  4647. return `${Number(value)}`;
  4648. } else {
  4649. return `${value}`;
  4650. }
  4651. }
  4652. function isExplicable(type) {
  4653. const explicitTypes = ["string", "number", "boolean"];
  4654. return explicitTypes.some((elem) => type.toLowerCase() === elem);
  4655. }
  4656. function isBoolean(...args) {
  4657. return args.some((elem) => elem.toLowerCase() === "boolean");
  4658. }
  4659. function createAppContext() {
  4660. return {
  4661. app: null,
  4662. config: {
  4663. isNativeTag: NO,
  4664. performance: false,
  4665. globalProperties: {},
  4666. optionMergeStrategies: {},
  4667. errorHandler: void 0,
  4668. warnHandler: void 0,
  4669. compilerOptions: {}
  4670. },
  4671. mixins: [],
  4672. components: {},
  4673. directives: {},
  4674. provides: /* @__PURE__ */ Object.create(null),
  4675. optionsCache: /* @__PURE__ */ new WeakMap(),
  4676. propsCache: /* @__PURE__ */ new WeakMap(),
  4677. emitsCache: /* @__PURE__ */ new WeakMap()
  4678. };
  4679. }
  4680. let uid$1 = 0;
  4681. function createAppAPI(render, hydrate) {
  4682. return function createApp2(rootComponent, rootProps = null) {
  4683. if (!isFunction(rootComponent)) {
  4684. rootComponent = Object.assign({}, rootComponent);
  4685. }
  4686. if (rootProps != null && !isObject(rootProps)) {
  4687. warn(`root props passed to app.mount() must be an object.`);
  4688. rootProps = null;
  4689. }
  4690. const context = createAppContext();
  4691. const installedPlugins = /* @__PURE__ */ new Set();
  4692. const app = context.app = {
  4693. _uid: uid$1++,
  4694. _component: rootComponent,
  4695. _props: rootProps,
  4696. _container: null,
  4697. _context: context,
  4698. _instance: null,
  4699. version,
  4700. get config() {
  4701. return context.config;
  4702. },
  4703. set config(v) {
  4704. {
  4705. warn(`app.config cannot be replaced. Modify individual options instead.`);
  4706. }
  4707. },
  4708. use(plugin2, ...options) {
  4709. if (installedPlugins.has(plugin2)) {
  4710. warn(`Plugin has already been applied to target app.`);
  4711. } else if (plugin2 && isFunction(plugin2.install)) {
  4712. installedPlugins.add(plugin2);
  4713. plugin2.install(app, ...options);
  4714. } else if (isFunction(plugin2)) {
  4715. installedPlugins.add(plugin2);
  4716. plugin2(app, ...options);
  4717. } else {
  4718. warn(`A plugin must either be a function or an object with an "install" function.`);
  4719. }
  4720. return app;
  4721. },
  4722. mixin(mixin) {
  4723. {
  4724. if (!context.mixins.includes(mixin)) {
  4725. context.mixins.push(mixin);
  4726. } else {
  4727. warn("Mixin has already been applied to target app" + (mixin.name ? `: ${mixin.name}` : ""));
  4728. }
  4729. }
  4730. return app;
  4731. },
  4732. component(name, component) {
  4733. {
  4734. validateComponentName(name, context.config);
  4735. }
  4736. if (!component) {
  4737. return context.components[name];
  4738. }
  4739. if (context.components[name]) {
  4740. warn(`Component "${name}" has already been registered in target app.`);
  4741. }
  4742. context.components[name] = component;
  4743. return app;
  4744. },
  4745. directive(name, directive) {
  4746. {
  4747. validateDirectiveName(name);
  4748. }
  4749. if (!directive) {
  4750. return context.directives[name];
  4751. }
  4752. if (context.directives[name]) {
  4753. warn(`Directive "${name}" has already been registered in target app.`);
  4754. }
  4755. context.directives[name] = directive;
  4756. return app;
  4757. },
  4758. // fixed by xxxxxx
  4759. mount() {
  4760. },
  4761. // fixed by xxxxxx
  4762. unmount() {
  4763. },
  4764. provide(key, value) {
  4765. if (key in context.provides) {
  4766. warn(`App already provides property with key "${String(key)}". It will be overwritten with the new value.`);
  4767. }
  4768. context.provides[key] = value;
  4769. return app;
  4770. }
  4771. };
  4772. return app;
  4773. };
  4774. }
  4775. let supported;
  4776. let perf;
  4777. function startMeasure(instance, type) {
  4778. if (instance.appContext.config.performance && isSupported()) {
  4779. perf.mark(`vue-${type}-${instance.uid}`);
  4780. }
  4781. {
  4782. devtoolsPerfStart(instance, type, isSupported() ? perf.now() : Date.now());
  4783. }
  4784. }
  4785. function endMeasure(instance, type) {
  4786. if (instance.appContext.config.performance && isSupported()) {
  4787. const startTag = `vue-${type}-${instance.uid}`;
  4788. const endTag = startTag + `:end`;
  4789. perf.mark(endTag);
  4790. perf.measure(`<${formatComponentName(instance, instance.type)}> ${type}`, startTag, endTag);
  4791. perf.clearMarks(startTag);
  4792. perf.clearMarks(endTag);
  4793. }
  4794. {
  4795. devtoolsPerfEnd(instance, type, isSupported() ? perf.now() : Date.now());
  4796. }
  4797. }
  4798. function isSupported() {
  4799. if (supported !== void 0) {
  4800. return supported;
  4801. }
  4802. if (typeof window !== "undefined" && window.performance) {
  4803. supported = true;
  4804. perf = window.performance;
  4805. } else {
  4806. supported = false;
  4807. }
  4808. return supported;
  4809. }
  4810. const queuePostRenderEffect$1 = queuePostFlushCb;
  4811. const Fragment = Symbol("Fragment");
  4812. const Text = Symbol("Text");
  4813. const Comment = Symbol("Comment");
  4814. const Static = Symbol("Static");
  4815. function isVNode(value) {
  4816. return value ? value.__v_isVNode === true : false;
  4817. }
  4818. const InternalObjectKey = `__vInternal`;
  4819. function guardReactiveProps(props) {
  4820. if (!props)
  4821. return null;
  4822. return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props;
  4823. }
  4824. const emptyAppContext = createAppContext();
  4825. let uid = 0;
  4826. function createComponentInstance(vnode, parent, suspense) {
  4827. const type = vnode.type;
  4828. const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
  4829. const instance = {
  4830. uid: uid++,
  4831. vnode,
  4832. type,
  4833. parent,
  4834. appContext,
  4835. root: null,
  4836. next: null,
  4837. subTree: null,
  4838. effect: null,
  4839. update: null,
  4840. scope: new EffectScope(
  4841. true
  4842. /* detached */
  4843. ),
  4844. render: null,
  4845. proxy: null,
  4846. exposed: null,
  4847. exposeProxy: null,
  4848. withProxy: null,
  4849. provides: parent ? parent.provides : Object.create(appContext.provides),
  4850. accessCache: null,
  4851. renderCache: [],
  4852. // local resolved assets
  4853. components: null,
  4854. directives: null,
  4855. // resolved props and emits options
  4856. propsOptions: normalizePropsOptions(type, appContext),
  4857. emitsOptions: normalizeEmitsOptions(type, appContext),
  4858. // emit
  4859. emit: null,
  4860. emitted: null,
  4861. // props default value
  4862. propsDefaults: EMPTY_OBJ,
  4863. // inheritAttrs
  4864. inheritAttrs: type.inheritAttrs,
  4865. // state
  4866. ctx: EMPTY_OBJ,
  4867. data: EMPTY_OBJ,
  4868. props: EMPTY_OBJ,
  4869. attrs: EMPTY_OBJ,
  4870. slots: EMPTY_OBJ,
  4871. refs: EMPTY_OBJ,
  4872. setupState: EMPTY_OBJ,
  4873. setupContext: null,
  4874. // suspense related
  4875. suspense,
  4876. suspenseId: suspense ? suspense.pendingId : 0,
  4877. asyncDep: null,
  4878. asyncResolved: false,
  4879. // lifecycle hooks
  4880. // not using enums here because it results in computed properties
  4881. isMounted: false,
  4882. isUnmounted: false,
  4883. isDeactivated: false,
  4884. bc: null,
  4885. c: null,
  4886. bm: null,
  4887. m: null,
  4888. bu: null,
  4889. u: null,
  4890. um: null,
  4891. bum: null,
  4892. da: null,
  4893. a: null,
  4894. rtg: null,
  4895. rtc: null,
  4896. ec: null,
  4897. sp: null
  4898. };
  4899. {
  4900. instance.ctx = createDevRenderContext(instance);
  4901. }
  4902. instance.root = parent ? parent.root : instance;
  4903. instance.emit = emit.bind(null, instance);
  4904. if (vnode.ce) {
  4905. vnode.ce(instance);
  4906. }
  4907. return instance;
  4908. }
  4909. let currentInstance = null;
  4910. const getCurrentInstance = () => currentInstance || currentRenderingInstance;
  4911. const setCurrentInstance = (instance) => {
  4912. currentInstance = instance;
  4913. instance.scope.on();
  4914. };
  4915. const unsetCurrentInstance = () => {
  4916. currentInstance && currentInstance.scope.off();
  4917. currentInstance = null;
  4918. };
  4919. const isBuiltInTag = /* @__PURE__ */ makeMap("slot,component");
  4920. function validateComponentName(name, config) {
  4921. const appIsNativeTag = config.isNativeTag || NO;
  4922. if (isBuiltInTag(name) || appIsNativeTag(name)) {
  4923. warn("Do not use built-in or reserved HTML elements as component id: " + name);
  4924. }
  4925. }
  4926. function isStatefulComponent(instance) {
  4927. return instance.vnode.shapeFlag & 4;
  4928. }
  4929. let isInSSRComponentSetup = false;
  4930. function setupComponent(instance, isSSR = false) {
  4931. isInSSRComponentSetup = isSSR;
  4932. const {
  4933. props
  4934. /*, children*/
  4935. } = instance.vnode;
  4936. const isStateful = isStatefulComponent(instance);
  4937. initProps$1(instance, props, isStateful, isSSR);
  4938. const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
  4939. isInSSRComponentSetup = false;
  4940. return setupResult;
  4941. }
  4942. function setupStatefulComponent(instance, isSSR) {
  4943. const Component2 = instance.type;
  4944. {
  4945. if (Component2.name) {
  4946. validateComponentName(Component2.name, instance.appContext.config);
  4947. }
  4948. if (Component2.components) {
  4949. const names = Object.keys(Component2.components);
  4950. for (let i = 0; i < names.length; i++) {
  4951. validateComponentName(names[i], instance.appContext.config);
  4952. }
  4953. }
  4954. if (Component2.directives) {
  4955. const names = Object.keys(Component2.directives);
  4956. for (let i = 0; i < names.length; i++) {
  4957. validateDirectiveName(names[i]);
  4958. }
  4959. }
  4960. if (Component2.compilerOptions && isRuntimeOnly()) {
  4961. warn(`"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.`);
  4962. }
  4963. }
  4964. instance.accessCache = /* @__PURE__ */ Object.create(null);
  4965. instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
  4966. {
  4967. exposePropsOnRenderContext(instance);
  4968. }
  4969. const { setup } = Component2;
  4970. if (setup) {
  4971. const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
  4972. setCurrentInstance(instance);
  4973. pauseTracking();
  4974. const setupResult = callWithErrorHandling(setup, instance, 0, [shallowReadonly(instance.props), setupContext]);
  4975. resetTracking();
  4976. unsetCurrentInstance();
  4977. if (isPromise(setupResult)) {
  4978. setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
  4979. {
  4980. warn(`setup() returned a Promise, but the version of Vue you are using does not support it yet.`);
  4981. }
  4982. } else {
  4983. handleSetupResult(instance, setupResult, isSSR);
  4984. }
  4985. } else {
  4986. finishComponentSetup(instance, isSSR);
  4987. }
  4988. }
  4989. function handleSetupResult(instance, setupResult, isSSR) {
  4990. if (isFunction(setupResult)) {
  4991. {
  4992. instance.render = setupResult;
  4993. }
  4994. } else if (isObject(setupResult)) {
  4995. if (isVNode(setupResult)) {
  4996. warn(`setup() should not return VNodes directly - return a render function instead.`);
  4997. }
  4998. {
  4999. instance.devtoolsRawSetupState = setupResult;
  5000. }
  5001. instance.setupState = proxyRefs(setupResult);
  5002. {
  5003. exposeSetupStateOnRenderContext(instance);
  5004. }
  5005. } else if (setupResult !== void 0) {
  5006. warn(`setup() should return an object. Received: ${setupResult === null ? "null" : typeof setupResult}`);
  5007. }
  5008. finishComponentSetup(instance, isSSR);
  5009. }
  5010. let compile;
  5011. const isRuntimeOnly = () => !compile;
  5012. function finishComponentSetup(instance, isSSR, skipOptions) {
  5013. const Component2 = instance.type;
  5014. if (!instance.render) {
  5015. instance.render = Component2.render || NOOP;
  5016. }
  5017. {
  5018. setCurrentInstance(instance);
  5019. pauseTracking();
  5020. applyOptions$1(instance);
  5021. resetTracking();
  5022. unsetCurrentInstance();
  5023. }
  5024. if (!Component2.render && instance.render === NOOP && !isSSR) {
  5025. if (Component2.template) {
  5026. warn(
  5027. `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".`
  5028. /* should not happen */
  5029. );
  5030. } else {
  5031. warn(`Component is missing template or render function.`);
  5032. }
  5033. }
  5034. }
  5035. function createAttrsProxy(instance) {
  5036. return new Proxy(
  5037. instance.attrs,
  5038. {
  5039. get(target, key) {
  5040. track(instance, "get", "$attrs");
  5041. return target[key];
  5042. },
  5043. set() {
  5044. warn(`setupContext.attrs is readonly.`);
  5045. return false;
  5046. },
  5047. deleteProperty() {
  5048. warn(`setupContext.attrs is readonly.`);
  5049. return false;
  5050. }
  5051. }
  5052. );
  5053. }
  5054. function createSetupContext(instance) {
  5055. const expose = (exposed) => {
  5056. {
  5057. if (instance.exposed) {
  5058. warn(`expose() should be called only once per setup().`);
  5059. }
  5060. if (exposed != null) {
  5061. let exposedType = typeof exposed;
  5062. if (exposedType === "object") {
  5063. if (isArray(exposed)) {
  5064. exposedType = "array";
  5065. } else if (isRef(exposed)) {
  5066. exposedType = "ref";
  5067. }
  5068. }
  5069. if (exposedType !== "object") {
  5070. warn(`expose() should be passed a plain object, received ${exposedType}.`);
  5071. }
  5072. }
  5073. }
  5074. instance.exposed = exposed || {};
  5075. };
  5076. let attrs;
  5077. {
  5078. return Object.freeze({
  5079. get attrs() {
  5080. return attrs || (attrs = createAttrsProxy(instance));
  5081. },
  5082. get slots() {
  5083. return shallowReadonly(instance.slots);
  5084. },
  5085. get emit() {
  5086. return (event, ...args) => instance.emit(event, ...args);
  5087. },
  5088. expose
  5089. });
  5090. }
  5091. }
  5092. function getExposeProxy(instance) {
  5093. if (instance.exposed) {
  5094. return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
  5095. get(target, key) {
  5096. if (key in target) {
  5097. return target[key];
  5098. }
  5099. return instance.proxy[key];
  5100. },
  5101. has(target, key) {
  5102. return key in target || key in publicPropertiesMap;
  5103. }
  5104. }));
  5105. }
  5106. }
  5107. const classifyRE = /(?:^|[-_])(\w)/g;
  5108. const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
  5109. function getComponentName(Component2, includeInferred = true) {
  5110. return isFunction(Component2) ? Component2.displayName || Component2.name : Component2.name || includeInferred && Component2.__name;
  5111. }
  5112. function formatComponentName(instance, Component2, isRoot = false) {
  5113. let name = getComponentName(Component2);
  5114. if (!name && Component2.__file) {
  5115. const match = Component2.__file.match(/([^/\\]+)\.\w+$/);
  5116. if (match) {
  5117. name = match[1];
  5118. }
  5119. }
  5120. if (!name && instance && instance.parent) {
  5121. const inferFromRegistry = (registry) => {
  5122. for (const key in registry) {
  5123. if (registry[key] === Component2) {
  5124. return key;
  5125. }
  5126. }
  5127. };
  5128. name = inferFromRegistry(instance.components || instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
  5129. }
  5130. return name ? classify(name) : isRoot ? `App` : `Anonymous`;
  5131. }
  5132. const computed = (getterOrOptions, debugOptions) => {
  5133. return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
  5134. };
  5135. const version = "3.2.47";
  5136. function unwrapper(target) {
  5137. return unref(target);
  5138. }
  5139. const ARRAYTYPE = "[object Array]";
  5140. const OBJECTTYPE = "[object Object]";
  5141. function diff(current, pre) {
  5142. const result = {};
  5143. syncKeys(current, pre);
  5144. _diff(current, pre, "", result);
  5145. return result;
  5146. }
  5147. function syncKeys(current, pre) {
  5148. current = unwrapper(current);
  5149. if (current === pre)
  5150. return;
  5151. const rootCurrentType = toTypeString(current);
  5152. const rootPreType = toTypeString(pre);
  5153. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  5154. for (let key in pre) {
  5155. const currentValue = current[key];
  5156. if (currentValue === void 0) {
  5157. current[key] = null;
  5158. } else {
  5159. syncKeys(currentValue, pre[key]);
  5160. }
  5161. }
  5162. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  5163. if (current.length >= pre.length) {
  5164. pre.forEach((item, index2) => {
  5165. syncKeys(current[index2], item);
  5166. });
  5167. }
  5168. }
  5169. }
  5170. function _diff(current, pre, path, result) {
  5171. current = unwrapper(current);
  5172. if (current === pre)
  5173. return;
  5174. const rootCurrentType = toTypeString(current);
  5175. const rootPreType = toTypeString(pre);
  5176. if (rootCurrentType == OBJECTTYPE) {
  5177. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  5178. setResult(result, path, current);
  5179. } else {
  5180. for (let key in current) {
  5181. const currentValue = unwrapper(current[key]);
  5182. const preValue = pre[key];
  5183. const currentType = toTypeString(currentValue);
  5184. const preType = toTypeString(preValue);
  5185. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  5186. if (currentValue != preValue) {
  5187. setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
  5188. }
  5189. } else if (currentType == ARRAYTYPE) {
  5190. if (preType != ARRAYTYPE) {
  5191. setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
  5192. } else {
  5193. if (currentValue.length < preValue.length) {
  5194. setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
  5195. } else {
  5196. currentValue.forEach((item, index2) => {
  5197. _diff(item, preValue[index2], (path == "" ? "" : path + ".") + key + "[" + index2 + "]", result);
  5198. });
  5199. }
  5200. }
  5201. } else if (currentType == OBJECTTYPE) {
  5202. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  5203. setResult(result, (path == "" ? "" : path + ".") + key, currentValue);
  5204. } else {
  5205. for (let subKey in currentValue) {
  5206. _diff(currentValue[subKey], preValue[subKey], (path == "" ? "" : path + ".") + key + "." + subKey, result);
  5207. }
  5208. }
  5209. }
  5210. }
  5211. }
  5212. } else if (rootCurrentType == ARRAYTYPE) {
  5213. if (rootPreType != ARRAYTYPE) {
  5214. setResult(result, path, current);
  5215. } else {
  5216. if (current.length < pre.length) {
  5217. setResult(result, path, current);
  5218. } else {
  5219. current.forEach((item, index2) => {
  5220. _diff(item, pre[index2], path + "[" + index2 + "]", result);
  5221. });
  5222. }
  5223. }
  5224. } else {
  5225. setResult(result, path, current);
  5226. }
  5227. }
  5228. function setResult(result, k, v) {
  5229. result[k] = v;
  5230. }
  5231. function hasComponentEffect(instance) {
  5232. return queue.includes(instance.update);
  5233. }
  5234. function flushCallbacks(instance) {
  5235. const ctx = instance.ctx;
  5236. const callbacks = ctx.__next_tick_callbacks;
  5237. if (callbacks && callbacks.length) {
  5238. const copies = callbacks.slice(0);
  5239. callbacks.length = 0;
  5240. for (let i = 0; i < copies.length; i++) {
  5241. copies[i]();
  5242. }
  5243. }
  5244. }
  5245. function nextTick(instance, fn) {
  5246. const ctx = instance.ctx;
  5247. if (!ctx.__next_tick_pending && !hasComponentEffect(instance)) {
  5248. return nextTick$1(fn && fn.bind(instance.proxy));
  5249. }
  5250. let _resolve;
  5251. if (!ctx.__next_tick_callbacks) {
  5252. ctx.__next_tick_callbacks = [];
  5253. }
  5254. ctx.__next_tick_callbacks.push(() => {
  5255. if (fn) {
  5256. callWithErrorHandling(
  5257. fn.bind(instance.proxy),
  5258. instance,
  5259. 14
  5260. /* ErrorCodes.SCHEDULER */
  5261. );
  5262. } else if (_resolve) {
  5263. _resolve(instance.proxy);
  5264. }
  5265. });
  5266. return new Promise((resolve2) => {
  5267. _resolve = resolve2;
  5268. });
  5269. }
  5270. function clone(src, seen) {
  5271. src = unwrapper(src);
  5272. const type = typeof src;
  5273. if (type === "object" && src !== null) {
  5274. let copy = seen.get(src);
  5275. if (typeof copy !== "undefined") {
  5276. return copy;
  5277. }
  5278. if (isArray(src)) {
  5279. const len = src.length;
  5280. copy = new Array(len);
  5281. seen.set(src, copy);
  5282. for (let i = 0; i < len; i++) {
  5283. copy[i] = clone(src[i], seen);
  5284. }
  5285. } else {
  5286. copy = {};
  5287. seen.set(src, copy);
  5288. for (const name in src) {
  5289. if (hasOwn(src, name)) {
  5290. copy[name] = clone(src[name], seen);
  5291. }
  5292. }
  5293. }
  5294. return copy;
  5295. }
  5296. if (type !== "symbol") {
  5297. return src;
  5298. }
  5299. }
  5300. function deepCopy(src) {
  5301. return clone(src, typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : /* @__PURE__ */ new Map());
  5302. }
  5303. function getMPInstanceData(instance, keys) {
  5304. const data = instance.data;
  5305. const ret = /* @__PURE__ */ Object.create(null);
  5306. keys.forEach((key) => {
  5307. ret[key] = data[key];
  5308. });
  5309. return ret;
  5310. }
  5311. function patch(instance, data, oldData) {
  5312. if (!data) {
  5313. return;
  5314. }
  5315. data = deepCopy(data);
  5316. const ctx = instance.ctx;
  5317. const mpType = ctx.mpType;
  5318. if (mpType === "page" || mpType === "component") {
  5319. data.r0 = 1;
  5320. const mpInstance = ctx.$scope;
  5321. const keys = Object.keys(data);
  5322. const diffData = diff(data, oldData || getMPInstanceData(mpInstance, keys));
  5323. if (Object.keys(diffData).length) {
  5324. ctx.__next_tick_pending = true;
  5325. mpInstance.setData(diffData, () => {
  5326. ctx.__next_tick_pending = false;
  5327. flushCallbacks(instance);
  5328. });
  5329. flushPreFlushCbs();
  5330. } else {
  5331. flushCallbacks(instance);
  5332. }
  5333. }
  5334. }
  5335. function initAppConfig(appConfig) {
  5336. appConfig.globalProperties.$nextTick = function $nextTick(fn) {
  5337. return nextTick(this.$, fn);
  5338. };
  5339. }
  5340. function onApplyOptions(options, instance, publicThis) {
  5341. instance.appContext.config.globalProperties.$applyOptions(options, instance, publicThis);
  5342. const computedOptions = options.computed;
  5343. if (computedOptions) {
  5344. const keys = Object.keys(computedOptions);
  5345. if (keys.length) {
  5346. const ctx = instance.ctx;
  5347. if (!ctx.$computedKeys) {
  5348. ctx.$computedKeys = [];
  5349. }
  5350. ctx.$computedKeys.push(...keys);
  5351. }
  5352. }
  5353. delete instance.ctx.$onApplyOptions;
  5354. }
  5355. function setRef$1(instance, isUnmount = false) {
  5356. const { setupState, $templateRefs, ctx: { $scope, $mpPlatform } } = instance;
  5357. if ($mpPlatform === "mp-alipay") {
  5358. return;
  5359. }
  5360. if (!$templateRefs || !$scope) {
  5361. return;
  5362. }
  5363. if (isUnmount) {
  5364. return $templateRefs.forEach((templateRef) => setTemplateRef(templateRef, null, setupState));
  5365. }
  5366. const check = $mpPlatform === "mp-baidu" || $mpPlatform === "mp-toutiao";
  5367. const doSetByRefs = (refs) => {
  5368. const mpComponents = (
  5369. // 字节小程序 selectAllComponents 可能返回 null
  5370. // https://github.com/dcloudio/uni-app/issues/3954
  5371. ($scope.selectAllComponents(".r") || []).concat($scope.selectAllComponents(".r-i-f") || [])
  5372. );
  5373. return refs.filter((templateRef) => {
  5374. const refValue = findComponentPublicInstance(mpComponents, templateRef.i);
  5375. if (check && refValue === null) {
  5376. return true;
  5377. }
  5378. setTemplateRef(templateRef, refValue, setupState);
  5379. return false;
  5380. });
  5381. };
  5382. const doSet = () => {
  5383. const refs = doSetByRefs($templateRefs);
  5384. if (refs.length && instance.proxy && instance.proxy.$scope) {
  5385. instance.proxy.$scope.setData({ r1: 1 }, () => {
  5386. doSetByRefs(refs);
  5387. });
  5388. }
  5389. };
  5390. if ($scope._$setRef) {
  5391. $scope._$setRef(doSet);
  5392. } else {
  5393. nextTick(instance, doSet);
  5394. }
  5395. }
  5396. function toSkip(value) {
  5397. if (isObject(value)) {
  5398. markRaw(value);
  5399. }
  5400. return value;
  5401. }
  5402. function findComponentPublicInstance(mpComponents, id) {
  5403. const mpInstance = mpComponents.find((com) => com && (com.properties || com.props).uI === id);
  5404. if (mpInstance) {
  5405. const vm = mpInstance.$vm;
  5406. if (vm) {
  5407. return getExposeProxy(vm.$) || vm;
  5408. }
  5409. return toSkip(mpInstance);
  5410. }
  5411. return null;
  5412. }
  5413. function setTemplateRef({ r: r2, f: f2 }, refValue, setupState) {
  5414. if (isFunction(r2)) {
  5415. r2(refValue, {});
  5416. } else {
  5417. const _isString = isString(r2);
  5418. const _isRef = isRef(r2);
  5419. if (_isString || _isRef) {
  5420. if (f2) {
  5421. if (!_isRef) {
  5422. return;
  5423. }
  5424. if (!isArray(r2.value)) {
  5425. r2.value = [];
  5426. }
  5427. const existing = r2.value;
  5428. if (existing.indexOf(refValue) === -1) {
  5429. existing.push(refValue);
  5430. if (!refValue) {
  5431. return;
  5432. }
  5433. onBeforeUnmount(() => remove(existing, refValue), refValue.$);
  5434. }
  5435. } else if (_isString) {
  5436. if (hasOwn(setupState, r2)) {
  5437. setupState[r2] = refValue;
  5438. }
  5439. } else if (isRef(r2)) {
  5440. r2.value = refValue;
  5441. } else {
  5442. warnRef(r2);
  5443. }
  5444. } else {
  5445. warnRef(r2);
  5446. }
  5447. }
  5448. }
  5449. function warnRef(ref2) {
  5450. warn("Invalid template ref type:", ref2, `(${typeof ref2})`);
  5451. }
  5452. var MPType;
  5453. (function(MPType2) {
  5454. MPType2["APP"] = "app";
  5455. MPType2["PAGE"] = "page";
  5456. MPType2["COMPONENT"] = "component";
  5457. })(MPType || (MPType = {}));
  5458. const queuePostRenderEffect = queuePostFlushCb;
  5459. function mountComponent(initialVNode, options) {
  5460. const instance = initialVNode.component = createComponentInstance(initialVNode, options.parentComponent, null);
  5461. {
  5462. instance.ctx.$onApplyOptions = onApplyOptions;
  5463. instance.ctx.$children = [];
  5464. }
  5465. if (options.mpType === "app") {
  5466. instance.render = NOOP;
  5467. }
  5468. if (options.onBeforeSetup) {
  5469. options.onBeforeSetup(instance, options);
  5470. }
  5471. {
  5472. pushWarningContext(initialVNode);
  5473. startMeasure(instance, `mount`);
  5474. }
  5475. {
  5476. startMeasure(instance, `init`);
  5477. }
  5478. setupComponent(instance);
  5479. {
  5480. endMeasure(instance, `init`);
  5481. }
  5482. {
  5483. if (options.parentComponent && instance.proxy) {
  5484. options.parentComponent.ctx.$children.push(getExposeProxy(instance) || instance.proxy);
  5485. }
  5486. }
  5487. setupRenderEffect(instance);
  5488. {
  5489. popWarningContext();
  5490. endMeasure(instance, `mount`);
  5491. }
  5492. return instance.proxy;
  5493. }
  5494. const getFunctionalFallthrough = (attrs) => {
  5495. let res;
  5496. for (const key in attrs) {
  5497. if (key === "class" || key === "style" || isOn(key)) {
  5498. (res || (res = {}))[key] = attrs[key];
  5499. }
  5500. }
  5501. return res;
  5502. };
  5503. function renderComponentRoot(instance) {
  5504. const { type: Component2, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit: emit2, render, renderCache, data, setupState, ctx, uid: uid2, appContext: { app: { config: { globalProperties: { pruneComponentPropsCache: pruneComponentPropsCache2 } } } }, inheritAttrs } = instance;
  5505. instance.$templateRefs = [];
  5506. instance.$ei = 0;
  5507. pruneComponentPropsCache2(uid2);
  5508. instance.__counter = instance.__counter === 0 ? 1 : 0;
  5509. let result;
  5510. const prev = setCurrentRenderingInstance(instance);
  5511. try {
  5512. if (vnode.shapeFlag & 4) {
  5513. fallthroughAttrs(inheritAttrs, props, propsOptions, attrs);
  5514. const proxyToUse = withProxy || proxy;
  5515. result = render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx);
  5516. } else {
  5517. fallthroughAttrs(inheritAttrs, props, propsOptions, Component2.props ? attrs : getFunctionalFallthrough(attrs));
  5518. const render2 = Component2;
  5519. result = render2.length > 1 ? render2(props, { attrs, slots, emit: emit2 }) : render2(
  5520. props,
  5521. null
  5522. /* we know it doesn't need it */
  5523. );
  5524. }
  5525. } catch (err) {
  5526. handleError(
  5527. err,
  5528. instance,
  5529. 1
  5530. /* ErrorCodes.RENDER_FUNCTION */
  5531. );
  5532. result = false;
  5533. }
  5534. setRef$1(instance);
  5535. setCurrentRenderingInstance(prev);
  5536. return result;
  5537. }
  5538. function fallthroughAttrs(inheritAttrs, props, propsOptions, fallthroughAttrs2) {
  5539. if (props && fallthroughAttrs2 && inheritAttrs !== false) {
  5540. const keys = Object.keys(fallthroughAttrs2).filter((key) => key !== "class" && key !== "style");
  5541. if (!keys.length) {
  5542. return;
  5543. }
  5544. if (propsOptions && keys.some(isModelListener)) {
  5545. keys.forEach((key) => {
  5546. if (!isModelListener(key) || !(key.slice(9) in propsOptions)) {
  5547. props[key] = fallthroughAttrs2[key];
  5548. }
  5549. });
  5550. } else {
  5551. keys.forEach((key) => props[key] = fallthroughAttrs2[key]);
  5552. }
  5553. }
  5554. }
  5555. const updateComponentPreRender = (instance) => {
  5556. pauseTracking();
  5557. flushPreFlushCbs();
  5558. resetTracking();
  5559. };
  5560. function componentUpdateScopedSlotsFn() {
  5561. const scopedSlotsData = this.$scopedSlotsData;
  5562. if (!scopedSlotsData || scopedSlotsData.length === 0) {
  5563. return;
  5564. }
  5565. const mpInstance = this.ctx.$scope;
  5566. const oldData = mpInstance.data;
  5567. const diffData = /* @__PURE__ */ Object.create(null);
  5568. scopedSlotsData.forEach(({ path, index: index2, data }) => {
  5569. const oldScopedSlotData = getValueByDataPath(oldData, path);
  5570. const diffPath = isString(index2) ? `${path}.${index2}` : `${path}[${index2}]`;
  5571. if (typeof oldScopedSlotData === "undefined" || typeof oldScopedSlotData[index2] === "undefined") {
  5572. diffData[diffPath] = data;
  5573. } else {
  5574. const diffScopedSlotData = diff(data, oldScopedSlotData[index2]);
  5575. Object.keys(diffScopedSlotData).forEach((name) => {
  5576. diffData[diffPath + "." + name] = diffScopedSlotData[name];
  5577. });
  5578. }
  5579. });
  5580. scopedSlotsData.length = 0;
  5581. if (Object.keys(diffData).length) {
  5582. mpInstance.setData(diffData);
  5583. }
  5584. }
  5585. function toggleRecurse({ effect, update }, allowed) {
  5586. effect.allowRecurse = update.allowRecurse = allowed;
  5587. }
  5588. function setupRenderEffect(instance) {
  5589. const updateScopedSlots = componentUpdateScopedSlotsFn.bind(instance);
  5590. instance.$updateScopedSlots = () => nextTick$1(() => queueJob(updateScopedSlots));
  5591. const componentUpdateFn = () => {
  5592. if (!instance.isMounted) {
  5593. onBeforeUnmount(() => {
  5594. setRef$1(instance, true);
  5595. }, instance);
  5596. {
  5597. startMeasure(instance, `patch`);
  5598. }
  5599. patch(instance, renderComponentRoot(instance));
  5600. {
  5601. endMeasure(instance, `patch`);
  5602. }
  5603. {
  5604. devtoolsComponentAdded(instance);
  5605. }
  5606. } else {
  5607. const { next, bu, u } = instance;
  5608. {
  5609. pushWarningContext(next || instance.vnode);
  5610. }
  5611. toggleRecurse(instance, false);
  5612. updateComponentPreRender();
  5613. if (bu) {
  5614. invokeArrayFns$1(bu);
  5615. }
  5616. toggleRecurse(instance, true);
  5617. {
  5618. startMeasure(instance, `patch`);
  5619. }
  5620. patch(instance, renderComponentRoot(instance));
  5621. {
  5622. endMeasure(instance, `patch`);
  5623. }
  5624. if (u) {
  5625. queuePostRenderEffect(u);
  5626. }
  5627. {
  5628. devtoolsComponentUpdated(instance);
  5629. }
  5630. {
  5631. popWarningContext();
  5632. }
  5633. }
  5634. };
  5635. const effect = instance.effect = new ReactiveEffect(
  5636. componentUpdateFn,
  5637. () => queueJob(instance.update),
  5638. instance.scope
  5639. // track it in component's effect scope
  5640. );
  5641. const update = instance.update = effect.run.bind(effect);
  5642. update.id = instance.uid;
  5643. toggleRecurse(instance, true);
  5644. {
  5645. effect.onTrack = instance.rtc ? (e2) => invokeArrayFns$1(instance.rtc, e2) : void 0;
  5646. effect.onTrigger = instance.rtg ? (e2) => invokeArrayFns$1(instance.rtg, e2) : void 0;
  5647. update.ownerInstance = instance;
  5648. }
  5649. update();
  5650. }
  5651. function unmountComponent(instance) {
  5652. const { bum, scope, update, um } = instance;
  5653. if (bum) {
  5654. invokeArrayFns$1(bum);
  5655. }
  5656. scope.stop();
  5657. if (update) {
  5658. update.active = false;
  5659. }
  5660. if (um) {
  5661. queuePostRenderEffect(um);
  5662. }
  5663. queuePostRenderEffect(() => {
  5664. instance.isUnmounted = true;
  5665. });
  5666. {
  5667. devtoolsComponentRemoved(instance);
  5668. }
  5669. }
  5670. const oldCreateApp = createAppAPI();
  5671. function getTarget() {
  5672. if (typeof window !== "undefined") {
  5673. return window;
  5674. }
  5675. if (typeof globalThis !== "undefined") {
  5676. return globalThis;
  5677. }
  5678. if (typeof global !== "undefined") {
  5679. return global;
  5680. }
  5681. if (typeof my !== "undefined") {
  5682. return my;
  5683. }
  5684. }
  5685. function createVueApp(rootComponent, rootProps = null) {
  5686. const target = getTarget();
  5687. target.__VUE__ = true;
  5688. {
  5689. setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
  5690. }
  5691. const app = oldCreateApp(rootComponent, rootProps);
  5692. const appContext = app._context;
  5693. initAppConfig(appContext.config);
  5694. const createVNode = (initialVNode) => {
  5695. initialVNode.appContext = appContext;
  5696. initialVNode.shapeFlag = 6;
  5697. return initialVNode;
  5698. };
  5699. const createComponent2 = function createComponent3(initialVNode, options) {
  5700. return mountComponent(createVNode(initialVNode), options);
  5701. };
  5702. const destroyComponent = function destroyComponent2(component) {
  5703. return component && unmountComponent(component.$);
  5704. };
  5705. app.mount = function mount() {
  5706. rootComponent.render = NOOP;
  5707. const instance = mountComponent(createVNode({ type: rootComponent }), {
  5708. mpType: MPType.APP,
  5709. mpInstance: null,
  5710. parentComponent: null,
  5711. slots: [],
  5712. props: null
  5713. });
  5714. app._instance = instance.$;
  5715. {
  5716. devtoolsInitApp(app, version);
  5717. }
  5718. instance.$app = app;
  5719. instance.$createComponent = createComponent2;
  5720. instance.$destroyComponent = destroyComponent;
  5721. appContext.$appInstance = instance;
  5722. return instance;
  5723. };
  5724. app.unmount = function unmount() {
  5725. warn(`Cannot unmount an app.`);
  5726. };
  5727. return app;
  5728. }
  5729. function injectLifecycleHook(name, hook, publicThis, instance) {
  5730. if (isFunction(hook)) {
  5731. injectHook(name, hook.bind(publicThis), instance);
  5732. }
  5733. }
  5734. function initHooks$1(options, instance, publicThis) {
  5735. const mpType = options.mpType || publicThis.$mpType;
  5736. if (!mpType || mpType === "component") {
  5737. return;
  5738. }
  5739. Object.keys(options).forEach((name) => {
  5740. if (isUniLifecycleHook(name, options[name], false)) {
  5741. const hooks = options[name];
  5742. if (isArray(hooks)) {
  5743. hooks.forEach((hook) => injectLifecycleHook(name, hook, publicThis, instance));
  5744. } else {
  5745. injectLifecycleHook(name, hooks, publicThis, instance);
  5746. }
  5747. }
  5748. });
  5749. }
  5750. function applyOptions$2(options, instance, publicThis) {
  5751. initHooks$1(options, instance, publicThis);
  5752. }
  5753. function set$3(target, key, val) {
  5754. return target[key] = val;
  5755. }
  5756. function createErrorHandler(app) {
  5757. return function errorHandler(err, instance, _info) {
  5758. if (!instance) {
  5759. throw err;
  5760. }
  5761. const appInstance = app._instance;
  5762. if (!appInstance || !appInstance.proxy) {
  5763. throw err;
  5764. }
  5765. {
  5766. appInstance.proxy.$callHook(ON_ERROR, err);
  5767. }
  5768. };
  5769. }
  5770. function mergeAsArray(to, from) {
  5771. return to ? [...new Set([].concat(to, from))] : from;
  5772. }
  5773. function initOptionMergeStrategies(optionMergeStrategies) {
  5774. UniLifecycleHooks.forEach((name) => {
  5775. optionMergeStrategies[name] = mergeAsArray;
  5776. });
  5777. }
  5778. let realAtob;
  5779. const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  5780. const b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  5781. if (typeof atob !== "function") {
  5782. realAtob = function(str) {
  5783. str = String(str).replace(/[\t\n\f\r ]+/g, "");
  5784. if (!b64re.test(str)) {
  5785. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  5786. }
  5787. str += "==".slice(2 - (str.length & 3));
  5788. var bitmap;
  5789. var result = "";
  5790. var r1;
  5791. var r2;
  5792. var i = 0;
  5793. for (; i < str.length; ) {
  5794. 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++)));
  5795. 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);
  5796. }
  5797. return result;
  5798. };
  5799. } else {
  5800. realAtob = atob;
  5801. }
  5802. function b64DecodeUnicode(str) {
  5803. return decodeURIComponent(realAtob(str).split("").map(function(c) {
  5804. return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
  5805. }).join(""));
  5806. }
  5807. function getCurrentUserInfo() {
  5808. const token = index.getStorageSync("uni_id_token") || "";
  5809. const tokenArr = token.split(".");
  5810. if (!token || tokenArr.length !== 3) {
  5811. return {
  5812. uid: null,
  5813. role: [],
  5814. permission: [],
  5815. tokenExpired: 0
  5816. };
  5817. }
  5818. let userInfo;
  5819. try {
  5820. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  5821. } catch (error) {
  5822. throw new Error("获取当前用户信息出错,详细错误信息为:" + error.message);
  5823. }
  5824. userInfo.tokenExpired = userInfo.exp * 1e3;
  5825. delete userInfo.exp;
  5826. delete userInfo.iat;
  5827. return userInfo;
  5828. }
  5829. function uniIdMixin(globalProperties) {
  5830. globalProperties.uniIDHasRole = function(roleId) {
  5831. const { role } = getCurrentUserInfo();
  5832. return role.indexOf(roleId) > -1;
  5833. };
  5834. globalProperties.uniIDHasPermission = function(permissionId) {
  5835. const { permission } = getCurrentUserInfo();
  5836. return this.uniIDHasRole("admin") || permission.indexOf(permissionId) > -1;
  5837. };
  5838. globalProperties.uniIDTokenValid = function() {
  5839. const { tokenExpired } = getCurrentUserInfo();
  5840. return tokenExpired > Date.now();
  5841. };
  5842. }
  5843. function initApp(app) {
  5844. const appConfig = app._context.config;
  5845. appConfig.errorHandler = invokeCreateErrorHandler(app, createErrorHandler);
  5846. initOptionMergeStrategies(appConfig.optionMergeStrategies);
  5847. const globalProperties = appConfig.globalProperties;
  5848. {
  5849. uniIdMixin(globalProperties);
  5850. }
  5851. {
  5852. globalProperties.$set = set$3;
  5853. globalProperties.$applyOptions = applyOptions$2;
  5854. }
  5855. {
  5856. index.invokeCreateVueAppHook(app);
  5857. }
  5858. }
  5859. const propsCaches = /* @__PURE__ */ Object.create(null);
  5860. function renderProps(props) {
  5861. const { uid: uid2, __counter } = getCurrentInstance();
  5862. const propsId = (propsCaches[uid2] || (propsCaches[uid2] = [])).push(guardReactiveProps(props)) - 1;
  5863. return uid2 + "," + propsId + "," + __counter;
  5864. }
  5865. function pruneComponentPropsCache(uid2) {
  5866. delete propsCaches[uid2];
  5867. }
  5868. function findComponentPropsData(up) {
  5869. if (!up) {
  5870. return;
  5871. }
  5872. const [uid2, propsId] = up.split(",");
  5873. if (!propsCaches[uid2]) {
  5874. return;
  5875. }
  5876. return propsCaches[uid2][parseInt(propsId)];
  5877. }
  5878. var plugin = {
  5879. install(app) {
  5880. initApp(app);
  5881. app.config.globalProperties.pruneComponentPropsCache = pruneComponentPropsCache;
  5882. const oldMount = app.mount;
  5883. app.mount = function mount(rootContainer) {
  5884. const instance = oldMount.call(app, rootContainer);
  5885. const createApp2 = getCreateApp();
  5886. if (createApp2) {
  5887. createApp2(instance);
  5888. } else {
  5889. if (typeof createMiniProgramApp !== "undefined") {
  5890. createMiniProgramApp(instance);
  5891. }
  5892. }
  5893. return instance;
  5894. };
  5895. }
  5896. };
  5897. function getCreateApp() {
  5898. const method = "createApp";
  5899. if (typeof global !== "undefined") {
  5900. return global[method];
  5901. } else if (typeof my !== "undefined") {
  5902. return my[method];
  5903. }
  5904. }
  5905. function vOn(value, key) {
  5906. const instance = getCurrentInstance();
  5907. const ctx = instance.ctx;
  5908. const extraKey = typeof key !== "undefined" && (ctx.$mpPlatform === "mp-weixin" || ctx.$mpPlatform === "mp-qq") && (isString(key) || typeof key === "number") ? "_" + key : "";
  5909. const name = "e" + instance.$ei++ + extraKey;
  5910. const mpInstance = ctx.$scope;
  5911. if (!value) {
  5912. delete mpInstance[name];
  5913. return name;
  5914. }
  5915. const existingInvoker = mpInstance[name];
  5916. if (existingInvoker) {
  5917. existingInvoker.value = value;
  5918. } else {
  5919. mpInstance[name] = createInvoker(value, instance);
  5920. }
  5921. return name;
  5922. }
  5923. function createInvoker(initialValue, instance) {
  5924. const invoker = (e2) => {
  5925. patchMPEvent(e2);
  5926. let args = [e2];
  5927. if (e2.detail && e2.detail.__args__) {
  5928. args = e2.detail.__args__;
  5929. }
  5930. const eventValue = invoker.value;
  5931. const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e2, eventValue), instance, 5, args);
  5932. const eventTarget = e2.target;
  5933. const eventSync = eventTarget ? eventTarget.dataset ? eventTarget.dataset.eventsync === "true" : false : false;
  5934. if (bubbles.includes(e2.type) && !eventSync) {
  5935. setTimeout(invoke);
  5936. } else {
  5937. const res = invoke();
  5938. if (e2.type === "input" && (isArray(res) || isPromise(res))) {
  5939. return;
  5940. }
  5941. return res;
  5942. }
  5943. };
  5944. invoker.value = initialValue;
  5945. return invoker;
  5946. }
  5947. const bubbles = [
  5948. // touch事件暂不做延迟,否则在 Android 上会影响性能,比如一些拖拽跟手手势等
  5949. // 'touchstart',
  5950. // 'touchmove',
  5951. // 'touchcancel',
  5952. // 'touchend',
  5953. "tap",
  5954. "longpress",
  5955. "longtap",
  5956. "transitionend",
  5957. "animationstart",
  5958. "animationiteration",
  5959. "animationend",
  5960. "touchforcechange"
  5961. ];
  5962. function patchMPEvent(event) {
  5963. if (event.type && event.target) {
  5964. event.preventDefault = NOOP;
  5965. event.stopPropagation = NOOP;
  5966. event.stopImmediatePropagation = NOOP;
  5967. if (!hasOwn(event, "detail")) {
  5968. event.detail = {};
  5969. }
  5970. if (hasOwn(event, "markerId")) {
  5971. event.detail = typeof event.detail === "object" ? event.detail : {};
  5972. event.detail.markerId = event.markerId;
  5973. }
  5974. if (isPlainObject$1(event.detail) && hasOwn(event.detail, "checked") && !hasOwn(event.detail, "value")) {
  5975. event.detail.value = event.detail.checked;
  5976. }
  5977. if (isPlainObject$1(event.detail)) {
  5978. event.target = extend({}, event.target, event.detail);
  5979. }
  5980. }
  5981. }
  5982. function patchStopImmediatePropagation(e2, value) {
  5983. if (isArray(value)) {
  5984. const originalStop = e2.stopImmediatePropagation;
  5985. e2.stopImmediatePropagation = () => {
  5986. originalStop && originalStop.call(e2);
  5987. e2._stopped = true;
  5988. };
  5989. return value.map((fn) => (e3) => !e3._stopped && fn(e3));
  5990. } else {
  5991. return value;
  5992. }
  5993. }
  5994. function vFor(source, renderItem) {
  5995. let ret;
  5996. if (isArray(source) || isString(source)) {
  5997. ret = new Array(source.length);
  5998. for (let i = 0, l = source.length; i < l; i++) {
  5999. ret[i] = renderItem(source[i], i, i);
  6000. }
  6001. } else if (typeof source === "number") {
  6002. if (!Number.isInteger(source)) {
  6003. warn(`The v-for range expect an integer value but got ${source}.`);
  6004. return [];
  6005. }
  6006. ret = new Array(source);
  6007. for (let i = 0; i < source; i++) {
  6008. ret[i] = renderItem(i + 1, i, i);
  6009. }
  6010. } else if (isObject(source)) {
  6011. if (source[Symbol.iterator]) {
  6012. ret = Array.from(source, (item, i) => renderItem(item, i, i));
  6013. } else {
  6014. const keys = Object.keys(source);
  6015. ret = new Array(keys.length);
  6016. for (let i = 0, l = keys.length; i < l; i++) {
  6017. const key = keys[i];
  6018. ret[i] = renderItem(source[key], key, i);
  6019. }
  6020. }
  6021. } else {
  6022. ret = [];
  6023. }
  6024. return ret;
  6025. }
  6026. function renderSlot(name, props = {}, key) {
  6027. const instance = getCurrentInstance();
  6028. const { parent, isMounted, ctx: { $scope } } = instance;
  6029. const vueIds = ($scope.properties || $scope.props).uI;
  6030. if (!vueIds) {
  6031. return;
  6032. }
  6033. if (!parent && !isMounted) {
  6034. onMounted(() => {
  6035. renderSlot(name, props, key);
  6036. }, instance);
  6037. return;
  6038. }
  6039. const invoker = findScopedSlotInvoker(vueIds, instance);
  6040. if (invoker) {
  6041. invoker(name, props, key);
  6042. }
  6043. }
  6044. function findScopedSlotInvoker(vueId, instance) {
  6045. let parent = instance.parent;
  6046. while (parent) {
  6047. const invokers = parent.$ssi;
  6048. if (invokers && invokers[vueId]) {
  6049. return invokers[vueId];
  6050. }
  6051. parent = parent.parent;
  6052. }
  6053. }
  6054. function stringifyStyle(value) {
  6055. if (isString(value)) {
  6056. return value;
  6057. }
  6058. return stringify(normalizeStyle(value));
  6059. }
  6060. function stringify(styles) {
  6061. let ret = "";
  6062. if (!styles || isString(styles)) {
  6063. return ret;
  6064. }
  6065. for (const key in styles) {
  6066. ret += `${key.startsWith(`--`) ? key : hyphenate(key)}:${styles[key]};`;
  6067. }
  6068. return ret;
  6069. }
  6070. const o = (value, key) => vOn(value, key);
  6071. const f = (source, renderItem) => vFor(source, renderItem);
  6072. const r = (name, props, key) => renderSlot(name, props, key);
  6073. const s = (value) => stringifyStyle(value);
  6074. const e = (target, ...sources) => extend(target, ...sources);
  6075. const n = (value) => normalizeClass(value);
  6076. const t = (val) => toDisplayString(val);
  6077. const p = (props) => renderProps(props);
  6078. function createApp$1(rootComponent, rootProps = null) {
  6079. rootComponent && (rootComponent.mpType = "app");
  6080. return createVueApp(rootComponent, rootProps).use(plugin);
  6081. }
  6082. const createSSRApp = createApp$1;
  6083. const MP_METHODS = [
  6084. "createSelectorQuery",
  6085. "createIntersectionObserver",
  6086. "selectAllComponents",
  6087. "selectComponent"
  6088. ];
  6089. function createEmitFn(oldEmit, ctx) {
  6090. return function emit2(event, ...args) {
  6091. const scope = ctx.$scope;
  6092. if (scope && event) {
  6093. const detail = { __args__: args };
  6094. {
  6095. scope.triggerEvent(event, detail);
  6096. }
  6097. }
  6098. return oldEmit.apply(this, [event, ...args]);
  6099. };
  6100. }
  6101. function initBaseInstance(instance, options) {
  6102. const ctx = instance.ctx;
  6103. ctx.mpType = options.mpType;
  6104. ctx.$mpType = options.mpType;
  6105. ctx.$mpPlatform = "mp-weixin";
  6106. ctx.$scope = options.mpInstance;
  6107. ctx.$mp = {};
  6108. {
  6109. ctx._self = {};
  6110. }
  6111. instance.slots = {};
  6112. if (isArray(options.slots) && options.slots.length) {
  6113. options.slots.forEach((name) => {
  6114. instance.slots[name] = true;
  6115. });
  6116. if (instance.slots[SLOT_DEFAULT_NAME]) {
  6117. instance.slots.default = true;
  6118. }
  6119. }
  6120. ctx.getOpenerEventChannel = function() {
  6121. {
  6122. return options.mpInstance.getOpenerEventChannel();
  6123. }
  6124. };
  6125. ctx.$hasHook = hasHook;
  6126. ctx.$callHook = callHook;
  6127. instance.emit = createEmitFn(instance.emit, ctx);
  6128. }
  6129. function initComponentInstance(instance, options) {
  6130. initBaseInstance(instance, options);
  6131. const ctx = instance.ctx;
  6132. MP_METHODS.forEach((method) => {
  6133. ctx[method] = function(...args) {
  6134. const mpInstance = ctx.$scope;
  6135. if (mpInstance && mpInstance[method]) {
  6136. return mpInstance[method].apply(mpInstance, args);
  6137. }
  6138. };
  6139. });
  6140. }
  6141. function initMocks(instance, mpInstance, mocks2) {
  6142. const ctx = instance.ctx;
  6143. mocks2.forEach((mock) => {
  6144. if (hasOwn(mpInstance, mock)) {
  6145. instance[mock] = ctx[mock] = mpInstance[mock];
  6146. }
  6147. });
  6148. }
  6149. function hasHook(name) {
  6150. const hooks = this.$[name];
  6151. if (hooks && hooks.length) {
  6152. return true;
  6153. }
  6154. return false;
  6155. }
  6156. function callHook(name, args) {
  6157. if (name === "mounted") {
  6158. callHook.call(this, "bm");
  6159. this.$.isMounted = true;
  6160. name = "m";
  6161. }
  6162. const hooks = this.$[name];
  6163. return hooks && invokeArrayFns(hooks, args);
  6164. }
  6165. const PAGE_INIT_HOOKS = [
  6166. ON_LOAD,
  6167. ON_SHOW,
  6168. ON_HIDE,
  6169. ON_UNLOAD,
  6170. ON_RESIZE,
  6171. ON_TAB_ITEM_TAP,
  6172. ON_REACH_BOTTOM,
  6173. ON_PULL_DOWN_REFRESH,
  6174. ON_ADD_TO_FAVORITES
  6175. // 'onReady', // lifetimes.ready
  6176. // 'onPageScroll', // 影响性能,开发者手动注册
  6177. // 'onShareTimeline', // 右上角菜单,开发者手动注册
  6178. // 'onShareAppMessage' // 右上角菜单,开发者手动注册
  6179. ];
  6180. function findHooks(vueOptions, hooks = /* @__PURE__ */ new Set()) {
  6181. if (vueOptions) {
  6182. Object.keys(vueOptions).forEach((name) => {
  6183. if (isUniLifecycleHook(name, vueOptions[name])) {
  6184. hooks.add(name);
  6185. }
  6186. });
  6187. {
  6188. const { extends: extendsOptions, mixins } = vueOptions;
  6189. if (mixins) {
  6190. mixins.forEach((mixin) => findHooks(mixin, hooks));
  6191. }
  6192. if (extendsOptions) {
  6193. findHooks(extendsOptions, hooks);
  6194. }
  6195. }
  6196. }
  6197. return hooks;
  6198. }
  6199. function initHook(mpOptions, hook, excludes) {
  6200. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  6201. mpOptions[hook] = function(args) {
  6202. return this.$vm && this.$vm.$callHook(hook, args);
  6203. };
  6204. }
  6205. }
  6206. const EXCLUDE_HOOKS = [ON_READY];
  6207. function initHooks(mpOptions, hooks, excludes = EXCLUDE_HOOKS) {
  6208. hooks.forEach((hook) => initHook(mpOptions, hook, excludes));
  6209. }
  6210. function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
  6211. findHooks(vueOptions).forEach((hook) => initHook(mpOptions, hook, excludes));
  6212. }
  6213. function initRuntimeHooks(mpOptions, runtimeHooks) {
  6214. if (!runtimeHooks) {
  6215. return;
  6216. }
  6217. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  6218. hooks.forEach((hook) => {
  6219. if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
  6220. initHook(mpOptions, hook, []);
  6221. }
  6222. });
  6223. }
  6224. const findMixinRuntimeHooks = /* @__PURE__ */ once(() => {
  6225. const runtimeHooks = [];
  6226. const app = isFunction(getApp) && getApp({ allowDefault: true });
  6227. if (app && app.$vm && app.$vm.$) {
  6228. const mixins = app.$vm.$.appContext.mixins;
  6229. if (isArray(mixins)) {
  6230. const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
  6231. mixins.forEach((mixin) => {
  6232. hooks.forEach((hook) => {
  6233. if (hasOwn(mixin, hook) && !runtimeHooks.includes(hook)) {
  6234. runtimeHooks.push(hook);
  6235. }
  6236. });
  6237. });
  6238. }
  6239. }
  6240. return runtimeHooks;
  6241. });
  6242. function initMixinRuntimeHooks(mpOptions) {
  6243. initHooks(mpOptions, findMixinRuntimeHooks());
  6244. }
  6245. const HOOKS = [
  6246. ON_SHOW,
  6247. ON_HIDE,
  6248. ON_ERROR,
  6249. ON_THEME_CHANGE,
  6250. ON_PAGE_NOT_FOUND,
  6251. ON_UNHANDLE_REJECTION
  6252. ];
  6253. function parseApp(instance, parseAppOptions) {
  6254. const internalInstance = instance.$;
  6255. const appOptions = {
  6256. globalData: instance.$options && instance.$options.globalData || {},
  6257. $vm: instance,
  6258. onLaunch(options) {
  6259. this.$vm = instance;
  6260. const ctx = internalInstance.ctx;
  6261. if (this.$vm && ctx.$scope) {
  6262. return;
  6263. }
  6264. initBaseInstance(internalInstance, {
  6265. mpType: "app",
  6266. mpInstance: this,
  6267. slots: []
  6268. });
  6269. ctx.globalData = this.globalData;
  6270. instance.$callHook(ON_LAUNCH, options);
  6271. }
  6272. };
  6273. initLocale(instance);
  6274. const vueOptions = instance.$.type;
  6275. initHooks(appOptions, HOOKS);
  6276. initUnknownHooks(appOptions, vueOptions);
  6277. {
  6278. const methods = vueOptions.methods;
  6279. methods && extend(appOptions, methods);
  6280. }
  6281. if (parseAppOptions) {
  6282. parseAppOptions.parse(appOptions);
  6283. }
  6284. return appOptions;
  6285. }
  6286. function initCreateApp(parseAppOptions) {
  6287. return function createApp2(vm) {
  6288. return App(parseApp(vm, parseAppOptions));
  6289. };
  6290. }
  6291. function initCreateSubpackageApp(parseAppOptions) {
  6292. return function createApp2(vm) {
  6293. const appOptions = parseApp(vm, parseAppOptions);
  6294. const app = isFunction(getApp) && getApp({
  6295. allowDefault: true
  6296. });
  6297. if (!app)
  6298. return;
  6299. vm.$.ctx.$scope = app;
  6300. const globalData = app.globalData;
  6301. if (globalData) {
  6302. Object.keys(appOptions.globalData).forEach((name) => {
  6303. if (!hasOwn(globalData, name)) {
  6304. globalData[name] = appOptions.globalData[name];
  6305. }
  6306. });
  6307. }
  6308. Object.keys(appOptions).forEach((name) => {
  6309. if (!hasOwn(app, name)) {
  6310. app[name] = appOptions[name];
  6311. }
  6312. });
  6313. initAppLifecycle(appOptions, vm);
  6314. };
  6315. }
  6316. function initAppLifecycle(appOptions, vm) {
  6317. if (isFunction(appOptions.onLaunch)) {
  6318. const args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  6319. appOptions.onLaunch(args);
  6320. }
  6321. if (isFunction(appOptions.onShow) && wx.onAppShow) {
  6322. wx.onAppShow((args) => {
  6323. vm.$callHook("onShow", args);
  6324. });
  6325. }
  6326. if (isFunction(appOptions.onHide) && wx.onAppHide) {
  6327. wx.onAppHide((args) => {
  6328. vm.$callHook("onHide", args);
  6329. });
  6330. }
  6331. }
  6332. function initLocale(appVm) {
  6333. const locale = ref(normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  6334. Object.defineProperty(appVm, "$locale", {
  6335. get() {
  6336. return locale.value;
  6337. },
  6338. set(v) {
  6339. locale.value = v;
  6340. }
  6341. });
  6342. }
  6343. function initVueIds(vueIds, mpInstance) {
  6344. if (!vueIds) {
  6345. return;
  6346. }
  6347. const ids = vueIds.split(",");
  6348. const len = ids.length;
  6349. if (len === 1) {
  6350. mpInstance._$vueId = ids[0];
  6351. } else if (len === 2) {
  6352. mpInstance._$vueId = ids[0];
  6353. mpInstance._$vuePid = ids[1];
  6354. }
  6355. }
  6356. const EXTRAS = ["externalClasses"];
  6357. function initExtraOptions(miniProgramComponentOptions, vueOptions) {
  6358. EXTRAS.forEach((name) => {
  6359. if (hasOwn(vueOptions, name)) {
  6360. miniProgramComponentOptions[name] = vueOptions[name];
  6361. }
  6362. });
  6363. }
  6364. const WORKLET_RE = /_(.*)_worklet_factory_/;
  6365. function initWorkletMethods(mpMethods, vueMethods) {
  6366. if (vueMethods) {
  6367. Object.keys(vueMethods).forEach((name) => {
  6368. const matches = name.match(WORKLET_RE);
  6369. if (matches) {
  6370. const workletName = matches[1];
  6371. mpMethods[name] = vueMethods[name];
  6372. mpMethods[workletName] = vueMethods[workletName];
  6373. }
  6374. });
  6375. }
  6376. }
  6377. function initWxsCallMethods(methods, wxsCallMethods) {
  6378. if (!isArray(wxsCallMethods)) {
  6379. return;
  6380. }
  6381. wxsCallMethods.forEach((callMethod) => {
  6382. methods[callMethod] = function(args) {
  6383. return this.$vm[callMethod](args);
  6384. };
  6385. });
  6386. }
  6387. function selectAllComponents(mpInstance, selector, $refs) {
  6388. const components = mpInstance.selectAllComponents(selector);
  6389. components.forEach((component) => {
  6390. const ref2 = component.properties.uR;
  6391. $refs[ref2] = component.$vm || component;
  6392. });
  6393. }
  6394. function initRefs(instance, mpInstance) {
  6395. Object.defineProperty(instance, "refs", {
  6396. get() {
  6397. const $refs = {};
  6398. selectAllComponents(mpInstance, ".r", $refs);
  6399. const forComponents = mpInstance.selectAllComponents(".r-i-f");
  6400. forComponents.forEach((component) => {
  6401. const ref2 = component.properties.uR;
  6402. if (!ref2) {
  6403. return;
  6404. }
  6405. if (!$refs[ref2]) {
  6406. $refs[ref2] = [];
  6407. }
  6408. $refs[ref2].push(component.$vm || component);
  6409. });
  6410. return $refs;
  6411. }
  6412. });
  6413. }
  6414. function findVmByVueId(instance, vuePid) {
  6415. const $children = instance.$children;
  6416. for (let i = $children.length - 1; i >= 0; i--) {
  6417. const childVm = $children[i];
  6418. if (childVm.$scope._$vueId === vuePid) {
  6419. return childVm;
  6420. }
  6421. }
  6422. let parentVm;
  6423. for (let i = $children.length - 1; i >= 0; i--) {
  6424. parentVm = findVmByVueId($children[i], vuePid);
  6425. if (parentVm) {
  6426. return parentVm;
  6427. }
  6428. }
  6429. }
  6430. const builtInProps = [
  6431. // 百度小程序,快手小程序自定义组件不支持绑定动态事件,动态dataset,故通过props传递事件信息
  6432. // event-opts
  6433. "eO",
  6434. // 组件 ref
  6435. "uR",
  6436. // 组件 ref-in-for
  6437. "uRIF",
  6438. // 组件 id
  6439. "uI",
  6440. // 组件类型 m: 小程序组件
  6441. "uT",
  6442. // 组件 props
  6443. "uP",
  6444. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  6445. "uS"
  6446. ];
  6447. function initDefaultProps(options, isBehavior = false) {
  6448. const properties = {};
  6449. if (!isBehavior) {
  6450. builtInProps.forEach((name) => {
  6451. properties[name] = {
  6452. type: null,
  6453. value: ""
  6454. };
  6455. });
  6456. properties.uS = {
  6457. type: null,
  6458. value: [],
  6459. observer: function(newVal) {
  6460. const $slots = /* @__PURE__ */ Object.create(null);
  6461. newVal && newVal.forEach((slotName) => {
  6462. $slots[slotName] = true;
  6463. });
  6464. this.setData({
  6465. $slots
  6466. });
  6467. }
  6468. };
  6469. }
  6470. if (options.behaviors) {
  6471. if (options.behaviors.includes("wx://form-field")) {
  6472. properties.name = {
  6473. type: null,
  6474. value: ""
  6475. };
  6476. properties.value = {
  6477. type: null,
  6478. value: ""
  6479. };
  6480. }
  6481. }
  6482. return properties;
  6483. }
  6484. function initVirtualHostProps(options) {
  6485. const properties = {};
  6486. {
  6487. if (options && options.virtualHost) {
  6488. properties.virtualHostStyle = {
  6489. type: null,
  6490. value: ""
  6491. };
  6492. properties.virtualHostClass = {
  6493. type: null,
  6494. value: ""
  6495. };
  6496. }
  6497. }
  6498. return properties;
  6499. }
  6500. function initProps(mpComponentOptions) {
  6501. if (!mpComponentOptions.properties) {
  6502. mpComponentOptions.properties = {};
  6503. }
  6504. extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
  6505. }
  6506. const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  6507. function parsePropType(type, defaultValue) {
  6508. if (isArray(type) && type.length === 1) {
  6509. return type[0];
  6510. }
  6511. return type;
  6512. }
  6513. function normalizePropType(type, defaultValue) {
  6514. const res = parsePropType(type);
  6515. return PROP_TYPES.indexOf(res) !== -1 ? res : null;
  6516. }
  6517. function initPageProps({ properties }, rawProps) {
  6518. if (isArray(rawProps)) {
  6519. rawProps.forEach((key) => {
  6520. properties[key] = {
  6521. type: String,
  6522. value: ""
  6523. };
  6524. });
  6525. } else if (isPlainObject$1(rawProps)) {
  6526. Object.keys(rawProps).forEach((key) => {
  6527. const opts = rawProps[key];
  6528. if (isPlainObject$1(opts)) {
  6529. let value = opts.default;
  6530. if (isFunction(value)) {
  6531. value = value();
  6532. }
  6533. const type = opts.type;
  6534. opts.type = normalizePropType(type);
  6535. properties[key] = {
  6536. type: opts.type,
  6537. value
  6538. };
  6539. } else {
  6540. properties[key] = {
  6541. type: normalizePropType(opts)
  6542. };
  6543. }
  6544. });
  6545. }
  6546. }
  6547. function findPropsData(properties, isPage2) {
  6548. return (isPage2 ? findPagePropsData(properties) : findComponentPropsData(properties.uP)) || {};
  6549. }
  6550. function findPagePropsData(properties) {
  6551. const propsData = {};
  6552. if (isPlainObject$1(properties)) {
  6553. Object.keys(properties).forEach((name) => {
  6554. if (builtInProps.indexOf(name) === -1) {
  6555. propsData[name] = properties[name];
  6556. }
  6557. });
  6558. }
  6559. return propsData;
  6560. }
  6561. function initFormField(vm) {
  6562. const vueOptions = vm.$options;
  6563. if (isArray(vueOptions.behaviors) && vueOptions.behaviors.includes("uni://form-field")) {
  6564. vm.$watch("modelValue", () => {
  6565. vm.$scope && vm.$scope.setData({
  6566. name: vm.name,
  6567. value: vm.modelValue
  6568. });
  6569. }, {
  6570. immediate: true
  6571. });
  6572. }
  6573. }
  6574. function initData(_) {
  6575. return {};
  6576. }
  6577. function initPropsObserver(componentOptions) {
  6578. const observe = function observe2() {
  6579. const up = this.properties.uP;
  6580. if (!up) {
  6581. return;
  6582. }
  6583. if (this.$vm) {
  6584. updateComponentProps(up, this.$vm.$);
  6585. } else if (this.properties.uT === "m") {
  6586. updateMiniProgramComponentProperties(up, this);
  6587. }
  6588. };
  6589. {
  6590. if (!componentOptions.observers) {
  6591. componentOptions.observers = {};
  6592. }
  6593. componentOptions.observers.uP = observe;
  6594. }
  6595. }
  6596. function updateMiniProgramComponentProperties(up, mpInstance) {
  6597. const prevProps = mpInstance.properties;
  6598. const nextProps = findComponentPropsData(up) || {};
  6599. if (hasPropsChanged(prevProps, nextProps, false)) {
  6600. mpInstance.setData(nextProps);
  6601. }
  6602. }
  6603. function updateComponentProps(up, instance) {
  6604. const prevProps = toRaw(instance.props);
  6605. const nextProps = findComponentPropsData(up) || {};
  6606. if (hasPropsChanged(prevProps, nextProps)) {
  6607. updateProps(instance, nextProps, prevProps, false);
  6608. if (hasQueueJob(instance.update)) {
  6609. invalidateJob(instance.update);
  6610. }
  6611. {
  6612. instance.update();
  6613. }
  6614. }
  6615. }
  6616. function hasPropsChanged(prevProps, nextProps, checkLen = true) {
  6617. const nextKeys = Object.keys(nextProps);
  6618. if (checkLen && nextKeys.length !== Object.keys(prevProps).length) {
  6619. return true;
  6620. }
  6621. for (let i = 0; i < nextKeys.length; i++) {
  6622. const key = nextKeys[i];
  6623. if (nextProps[key] !== prevProps[key]) {
  6624. return true;
  6625. }
  6626. }
  6627. return false;
  6628. }
  6629. function initBehaviors(vueOptions) {
  6630. const vueBehaviors = vueOptions.behaviors;
  6631. let vueProps = vueOptions.props;
  6632. if (!vueProps) {
  6633. vueOptions.props = vueProps = [];
  6634. }
  6635. const behaviors = [];
  6636. if (isArray(vueBehaviors)) {
  6637. vueBehaviors.forEach((behavior) => {
  6638. behaviors.push(behavior.replace("uni://", "wx://"));
  6639. if (behavior === "uni://form-field") {
  6640. if (isArray(vueProps)) {
  6641. vueProps.push("name");
  6642. vueProps.push("modelValue");
  6643. } else {
  6644. vueProps.name = {
  6645. type: String,
  6646. default: ""
  6647. };
  6648. vueProps.modelValue = {
  6649. type: [String, Number, Boolean, Array, Object, Date],
  6650. default: ""
  6651. };
  6652. }
  6653. }
  6654. });
  6655. }
  6656. return behaviors;
  6657. }
  6658. function applyOptions(componentOptions, vueOptions) {
  6659. componentOptions.data = initData();
  6660. componentOptions.behaviors = initBehaviors(vueOptions);
  6661. }
  6662. function parseComponent(vueOptions, { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 }) {
  6663. vueOptions = vueOptions.default || vueOptions;
  6664. const options = {
  6665. multipleSlots: true,
  6666. addGlobalClass: true,
  6667. pureDataPattern: /^uP$/
  6668. };
  6669. if (isArray(vueOptions.mixins)) {
  6670. vueOptions.mixins.forEach((item) => {
  6671. if (isObject(item.options)) {
  6672. extend(options, item.options);
  6673. }
  6674. });
  6675. }
  6676. if (vueOptions.options) {
  6677. extend(options, vueOptions.options);
  6678. }
  6679. const mpComponentOptions = {
  6680. options,
  6681. lifetimes: initLifetimes2({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }),
  6682. pageLifetimes: {
  6683. show() {
  6684. this.$vm && this.$vm.$callHook("onPageShow");
  6685. },
  6686. hide() {
  6687. this.$vm && this.$vm.$callHook("onPageHide");
  6688. },
  6689. resize(size2) {
  6690. this.$vm && this.$vm.$callHook("onPageResize", size2);
  6691. }
  6692. },
  6693. methods: {
  6694. __l: handleLink2
  6695. }
  6696. };
  6697. {
  6698. applyOptions(mpComponentOptions, vueOptions);
  6699. }
  6700. initProps(mpComponentOptions);
  6701. initPropsObserver(mpComponentOptions);
  6702. initExtraOptions(mpComponentOptions, vueOptions);
  6703. initWxsCallMethods(mpComponentOptions.methods, vueOptions.wxsCallMethods);
  6704. {
  6705. initWorkletMethods(mpComponentOptions.methods, vueOptions.methods);
  6706. }
  6707. if (parse) {
  6708. parse(mpComponentOptions, { handleLink: handleLink2 });
  6709. }
  6710. return mpComponentOptions;
  6711. }
  6712. function initCreateComponent(parseOptions2) {
  6713. return function createComponent2(vueComponentOptions) {
  6714. return Component(parseComponent(vueComponentOptions, parseOptions2));
  6715. };
  6716. }
  6717. let $createComponentFn;
  6718. let $destroyComponentFn;
  6719. function getAppVm() {
  6720. return getApp().$vm;
  6721. }
  6722. function $createComponent(initialVNode, options) {
  6723. if (!$createComponentFn) {
  6724. $createComponentFn = getAppVm().$createComponent;
  6725. }
  6726. const proxy = $createComponentFn(initialVNode, options);
  6727. return getExposeProxy(proxy.$) || proxy;
  6728. }
  6729. function $destroyComponent(instance) {
  6730. if (!$destroyComponentFn) {
  6731. $destroyComponentFn = getAppVm().$destroyComponent;
  6732. }
  6733. return $destroyComponentFn(instance);
  6734. }
  6735. function parsePage(vueOptions, parseOptions2) {
  6736. const { parse, mocks: mocks2, isPage: isPage2, initRelation: initRelation2, handleLink: handleLink2, initLifetimes: initLifetimes2 } = parseOptions2;
  6737. const miniProgramPageOptions = parseComponent(vueOptions, {
  6738. mocks: mocks2,
  6739. isPage: isPage2,
  6740. initRelation: initRelation2,
  6741. handleLink: handleLink2,
  6742. initLifetimes: initLifetimes2
  6743. });
  6744. initPageProps(miniProgramPageOptions, (vueOptions.default || vueOptions).props);
  6745. const methods = miniProgramPageOptions.methods;
  6746. methods.onLoad = function(query) {
  6747. this.options = query;
  6748. this.$page = {
  6749. fullPath: addLeadingSlash(this.route + stringifyQuery(query))
  6750. };
  6751. return this.$vm && this.$vm.$callHook(ON_LOAD, query);
  6752. };
  6753. initHooks(methods, PAGE_INIT_HOOKS);
  6754. {
  6755. initUnknownHooks(methods, vueOptions);
  6756. }
  6757. initRuntimeHooks(methods, vueOptions.__runtimeHooks);
  6758. initMixinRuntimeHooks(methods);
  6759. parse && parse(miniProgramPageOptions, { handleLink: handleLink2 });
  6760. return miniProgramPageOptions;
  6761. }
  6762. function initCreatePage(parseOptions2) {
  6763. return function createPage2(vuePageOptions) {
  6764. return Component(parsePage(vuePageOptions, parseOptions2));
  6765. };
  6766. }
  6767. function initCreatePluginApp(parseAppOptions) {
  6768. return function createApp2(vm) {
  6769. initAppLifecycle(parseApp(vm, parseAppOptions), vm);
  6770. };
  6771. }
  6772. const MPPage = Page;
  6773. const MPComponent = Component;
  6774. function initTriggerEvent(mpInstance) {
  6775. const oldTriggerEvent = mpInstance.triggerEvent;
  6776. const newTriggerEvent = function(event, ...args) {
  6777. return oldTriggerEvent.apply(mpInstance, [customizeEvent(event), ...args]);
  6778. };
  6779. try {
  6780. mpInstance.triggerEvent = newTriggerEvent;
  6781. } catch (error) {
  6782. mpInstance._triggerEvent = newTriggerEvent;
  6783. }
  6784. }
  6785. function initMiniProgramHook(name, options, isComponent) {
  6786. const oldHook = options[name];
  6787. if (!oldHook) {
  6788. options[name] = function() {
  6789. initTriggerEvent(this);
  6790. };
  6791. } else {
  6792. options[name] = function(...args) {
  6793. initTriggerEvent(this);
  6794. return oldHook.apply(this, args);
  6795. };
  6796. }
  6797. }
  6798. Page = function(options) {
  6799. initMiniProgramHook(ON_LOAD, options);
  6800. return MPPage(options);
  6801. };
  6802. Component = function(options) {
  6803. initMiniProgramHook("created", options);
  6804. const isVueComponent = options.properties && options.properties.uP;
  6805. if (!isVueComponent) {
  6806. initProps(options);
  6807. initPropsObserver(options);
  6808. }
  6809. return MPComponent(options);
  6810. };
  6811. function initLifetimes({ mocks: mocks2, isPage: isPage2, initRelation: initRelation2, vueOptions }) {
  6812. return {
  6813. attached() {
  6814. let properties = this.properties;
  6815. initVueIds(properties.uI, this);
  6816. const relationOptions = {
  6817. vuePid: this._$vuePid
  6818. };
  6819. initRelation2(this, relationOptions);
  6820. const mpInstance = this;
  6821. const isMiniProgramPage = isPage2(mpInstance);
  6822. let propsData = properties;
  6823. this.$vm = $createComponent({
  6824. type: vueOptions,
  6825. props: findPropsData(propsData, isMiniProgramPage)
  6826. }, {
  6827. mpType: isMiniProgramPage ? "page" : "component",
  6828. mpInstance,
  6829. slots: properties.uS || {},
  6830. parentComponent: relationOptions.parent && relationOptions.parent.$,
  6831. onBeforeSetup(instance, options) {
  6832. initRefs(instance, mpInstance);
  6833. initMocks(instance, mpInstance, mocks2);
  6834. initComponentInstance(instance, options);
  6835. }
  6836. });
  6837. if (!isMiniProgramPage) {
  6838. initFormField(this.$vm);
  6839. }
  6840. },
  6841. ready() {
  6842. if (this.$vm) {
  6843. {
  6844. this.$vm.$callHook("mounted");
  6845. this.$vm.$callHook(ON_READY);
  6846. }
  6847. }
  6848. },
  6849. detached() {
  6850. if (this.$vm) {
  6851. pruneComponentPropsCache(this.$vm.$.uid);
  6852. $destroyComponent(this.$vm);
  6853. }
  6854. }
  6855. };
  6856. }
  6857. const mocks = ["__route__", "__wxExparserNodeId__", "__wxWebviewId__"];
  6858. function isPage(mpInstance) {
  6859. return !!mpInstance.route;
  6860. }
  6861. function initRelation(mpInstance, detail) {
  6862. mpInstance.triggerEvent("__l", detail);
  6863. }
  6864. function handleLink(event) {
  6865. const detail = event.detail || event.value;
  6866. const vuePid = detail.vuePid;
  6867. let parentVm;
  6868. if (vuePid) {
  6869. parentVm = findVmByVueId(this.$vm, vuePid);
  6870. }
  6871. if (!parentVm) {
  6872. parentVm = this.$vm;
  6873. }
  6874. detail.parent = parentVm;
  6875. }
  6876. var parseOptions = /* @__PURE__ */ Object.freeze({
  6877. __proto__: null,
  6878. handleLink,
  6879. initLifetimes,
  6880. initRelation,
  6881. isPage,
  6882. mocks
  6883. });
  6884. const createApp = initCreateApp();
  6885. const createPage = initCreatePage(parseOptions);
  6886. const createComponent = initCreateComponent(parseOptions);
  6887. const createPluginApp = initCreatePluginApp();
  6888. const createSubpackageApp = initCreateSubpackageApp();
  6889. {
  6890. wx.createApp = global.createApp = createApp;
  6891. wx.createPage = createPage;
  6892. wx.createComponent = createComponent;
  6893. wx.createPluginApp = global.createPluginApp = createPluginApp;
  6894. wx.createSubpackageApp = global.createSubpackageApp = createSubpackageApp;
  6895. }
  6896. var isVue2 = false;
  6897. function set(target, key, val) {
  6898. if (Array.isArray(target)) {
  6899. target.length = Math.max(target.length, key);
  6900. target.splice(key, 1, val);
  6901. return val;
  6902. }
  6903. target[key] = val;
  6904. return val;
  6905. }
  6906. function del(target, key) {
  6907. if (Array.isArray(target)) {
  6908. target.splice(key, 1);
  6909. return;
  6910. }
  6911. delete target[key];
  6912. }
  6913. /*!
  6914. * pinia v2.0.32
  6915. * (c) 2023 Eduardo San Martin Morote
  6916. * @license MIT
  6917. */
  6918. let activePinia;
  6919. const setActivePinia = (pinia) => activePinia = pinia;
  6920. const piniaSymbol = Symbol("pinia");
  6921. function isPlainObject(o2) {
  6922. return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function";
  6923. }
  6924. var MutationType;
  6925. (function(MutationType2) {
  6926. MutationType2["direct"] = "direct";
  6927. MutationType2["patchObject"] = "patch object";
  6928. MutationType2["patchFunction"] = "patch function";
  6929. })(MutationType || (MutationType = {}));
  6930. const IS_CLIENT = typeof window !== "undefined";
  6931. const USE_DEVTOOLS = IS_CLIENT;
  6932. const componentStateTypes = [];
  6933. const getStoreType = (id) => "🍍 " + id;
  6934. function addStoreToDevtools(app, store) {
  6935. if (!componentStateTypes.includes(getStoreType(store.$id))) {
  6936. componentStateTypes.push(getStoreType(store.$id));
  6937. }
  6938. }
  6939. function patchActionForGrouping(store, actionNames) {
  6940. const actions = actionNames.reduce((storeActions, actionName) => {
  6941. storeActions[actionName] = toRaw(store)[actionName];
  6942. return storeActions;
  6943. }, {});
  6944. for (const actionName in actions) {
  6945. store[actionName] = function() {
  6946. const trackedStore = new Proxy(store, {
  6947. get(...args) {
  6948. return Reflect.get(...args);
  6949. },
  6950. set(...args) {
  6951. return Reflect.set(...args);
  6952. }
  6953. });
  6954. return actions[actionName].apply(trackedStore, arguments);
  6955. };
  6956. }
  6957. }
  6958. function devtoolsPlugin({ app, store, options }) {
  6959. if (store.$id.startsWith("__hot:")) {
  6960. return;
  6961. }
  6962. if (options.state) {
  6963. store._isOptionsAPI = true;
  6964. }
  6965. if (typeof options.state === "function") {
  6966. patchActionForGrouping(
  6967. // @ts-expect-error: can cast the store...
  6968. store,
  6969. Object.keys(options.actions)
  6970. );
  6971. const originalHotUpdate = store._hotUpdate;
  6972. toRaw(store)._hotUpdate = function(newStore) {
  6973. originalHotUpdate.apply(this, arguments);
  6974. patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions));
  6975. };
  6976. }
  6977. addStoreToDevtools(
  6978. app,
  6979. // FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
  6980. store
  6981. );
  6982. }
  6983. function createPinia() {
  6984. const scope = effectScope(true);
  6985. const state = scope.run(() => ref({}));
  6986. let _p = [];
  6987. let toBeInstalled = [];
  6988. const pinia = markRaw({
  6989. install(app) {
  6990. setActivePinia(pinia);
  6991. {
  6992. pinia._a = app;
  6993. app.provide(piniaSymbol, pinia);
  6994. app.config.globalProperties.$pinia = pinia;
  6995. toBeInstalled.forEach((plugin2) => _p.push(plugin2));
  6996. toBeInstalled = [];
  6997. }
  6998. },
  6999. use(plugin2) {
  7000. if (!this._a && !isVue2) {
  7001. toBeInstalled.push(plugin2);
  7002. } else {
  7003. _p.push(plugin2);
  7004. }
  7005. return this;
  7006. },
  7007. _p,
  7008. // it's actually undefined here
  7009. // @ts-expect-error
  7010. _a: null,
  7011. _e: scope,
  7012. _s: /* @__PURE__ */ new Map(),
  7013. state
  7014. });
  7015. if (USE_DEVTOOLS && typeof Proxy !== "undefined") {
  7016. pinia.use(devtoolsPlugin);
  7017. }
  7018. return pinia;
  7019. }
  7020. function patchObject(newState, oldState) {
  7021. for (const key in oldState) {
  7022. const subPatch = oldState[key];
  7023. if (!(key in newState)) {
  7024. continue;
  7025. }
  7026. const targetValue = newState[key];
  7027. if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
  7028. newState[key] = patchObject(targetValue, subPatch);
  7029. } else {
  7030. {
  7031. newState[key] = subPatch;
  7032. }
  7033. }
  7034. }
  7035. return newState;
  7036. }
  7037. const noop = () => {
  7038. };
  7039. function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
  7040. subscriptions.push(callback);
  7041. const removeSubscription = () => {
  7042. const idx = subscriptions.indexOf(callback);
  7043. if (idx > -1) {
  7044. subscriptions.splice(idx, 1);
  7045. onCleanup();
  7046. }
  7047. };
  7048. if (!detached && getCurrentScope()) {
  7049. onScopeDispose(removeSubscription);
  7050. }
  7051. return removeSubscription;
  7052. }
  7053. function triggerSubscriptions(subscriptions, ...args) {
  7054. subscriptions.slice().forEach((callback) => {
  7055. callback(...args);
  7056. });
  7057. }
  7058. function mergeReactiveObjects(target, patchToApply) {
  7059. if (target instanceof Map && patchToApply instanceof Map) {
  7060. patchToApply.forEach((value, key) => target.set(key, value));
  7061. }
  7062. if (target instanceof Set && patchToApply instanceof Set) {
  7063. patchToApply.forEach(target.add, target);
  7064. }
  7065. for (const key in patchToApply) {
  7066. if (!patchToApply.hasOwnProperty(key))
  7067. continue;
  7068. const subPatch = patchToApply[key];
  7069. const targetValue = target[key];
  7070. if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
  7071. target[key] = mergeReactiveObjects(targetValue, subPatch);
  7072. } else {
  7073. target[key] = subPatch;
  7074. }
  7075. }
  7076. return target;
  7077. }
  7078. const skipHydrateSymbol = Symbol("pinia:skipHydration");
  7079. function shouldHydrate(obj) {
  7080. return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
  7081. }
  7082. const { assign } = Object;
  7083. function isComputed(o2) {
  7084. return !!(isRef(o2) && o2.effect);
  7085. }
  7086. function createOptionsStore(id, options, pinia, hot) {
  7087. const { state, actions, getters } = options;
  7088. const initialState = pinia.state.value[id];
  7089. let store;
  7090. function setup() {
  7091. if (!initialState && !hot) {
  7092. {
  7093. pinia.state.value[id] = state ? state() : {};
  7094. }
  7095. }
  7096. const localState = hot ? (
  7097. // use ref() to unwrap refs inside state TODO: check if this is still necessary
  7098. toRefs(ref(state ? state() : {}).value)
  7099. ) : toRefs(pinia.state.value[id]);
  7100. return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
  7101. if (name in localState) {
  7102. console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
  7103. }
  7104. computedGetters[name] = markRaw(computed(() => {
  7105. setActivePinia(pinia);
  7106. const store2 = pinia._s.get(id);
  7107. return getters[name].call(store2, store2);
  7108. }));
  7109. return computedGetters;
  7110. }, {}));
  7111. }
  7112. store = createSetupStore(id, setup, options, pinia, hot, true);
  7113. store.$reset = function $reset() {
  7114. const newState = state ? state() : {};
  7115. this.$patch(($state) => {
  7116. assign($state, newState);
  7117. });
  7118. };
  7119. return store;
  7120. }
  7121. function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
  7122. let scope;
  7123. const optionsForPlugin = assign({ actions: {} }, options);
  7124. if (!pinia._e.active) {
  7125. throw new Error("Pinia destroyed");
  7126. }
  7127. const $subscribeOptions = {
  7128. deep: true
  7129. // flush: 'post',
  7130. };
  7131. {
  7132. $subscribeOptions.onTrigger = (event) => {
  7133. if (isListening) {
  7134. debuggerEvents = event;
  7135. } else if (isListening == false && !store._hotUpdating) {
  7136. if (Array.isArray(debuggerEvents)) {
  7137. debuggerEvents.push(event);
  7138. } else {
  7139. console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
  7140. }
  7141. }
  7142. };
  7143. }
  7144. let isListening;
  7145. let isSyncListening;
  7146. let subscriptions = markRaw([]);
  7147. let actionSubscriptions = markRaw([]);
  7148. let debuggerEvents;
  7149. const initialState = pinia.state.value[$id];
  7150. if (!isOptionsStore && !initialState && !hot) {
  7151. {
  7152. pinia.state.value[$id] = {};
  7153. }
  7154. }
  7155. const hotState = ref({});
  7156. let activeListener;
  7157. function $patch(partialStateOrMutator) {
  7158. let subscriptionMutation;
  7159. isListening = isSyncListening = false;
  7160. {
  7161. debuggerEvents = [];
  7162. }
  7163. if (typeof partialStateOrMutator === "function") {
  7164. partialStateOrMutator(pinia.state.value[$id]);
  7165. subscriptionMutation = {
  7166. type: MutationType.patchFunction,
  7167. storeId: $id,
  7168. events: debuggerEvents
  7169. };
  7170. } else {
  7171. mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
  7172. subscriptionMutation = {
  7173. type: MutationType.patchObject,
  7174. payload: partialStateOrMutator,
  7175. storeId: $id,
  7176. events: debuggerEvents
  7177. };
  7178. }
  7179. const myListenerId = activeListener = Symbol();
  7180. nextTick$1().then(() => {
  7181. if (activeListener === myListenerId) {
  7182. isListening = true;
  7183. }
  7184. });
  7185. isSyncListening = true;
  7186. triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
  7187. }
  7188. const $reset = () => {
  7189. throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
  7190. };
  7191. function $dispose() {
  7192. scope.stop();
  7193. subscriptions = [];
  7194. actionSubscriptions = [];
  7195. pinia._s.delete($id);
  7196. }
  7197. function wrapAction(name, action) {
  7198. return function() {
  7199. setActivePinia(pinia);
  7200. const args = Array.from(arguments);
  7201. const afterCallbackList = [];
  7202. const onErrorCallbackList = [];
  7203. function after(callback) {
  7204. afterCallbackList.push(callback);
  7205. }
  7206. function onError(callback) {
  7207. onErrorCallbackList.push(callback);
  7208. }
  7209. triggerSubscriptions(actionSubscriptions, {
  7210. args,
  7211. name,
  7212. store,
  7213. after,
  7214. onError
  7215. });
  7216. let ret;
  7217. try {
  7218. ret = action.apply(this && this.$id === $id ? this : store, args);
  7219. } catch (error) {
  7220. triggerSubscriptions(onErrorCallbackList, error);
  7221. throw error;
  7222. }
  7223. if (ret instanceof Promise) {
  7224. return ret.then((value) => {
  7225. triggerSubscriptions(afterCallbackList, value);
  7226. return value;
  7227. }).catch((error) => {
  7228. triggerSubscriptions(onErrorCallbackList, error);
  7229. return Promise.reject(error);
  7230. });
  7231. }
  7232. triggerSubscriptions(afterCallbackList, ret);
  7233. return ret;
  7234. };
  7235. }
  7236. const _hmrPayload = /* @__PURE__ */ markRaw({
  7237. actions: {},
  7238. getters: {},
  7239. state: [],
  7240. hotState
  7241. });
  7242. const partialStore = {
  7243. _p: pinia,
  7244. // _s: scope,
  7245. $id,
  7246. $onAction: addSubscription.bind(null, actionSubscriptions),
  7247. $patch,
  7248. $reset,
  7249. $subscribe(callback, options2 = {}) {
  7250. const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
  7251. const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
  7252. if (options2.flush === "sync" ? isSyncListening : isListening) {
  7253. callback({
  7254. storeId: $id,
  7255. type: MutationType.direct,
  7256. events: debuggerEvents
  7257. }, state);
  7258. }
  7259. }, assign({}, $subscribeOptions, options2)));
  7260. return removeSubscription;
  7261. },
  7262. $dispose
  7263. };
  7264. const store = reactive(
  7265. assign(
  7266. {
  7267. _hmrPayload,
  7268. _customProperties: markRaw(/* @__PURE__ */ new Set())
  7269. // devtools custom properties
  7270. },
  7271. partialStore
  7272. // must be added later
  7273. // setupStore
  7274. )
  7275. );
  7276. pinia._s.set($id, store);
  7277. const setupStore = pinia._e.run(() => {
  7278. scope = effectScope();
  7279. return scope.run(() => setup());
  7280. });
  7281. for (const key in setupStore) {
  7282. const prop = setupStore[key];
  7283. if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
  7284. if (hot) {
  7285. set(hotState.value, key, toRef(setupStore, key));
  7286. } else if (!isOptionsStore) {
  7287. if (initialState && shouldHydrate(prop)) {
  7288. if (isRef(prop)) {
  7289. prop.value = initialState[key];
  7290. } else {
  7291. mergeReactiveObjects(prop, initialState[key]);
  7292. }
  7293. }
  7294. {
  7295. pinia.state.value[$id][key] = prop;
  7296. }
  7297. }
  7298. {
  7299. _hmrPayload.state.push(key);
  7300. }
  7301. } else if (typeof prop === "function") {
  7302. const actionValue = hot ? prop : wrapAction(key, prop);
  7303. {
  7304. setupStore[key] = actionValue;
  7305. }
  7306. {
  7307. _hmrPayload.actions[key] = prop;
  7308. }
  7309. optionsForPlugin.actions[key] = prop;
  7310. } else {
  7311. if (isComputed(prop)) {
  7312. _hmrPayload.getters[key] = isOptionsStore ? (
  7313. // @ts-expect-error
  7314. options.getters[key]
  7315. ) : prop;
  7316. if (IS_CLIENT) {
  7317. const getters = setupStore._getters || // @ts-expect-error: same
  7318. (setupStore._getters = markRaw([]));
  7319. getters.push(key);
  7320. }
  7321. }
  7322. }
  7323. }
  7324. {
  7325. assign(store, setupStore);
  7326. assign(toRaw(store), setupStore);
  7327. }
  7328. Object.defineProperty(store, "$state", {
  7329. get: () => hot ? hotState.value : pinia.state.value[$id],
  7330. set: (state) => {
  7331. if (hot) {
  7332. throw new Error("cannot set hotState");
  7333. }
  7334. $patch(($state) => {
  7335. assign($state, state);
  7336. });
  7337. }
  7338. });
  7339. {
  7340. store._hotUpdate = markRaw((newStore) => {
  7341. store._hotUpdating = true;
  7342. newStore._hmrPayload.state.forEach((stateKey) => {
  7343. if (stateKey in store.$state) {
  7344. const newStateTarget = newStore.$state[stateKey];
  7345. const oldStateSource = store.$state[stateKey];
  7346. if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
  7347. patchObject(newStateTarget, oldStateSource);
  7348. } else {
  7349. newStore.$state[stateKey] = oldStateSource;
  7350. }
  7351. }
  7352. set(store, stateKey, toRef(newStore.$state, stateKey));
  7353. });
  7354. Object.keys(store.$state).forEach((stateKey) => {
  7355. if (!(stateKey in newStore.$state)) {
  7356. del(store, stateKey);
  7357. }
  7358. });
  7359. isListening = false;
  7360. isSyncListening = false;
  7361. pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
  7362. isSyncListening = true;
  7363. nextTick$1().then(() => {
  7364. isListening = true;
  7365. });
  7366. for (const actionName in newStore._hmrPayload.actions) {
  7367. const action = newStore[actionName];
  7368. set(store, actionName, wrapAction(actionName, action));
  7369. }
  7370. for (const getterName in newStore._hmrPayload.getters) {
  7371. const getter = newStore._hmrPayload.getters[getterName];
  7372. const getterValue = isOptionsStore ? (
  7373. // special handling of options api
  7374. computed(() => {
  7375. setActivePinia(pinia);
  7376. return getter.call(store, store);
  7377. })
  7378. ) : getter;
  7379. set(store, getterName, getterValue);
  7380. }
  7381. Object.keys(store._hmrPayload.getters).forEach((key) => {
  7382. if (!(key in newStore._hmrPayload.getters)) {
  7383. del(store, key);
  7384. }
  7385. });
  7386. Object.keys(store._hmrPayload.actions).forEach((key) => {
  7387. if (!(key in newStore._hmrPayload.actions)) {
  7388. del(store, key);
  7389. }
  7390. });
  7391. store._hmrPayload = newStore._hmrPayload;
  7392. store._getters = newStore._getters;
  7393. store._hotUpdating = false;
  7394. });
  7395. }
  7396. if (USE_DEVTOOLS) {
  7397. const nonEnumerable = {
  7398. writable: true,
  7399. configurable: true,
  7400. // avoid warning on devtools trying to display this property
  7401. enumerable: false
  7402. };
  7403. ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
  7404. Object.defineProperty(store, p2, assign({ value: store[p2] }, nonEnumerable));
  7405. });
  7406. }
  7407. pinia._p.forEach((extender) => {
  7408. if (USE_DEVTOOLS) {
  7409. const extensions = scope.run(() => extender({
  7410. store,
  7411. app: pinia._a,
  7412. pinia,
  7413. options: optionsForPlugin
  7414. }));
  7415. Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
  7416. assign(store, extensions);
  7417. } else {
  7418. assign(store, scope.run(() => extender({
  7419. store,
  7420. app: pinia._a,
  7421. pinia,
  7422. options: optionsForPlugin
  7423. })));
  7424. }
  7425. });
  7426. if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
  7427. console.warn(`[🍍]: The "state" must be a plain object. It cannot be
  7428. state: () => new MyClass()
  7429. Found in store "${store.$id}".`);
  7430. }
  7431. if (initialState && isOptionsStore && options.hydrate) {
  7432. options.hydrate(store.$state, initialState);
  7433. }
  7434. isListening = true;
  7435. isSyncListening = true;
  7436. return store;
  7437. }
  7438. function defineStore(idOrOptions, setup, setupOptions) {
  7439. let id;
  7440. let options;
  7441. const isSetupStore = typeof setup === "function";
  7442. if (typeof idOrOptions === "string") {
  7443. id = idOrOptions;
  7444. options = isSetupStore ? setupOptions : setup;
  7445. } else {
  7446. options = idOrOptions;
  7447. id = idOrOptions.id;
  7448. }
  7449. function useStore(pinia, hot) {
  7450. const currentInstance2 = getCurrentInstance();
  7451. pinia = // in test mode, ignore the argument provided as we can always retrieve a
  7452. // pinia instance with getActivePinia()
  7453. pinia || currentInstance2 && inject(piniaSymbol, null);
  7454. if (pinia)
  7455. setActivePinia(pinia);
  7456. if (!activePinia) {
  7457. throw new Error(`[🍍]: getActivePinia was called with no active Pinia. Did you forget to install pinia?
  7458. const pinia = createPinia()
  7459. app.use(pinia)
  7460. This will fail in production.`);
  7461. }
  7462. pinia = activePinia;
  7463. if (!pinia._s.has(id)) {
  7464. if (isSetupStore) {
  7465. createSetupStore(id, setup, options, pinia);
  7466. } else {
  7467. createOptionsStore(id, options, pinia);
  7468. }
  7469. {
  7470. useStore._pinia = pinia;
  7471. }
  7472. }
  7473. const store = pinia._s.get(id);
  7474. if (hot) {
  7475. const hotId = "__hot:" + id;
  7476. const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
  7477. hot._hotUpdate(newStore);
  7478. delete pinia.state.value[hotId];
  7479. pinia._s.delete(hotId);
  7480. }
  7481. if (IS_CLIENT && currentInstance2 && currentInstance2.proxy && // avoid adding stores that are just built for hot module replacement
  7482. !hot) {
  7483. const vm = currentInstance2.proxy;
  7484. const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
  7485. cache[id] = store;
  7486. }
  7487. return store;
  7488. }
  7489. useStore.$id = id;
  7490. return useStore;
  7491. }
  7492. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  7493. function getAugmentedNamespace(n2) {
  7494. if (n2.__esModule)
  7495. return n2;
  7496. var f2 = n2.default;
  7497. if (typeof f2 == "function") {
  7498. var a = function a2() {
  7499. if (this instanceof a2) {
  7500. var args = [null];
  7501. args.push.apply(args, arguments);
  7502. var Ctor = Function.bind.apply(f2, args);
  7503. return new Ctor();
  7504. }
  7505. return f2.apply(this, arguments);
  7506. };
  7507. a.prototype = f2.prototype;
  7508. } else
  7509. a = {};
  7510. Object.defineProperty(a, "__esModule", { value: true });
  7511. Object.keys(n2).forEach(function(k) {
  7512. var d = Object.getOwnPropertyDescriptor(n2, k);
  7513. Object.defineProperty(a, k, d.get ? d : {
  7514. enumerable: true,
  7515. get: function() {
  7516. return n2[k];
  7517. }
  7518. });
  7519. });
  7520. return a;
  7521. }
  7522. var md5Exports = {};
  7523. var md5$1 = {
  7524. get exports() {
  7525. return md5Exports;
  7526. },
  7527. set exports(v) {
  7528. md5Exports = v;
  7529. }
  7530. };
  7531. const __viteBrowserExternal = new Proxy({}, {
  7532. get(_, key) {
  7533. throw new Error(`Module "" has been externalized for browser compatibility. Cannot access ".${key}" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
  7534. }
  7535. });
  7536. const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  7537. __proto__: null,
  7538. default: __viteBrowserExternal
  7539. }, Symbol.toStringTag, { value: "Module" }));
  7540. const require$$1 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
  7541. /**
  7542. * [js-md5]{@link https://github.com/emn178/js-md5}
  7543. *
  7544. * @namespace md5
  7545. * @version 0.8.3
  7546. * @author Chen, Yi-Cyuan [emn178@gmail.com]
  7547. * @copyright Chen, Yi-Cyuan 2014-2023
  7548. * @license MIT
  7549. */
  7550. (function(module2) {
  7551. (function() {
  7552. var INPUT_ERROR = "input is invalid type";
  7553. var FINALIZE_ERROR = "finalize already called";
  7554. var WINDOW = typeof window === "object";
  7555. var root = WINDOW ? window : {};
  7556. if (root.JS_MD5_NO_WINDOW) {
  7557. WINDOW = false;
  7558. }
  7559. var WEB_WORKER = !WINDOW && typeof self === "object";
  7560. var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node;
  7561. if (NODE_JS) {
  7562. root = commonjsGlobal;
  7563. } else if (WEB_WORKER) {
  7564. root = self;
  7565. }
  7566. var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && true && module2.exports;
  7567. var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined";
  7568. var HEX_CHARS = "0123456789abcdef".split("");
  7569. var EXTRA = [128, 32768, 8388608, -2147483648];
  7570. var SHIFT = [0, 8, 16, 24];
  7571. var OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer", "base64"];
  7572. var BASE64_ENCODE_CHAR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
  7573. var blocks = [], buffer8;
  7574. if (ARRAY_BUFFER) {
  7575. var buffer2 = new ArrayBuffer(68);
  7576. buffer8 = new Uint8Array(buffer2);
  7577. blocks = new Uint32Array(buffer2);
  7578. }
  7579. var isArray2 = Array.isArray;
  7580. if (root.JS_MD5_NO_NODE_JS || !isArray2) {
  7581. isArray2 = function(obj) {
  7582. return Object.prototype.toString.call(obj) === "[object Array]";
  7583. };
  7584. }
  7585. var isView = ArrayBuffer.isView;
  7586. if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !isView)) {
  7587. isView = function(obj) {
  7588. return typeof obj === "object" && obj.buffer && obj.buffer.constructor === ArrayBuffer;
  7589. };
  7590. }
  7591. var formatMessage = function(message) {
  7592. var type = typeof message;
  7593. if (type === "string") {
  7594. return [message, true];
  7595. }
  7596. if (type !== "object" || message === null) {
  7597. throw new Error(INPUT_ERROR);
  7598. }
  7599. if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
  7600. return [new Uint8Array(message), false];
  7601. }
  7602. if (!isArray2(message) && !isView(message)) {
  7603. throw new Error(INPUT_ERROR);
  7604. }
  7605. return [message, false];
  7606. };
  7607. var createOutputMethod = function(outputType) {
  7608. return function(message) {
  7609. return new Md5(true).update(message)[outputType]();
  7610. };
  7611. };
  7612. var createMethod = function() {
  7613. var method = createOutputMethod("hex");
  7614. if (NODE_JS) {
  7615. method = nodeWrap(method);
  7616. }
  7617. method.create = function() {
  7618. return new Md5();
  7619. };
  7620. method.update = function(message) {
  7621. return method.create().update(message);
  7622. };
  7623. for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
  7624. var type = OUTPUT_TYPES[i];
  7625. method[type] = createOutputMethod(type);
  7626. }
  7627. return method;
  7628. };
  7629. var nodeWrap = function(method) {
  7630. var crypto = require$$1;
  7631. var Buffer = require$$1.Buffer;
  7632. var bufferFrom;
  7633. if (Buffer.from && !root.JS_MD5_NO_BUFFER_FROM) {
  7634. bufferFrom = Buffer.from;
  7635. } else {
  7636. bufferFrom = function(message) {
  7637. return new Buffer(message);
  7638. };
  7639. }
  7640. var nodeMethod = function(message) {
  7641. if (typeof message === "string") {
  7642. return crypto.createHash("md5").update(message, "utf8").digest("hex");
  7643. } else {
  7644. if (message === null || message === void 0) {
  7645. throw new Error(INPUT_ERROR);
  7646. } else if (message.constructor === ArrayBuffer) {
  7647. message = new Uint8Array(message);
  7648. }
  7649. }
  7650. if (isArray2(message) || isView(message) || message.constructor === Buffer) {
  7651. return crypto.createHash("md5").update(bufferFrom(message)).digest("hex");
  7652. } else {
  7653. return method(message);
  7654. }
  7655. };
  7656. return nodeMethod;
  7657. };
  7658. var createHmacOutputMethod = function(outputType) {
  7659. return function(key, message) {
  7660. return new HmacMd5(key, true).update(message)[outputType]();
  7661. };
  7662. };
  7663. var createHmacMethod = function() {
  7664. var method = createHmacOutputMethod("hex");
  7665. method.create = function(key) {
  7666. return new HmacMd5(key);
  7667. };
  7668. method.update = function(key, message) {
  7669. return method.create(key).update(message);
  7670. };
  7671. for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
  7672. var type = OUTPUT_TYPES[i];
  7673. method[type] = createHmacOutputMethod(type);
  7674. }
  7675. return method;
  7676. };
  7677. function Md5(sharedMemory) {
  7678. if (sharedMemory) {
  7679. blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
  7680. this.blocks = blocks;
  7681. this.buffer8 = buffer8;
  7682. } else {
  7683. if (ARRAY_BUFFER) {
  7684. var buffer3 = new ArrayBuffer(68);
  7685. this.buffer8 = new Uint8Array(buffer3);
  7686. this.blocks = new Uint32Array(buffer3);
  7687. } else {
  7688. this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  7689. }
  7690. }
  7691. this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
  7692. this.finalized = this.hashed = false;
  7693. this.first = true;
  7694. }
  7695. Md5.prototype.update = function(message) {
  7696. if (this.finalized) {
  7697. throw new Error(FINALIZE_ERROR);
  7698. }
  7699. var result = formatMessage(message);
  7700. message = result[0];
  7701. var isString2 = result[1];
  7702. var code, index2 = 0, i, length = message.length, blocks2 = this.blocks;
  7703. var buffer82 = this.buffer8;
  7704. while (index2 < length) {
  7705. if (this.hashed) {
  7706. this.hashed = false;
  7707. blocks2[0] = blocks2[16];
  7708. blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
  7709. }
  7710. if (isString2) {
  7711. if (ARRAY_BUFFER) {
  7712. for (i = this.start; index2 < length && i < 64; ++index2) {
  7713. code = message.charCodeAt(index2);
  7714. if (code < 128) {
  7715. buffer82[i++] = code;
  7716. } else if (code < 2048) {
  7717. buffer82[i++] = 192 | code >>> 6;
  7718. buffer82[i++] = 128 | code & 63;
  7719. } else if (code < 55296 || code >= 57344) {
  7720. buffer82[i++] = 224 | code >>> 12;
  7721. buffer82[i++] = 128 | code >>> 6 & 63;
  7722. buffer82[i++] = 128 | code & 63;
  7723. } else {
  7724. code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index2) & 1023);
  7725. buffer82[i++] = 240 | code >>> 18;
  7726. buffer82[i++] = 128 | code >>> 12 & 63;
  7727. buffer82[i++] = 128 | code >>> 6 & 63;
  7728. buffer82[i++] = 128 | code & 63;
  7729. }
  7730. }
  7731. } else {
  7732. for (i = this.start; index2 < length && i < 64; ++index2) {
  7733. code = message.charCodeAt(index2);
  7734. if (code < 128) {
  7735. blocks2[i >>> 2] |= code << SHIFT[i++ & 3];
  7736. } else if (code < 2048) {
  7737. blocks2[i >>> 2] |= (192 | code >>> 6) << SHIFT[i++ & 3];
  7738. blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
  7739. } else if (code < 55296 || code >= 57344) {
  7740. blocks2[i >>> 2] |= (224 | code >>> 12) << SHIFT[i++ & 3];
  7741. blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
  7742. blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
  7743. } else {
  7744. code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index2) & 1023);
  7745. blocks2[i >>> 2] |= (240 | code >>> 18) << SHIFT[i++ & 3];
  7746. blocks2[i >>> 2] |= (128 | code >>> 12 & 63) << SHIFT[i++ & 3];
  7747. blocks2[i >>> 2] |= (128 | code >>> 6 & 63) << SHIFT[i++ & 3];
  7748. blocks2[i >>> 2] |= (128 | code & 63) << SHIFT[i++ & 3];
  7749. }
  7750. }
  7751. }
  7752. } else {
  7753. if (ARRAY_BUFFER) {
  7754. for (i = this.start; index2 < length && i < 64; ++index2) {
  7755. buffer82[i++] = message[index2];
  7756. }
  7757. } else {
  7758. for (i = this.start; index2 < length && i < 64; ++index2) {
  7759. blocks2[i >>> 2] |= message[index2] << SHIFT[i++ & 3];
  7760. }
  7761. }
  7762. }
  7763. this.lastByteIndex = i;
  7764. this.bytes += i - this.start;
  7765. if (i >= 64) {
  7766. this.start = i - 64;
  7767. this.hash();
  7768. this.hashed = true;
  7769. } else {
  7770. this.start = i;
  7771. }
  7772. }
  7773. if (this.bytes > 4294967295) {
  7774. this.hBytes += this.bytes / 4294967296 << 0;
  7775. this.bytes = this.bytes % 4294967296;
  7776. }
  7777. return this;
  7778. };
  7779. Md5.prototype.finalize = function() {
  7780. if (this.finalized) {
  7781. return;
  7782. }
  7783. this.finalized = true;
  7784. var blocks2 = this.blocks, i = this.lastByteIndex;
  7785. blocks2[i >>> 2] |= EXTRA[i & 3];
  7786. if (i >= 56) {
  7787. if (!this.hashed) {
  7788. this.hash();
  7789. }
  7790. blocks2[0] = blocks2[16];
  7791. blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0;
  7792. }
  7793. blocks2[14] = this.bytes << 3;
  7794. blocks2[15] = this.hBytes << 3 | this.bytes >>> 29;
  7795. this.hash();
  7796. };
  7797. Md5.prototype.hash = function() {
  7798. var a, b, c, d, bc, da, blocks2 = this.blocks;
  7799. if (this.first) {
  7800. a = blocks2[0] - 680876937;
  7801. a = (a << 7 | a >>> 25) - 271733879 << 0;
  7802. d = (-1732584194 ^ a & 2004318071) + blocks2[1] - 117830708;
  7803. d = (d << 12 | d >>> 20) + a << 0;
  7804. c = (-271733879 ^ d & (a ^ -271733879)) + blocks2[2] - 1126478375;
  7805. c = (c << 17 | c >>> 15) + d << 0;
  7806. b = (a ^ c & (d ^ a)) + blocks2[3] - 1316259209;
  7807. b = (b << 22 | b >>> 10) + c << 0;
  7808. } else {
  7809. a = this.h0;
  7810. b = this.h1;
  7811. c = this.h2;
  7812. d = this.h3;
  7813. a += (d ^ b & (c ^ d)) + blocks2[0] - 680876936;
  7814. a = (a << 7 | a >>> 25) + b << 0;
  7815. d += (c ^ a & (b ^ c)) + blocks2[1] - 389564586;
  7816. d = (d << 12 | d >>> 20) + a << 0;
  7817. c += (b ^ d & (a ^ b)) + blocks2[2] + 606105819;
  7818. c = (c << 17 | c >>> 15) + d << 0;
  7819. b += (a ^ c & (d ^ a)) + blocks2[3] - 1044525330;
  7820. b = (b << 22 | b >>> 10) + c << 0;
  7821. }
  7822. a += (d ^ b & (c ^ d)) + blocks2[4] - 176418897;
  7823. a = (a << 7 | a >>> 25) + b << 0;
  7824. d += (c ^ a & (b ^ c)) + blocks2[5] + 1200080426;
  7825. d = (d << 12 | d >>> 20) + a << 0;
  7826. c += (b ^ d & (a ^ b)) + blocks2[6] - 1473231341;
  7827. c = (c << 17 | c >>> 15) + d << 0;
  7828. b += (a ^ c & (d ^ a)) + blocks2[7] - 45705983;
  7829. b = (b << 22 | b >>> 10) + c << 0;
  7830. a += (d ^ b & (c ^ d)) + blocks2[8] + 1770035416;
  7831. a = (a << 7 | a >>> 25) + b << 0;
  7832. d += (c ^ a & (b ^ c)) + blocks2[9] - 1958414417;
  7833. d = (d << 12 | d >>> 20) + a << 0;
  7834. c += (b ^ d & (a ^ b)) + blocks2[10] - 42063;
  7835. c = (c << 17 | c >>> 15) + d << 0;
  7836. b += (a ^ c & (d ^ a)) + blocks2[11] - 1990404162;
  7837. b = (b << 22 | b >>> 10) + c << 0;
  7838. a += (d ^ b & (c ^ d)) + blocks2[12] + 1804603682;
  7839. a = (a << 7 | a >>> 25) + b << 0;
  7840. d += (c ^ a & (b ^ c)) + blocks2[13] - 40341101;
  7841. d = (d << 12 | d >>> 20) + a << 0;
  7842. c += (b ^ d & (a ^ b)) + blocks2[14] - 1502002290;
  7843. c = (c << 17 | c >>> 15) + d << 0;
  7844. b += (a ^ c & (d ^ a)) + blocks2[15] + 1236535329;
  7845. b = (b << 22 | b >>> 10) + c << 0;
  7846. a += (c ^ d & (b ^ c)) + blocks2[1] - 165796510;
  7847. a = (a << 5 | a >>> 27) + b << 0;
  7848. d += (b ^ c & (a ^ b)) + blocks2[6] - 1069501632;
  7849. d = (d << 9 | d >>> 23) + a << 0;
  7850. c += (a ^ b & (d ^ a)) + blocks2[11] + 643717713;
  7851. c = (c << 14 | c >>> 18) + d << 0;
  7852. b += (d ^ a & (c ^ d)) + blocks2[0] - 373897302;
  7853. b = (b << 20 | b >>> 12) + c << 0;
  7854. a += (c ^ d & (b ^ c)) + blocks2[5] - 701558691;
  7855. a = (a << 5 | a >>> 27) + b << 0;
  7856. d += (b ^ c & (a ^ b)) + blocks2[10] + 38016083;
  7857. d = (d << 9 | d >>> 23) + a << 0;
  7858. c += (a ^ b & (d ^ a)) + blocks2[15] - 660478335;
  7859. c = (c << 14 | c >>> 18) + d << 0;
  7860. b += (d ^ a & (c ^ d)) + blocks2[4] - 405537848;
  7861. b = (b << 20 | b >>> 12) + c << 0;
  7862. a += (c ^ d & (b ^ c)) + blocks2[9] + 568446438;
  7863. a = (a << 5 | a >>> 27) + b << 0;
  7864. d += (b ^ c & (a ^ b)) + blocks2[14] - 1019803690;
  7865. d = (d << 9 | d >>> 23) + a << 0;
  7866. c += (a ^ b & (d ^ a)) + blocks2[3] - 187363961;
  7867. c = (c << 14 | c >>> 18) + d << 0;
  7868. b += (d ^ a & (c ^ d)) + blocks2[8] + 1163531501;
  7869. b = (b << 20 | b >>> 12) + c << 0;
  7870. a += (c ^ d & (b ^ c)) + blocks2[13] - 1444681467;
  7871. a = (a << 5 | a >>> 27) + b << 0;
  7872. d += (b ^ c & (a ^ b)) + blocks2[2] - 51403784;
  7873. d = (d << 9 | d >>> 23) + a << 0;
  7874. c += (a ^ b & (d ^ a)) + blocks2[7] + 1735328473;
  7875. c = (c << 14 | c >>> 18) + d << 0;
  7876. b += (d ^ a & (c ^ d)) + blocks2[12] - 1926607734;
  7877. b = (b << 20 | b >>> 12) + c << 0;
  7878. bc = b ^ c;
  7879. a += (bc ^ d) + blocks2[5] - 378558;
  7880. a = (a << 4 | a >>> 28) + b << 0;
  7881. d += (bc ^ a) + blocks2[8] - 2022574463;
  7882. d = (d << 11 | d >>> 21) + a << 0;
  7883. da = d ^ a;
  7884. c += (da ^ b) + blocks2[11] + 1839030562;
  7885. c = (c << 16 | c >>> 16) + d << 0;
  7886. b += (da ^ c) + blocks2[14] - 35309556;
  7887. b = (b << 23 | b >>> 9) + c << 0;
  7888. bc = b ^ c;
  7889. a += (bc ^ d) + blocks2[1] - 1530992060;
  7890. a = (a << 4 | a >>> 28) + b << 0;
  7891. d += (bc ^ a) + blocks2[4] + 1272893353;
  7892. d = (d << 11 | d >>> 21) + a << 0;
  7893. da = d ^ a;
  7894. c += (da ^ b) + blocks2[7] - 155497632;
  7895. c = (c << 16 | c >>> 16) + d << 0;
  7896. b += (da ^ c) + blocks2[10] - 1094730640;
  7897. b = (b << 23 | b >>> 9) + c << 0;
  7898. bc = b ^ c;
  7899. a += (bc ^ d) + blocks2[13] + 681279174;
  7900. a = (a << 4 | a >>> 28) + b << 0;
  7901. d += (bc ^ a) + blocks2[0] - 358537222;
  7902. d = (d << 11 | d >>> 21) + a << 0;
  7903. da = d ^ a;
  7904. c += (da ^ b) + blocks2[3] - 722521979;
  7905. c = (c << 16 | c >>> 16) + d << 0;
  7906. b += (da ^ c) + blocks2[6] + 76029189;
  7907. b = (b << 23 | b >>> 9) + c << 0;
  7908. bc = b ^ c;
  7909. a += (bc ^ d) + blocks2[9] - 640364487;
  7910. a = (a << 4 | a >>> 28) + b << 0;
  7911. d += (bc ^ a) + blocks2[12] - 421815835;
  7912. d = (d << 11 | d >>> 21) + a << 0;
  7913. da = d ^ a;
  7914. c += (da ^ b) + blocks2[15] + 530742520;
  7915. c = (c << 16 | c >>> 16) + d << 0;
  7916. b += (da ^ c) + blocks2[2] - 995338651;
  7917. b = (b << 23 | b >>> 9) + c << 0;
  7918. a += (c ^ (b | ~d)) + blocks2[0] - 198630844;
  7919. a = (a << 6 | a >>> 26) + b << 0;
  7920. d += (b ^ (a | ~c)) + blocks2[7] + 1126891415;
  7921. d = (d << 10 | d >>> 22) + a << 0;
  7922. c += (a ^ (d | ~b)) + blocks2[14] - 1416354905;
  7923. c = (c << 15 | c >>> 17) + d << 0;
  7924. b += (d ^ (c | ~a)) + blocks2[5] - 57434055;
  7925. b = (b << 21 | b >>> 11) + c << 0;
  7926. a += (c ^ (b | ~d)) + blocks2[12] + 1700485571;
  7927. a = (a << 6 | a >>> 26) + b << 0;
  7928. d += (b ^ (a | ~c)) + blocks2[3] - 1894986606;
  7929. d = (d << 10 | d >>> 22) + a << 0;
  7930. c += (a ^ (d | ~b)) + blocks2[10] - 1051523;
  7931. c = (c << 15 | c >>> 17) + d << 0;
  7932. b += (d ^ (c | ~a)) + blocks2[1] - 2054922799;
  7933. b = (b << 21 | b >>> 11) + c << 0;
  7934. a += (c ^ (b | ~d)) + blocks2[8] + 1873313359;
  7935. a = (a << 6 | a >>> 26) + b << 0;
  7936. d += (b ^ (a | ~c)) + blocks2[15] - 30611744;
  7937. d = (d << 10 | d >>> 22) + a << 0;
  7938. c += (a ^ (d | ~b)) + blocks2[6] - 1560198380;
  7939. c = (c << 15 | c >>> 17) + d << 0;
  7940. b += (d ^ (c | ~a)) + blocks2[13] + 1309151649;
  7941. b = (b << 21 | b >>> 11) + c << 0;
  7942. a += (c ^ (b | ~d)) + blocks2[4] - 145523070;
  7943. a = (a << 6 | a >>> 26) + b << 0;
  7944. d += (b ^ (a | ~c)) + blocks2[11] - 1120210379;
  7945. d = (d << 10 | d >>> 22) + a << 0;
  7946. c += (a ^ (d | ~b)) + blocks2[2] + 718787259;
  7947. c = (c << 15 | c >>> 17) + d << 0;
  7948. b += (d ^ (c | ~a)) + blocks2[9] - 343485551;
  7949. b = (b << 21 | b >>> 11) + c << 0;
  7950. if (this.first) {
  7951. this.h0 = a + 1732584193 << 0;
  7952. this.h1 = b - 271733879 << 0;
  7953. this.h2 = c - 1732584194 << 0;
  7954. this.h3 = d + 271733878 << 0;
  7955. this.first = false;
  7956. } else {
  7957. this.h0 = this.h0 + a << 0;
  7958. this.h1 = this.h1 + b << 0;
  7959. this.h2 = this.h2 + c << 0;
  7960. this.h3 = this.h3 + d << 0;
  7961. }
  7962. };
  7963. Md5.prototype.hex = function() {
  7964. this.finalize();
  7965. var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
  7966. return HEX_CHARS[h0 >>> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h0 >>> 12 & 15] + HEX_CHARS[h0 >>> 8 & 15] + HEX_CHARS[h0 >>> 20 & 15] + HEX_CHARS[h0 >>> 16 & 15] + HEX_CHARS[h0 >>> 28 & 15] + HEX_CHARS[h0 >>> 24 & 15] + HEX_CHARS[h1 >>> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h1 >>> 12 & 15] + HEX_CHARS[h1 >>> 8 & 15] + HEX_CHARS[h1 >>> 20 & 15] + HEX_CHARS[h1 >>> 16 & 15] + HEX_CHARS[h1 >>> 28 & 15] + HEX_CHARS[h1 >>> 24 & 15] + HEX_CHARS[h2 >>> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h2 >>> 12 & 15] + HEX_CHARS[h2 >>> 8 & 15] + HEX_CHARS[h2 >>> 20 & 15] + HEX_CHARS[h2 >>> 16 & 15] + HEX_CHARS[h2 >>> 28 & 15] + HEX_CHARS[h2 >>> 24 & 15] + HEX_CHARS[h3 >>> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h3 >>> 12 & 15] + HEX_CHARS[h3 >>> 8 & 15] + HEX_CHARS[h3 >>> 20 & 15] + HEX_CHARS[h3 >>> 16 & 15] + HEX_CHARS[h3 >>> 28 & 15] + HEX_CHARS[h3 >>> 24 & 15];
  7967. };
  7968. Md5.prototype.toString = Md5.prototype.hex;
  7969. Md5.prototype.digest = function() {
  7970. this.finalize();
  7971. var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
  7972. return [
  7973. h0 & 255,
  7974. h0 >>> 8 & 255,
  7975. h0 >>> 16 & 255,
  7976. h0 >>> 24 & 255,
  7977. h1 & 255,
  7978. h1 >>> 8 & 255,
  7979. h1 >>> 16 & 255,
  7980. h1 >>> 24 & 255,
  7981. h2 & 255,
  7982. h2 >>> 8 & 255,
  7983. h2 >>> 16 & 255,
  7984. h2 >>> 24 & 255,
  7985. h3 & 255,
  7986. h3 >>> 8 & 255,
  7987. h3 >>> 16 & 255,
  7988. h3 >>> 24 & 255
  7989. ];
  7990. };
  7991. Md5.prototype.array = Md5.prototype.digest;
  7992. Md5.prototype.arrayBuffer = function() {
  7993. this.finalize();
  7994. var buffer3 = new ArrayBuffer(16);
  7995. var blocks2 = new Uint32Array(buffer3);
  7996. blocks2[0] = this.h0;
  7997. blocks2[1] = this.h1;
  7998. blocks2[2] = this.h2;
  7999. blocks2[3] = this.h3;
  8000. return buffer3;
  8001. };
  8002. Md5.prototype.buffer = Md5.prototype.arrayBuffer;
  8003. Md5.prototype.base64 = function() {
  8004. var v1, v2, v3, base64Str = "", bytes = this.array();
  8005. for (var i = 0; i < 15; ) {
  8006. v1 = bytes[i++];
  8007. v2 = bytes[i++];
  8008. v3 = bytes[i++];
  8009. base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] + BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] + BASE64_ENCODE_CHAR[v3 & 63];
  8010. }
  8011. v1 = bytes[i];
  8012. base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] + BASE64_ENCODE_CHAR[v1 << 4 & 63] + "==";
  8013. return base64Str;
  8014. };
  8015. function HmacMd5(key, sharedMemory) {
  8016. var i, result = formatMessage(key);
  8017. key = result[0];
  8018. if (result[1]) {
  8019. var bytes = [], length = key.length, index2 = 0, code;
  8020. for (i = 0; i < length; ++i) {
  8021. code = key.charCodeAt(i);
  8022. if (code < 128) {
  8023. bytes[index2++] = code;
  8024. } else if (code < 2048) {
  8025. bytes[index2++] = 192 | code >>> 6;
  8026. bytes[index2++] = 128 | code & 63;
  8027. } else if (code < 55296 || code >= 57344) {
  8028. bytes[index2++] = 224 | code >>> 12;
  8029. bytes[index2++] = 128 | code >>> 6 & 63;
  8030. bytes[index2++] = 128 | code & 63;
  8031. } else {
  8032. code = 65536 + ((code & 1023) << 10 | key.charCodeAt(++i) & 1023);
  8033. bytes[index2++] = 240 | code >>> 18;
  8034. bytes[index2++] = 128 | code >>> 12 & 63;
  8035. bytes[index2++] = 128 | code >>> 6 & 63;
  8036. bytes[index2++] = 128 | code & 63;
  8037. }
  8038. }
  8039. key = bytes;
  8040. }
  8041. if (key.length > 64) {
  8042. key = new Md5(true).update(key).array();
  8043. }
  8044. var oKeyPad = [], iKeyPad = [];
  8045. for (i = 0; i < 64; ++i) {
  8046. var b = key[i] || 0;
  8047. oKeyPad[i] = 92 ^ b;
  8048. iKeyPad[i] = 54 ^ b;
  8049. }
  8050. Md5.call(this, sharedMemory);
  8051. this.update(iKeyPad);
  8052. this.oKeyPad = oKeyPad;
  8053. this.inner = true;
  8054. this.sharedMemory = sharedMemory;
  8055. }
  8056. HmacMd5.prototype = new Md5();
  8057. HmacMd5.prototype.finalize = function() {
  8058. Md5.prototype.finalize.call(this);
  8059. if (this.inner) {
  8060. this.inner = false;
  8061. var innerHash = this.array();
  8062. Md5.call(this, this.sharedMemory);
  8063. this.update(this.oKeyPad);
  8064. this.update(innerHash);
  8065. Md5.prototype.finalize.call(this);
  8066. }
  8067. };
  8068. var exports2 = createMethod();
  8069. exports2.md5 = exports2;
  8070. exports2.md5.hmac = createHmacMethod();
  8071. if (COMMON_JS) {
  8072. module2.exports = exports2;
  8073. } else {
  8074. root.md5 = exports2;
  8075. }
  8076. })();
  8077. })(md5$1);
  8078. const md5 = md5Exports;
  8079. const createHook = (lifecycle) => (hook, target = getCurrentInstance()) => {
  8080. !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
  8081. };
  8082. const onShow = /* @__PURE__ */ createHook(ON_SHOW);
  8083. const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
  8084. const onReachBottom = /* @__PURE__ */ createHook(ON_REACH_BOTTOM);
  8085. const onPullDownRefresh = /* @__PURE__ */ createHook(ON_PULL_DOWN_REFRESH);
  8086. exports._export_sfc = _export_sfc;
  8087. exports.computed = computed;
  8088. exports.createPinia = createPinia;
  8089. exports.createSSRApp = createSSRApp;
  8090. exports.defineStore = defineStore;
  8091. exports.e = e;
  8092. exports.f = f;
  8093. exports.index = index;
  8094. exports.isRef = isRef;
  8095. exports.md5 = md5;
  8096. exports.n = n;
  8097. exports.nextTick$1 = nextTick$1;
  8098. exports.o = o;
  8099. exports.onLoad = onLoad;
  8100. exports.onPullDownRefresh = onPullDownRefresh;
  8101. exports.onReachBottom = onReachBottom;
  8102. exports.onShow = onShow;
  8103. exports.p = p;
  8104. exports.r = r;
  8105. exports.reactive = reactive;
  8106. exports.ref = ref;
  8107. exports.resolveComponent = resolveComponent;
  8108. exports.s = s;
  8109. exports.t = t;
  8110. exports.unref = unref;
  8111. exports.wx$1 = wx$1;