reactivity.esm-bundler.js 53 KB

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