reactivity.esm-browser.js 53 KB

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