智慧水务管理系统 - 精河县供水工程综合管理平台

reactivity.esm-browser.js 53KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053
  1. /**
  2. * @vue/reactivity v3.5.38
  3. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  4. * @license MIT
  5. **/
  6. // @__NO_SIDE_EFFECTS__
  7. function makeMap(str) {
  8. const map = /* @__PURE__ */ Object.create(null);
  9. for (const key of str.split(",")) map[key] = 1;
  10. return (val) => val in map;
  11. }
  12. const EMPTY_OBJ = Object.freeze({}) ;
  13. const NOOP = () => {
  14. };
  15. const extend = Object.assign;
  16. const remove = (arr, el) => {
  17. const i = arr.indexOf(el);
  18. if (i > -1) {
  19. arr.splice(i, 1);
  20. }
  21. };
  22. const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  23. const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
  24. const isArray = Array.isArray;
  25. const isMap = (val) => toTypeString(val) === "[object Map]";
  26. const isSet = (val) => toTypeString(val) === "[object Set]";
  27. const isFunction = (val) => typeof val === "function";
  28. const isString = (val) => typeof val === "string";
  29. const isSymbol = (val) => typeof val === "symbol";
  30. const isObject = (val) => val !== null && typeof val === "object";
  31. const objectToString = Object.prototype.toString;
  32. const toTypeString = (value) => objectToString.call(value);
  33. const toRawType = (value) => {
  34. return toTypeString(value).slice(8, -1);
  35. };
  36. const isPlainObject = (val) => toTypeString(val) === "[object Object]";
  37. const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
  38. const cacheStringFunction = (fn) => {
  39. const cache = /* @__PURE__ */ Object.create(null);
  40. return ((str) => {
  41. const hit = cache[str];
  42. return hit || (cache[str] = fn(str));
  43. });
  44. };
  45. const capitalize = cacheStringFunction((str) => {
  46. return str.charAt(0).toUpperCase() + str.slice(1);
  47. });
  48. const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
  49. const def = (obj, key, value, writable = false) => {
  50. Object.defineProperty(obj, key, {
  51. configurable: true,
  52. enumerable: false,
  53. writable,
  54. value
  55. });
  56. };
  57. function warn(msg, ...args) {
  58. console.warn(`[Vue warn] ${msg}`, ...args);
  59. }
  60. let activeEffectScope;
  61. class EffectScope {
  62. // TODO isolatedDeclarations "__v_skip"
  63. constructor(detached = false) {
  64. this.detached = detached;
  65. /**
  66. * @internal
  67. */
  68. this._active = true;
  69. /**
  70. * @internal track `on` calls, allow `on` call multiple times
  71. */
  72. this._on = 0;
  73. /**
  74. * @internal
  75. */
  76. this.effects = [];
  77. /**
  78. * @internal
  79. */
  80. this.cleanups = [];
  81. this._isPaused = false;
  82. this._warnOnRun = true;
  83. this.__v_skip = true;
  84. if (!detached && activeEffectScope) {
  85. if (activeEffectScope.active) {
  86. this.parent = activeEffectScope;
  87. this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
  88. this
  89. ) - 1;
  90. } else {
  91. this._active = false;
  92. this._warnOnRun = false;
  93. }
  94. }
  95. }
  96. get active() {
  97. return this._active;
  98. }
  99. pause() {
  100. if (this._active) {
  101. this._isPaused = true;
  102. let i, l;
  103. if (this.scopes) {
  104. for (i = 0, l = this.scopes.length; i < l; i++) {
  105. this.scopes[i].pause();
  106. }
  107. }
  108. for (i = 0, l = this.effects.length; i < l; i++) {
  109. this.effects[i].pause();
  110. }
  111. }
  112. }
  113. /**
  114. * Resumes the effect scope, including all child scopes and effects.
  115. */
  116. resume() {
  117. if (this._active) {
  118. if (this._isPaused) {
  119. this._isPaused = false;
  120. let i, l;
  121. if (this.scopes) {
  122. for (i = 0, l = this.scopes.length; i < l; i++) {
  123. this.scopes[i].resume();
  124. }
  125. }
  126. for (i = 0, l = this.effects.length; i < l; i++) {
  127. this.effects[i].resume();
  128. }
  129. }
  130. }
  131. }
  132. run(fn) {
  133. if (this._active) {
  134. const currentEffectScope = activeEffectScope;
  135. try {
  136. activeEffectScope = this;
  137. return fn();
  138. } finally {
  139. activeEffectScope = currentEffectScope;
  140. }
  141. } else if (this._warnOnRun) {
  142. warn(`cannot run an inactive effect scope.`);
  143. }
  144. }
  145. /**
  146. * This should only be called on non-detached scopes
  147. * @internal
  148. */
  149. on() {
  150. if (++this._on === 1) {
  151. this.prevScope = activeEffectScope;
  152. activeEffectScope = this;
  153. }
  154. }
  155. /**
  156. * This should only be called on non-detached scopes
  157. * @internal
  158. */
  159. off() {
  160. if (this._on > 0 && --this._on === 0) {
  161. if (activeEffectScope === this) {
  162. activeEffectScope = this.prevScope;
  163. } else {
  164. let current = activeEffectScope;
  165. while (current) {
  166. if (current.prevScope === this) {
  167. current.prevScope = this.prevScope;
  168. break;
  169. }
  170. current = current.prevScope;
  171. }
  172. }
  173. this.prevScope = void 0;
  174. }
  175. }
  176. stop(fromParent) {
  177. if (this._active) {
  178. this._active = false;
  179. let i, l;
  180. for (i = 0, l = this.effects.length; i < l; i++) {
  181. this.effects[i].stop();
  182. }
  183. this.effects.length = 0;
  184. for (i = 0, l = this.cleanups.length; i < l; i++) {
  185. this.cleanups[i]();
  186. }
  187. this.cleanups.length = 0;
  188. if (this.scopes) {
  189. for (i = 0, l = this.scopes.length; i < l; i++) {
  190. this.scopes[i].stop(true);
  191. }
  192. this.scopes.length = 0;
  193. }
  194. if (!this.detached && this.parent && !fromParent) {
  195. const last = this.parent.scopes.pop();
  196. if (last && last !== this) {
  197. this.parent.scopes[this.index] = last;
  198. last.index = this.index;
  199. }
  200. }
  201. this.parent = void 0;
  202. }
  203. }
  204. }
  205. function effectScope(detached) {
  206. return new EffectScope(detached);
  207. }
  208. function getCurrentScope() {
  209. return activeEffectScope;
  210. }
  211. function onScopeDispose(fn, failSilently = false) {
  212. if (activeEffectScope) {
  213. activeEffectScope.cleanups.push(fn);
  214. } else if (!failSilently) {
  215. warn(
  216. `onScopeDispose() is called when there is no active effect scope to be associated with.`
  217. );
  218. }
  219. }
  220. let activeSub;
  221. const EffectFlags = {
  222. "ACTIVE": 1,
  223. "1": "ACTIVE",
  224. "RUNNING": 2,
  225. "2": "RUNNING",
  226. "TRACKING": 4,
  227. "4": "TRACKING",
  228. "NOTIFIED": 8,
  229. "8": "NOTIFIED",
  230. "DIRTY": 16,
  231. "16": "DIRTY",
  232. "ALLOW_RECURSE": 32,
  233. "32": "ALLOW_RECURSE",
  234. "PAUSED": 64,
  235. "64": "PAUSED",
  236. "EVALUATED": 128,
  237. "128": "EVALUATED"
  238. };
  239. const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
  240. class ReactiveEffect {
  241. constructor(fn) {
  242. this.fn = fn;
  243. /**
  244. * @internal
  245. */
  246. this.deps = void 0;
  247. /**
  248. * @internal
  249. */
  250. this.depsTail = void 0;
  251. /**
  252. * @internal
  253. */
  254. this.flags = 1 | 4;
  255. /**
  256. * @internal
  257. */
  258. this.next = void 0;
  259. /**
  260. * @internal
  261. */
  262. this.cleanup = void 0;
  263. this.scheduler = void 0;
  264. if (activeEffectScope) {
  265. if (activeEffectScope.active) {
  266. activeEffectScope.effects.push(this);
  267. } else {
  268. this.flags &= -2;
  269. }
  270. }
  271. }
  272. pause() {
  273. this.flags |= 64;
  274. }
  275. resume() {
  276. if (this.flags & 64) {
  277. this.flags &= -65;
  278. if (pausedQueueEffects.has(this)) {
  279. pausedQueueEffects.delete(this);
  280. this.trigger();
  281. }
  282. }
  283. }
  284. /**
  285. * @internal
  286. */
  287. notify() {
  288. if (this.flags & 2 && !(this.flags & 32)) {
  289. return;
  290. }
  291. if (!(this.flags & 8)) {
  292. batch(this);
  293. }
  294. }
  295. run() {
  296. if (!(this.flags & 1)) {
  297. return this.fn();
  298. }
  299. this.flags |= 2;
  300. cleanupEffect(this);
  301. prepareDeps(this);
  302. const prevEffect = activeSub;
  303. const prevShouldTrack = shouldTrack;
  304. activeSub = this;
  305. shouldTrack = true;
  306. try {
  307. return this.fn();
  308. } finally {
  309. if (activeSub !== this) {
  310. warn(
  311. "Active effect was not restored correctly - this is likely a Vue internal bug."
  312. );
  313. }
  314. cleanupDeps(this);
  315. activeSub = prevEffect;
  316. shouldTrack = prevShouldTrack;
  317. this.flags &= -3;
  318. }
  319. }
  320. stop() {
  321. if (this.flags & 1) {
  322. for (let link = this.deps; link; link = link.nextDep) {
  323. removeSub(link);
  324. }
  325. this.deps = this.depsTail = void 0;
  326. cleanupEffect(this);
  327. this.onStop && this.onStop();
  328. this.flags &= -2;
  329. }
  330. }
  331. trigger() {
  332. if (this.flags & 64) {
  333. pausedQueueEffects.add(this);
  334. } else if (this.scheduler) {
  335. this.scheduler();
  336. } else {
  337. this.runIfDirty();
  338. }
  339. }
  340. /**
  341. * @internal
  342. */
  343. runIfDirty() {
  344. if (isDirty(this)) {
  345. this.run();
  346. }
  347. }
  348. get dirty() {
  349. return isDirty(this);
  350. }
  351. }
  352. let batchDepth = 0;
  353. let batchedSub;
  354. let batchedComputed;
  355. function batch(sub, isComputed = false) {
  356. sub.flags |= 8;
  357. if (isComputed) {
  358. sub.next = batchedComputed;
  359. batchedComputed = sub;
  360. return;
  361. }
  362. sub.next = batchedSub;
  363. batchedSub = sub;
  364. }
  365. function startBatch() {
  366. batchDepth++;
  367. }
  368. function endBatch() {
  369. if (--batchDepth > 0) {
  370. return;
  371. }
  372. if (batchedComputed) {
  373. let e = batchedComputed;
  374. batchedComputed = void 0;
  375. while (e) {
  376. const next = e.next;
  377. e.next = void 0;
  378. e.flags &= -9;
  379. e = next;
  380. }
  381. }
  382. let error;
  383. while (batchedSub) {
  384. let e = batchedSub;
  385. batchedSub = void 0;
  386. while (e) {
  387. const next = e.next;
  388. e.next = void 0;
  389. e.flags &= -9;
  390. if (e.flags & 1) {
  391. try {
  392. ;
  393. e.trigger();
  394. } catch (err) {
  395. if (!error) error = err;
  396. }
  397. }
  398. e = next;
  399. }
  400. }
  401. if (error) throw error;
  402. }
  403. function prepareDeps(sub) {
  404. for (let link = sub.deps; link; link = link.nextDep) {
  405. link.version = -1;
  406. link.prevActiveLink = link.dep.activeLink;
  407. link.dep.activeLink = link;
  408. }
  409. }
  410. function cleanupDeps(sub) {
  411. let head;
  412. let tail = sub.depsTail;
  413. let link = tail;
  414. while (link) {
  415. const prev = link.prevDep;
  416. if (link.version === -1) {
  417. if (link === tail) tail = prev;
  418. removeSub(link);
  419. removeDep(link);
  420. } else {
  421. head = link;
  422. }
  423. link.dep.activeLink = link.prevActiveLink;
  424. link.prevActiveLink = void 0;
  425. link = prev;
  426. }
  427. sub.deps = head;
  428. sub.depsTail = tail;
  429. }
  430. function isDirty(sub) {
  431. for (let link = sub.deps; link; link = link.nextDep) {
  432. if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
  433. return true;
  434. }
  435. }
  436. if (sub._dirty) {
  437. return true;
  438. }
  439. return false;
  440. }
  441. function refreshComputed(computed) {
  442. if (computed.flags & 4 && !(computed.flags & 16)) {
  443. return;
  444. }
  445. computed.flags &= -17;
  446. if (computed.globalVersion === globalVersion) {
  447. return;
  448. }
  449. computed.globalVersion = globalVersion;
  450. if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
  451. return;
  452. }
  453. computed.flags |= 2;
  454. const dep = computed.dep;
  455. const prevSub = activeSub;
  456. const prevShouldTrack = shouldTrack;
  457. activeSub = computed;
  458. shouldTrack = true;
  459. try {
  460. prepareDeps(computed);
  461. const value = computed.fn(computed._value);
  462. if (dep.version === 0 || hasChanged(value, computed._value)) {
  463. computed.flags |= 128;
  464. computed._value = value;
  465. dep.version++;
  466. }
  467. } catch (err) {
  468. dep.version++;
  469. throw err;
  470. } finally {
  471. activeSub = prevSub;
  472. shouldTrack = prevShouldTrack;
  473. cleanupDeps(computed);
  474. computed.flags &= -3;
  475. }
  476. }
  477. function removeSub(link, soft = false) {
  478. const { dep, prevSub, nextSub } = link;
  479. if (prevSub) {
  480. prevSub.nextSub = nextSub;
  481. link.prevSub = void 0;
  482. }
  483. if (nextSub) {
  484. nextSub.prevSub = prevSub;
  485. link.nextSub = void 0;
  486. }
  487. if (dep.subsHead === link) {
  488. dep.subsHead = nextSub;
  489. }
  490. if (dep.subs === link) {
  491. dep.subs = prevSub;
  492. if (!prevSub && dep.computed) {
  493. dep.computed.flags &= -5;
  494. for (let l = dep.computed.deps; l; l = l.nextDep) {
  495. removeSub(l, true);
  496. }
  497. }
  498. }
  499. if (!soft && !--dep.sc && dep.map) {
  500. dep.map.delete(dep.key);
  501. }
  502. }
  503. function removeDep(link) {
  504. const { prevDep, nextDep } = link;
  505. if (prevDep) {
  506. prevDep.nextDep = nextDep;
  507. link.prevDep = void 0;
  508. }
  509. if (nextDep) {
  510. nextDep.prevDep = prevDep;
  511. link.nextDep = void 0;
  512. }
  513. }
  514. function effect(fn, options) {
  515. if (fn.effect instanceof ReactiveEffect) {
  516. fn = fn.effect.fn;
  517. }
  518. const e = new ReactiveEffect(fn);
  519. if (options) {
  520. extend(e, options);
  521. }
  522. try {
  523. e.run();
  524. } catch (err) {
  525. e.stop();
  526. throw err;
  527. }
  528. const runner = e.run.bind(e);
  529. runner.effect = e;
  530. return runner;
  531. }
  532. function stop(runner) {
  533. runner.effect.stop();
  534. }
  535. let shouldTrack = true;
  536. const trackStack = [];
  537. function pauseTracking() {
  538. trackStack.push(shouldTrack);
  539. shouldTrack = false;
  540. }
  541. function enableTracking() {
  542. trackStack.push(shouldTrack);
  543. shouldTrack = true;
  544. }
  545. function resetTracking() {
  546. const last = trackStack.pop();
  547. shouldTrack = last === void 0 ? true : last;
  548. }
  549. function onEffectCleanup(fn, failSilently = false) {
  550. if (activeSub instanceof ReactiveEffect) {
  551. activeSub.cleanup = fn;
  552. } else if (!failSilently) {
  553. warn(
  554. `onEffectCleanup() was called when there was no active effect to associate with.`
  555. );
  556. }
  557. }
  558. function cleanupEffect(e) {
  559. const { cleanup } = e;
  560. e.cleanup = void 0;
  561. if (cleanup) {
  562. const prevSub = activeSub;
  563. activeSub = void 0;
  564. try {
  565. cleanup();
  566. } finally {
  567. activeSub = prevSub;
  568. }
  569. }
  570. }
  571. let globalVersion = 0;
  572. class Link {
  573. constructor(sub, dep) {
  574. this.sub = sub;
  575. this.dep = dep;
  576. this.version = dep.version;
  577. this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
  578. }
  579. }
  580. class Dep {
  581. // TODO isolatedDeclarations "__v_skip"
  582. constructor(computed) {
  583. this.computed = computed;
  584. this.version = 0;
  585. /**
  586. * Link between this dep and the current active effect
  587. */
  588. this.activeLink = void 0;
  589. /**
  590. * Doubly linked list representing the subscribing effects (tail)
  591. */
  592. this.subs = void 0;
  593. /**
  594. * For object property deps cleanup
  595. */
  596. this.map = void 0;
  597. this.key = void 0;
  598. /**
  599. * Subscriber counter
  600. */
  601. this.sc = 0;
  602. /**
  603. * @internal
  604. */
  605. this.__v_skip = true;
  606. {
  607. this.subsHead = void 0;
  608. }
  609. }
  610. track(debugInfo) {
  611. if (!activeSub || !shouldTrack || activeSub === this.computed) {
  612. return;
  613. }
  614. let link = this.activeLink;
  615. if (link === void 0 || link.sub !== activeSub) {
  616. link = this.activeLink = new Link(activeSub, this);
  617. if (!activeSub.deps) {
  618. activeSub.deps = activeSub.depsTail = link;
  619. } else {
  620. link.prevDep = activeSub.depsTail;
  621. activeSub.depsTail.nextDep = link;
  622. activeSub.depsTail = link;
  623. }
  624. addSub(link);
  625. } else if (link.version === -1) {
  626. link.version = this.version;
  627. if (link.nextDep) {
  628. const next = link.nextDep;
  629. next.prevDep = link.prevDep;
  630. if (link.prevDep) {
  631. link.prevDep.nextDep = next;
  632. }
  633. link.prevDep = activeSub.depsTail;
  634. link.nextDep = void 0;
  635. activeSub.depsTail.nextDep = link;
  636. activeSub.depsTail = link;
  637. if (activeSub.deps === link) {
  638. activeSub.deps = next;
  639. }
  640. }
  641. }
  642. if (activeSub.onTrack) {
  643. activeSub.onTrack(
  644. extend(
  645. {
  646. effect: activeSub
  647. },
  648. debugInfo
  649. )
  650. );
  651. }
  652. return link;
  653. }
  654. trigger(debugInfo) {
  655. this.version++;
  656. globalVersion++;
  657. this.notify(debugInfo);
  658. }
  659. notify(debugInfo) {
  660. startBatch();
  661. try {
  662. if (true) {
  663. for (let head = this.subsHead; head; head = head.nextSub) {
  664. if (head.sub.onTrigger && !(head.sub.flags & 8)) {
  665. head.sub.onTrigger(
  666. extend(
  667. {
  668. effect: head.sub
  669. },
  670. debugInfo
  671. )
  672. );
  673. }
  674. }
  675. }
  676. for (let link = this.subs; link; link = link.prevSub) {
  677. if (link.sub.notify()) {
  678. ;
  679. link.sub.dep.notify();
  680. }
  681. }
  682. } finally {
  683. endBatch();
  684. }
  685. }
  686. }
  687. function addSub(link) {
  688. link.dep.sc++;
  689. if (link.sub.flags & 4) {
  690. const computed = link.dep.computed;
  691. if (computed && !link.dep.subs) {
  692. computed.flags |= 4 | 16;
  693. for (let l = computed.deps; l; l = l.nextDep) {
  694. addSub(l);
  695. }
  696. }
  697. const currentTail = link.dep.subs;
  698. if (currentTail !== link) {
  699. link.prevSub = currentTail;
  700. if (currentTail) currentTail.nextSub = link;
  701. }
  702. if (link.dep.subsHead === void 0) {
  703. link.dep.subsHead = link;
  704. }
  705. link.dep.subs = link;
  706. }
  707. }
  708. const targetMap = /* @__PURE__ */ new WeakMap();
  709. const ITERATE_KEY = /* @__PURE__ */ Symbol(
  710. "Object iterate"
  711. );
  712. const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  713. "Map keys iterate"
  714. );
  715. const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
  716. "Array iterate"
  717. );
  718. function track(target, type, key) {
  719. if (shouldTrack && activeSub) {
  720. let depsMap = targetMap.get(target);
  721. if (!depsMap) {
  722. targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
  723. }
  724. let dep = depsMap.get(key);
  725. if (!dep) {
  726. depsMap.set(key, dep = new Dep());
  727. dep.map = depsMap;
  728. dep.key = key;
  729. }
  730. {
  731. dep.track({
  732. target,
  733. type,
  734. key
  735. });
  736. }
  737. }
  738. }
  739. function trigger(target, type, key, newValue, oldValue, oldTarget) {
  740. const depsMap = targetMap.get(target);
  741. if (!depsMap) {
  742. globalVersion++;
  743. return;
  744. }
  745. const run = (dep) => {
  746. if (dep) {
  747. {
  748. dep.trigger({
  749. target,
  750. type,
  751. key,
  752. newValue,
  753. oldValue,
  754. oldTarget
  755. });
  756. }
  757. }
  758. };
  759. startBatch();
  760. if (type === "clear") {
  761. depsMap.forEach(run);
  762. } else {
  763. const targetIsArray = isArray(target);
  764. const isArrayIndex = targetIsArray && isIntegerKey(key);
  765. if (targetIsArray && key === "length") {
  766. const newLength = Number(newValue);
  767. depsMap.forEach((dep, key2) => {
  768. if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
  769. run(dep);
  770. }
  771. });
  772. } else {
  773. if (key !== void 0 || depsMap.has(void 0)) {
  774. run(depsMap.get(key));
  775. }
  776. if (isArrayIndex) {
  777. run(depsMap.get(ARRAY_ITERATE_KEY));
  778. }
  779. switch (type) {
  780. case "add":
  781. if (!targetIsArray) {
  782. run(depsMap.get(ITERATE_KEY));
  783. if (isMap(target)) {
  784. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  785. }
  786. } else if (isArrayIndex) {
  787. run(depsMap.get("length"));
  788. }
  789. break;
  790. case "delete":
  791. if (!targetIsArray) {
  792. run(depsMap.get(ITERATE_KEY));
  793. if (isMap(target)) {
  794. run(depsMap.get(MAP_KEY_ITERATE_KEY));
  795. }
  796. }
  797. break;
  798. case "set":
  799. if (isMap(target)) {
  800. run(depsMap.get(ITERATE_KEY));
  801. }
  802. break;
  803. }
  804. }
  805. }
  806. endBatch();
  807. }
  808. function getDepFromReactive(object, key) {
  809. const depMap = targetMap.get(object);
  810. return depMap && depMap.get(key);
  811. }
  812. function reactiveReadArray(array) {
  813. const raw = toRaw(array);
  814. if (raw === array) return raw;
  815. track(raw, "iterate", ARRAY_ITERATE_KEY);
  816. return isShallow(array) ? raw : raw.map(toReactive);
  817. }
  818. function shallowReadArray(arr) {
  819. track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
  820. return arr;
  821. }
  822. function toWrapped(target, item) {
  823. if (isReadonly(target)) {
  824. return isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
  825. }
  826. return toReactive(item);
  827. }
  828. const arrayInstrumentations = {
  829. __proto__: null,
  830. [Symbol.iterator]() {
  831. return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
  832. },
  833. concat(...args) {
  834. return reactiveReadArray(this).concat(
  835. ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
  836. );
  837. },
  838. entries() {
  839. return iterator(this, "entries", (value) => {
  840. value[1] = toWrapped(this, value[1]);
  841. return value;
  842. });
  843. },
  844. every(fn, thisArg) {
  845. return apply(this, "every", fn, thisArg, void 0, arguments);
  846. },
  847. filter(fn, thisArg) {
  848. return apply(
  849. this,
  850. "filter",
  851. fn,
  852. thisArg,
  853. (v) => v.map((item) => toWrapped(this, item)),
  854. arguments
  855. );
  856. },
  857. find(fn, thisArg) {
  858. return apply(
  859. this,
  860. "find",
  861. fn,
  862. thisArg,
  863. (item) => toWrapped(this, item),
  864. arguments
  865. );
  866. },
  867. findIndex(fn, thisArg) {
  868. return apply(this, "findIndex", fn, thisArg, void 0, arguments);
  869. },
  870. findLast(fn, thisArg) {
  871. return apply(
  872. this,
  873. "findLast",
  874. fn,
  875. thisArg,
  876. (item) => toWrapped(this, item),
  877. arguments
  878. );
  879. },
  880. findLastIndex(fn, thisArg) {
  881. return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
  882. },
  883. // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
  884. forEach(fn, thisArg) {
  885. return apply(this, "forEach", fn, thisArg, void 0, arguments);
  886. },
  887. includes(...args) {
  888. return searchProxy(this, "includes", args);
  889. },
  890. indexOf(...args) {
  891. return searchProxy(this, "indexOf", args);
  892. },
  893. join(separator) {
  894. return reactiveReadArray(this).join(separator);
  895. },
  896. // keys() iterator only reads `length`, no optimization required
  897. lastIndexOf(...args) {
  898. return searchProxy(this, "lastIndexOf", args);
  899. },
  900. map(fn, thisArg) {
  901. return apply(this, "map", fn, thisArg, void 0, arguments);
  902. },
  903. pop() {
  904. return noTracking(this, "pop");
  905. },
  906. push(...args) {
  907. return noTracking(this, "push", args);
  908. },
  909. reduce(fn, ...args) {
  910. return reduce(this, "reduce", fn, args);
  911. },
  912. reduceRight(fn, ...args) {
  913. return reduce(this, "reduceRight", fn, args);
  914. },
  915. shift() {
  916. return noTracking(this, "shift");
  917. },
  918. // slice could use ARRAY_ITERATE but also seems to beg for range tracking
  919. some(fn, thisArg) {
  920. return apply(this, "some", fn, thisArg, void 0, arguments);
  921. },
  922. splice(...args) {
  923. return noTracking(this, "splice", args);
  924. },
  925. toReversed() {
  926. return reactiveReadArray(this).toReversed();
  927. },
  928. toSorted(comparer) {
  929. return reactiveReadArray(this).toSorted(comparer);
  930. },
  931. toSpliced(...args) {
  932. return reactiveReadArray(this).toSpliced(...args);
  933. },
  934. unshift(...args) {
  935. return noTracking(this, "unshift", args);
  936. },
  937. values() {
  938. return iterator(this, "values", (item) => toWrapped(this, item));
  939. }
  940. };
  941. function iterator(self, method, wrapValue) {
  942. const arr = shallowReadArray(self);
  943. const iter = arr[method]();
  944. if (arr !== self && !isShallow(self)) {
  945. iter._next = iter.next;
  946. iter.next = () => {
  947. const result = iter._next();
  948. if (!result.done) {
  949. result.value = wrapValue(result.value);
  950. }
  951. return result;
  952. };
  953. }
  954. return iter;
  955. }
  956. const arrayProto = Array.prototype;
  957. function apply(self, method, fn, thisArg, wrappedRetFn, args) {
  958. const arr = shallowReadArray(self);
  959. const needsWrap = arr !== self && !isShallow(self);
  960. const methodFn = arr[method];
  961. if (methodFn !== arrayProto[method]) {
  962. const result2 = methodFn.apply(self, args);
  963. return needsWrap ? toReactive(result2) : result2;
  964. }
  965. let wrappedFn = fn;
  966. if (arr !== self) {
  967. if (needsWrap) {
  968. wrappedFn = function(item, index) {
  969. return fn.call(this, toWrapped(self, item), index, self);
  970. };
  971. } else if (fn.length > 2) {
  972. wrappedFn = function(item, index) {
  973. return fn.call(this, item, index, self);
  974. };
  975. }
  976. }
  977. const result = methodFn.call(arr, wrappedFn, thisArg);
  978. return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
  979. }
  980. function reduce(self, method, fn, args) {
  981. const arr = shallowReadArray(self);
  982. const needsWrap = arr !== self && !isShallow(self);
  983. let wrappedFn = fn;
  984. let wrapInitialAccumulator = false;
  985. if (arr !== self) {
  986. if (needsWrap) {
  987. wrapInitialAccumulator = args.length === 0;
  988. wrappedFn = function(acc, item, index) {
  989. if (wrapInitialAccumulator) {
  990. wrapInitialAccumulator = false;
  991. acc = toWrapped(self, acc);
  992. }
  993. return fn.call(this, acc, toWrapped(self, item), index, self);
  994. };
  995. } else if (fn.length > 3) {
  996. wrappedFn = function(acc, item, index) {
  997. return fn.call(this, acc, item, index, self);
  998. };
  999. }
  1000. }
  1001. const result = arr[method](wrappedFn, ...args);
  1002. return wrapInitialAccumulator ? toWrapped(self, result) : result;
  1003. }
  1004. function searchProxy(self, method, args) {
  1005. const arr = toRaw(self);
  1006. track(arr, "iterate", ARRAY_ITERATE_KEY);
  1007. const res = arr[method](...args);
  1008. if ((res === -1 || res === false) && isProxy(args[0])) {
  1009. args[0] = toRaw(args[0]);
  1010. return arr[method](...args);
  1011. }
  1012. return res;
  1013. }
  1014. function noTracking(self, method, args = []) {
  1015. pauseTracking();
  1016. startBatch();
  1017. const res = toRaw(self)[method].apply(self, args);
  1018. endBatch();
  1019. resetTracking();
  1020. return res;
  1021. }
  1022. const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
  1023. const builtInSymbols = new Set(
  1024. /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
  1025. );
  1026. function hasOwnProperty(key) {
  1027. if (!isSymbol(key)) key = String(key);
  1028. const obj = toRaw(this);
  1029. track(obj, "has", key);
  1030. return obj.hasOwnProperty(key);
  1031. }
  1032. class BaseReactiveHandler {
  1033. constructor(_isReadonly = false, _isShallow = false) {
  1034. this._isReadonly = _isReadonly;
  1035. this._isShallow = _isShallow;
  1036. }
  1037. get(target, key, receiver) {
  1038. if (key === "__v_skip") return target["__v_skip"];
  1039. const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
  1040. if (key === "__v_isReactive") {
  1041. return !isReadonly2;
  1042. } else if (key === "__v_isReadonly") {
  1043. return isReadonly2;
  1044. } else if (key === "__v_isShallow") {
  1045. return isShallow2;
  1046. } else if (key === "__v_raw") {
  1047. if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
  1048. // this means the receiver is a user proxy of the reactive proxy
  1049. Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
  1050. return target;
  1051. }
  1052. return;
  1053. }
  1054. const targetIsArray = isArray(target);
  1055. if (!isReadonly2) {
  1056. let fn;
  1057. if (targetIsArray && (fn = arrayInstrumentations[key])) {
  1058. return fn;
  1059. }
  1060. if (key === "hasOwnProperty") {
  1061. return hasOwnProperty;
  1062. }
  1063. }
  1064. const res = Reflect.get(
  1065. target,
  1066. key,
  1067. // if this is a proxy wrapping a ref, return methods using the raw ref
  1068. // as receiver so that we don't have to call `toRaw` on the ref in all
  1069. // its class methods
  1070. isRef(target) ? target : receiver
  1071. );
  1072. if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
  1073. return res;
  1074. }
  1075. if (!isReadonly2) {
  1076. track(target, "get", key);
  1077. }
  1078. if (isShallow2) {
  1079. return res;
  1080. }
  1081. if (isRef(res)) {
  1082. const value = targetIsArray && isIntegerKey(key) ? res : res.value;
  1083. return isReadonly2 && isObject(value) ? readonly(value) : value;
  1084. }
  1085. if (isObject(res)) {
  1086. return isReadonly2 ? readonly(res) : reactive(res);
  1087. }
  1088. return res;
  1089. }
  1090. }
  1091. class MutableReactiveHandler extends BaseReactiveHandler {
  1092. constructor(isShallow2 = false) {
  1093. super(false, isShallow2);
  1094. }
  1095. set(target, key, value, receiver) {
  1096. let oldValue = target[key];
  1097. const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
  1098. if (!this._isShallow) {
  1099. const isOldValueReadonly = isReadonly(oldValue);
  1100. if (!isShallow(value) && !isReadonly(value)) {
  1101. oldValue = toRaw(oldValue);
  1102. value = toRaw(value);
  1103. }
  1104. if (!isArrayWithIntegerKey && isRef(oldValue) && !isRef(value)) {
  1105. if (isOldValueReadonly) {
  1106. {
  1107. warn(
  1108. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1109. target[key]
  1110. );
  1111. }
  1112. return true;
  1113. } else {
  1114. oldValue.value = value;
  1115. return true;
  1116. }
  1117. }
  1118. }
  1119. const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
  1120. const result = Reflect.set(
  1121. target,
  1122. key,
  1123. value,
  1124. isRef(target) ? target : receiver
  1125. );
  1126. if (target === toRaw(receiver)) {
  1127. if (!hadKey) {
  1128. trigger(target, "add", key, value);
  1129. } else if (hasChanged(value, oldValue)) {
  1130. trigger(target, "set", key, value, oldValue);
  1131. }
  1132. }
  1133. return result;
  1134. }
  1135. deleteProperty(target, key) {
  1136. const hadKey = hasOwn(target, key);
  1137. const oldValue = target[key];
  1138. const result = Reflect.deleteProperty(target, key);
  1139. if (result && hadKey) {
  1140. trigger(target, "delete", key, void 0, oldValue);
  1141. }
  1142. return result;
  1143. }
  1144. has(target, key) {
  1145. const result = Reflect.has(target, key);
  1146. if (!isSymbol(key) || !builtInSymbols.has(key)) {
  1147. track(target, "has", key);
  1148. }
  1149. return result;
  1150. }
  1151. ownKeys(target) {
  1152. track(
  1153. target,
  1154. "iterate",
  1155. isArray(target) ? "length" : ITERATE_KEY
  1156. );
  1157. return Reflect.ownKeys(target);
  1158. }
  1159. }
  1160. class ReadonlyReactiveHandler extends BaseReactiveHandler {
  1161. constructor(isShallow2 = false) {
  1162. super(true, isShallow2);
  1163. }
  1164. set(target, key) {
  1165. {
  1166. warn(
  1167. `Set operation on key "${String(key)}" failed: target is readonly.`,
  1168. target
  1169. );
  1170. }
  1171. return true;
  1172. }
  1173. deleteProperty(target, key) {
  1174. {
  1175. warn(
  1176. `Delete operation on key "${String(key)}" failed: target is readonly.`,
  1177. target
  1178. );
  1179. }
  1180. return true;
  1181. }
  1182. }
  1183. const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
  1184. const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
  1185. const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
  1186. const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
  1187. const toShallow = (value) => value;
  1188. const getProto = (v) => Reflect.getPrototypeOf(v);
  1189. function createIterableMethod(method, isReadonly2, isShallow2) {
  1190. return function(...args) {
  1191. const target = this["__v_raw"];
  1192. const rawTarget = toRaw(target);
  1193. const targetIsMap = isMap(rawTarget);
  1194. const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
  1195. const isKeyOnly = method === "keys" && targetIsMap;
  1196. const innerIterator = target[method](...args);
  1197. const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
  1198. !isReadonly2 && track(
  1199. rawTarget,
  1200. "iterate",
  1201. isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
  1202. );
  1203. return extend(
  1204. // inheriting all iterator properties
  1205. Object.create(innerIterator),
  1206. {
  1207. // iterator protocol
  1208. next() {
  1209. const { value, done } = innerIterator.next();
  1210. return done ? { value, done } : {
  1211. value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
  1212. done
  1213. };
  1214. }
  1215. }
  1216. );
  1217. };
  1218. }
  1219. function createReadonlyMethod(type) {
  1220. return function(...args) {
  1221. {
  1222. const key = args[0] ? `on key "${args[0]}" ` : ``;
  1223. warn(
  1224. `${capitalize(type)} operation ${key}failed: target is readonly.`,
  1225. toRaw(this)
  1226. );
  1227. }
  1228. return type === "delete" ? false : type === "clear" ? void 0 : this;
  1229. };
  1230. }
  1231. function createInstrumentations(readonly, shallow) {
  1232. const instrumentations = {
  1233. get(key) {
  1234. const target = this["__v_raw"];
  1235. const rawTarget = toRaw(target);
  1236. const rawKey = toRaw(key);
  1237. if (!readonly) {
  1238. if (hasChanged(key, rawKey)) {
  1239. track(rawTarget, "get", key);
  1240. }
  1241. track(rawTarget, "get", rawKey);
  1242. }
  1243. const { has } = getProto(rawTarget);
  1244. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1245. if (has.call(rawTarget, key)) {
  1246. return wrap(target.get(key));
  1247. } else if (has.call(rawTarget, rawKey)) {
  1248. return wrap(target.get(rawKey));
  1249. } else if (target !== rawTarget) {
  1250. target.get(key);
  1251. }
  1252. },
  1253. get size() {
  1254. const target = this["__v_raw"];
  1255. !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
  1256. return target.size;
  1257. },
  1258. has(key) {
  1259. const target = this["__v_raw"];
  1260. const rawTarget = toRaw(target);
  1261. const rawKey = toRaw(key);
  1262. if (!readonly) {
  1263. if (hasChanged(key, rawKey)) {
  1264. track(rawTarget, "has", key);
  1265. }
  1266. track(rawTarget, "has", rawKey);
  1267. }
  1268. return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
  1269. },
  1270. forEach(callback, thisArg) {
  1271. const observed = this;
  1272. const target = observed["__v_raw"];
  1273. const rawTarget = toRaw(target);
  1274. const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
  1275. !readonly && track(rawTarget, "iterate", ITERATE_KEY);
  1276. return target.forEach((value, key) => {
  1277. return callback.call(thisArg, wrap(value), wrap(key), observed);
  1278. });
  1279. }
  1280. };
  1281. extend(
  1282. instrumentations,
  1283. readonly ? {
  1284. add: createReadonlyMethod("add"),
  1285. set: createReadonlyMethod("set"),
  1286. delete: createReadonlyMethod("delete"),
  1287. clear: createReadonlyMethod("clear")
  1288. } : {
  1289. add(value) {
  1290. const target = toRaw(this);
  1291. const proto = getProto(target);
  1292. const rawValue = toRaw(value);
  1293. const valueToAdd = !shallow && !isShallow(value) && !isReadonly(value) ? rawValue : value;
  1294. const hadKey = proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue);
  1295. if (!hadKey) {
  1296. target.add(valueToAdd);
  1297. trigger(target, "add", valueToAdd, valueToAdd);
  1298. }
  1299. return this;
  1300. },
  1301. set(key, value) {
  1302. if (!shallow && !isShallow(value) && !isReadonly(value)) {
  1303. value = toRaw(value);
  1304. }
  1305. const target = toRaw(this);
  1306. const { has, get } = getProto(target);
  1307. let hadKey = has.call(target, key);
  1308. if (!hadKey) {
  1309. key = toRaw(key);
  1310. hadKey = has.call(target, key);
  1311. } else {
  1312. checkIdentityKeys(target, has, key);
  1313. }
  1314. const oldValue = get.call(target, key);
  1315. target.set(key, value);
  1316. if (!hadKey) {
  1317. trigger(target, "add", key, value);
  1318. } else if (hasChanged(value, oldValue)) {
  1319. trigger(target, "set", key, value, oldValue);
  1320. }
  1321. return this;
  1322. },
  1323. delete(key) {
  1324. const target = toRaw(this);
  1325. const { has, get } = getProto(target);
  1326. let hadKey = has.call(target, key);
  1327. if (!hadKey) {
  1328. key = toRaw(key);
  1329. hadKey = has.call(target, key);
  1330. } else {
  1331. checkIdentityKeys(target, has, key);
  1332. }
  1333. const oldValue = get ? get.call(target, key) : void 0;
  1334. const result = target.delete(key);
  1335. if (hadKey) {
  1336. trigger(target, "delete", key, void 0, oldValue);
  1337. }
  1338. return result;
  1339. },
  1340. clear() {
  1341. const target = toRaw(this);
  1342. const hadItems = target.size !== 0;
  1343. const oldTarget = isMap(target) ? new Map(target) : new Set(target) ;
  1344. const result = target.clear();
  1345. if (hadItems) {
  1346. trigger(
  1347. target,
  1348. "clear",
  1349. void 0,
  1350. void 0,
  1351. oldTarget
  1352. );
  1353. }
  1354. return result;
  1355. }
  1356. }
  1357. );
  1358. const iteratorMethods = [
  1359. "keys",
  1360. "values",
  1361. "entries",
  1362. Symbol.iterator
  1363. ];
  1364. iteratorMethods.forEach((method) => {
  1365. instrumentations[method] = createIterableMethod(method, readonly, shallow);
  1366. });
  1367. return instrumentations;
  1368. }
  1369. function createInstrumentationGetter(isReadonly2, shallow) {
  1370. const instrumentations = createInstrumentations(isReadonly2, shallow);
  1371. return (target, key, receiver) => {
  1372. if (key === "__v_isReactive") {
  1373. return !isReadonly2;
  1374. } else if (key === "__v_isReadonly") {
  1375. return isReadonly2;
  1376. } else if (key === "__v_raw") {
  1377. return target;
  1378. }
  1379. return Reflect.get(
  1380. hasOwn(instrumentations, key) && key in target ? instrumentations : target,
  1381. key,
  1382. receiver
  1383. );
  1384. };
  1385. }
  1386. const mutableCollectionHandlers = {
  1387. get: /* @__PURE__ */ createInstrumentationGetter(false, false)
  1388. };
  1389. const shallowCollectionHandlers = {
  1390. get: /* @__PURE__ */ createInstrumentationGetter(false, true)
  1391. };
  1392. const readonlyCollectionHandlers = {
  1393. get: /* @__PURE__ */ createInstrumentationGetter(true, false)
  1394. };
  1395. const shallowReadonlyCollectionHandlers = {
  1396. get: /* @__PURE__ */ createInstrumentationGetter(true, true)
  1397. };
  1398. function checkIdentityKeys(target, has, key) {
  1399. const rawKey = toRaw(key);
  1400. if (rawKey !== key && has.call(target, rawKey)) {
  1401. const type = toRawType(target);
  1402. warn(
  1403. `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.`
  1404. );
  1405. }
  1406. }
  1407. const reactiveMap = /* @__PURE__ */ new WeakMap();
  1408. const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
  1409. const readonlyMap = /* @__PURE__ */ new WeakMap();
  1410. const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
  1411. function targetTypeMap(rawType) {
  1412. switch (rawType) {
  1413. case "Object":
  1414. case "Array":
  1415. return 1 /* COMMON */;
  1416. case "Map":
  1417. case "Set":
  1418. case "WeakMap":
  1419. case "WeakSet":
  1420. return 2 /* COLLECTION */;
  1421. default:
  1422. return 0 /* INVALID */;
  1423. }
  1424. }
  1425. // @__NO_SIDE_EFFECTS__
  1426. function reactive(target) {
  1427. if (/* @__PURE__ */ isReadonly(target)) {
  1428. return target;
  1429. }
  1430. return createReactiveObject(
  1431. target,
  1432. false,
  1433. mutableHandlers,
  1434. mutableCollectionHandlers,
  1435. reactiveMap
  1436. );
  1437. }
  1438. // @__NO_SIDE_EFFECTS__
  1439. function shallowReactive(target) {
  1440. return createReactiveObject(
  1441. target,
  1442. false,
  1443. shallowReactiveHandlers,
  1444. shallowCollectionHandlers,
  1445. shallowReactiveMap
  1446. );
  1447. }
  1448. // @__NO_SIDE_EFFECTS__
  1449. function readonly(target) {
  1450. return createReactiveObject(
  1451. target,
  1452. true,
  1453. readonlyHandlers,
  1454. readonlyCollectionHandlers,
  1455. readonlyMap
  1456. );
  1457. }
  1458. // @__NO_SIDE_EFFECTS__
  1459. function shallowReadonly(target) {
  1460. return createReactiveObject(
  1461. target,
  1462. true,
  1463. shallowReadonlyHandlers,
  1464. shallowReadonlyCollectionHandlers,
  1465. shallowReadonlyMap
  1466. );
  1467. }
  1468. function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
  1469. if (!isObject(target)) {
  1470. {
  1471. warn(
  1472. `value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
  1473. target
  1474. )}`
  1475. );
  1476. }
  1477. return target;
  1478. }
  1479. if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
  1480. return target;
  1481. }
  1482. if (target["__v_skip"] || !Object.isExtensible(target)) {
  1483. return target;
  1484. }
  1485. const existingProxy = proxyMap.get(target);
  1486. if (existingProxy) {
  1487. return existingProxy;
  1488. }
  1489. const targetType = targetTypeMap(toRawType(target));
  1490. if (targetType === 0 /* INVALID */) {
  1491. return target;
  1492. }
  1493. const proxy = new Proxy(
  1494. target,
  1495. targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
  1496. );
  1497. proxyMap.set(target, proxy);
  1498. return proxy;
  1499. }
  1500. // @__NO_SIDE_EFFECTS__
  1501. function isReactive(value) {
  1502. if (/* @__PURE__ */ isReadonly(value)) {
  1503. return /* @__PURE__ */ isReactive(value["__v_raw"]);
  1504. }
  1505. return !!(value && value["__v_isReactive"]);
  1506. }
  1507. // @__NO_SIDE_EFFECTS__
  1508. function isReadonly(value) {
  1509. return !!(value && value["__v_isReadonly"]);
  1510. }
  1511. // @__NO_SIDE_EFFECTS__
  1512. function isShallow(value) {
  1513. return !!(value && value["__v_isShallow"]);
  1514. }
  1515. // @__NO_SIDE_EFFECTS__
  1516. function isProxy(value) {
  1517. return value ? !!value["__v_raw"] : false;
  1518. }
  1519. // @__NO_SIDE_EFFECTS__
  1520. function toRaw(observed) {
  1521. const raw = observed && observed["__v_raw"];
  1522. return raw ? /* @__PURE__ */ toRaw(raw) : observed;
  1523. }
  1524. function markRaw(value) {
  1525. if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
  1526. def(value, "__v_skip", true);
  1527. }
  1528. return value;
  1529. }
  1530. const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
  1531. const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
  1532. // @__NO_SIDE_EFFECTS__
  1533. function isRef(r) {
  1534. return r ? r["__v_isRef"] === true : false;
  1535. }
  1536. // @__NO_SIDE_EFFECTS__
  1537. function ref(value) {
  1538. return createRef(value, false);
  1539. }
  1540. // @__NO_SIDE_EFFECTS__
  1541. function shallowRef(value) {
  1542. return createRef(value, true);
  1543. }
  1544. function createRef(rawValue, shallow) {
  1545. if (/* @__PURE__ */ isRef(rawValue)) {
  1546. return rawValue;
  1547. }
  1548. return new RefImpl(rawValue, shallow);
  1549. }
  1550. class RefImpl {
  1551. constructor(value, isShallow2) {
  1552. this.dep = new Dep();
  1553. this["__v_isRef"] = true;
  1554. this["__v_isShallow"] = false;
  1555. this._rawValue = isShallow2 ? value : toRaw(value);
  1556. this._value = isShallow2 ? value : toReactive(value);
  1557. this["__v_isShallow"] = isShallow2;
  1558. }
  1559. get value() {
  1560. {
  1561. this.dep.track({
  1562. target: this,
  1563. type: "get",
  1564. key: "value"
  1565. });
  1566. }
  1567. return this._value;
  1568. }
  1569. set value(newValue) {
  1570. const oldValue = this._rawValue;
  1571. const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
  1572. newValue = useDirectValue ? newValue : toRaw(newValue);
  1573. if (hasChanged(newValue, oldValue)) {
  1574. this._rawValue = newValue;
  1575. this._value = useDirectValue ? newValue : toReactive(newValue);
  1576. {
  1577. this.dep.trigger({
  1578. target: this,
  1579. type: "set",
  1580. key: "value",
  1581. newValue,
  1582. oldValue
  1583. });
  1584. }
  1585. }
  1586. }
  1587. }
  1588. function triggerRef(ref2) {
  1589. if (ref2.dep) {
  1590. {
  1591. ref2.dep.trigger({
  1592. target: ref2,
  1593. type: "set",
  1594. key: "value",
  1595. newValue: ref2._value
  1596. });
  1597. }
  1598. }
  1599. }
  1600. function unref(ref2) {
  1601. return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
  1602. }
  1603. function toValue(source) {
  1604. return isFunction(source) ? source() : unref(source);
  1605. }
  1606. const shallowUnwrapHandlers = {
  1607. get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
  1608. set: (target, key, value, receiver) => {
  1609. const oldValue = target[key];
  1610. if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
  1611. oldValue.value = value;
  1612. return true;
  1613. } else {
  1614. return Reflect.set(target, key, value, receiver);
  1615. }
  1616. }
  1617. };
  1618. function proxyRefs(objectWithRefs) {
  1619. return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
  1620. }
  1621. class CustomRefImpl {
  1622. constructor(factory) {
  1623. this["__v_isRef"] = true;
  1624. this._value = void 0;
  1625. const dep = this.dep = new Dep();
  1626. const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
  1627. this._get = get;
  1628. this._set = set;
  1629. }
  1630. get value() {
  1631. return this._value = this._get();
  1632. }
  1633. set value(newVal) {
  1634. this._set(newVal);
  1635. }
  1636. }
  1637. function customRef(factory) {
  1638. return new CustomRefImpl(factory);
  1639. }
  1640. // @__NO_SIDE_EFFECTS__
  1641. function toRefs(object) {
  1642. if (!isProxy(object)) {
  1643. warn(`toRefs() expects a reactive object but received a plain one.`);
  1644. }
  1645. const ret = isArray(object) ? new Array(object.length) : {};
  1646. for (const key in object) {
  1647. ret[key] = propertyToRef(object, key);
  1648. }
  1649. return ret;
  1650. }
  1651. class ObjectRefImpl {
  1652. constructor(_object, key, _defaultValue) {
  1653. this._object = _object;
  1654. this._defaultValue = _defaultValue;
  1655. this["__v_isRef"] = true;
  1656. this._value = void 0;
  1657. this._key = isSymbol(key) ? key : String(key);
  1658. this._raw = toRaw(_object);
  1659. let shallow = true;
  1660. let obj = _object;
  1661. if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) {
  1662. do {
  1663. shallow = !isProxy(obj) || isShallow(obj);
  1664. } while (shallow && (obj = obj["__v_raw"]));
  1665. }
  1666. this._shallow = shallow;
  1667. }
  1668. get value() {
  1669. let val = this._object[this._key];
  1670. if (this._shallow) {
  1671. val = unref(val);
  1672. }
  1673. return this._value = val === void 0 ? this._defaultValue : val;
  1674. }
  1675. set value(newVal) {
  1676. if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
  1677. const nestedRef = this._object[this._key];
  1678. if (/* @__PURE__ */ isRef(nestedRef)) {
  1679. nestedRef.value = newVal;
  1680. return;
  1681. }
  1682. }
  1683. this._object[this._key] = newVal;
  1684. }
  1685. get dep() {
  1686. return getDepFromReactive(this._raw, this._key);
  1687. }
  1688. }
  1689. class GetterRefImpl {
  1690. constructor(_getter) {
  1691. this._getter = _getter;
  1692. this["__v_isRef"] = true;
  1693. this["__v_isReadonly"] = true;
  1694. this._value = void 0;
  1695. }
  1696. get value() {
  1697. return this._value = this._getter();
  1698. }
  1699. }
  1700. // @__NO_SIDE_EFFECTS__
  1701. function toRef(source, key, defaultValue) {
  1702. if (/* @__PURE__ */ isRef(source)) {
  1703. return source;
  1704. } else if (isFunction(source)) {
  1705. return new GetterRefImpl(source);
  1706. } else if (isObject(source) && arguments.length > 1) {
  1707. return propertyToRef(source, key, defaultValue);
  1708. } else {
  1709. return /* @__PURE__ */ ref(source);
  1710. }
  1711. }
  1712. function propertyToRef(source, key, defaultValue) {
  1713. return new ObjectRefImpl(source, key, defaultValue);
  1714. }
  1715. class ComputedRefImpl {
  1716. constructor(fn, setter, isSSR) {
  1717. this.fn = fn;
  1718. this.setter = setter;
  1719. /**
  1720. * @internal
  1721. */
  1722. this._value = void 0;
  1723. /**
  1724. * @internal
  1725. */
  1726. this.dep = new Dep(this);
  1727. /**
  1728. * @internal
  1729. */
  1730. this.__v_isRef = true;
  1731. // TODO isolatedDeclarations "__v_isReadonly"
  1732. // A computed is also a subscriber that tracks other deps
  1733. /**
  1734. * @internal
  1735. */
  1736. this.deps = void 0;
  1737. /**
  1738. * @internal
  1739. */
  1740. this.depsTail = void 0;
  1741. /**
  1742. * @internal
  1743. */
  1744. this.flags = 16;
  1745. /**
  1746. * @internal
  1747. */
  1748. this.globalVersion = globalVersion - 1;
  1749. /**
  1750. * @internal
  1751. */
  1752. this.next = void 0;
  1753. // for backwards compat
  1754. this.effect = this;
  1755. this["__v_isReadonly"] = !setter;
  1756. this.isSSR = isSSR;
  1757. }
  1758. /**
  1759. * @internal
  1760. */
  1761. notify() {
  1762. this.flags |= 16;
  1763. if (!(this.flags & 8) && // avoid infinite self recursion
  1764. activeSub !== this) {
  1765. batch(this, true);
  1766. return true;
  1767. }
  1768. }
  1769. get value() {
  1770. const link = this.dep.track({
  1771. target: this,
  1772. type: "get",
  1773. key: "value"
  1774. }) ;
  1775. refreshComputed(this);
  1776. if (link) {
  1777. link.version = this.dep.version;
  1778. }
  1779. return this._value;
  1780. }
  1781. set value(newValue) {
  1782. if (this.setter) {
  1783. this.setter(newValue);
  1784. } else {
  1785. warn("Write operation failed: computed value is readonly");
  1786. }
  1787. }
  1788. }
  1789. // @__NO_SIDE_EFFECTS__
  1790. function computed(getterOrOptions, debugOptions, isSSR = false) {
  1791. let getter;
  1792. let setter;
  1793. if (isFunction(getterOrOptions)) {
  1794. getter = getterOrOptions;
  1795. } else {
  1796. getter = getterOrOptions.get;
  1797. setter = getterOrOptions.set;
  1798. }
  1799. const cRef = new ComputedRefImpl(getter, setter, isSSR);
  1800. if (debugOptions && !isSSR) {
  1801. cRef.onTrack = debugOptions.onTrack;
  1802. cRef.onTrigger = debugOptions.onTrigger;
  1803. }
  1804. return cRef;
  1805. }
  1806. const TrackOpTypes = {
  1807. "GET": "get",
  1808. "HAS": "has",
  1809. "ITERATE": "iterate"
  1810. };
  1811. const TriggerOpTypes = {
  1812. "SET": "set",
  1813. "ADD": "add",
  1814. "DELETE": "delete",
  1815. "CLEAR": "clear"
  1816. };
  1817. const ReactiveFlags = {
  1818. "SKIP": "__v_skip",
  1819. "IS_REACTIVE": "__v_isReactive",
  1820. "IS_READONLY": "__v_isReadonly",
  1821. "IS_SHALLOW": "__v_isShallow",
  1822. "RAW": "__v_raw",
  1823. "IS_REF": "__v_isRef"
  1824. };
  1825. const WatchErrorCodes = {
  1826. "WATCH_GETTER": 2,
  1827. "2": "WATCH_GETTER",
  1828. "WATCH_CALLBACK": 3,
  1829. "3": "WATCH_CALLBACK",
  1830. "WATCH_CLEANUP": 4,
  1831. "4": "WATCH_CLEANUP"
  1832. };
  1833. const INITIAL_WATCHER_VALUE = {};
  1834. const cleanupMap = /* @__PURE__ */ new WeakMap();
  1835. let activeWatcher = void 0;
  1836. function getCurrentWatcher() {
  1837. return activeWatcher;
  1838. }
  1839. function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
  1840. if (owner) {
  1841. let cleanups = cleanupMap.get(owner);
  1842. if (!cleanups) cleanupMap.set(owner, cleanups = []);
  1843. cleanups.push(cleanupFn);
  1844. } else if (!failSilently) {
  1845. warn(
  1846. `onWatcherCleanup() was called when there was no active watcher to associate with.`
  1847. );
  1848. }
  1849. }
  1850. function watch(source, cb, options = EMPTY_OBJ) {
  1851. const { immediate, deep, once, scheduler, augmentJob, call } = options;
  1852. const warnInvalidSource = (s) => {
  1853. (options.onWarn || warn)(
  1854. `Invalid watch source: `,
  1855. s,
  1856. `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
  1857. );
  1858. };
  1859. const reactiveGetter = (source2) => {
  1860. if (deep) return source2;
  1861. if (isShallow(source2) || deep === false || deep === 0)
  1862. return traverse(source2, 1);
  1863. return traverse(source2);
  1864. };
  1865. let effect;
  1866. let getter;
  1867. let cleanup;
  1868. let boundCleanup;
  1869. let forceTrigger = false;
  1870. let isMultiSource = false;
  1871. if (isRef(source)) {
  1872. getter = () => source.value;
  1873. forceTrigger = isShallow(source);
  1874. } else if (isReactive(source)) {
  1875. getter = () => reactiveGetter(source);
  1876. forceTrigger = true;
  1877. } else if (isArray(source)) {
  1878. isMultiSource = true;
  1879. forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
  1880. getter = () => source.map((s) => {
  1881. if (isRef(s)) {
  1882. return s.value;
  1883. } else if (isReactive(s)) {
  1884. return reactiveGetter(s);
  1885. } else if (isFunction(s)) {
  1886. return call ? call(s, 2) : s();
  1887. } else {
  1888. warnInvalidSource(s);
  1889. }
  1890. });
  1891. } else if (isFunction(source)) {
  1892. if (cb) {
  1893. getter = call ? () => call(source, 2) : source;
  1894. } else {
  1895. getter = () => {
  1896. if (cleanup) {
  1897. pauseTracking();
  1898. try {
  1899. cleanup();
  1900. } finally {
  1901. resetTracking();
  1902. }
  1903. }
  1904. const currentEffect = activeWatcher;
  1905. activeWatcher = effect;
  1906. try {
  1907. return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
  1908. } finally {
  1909. activeWatcher = currentEffect;
  1910. }
  1911. };
  1912. }
  1913. } else {
  1914. getter = NOOP;
  1915. warnInvalidSource(source);
  1916. }
  1917. if (cb && deep) {
  1918. const baseGetter = getter;
  1919. const depth = deep === true ? Infinity : deep;
  1920. getter = () => traverse(baseGetter(), depth);
  1921. }
  1922. const scope = getCurrentScope();
  1923. const watchHandle = () => {
  1924. effect.stop();
  1925. if (scope && scope.active) {
  1926. remove(scope.effects, effect);
  1927. }
  1928. };
  1929. if (once && cb) {
  1930. const _cb = cb;
  1931. cb = (...args) => {
  1932. const res = _cb(...args);
  1933. watchHandle();
  1934. return res;
  1935. };
  1936. }
  1937. let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
  1938. const job = (immediateFirstRun) => {
  1939. if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
  1940. return;
  1941. }
  1942. if (cb) {
  1943. const newValue = effect.run();
  1944. if (immediateFirstRun || deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
  1945. if (cleanup) {
  1946. cleanup();
  1947. }
  1948. const currentWatcher = activeWatcher;
  1949. activeWatcher = effect;
  1950. try {
  1951. const args = [
  1952. newValue,
  1953. // pass undefined as the old value when it's changed for the first time
  1954. oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
  1955. boundCleanup
  1956. ];
  1957. oldValue = newValue;
  1958. call ? call(cb, 3, args) : (
  1959. // @ts-expect-error
  1960. cb(...args)
  1961. );
  1962. } finally {
  1963. activeWatcher = currentWatcher;
  1964. }
  1965. }
  1966. } else {
  1967. effect.run();
  1968. }
  1969. };
  1970. if (augmentJob) {
  1971. augmentJob(job);
  1972. }
  1973. effect = new ReactiveEffect(getter);
  1974. effect.scheduler = scheduler ? () => scheduler(job, false) : job;
  1975. boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
  1976. cleanup = effect.onStop = () => {
  1977. const cleanups = cleanupMap.get(effect);
  1978. if (cleanups) {
  1979. if (call) {
  1980. call(cleanups, 4);
  1981. } else {
  1982. for (const cleanup2 of cleanups) cleanup2();
  1983. }
  1984. cleanupMap.delete(effect);
  1985. }
  1986. };
  1987. {
  1988. effect.onTrack = options.onTrack;
  1989. effect.onTrigger = options.onTrigger;
  1990. }
  1991. if (cb) {
  1992. if (immediate) {
  1993. job(true);
  1994. } else {
  1995. oldValue = effect.run();
  1996. }
  1997. } else if (scheduler) {
  1998. scheduler(job.bind(null, true), true);
  1999. } else {
  2000. effect.run();
  2001. }
  2002. watchHandle.pause = effect.pause.bind(effect);
  2003. watchHandle.resume = effect.resume.bind(effect);
  2004. watchHandle.stop = watchHandle;
  2005. return watchHandle;
  2006. }
  2007. function traverse(value, depth = Infinity, seen) {
  2008. if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
  2009. return value;
  2010. }
  2011. seen = seen || /* @__PURE__ */ new Map();
  2012. if ((seen.get(value) || 0) >= depth) {
  2013. return value;
  2014. }
  2015. seen.set(value, depth);
  2016. depth--;
  2017. if (isRef(value)) {
  2018. traverse(value.value, depth, seen);
  2019. } else if (isArray(value)) {
  2020. for (let i = 0; i < value.length; i++) {
  2021. traverse(value[i], depth, seen);
  2022. }
  2023. } else if (isSet(value) || isMap(value)) {
  2024. value.forEach((v) => {
  2025. traverse(v, depth, seen);
  2026. });
  2027. } else if (isPlainObject(value)) {
  2028. for (const key in value) {
  2029. traverse(value[key], depth, seen);
  2030. }
  2031. for (const key of Object.getOwnPropertySymbols(value)) {
  2032. if (Object.prototype.propertyIsEnumerable.call(value, key)) {
  2033. traverse(value[key], depth, seen);
  2034. }
  2035. }
  2036. }
  2037. return value;
  2038. }
  2039. export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };