reactivity.esm-browser.js 53 KB

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