@accelint/map-toolkit 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/catalog-info.yaml +5 -3
  3. package/dist/camera/use-camera-state.js +1 -2
  4. package/dist/camera/use-camera-state.js.map +1 -1
  5. package/dist/deckgl/base-map/constants.d.ts +9 -2
  6. package/dist/deckgl/base-map/constants.js +9 -2
  7. package/dist/deckgl/base-map/constants.js.map +1 -1
  8. package/dist/deckgl/base-map/index.d.ts +4 -2
  9. package/dist/deckgl/base-map/index.js +5 -6
  10. package/dist/deckgl/base-map/index.js.map +1 -1
  11. package/dist/deckgl/base-map/types.d.ts +6 -1
  12. package/dist/deckgl/index.d.ts +8 -2
  13. package/dist/deckgl/index.js +6 -2
  14. package/dist/deckgl/saved-viewports/index.d.ts +1 -1
  15. package/dist/deckgl/saved-viewports/index.js +1 -2
  16. package/dist/deckgl/saved-viewports/index.js.map +1 -1
  17. package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +44 -0
  18. package/dist/deckgl/shapes/display-shape-layer/constants.js +61 -0
  19. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -0
  20. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js → deckgl/shapes/display-shape-layer/fiber.d.ts} +11 -7
  21. package/dist/{packages/hotkey-manager/dist/lib/is-client/index.js → deckgl/shapes/display-shape-layer/fiber.js} +6 -7
  22. package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -0
  23. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +206 -0
  24. package/dist/deckgl/shapes/display-shape-layer/index.js +416 -0
  25. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -0
  26. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +66 -0
  27. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +116 -0
  28. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -0
  29. package/dist/deckgl/shapes/display-shape-layer/store.d.ts +87 -0
  30. package/dist/deckgl/shapes/display-shape-layer/store.js +316 -0
  31. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -0
  32. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +115 -0
  33. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fly-to-viewport.js → deckgl/shapes/display-shape-layer/types.js} +0 -2
  34. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.d.ts +89 -0
  35. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js +88 -0
  36. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +1 -0
  37. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +61 -0
  38. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +111 -0
  39. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -0
  40. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +196 -0
  41. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +368 -0
  42. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -0
  43. package/dist/deckgl/shapes/index.d.ts +20 -0
  44. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js → deckgl/shapes/index.js} +6 -11
  45. package/dist/deckgl/shapes/shared/constants.d.ts +78 -0
  46. package/dist/deckgl/shapes/shared/constants.js +109 -0
  47. package/dist/deckgl/shapes/shared/constants.js.map +1 -0
  48. package/dist/deckgl/shapes/shared/events.d.ts +73 -0
  49. package/dist/deckgl/shapes/shared/events.js +58 -0
  50. package/dist/deckgl/shapes/shared/events.js.map +1 -0
  51. package/dist/deckgl/shapes/shared/types.d.ts +158 -0
  52. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js → deckgl/shapes/shared/types.js} +13 -4
  53. package/dist/deckgl/shapes/shared/types.js.map +1 -0
  54. package/dist/deckgl/symbol-layer/index.d.ts +1 -1
  55. package/dist/viewport/viewport-size.d.ts +2 -2
  56. package/package.json +36 -20
  57. package/dist/_virtual/rolldown_runtime.js +0 -22
  58. package/dist/decorators/deckgl.d.ts +0 -19
  59. package/dist/decorators/deckgl.js +0 -32
  60. package/dist/decorators/deckgl.js.map +0 -1
  61. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js.map +0 -1
  62. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js +0 -63
  63. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js.map +0 -1
  64. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js.map +0 -1
  65. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/index.js +0 -19
  66. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js.map +0 -1
  67. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/normalize-viewport-props.js +0 -14
  68. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js +0 -59
  69. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js.map +0 -1
  70. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-viewport.js +0 -16
  71. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +0 -29
  72. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +0 -1
  73. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +0 -29
  74. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +0 -1
  75. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +0 -54
  76. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +0 -1
  77. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/layer.js +0 -15
  78. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +0 -29
  79. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +0 -1
  80. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js +0 -91
  81. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +0 -1
  82. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +0 -88
  83. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +0 -1
  84. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +0 -29
  85. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +0 -1
  86. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +0 -69
  87. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +0 -1
  88. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +0 -35
  89. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +0 -1
  90. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/source.js +0 -15
  91. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +0 -29
  92. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +0 -1
  93. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +0 -40
  94. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +0 -1
  95. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +0 -23
  96. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +0 -1
  97. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/index.js +0 -27
  98. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +0 -57
  99. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +0 -1
  100. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +0 -343
  101. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +0 -1
  102. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +0 -28
  103. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +0 -1
  104. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +0 -31
  105. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +0 -1
  106. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +0 -57
  107. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +0 -1
  108. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +0 -30
  109. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +0 -1
  110. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +0 -53
  111. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +0 -1
  112. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +0 -52
  113. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +0 -1
  114. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +0 -22
  115. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  116. package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js +0 -812
  117. package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js.map +0 -1
  118. package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js +0 -35
  119. package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js.map +0 -1
  120. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js +0 -195
  121. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js.map +0 -1
  122. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js +0 -76
  123. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js.map +0 -1
  124. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js +0 -39
  125. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js.map +0 -1
  126. package/dist/node_modules/.pnpm/react-map-gl@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-map-gl/dist/maplibre.js +0 -16
  127. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js +0 -27
  128. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js.map +0 -1
  129. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +0 -45
  130. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js.map +0 -1
  131. package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js +0 -78
  132. package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js.map +0 -1
  133. package/dist/packages/hotkey-manager/dist/constants.js +0 -47
  134. package/dist/packages/hotkey-manager/dist/constants.js.map +0 -1
  135. package/dist/packages/hotkey-manager/dist/enums/keycode.js +0 -130
  136. package/dist/packages/hotkey-manager/dist/enums/keycode.js.map +0 -1
  137. package/dist/packages/hotkey-manager/dist/lib/is-client/index.js.map +0 -1
  138. package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js +0 -24
  139. package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js.map +0 -1
  140. package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js +0 -39
  141. package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js.map +0 -1
  142. package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js +0 -27
  143. package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js.map +0 -1
  144. package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js +0 -95
  145. package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js.map +0 -1
@@ -1,812 +0,0 @@
1
- /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
-
14
- //#region ../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
15
- var NOTHING = Symbol.for("immer-nothing");
16
- var DRAFTABLE = Symbol.for("immer-draftable");
17
- var DRAFT_STATE = Symbol.for("immer-state");
18
- var errors = process.env.NODE_ENV !== "production" ? [
19
- function(plugin) {
20
- return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
21
- },
22
- function(thing) {
23
- return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
24
- },
25
- "This object has been frozen and should not be mutated",
26
- function(data) {
27
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
28
- },
29
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
30
- "Immer forbids circular references",
31
- "The first or second argument to `produce` must be a function",
32
- "The third argument to `produce` must be a function or undefined",
33
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
34
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
35
- function(thing) {
36
- return `'current' expects a draft, got: ${thing}`;
37
- },
38
- "Object.defineProperty() cannot be used on an Immer draft",
39
- "Object.setPrototypeOf() cannot be used on an Immer draft",
40
- "Immer only supports deleting array indices",
41
- "Immer only supports setting array indices and the 'length' property",
42
- function(thing) {
43
- return `'original' expects a draft, got: ${thing}`;
44
- }
45
- ] : [];
46
- function die(error, ...args) {
47
- if (process.env.NODE_ENV !== "production") {
48
- const e = errors[error];
49
- const msg = typeof e === "function" ? e.apply(null, args) : e;
50
- throw new Error(`[Immer] ${msg}`);
51
- }
52
- throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
53
- }
54
- var getPrototypeOf = Object.getPrototypeOf;
55
- function isDraft(value) {
56
- return !!value && !!value[DRAFT_STATE];
57
- }
58
- function isDraftable(value) {
59
- if (!value) return false;
60
- return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
61
- }
62
- var objectCtorString = Object.prototype.constructor.toString();
63
- var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
64
- function isPlainObject(value) {
65
- if (!value || typeof value !== "object") return false;
66
- const proto = Object.getPrototypeOf(value);
67
- if (proto === null || proto === Object.prototype) return true;
68
- const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
69
- if (Ctor === Object) return true;
70
- if (typeof Ctor !== "function") return false;
71
- let ctorString = cachedCtorStrings.get(Ctor);
72
- if (ctorString === void 0) {
73
- ctorString = Function.toString.call(Ctor);
74
- cachedCtorStrings.set(Ctor, ctorString);
75
- }
76
- return ctorString === objectCtorString;
77
- }
78
- function each(obj, iter, strict = true) {
79
- if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : Object.keys(obj)).forEach((key) => {
80
- iter(key, obj[key], obj);
81
- });
82
- else obj.forEach((entry, index) => iter(index, entry, obj));
83
- }
84
- function getArchtype(thing) {
85
- const state = thing[DRAFT_STATE];
86
- return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
87
- }
88
- function has(thing, prop) {
89
- return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
90
- }
91
- function set(thing, propOrOldValue, value) {
92
- const t = getArchtype(thing);
93
- if (t === 2) thing.set(propOrOldValue, value);
94
- else if (t === 3) thing.add(value);
95
- else thing[propOrOldValue] = value;
96
- }
97
- function is(x, y) {
98
- if (x === y) return x !== 0 || 1 / x === 1 / y;
99
- else return x !== x && y !== y;
100
- }
101
- function isMap(target) {
102
- return target instanceof Map;
103
- }
104
- function isSet(target) {
105
- return target instanceof Set;
106
- }
107
- function latest(state) {
108
- return state.copy_ || state.base_;
109
- }
110
- function shallowCopy(base, strict) {
111
- if (isMap(base)) return new Map(base);
112
- if (isSet(base)) return new Set(base);
113
- if (Array.isArray(base)) return Array.prototype.slice.call(base);
114
- const isPlain = isPlainObject(base);
115
- if (strict === true || strict === "class_only" && !isPlain) {
116
- const descriptors = Object.getOwnPropertyDescriptors(base);
117
- delete descriptors[DRAFT_STATE];
118
- let keys = Reflect.ownKeys(descriptors);
119
- for (let i = 0; i < keys.length; i++) {
120
- const key = keys[i];
121
- const desc = descriptors[key];
122
- if (desc.writable === false) {
123
- desc.writable = true;
124
- desc.configurable = true;
125
- }
126
- if (desc.get || desc.set) descriptors[key] = {
127
- configurable: true,
128
- writable: true,
129
- enumerable: desc.enumerable,
130
- value: base[key]
131
- };
132
- }
133
- return Object.create(getPrototypeOf(base), descriptors);
134
- } else {
135
- const proto = getPrototypeOf(base);
136
- if (proto !== null && isPlain) return { ...base };
137
- const obj = Object.create(proto);
138
- return Object.assign(obj, base);
139
- }
140
- }
141
- function freeze(obj, deep = false) {
142
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
143
- if (getArchtype(obj) > 1) Object.defineProperties(obj, {
144
- set: dontMutateMethodOverride,
145
- add: dontMutateMethodOverride,
146
- clear: dontMutateMethodOverride,
147
- delete: dontMutateMethodOverride
148
- });
149
- Object.freeze(obj);
150
- if (deep) Object.values(obj).forEach((value) => freeze(value, true));
151
- return obj;
152
- }
153
- function dontMutateFrozenCollections() {
154
- die(2);
155
- }
156
- var dontMutateMethodOverride = { value: dontMutateFrozenCollections };
157
- function isFrozen(obj) {
158
- if (obj === null || typeof obj !== "object") return true;
159
- return Object.isFrozen(obj);
160
- }
161
- var plugins = {};
162
- function getPlugin(pluginKey) {
163
- const plugin = plugins[pluginKey];
164
- if (!plugin) die(0, pluginKey);
165
- return plugin;
166
- }
167
- function loadPlugin(pluginKey, implementation) {
168
- if (!plugins[pluginKey]) plugins[pluginKey] = implementation;
169
- }
170
- var currentScope;
171
- function getCurrentScope() {
172
- return currentScope;
173
- }
174
- function createScope(parent_, immer_) {
175
- return {
176
- drafts_: [],
177
- parent_,
178
- immer_,
179
- canAutoFreeze_: true,
180
- unfinalizedDrafts_: 0
181
- };
182
- }
183
- function usePatchesInScope(scope, patchListener) {
184
- if (patchListener) {
185
- getPlugin("Patches");
186
- scope.patches_ = [];
187
- scope.inversePatches_ = [];
188
- scope.patchListener_ = patchListener;
189
- }
190
- }
191
- function revokeScope(scope) {
192
- leaveScope(scope);
193
- scope.drafts_.forEach(revokeDraft);
194
- scope.drafts_ = null;
195
- }
196
- function leaveScope(scope) {
197
- if (scope === currentScope) currentScope = scope.parent_;
198
- }
199
- function enterScope(immer2) {
200
- return currentScope = createScope(currentScope, immer2);
201
- }
202
- function revokeDraft(draft) {
203
- const state = draft[DRAFT_STATE];
204
- if (state.type_ === 0 || state.type_ === 1) state.revoke_();
205
- else state.revoked_ = true;
206
- }
207
- function processResult(result, scope) {
208
- scope.unfinalizedDrafts_ = scope.drafts_.length;
209
- const baseDraft = scope.drafts_[0];
210
- if (result !== void 0 && result !== baseDraft) {
211
- if (baseDraft[DRAFT_STATE].modified_) {
212
- revokeScope(scope);
213
- die(4);
214
- }
215
- if (isDraftable(result)) {
216
- result = finalize(scope, result);
217
- if (!scope.parent_) maybeFreeze(scope, result);
218
- }
219
- if (scope.patches_) getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope.patches_, scope.inversePatches_);
220
- } else result = finalize(scope, baseDraft, []);
221
- revokeScope(scope);
222
- if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
223
- return result !== NOTHING ? result : void 0;
224
- }
225
- function finalize(rootScope, value, path) {
226
- if (isFrozen(value)) return value;
227
- const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
228
- const state = value[DRAFT_STATE];
229
- if (!state) {
230
- each(value, (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path), useStrictIteration);
231
- return value;
232
- }
233
- if (state.scope_ !== rootScope) return value;
234
- if (!state.modified_) {
235
- maybeFreeze(rootScope, state.base_, true);
236
- return state.base_;
237
- }
238
- if (!state.finalized_) {
239
- state.finalized_ = true;
240
- state.scope_.unfinalizedDrafts_--;
241
- const result = state.copy_;
242
- let resultEach = result;
243
- let isSet2 = false;
244
- if (state.type_ === 3) {
245
- resultEach = new Set(result);
246
- result.clear();
247
- isSet2 = true;
248
- }
249
- each(resultEach, (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2), useStrictIteration);
250
- maybeFreeze(rootScope, result, false);
251
- if (path && rootScope.patches_) getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
252
- }
253
- return state.copy_;
254
- }
255
- function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
256
- if (childValue == null) return;
257
- if (typeof childValue !== "object" && !targetIsSet) return;
258
- const childIsFrozen = isFrozen(childValue);
259
- if (childIsFrozen && !targetIsSet) return;
260
- if (process.env.NODE_ENV !== "production" && childValue === targetObject) die(5);
261
- if (isDraft(childValue)) {
262
- const res = finalize(rootScope, childValue, rootPath && parentState && parentState.type_ !== 3 && !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0);
263
- set(targetObject, prop, res);
264
- if (isDraft(res)) rootScope.canAutoFreeze_ = false;
265
- else return;
266
- } else if (targetIsSet) targetObject.add(childValue);
267
- if (isDraftable(childValue) && !childIsFrozen) {
268
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return;
269
- if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) return;
270
- finalize(rootScope, childValue);
271
- if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop))) maybeFreeze(rootScope, childValue);
272
- }
273
- }
274
- function maybeFreeze(scope, value, deep = false) {
275
- if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
276
- }
277
- function createProxyProxy(base, parent) {
278
- const isArray = Array.isArray(base);
279
- const state = {
280
- type_: isArray ? 1 : 0,
281
- scope_: parent ? parent.scope_ : getCurrentScope(),
282
- modified_: false,
283
- finalized_: false,
284
- assigned_: {},
285
- parent_: parent,
286
- base_: base,
287
- draft_: null,
288
- copy_: null,
289
- revoke_: null,
290
- isManual_: false
291
- };
292
- let target = state;
293
- let traps = objectTraps;
294
- if (isArray) {
295
- target = [state];
296
- traps = arrayTraps;
297
- }
298
- const { revoke, proxy } = Proxy.revocable(target, traps);
299
- state.draft_ = proxy;
300
- state.revoke_ = revoke;
301
- return proxy;
302
- }
303
- var objectTraps = {
304
- get(state, prop) {
305
- if (prop === DRAFT_STATE) return state;
306
- const source = latest(state);
307
- if (!has(source, prop)) return readPropFromProto(state, source, prop);
308
- const value = source[prop];
309
- if (state.finalized_ || !isDraftable(value)) return value;
310
- if (value === peek(state.base_, prop)) {
311
- prepareCopy(state);
312
- return state.copy_[prop] = createProxy(value, state);
313
- }
314
- return value;
315
- },
316
- has(state, prop) {
317
- return prop in latest(state);
318
- },
319
- ownKeys(state) {
320
- return Reflect.ownKeys(latest(state));
321
- },
322
- set(state, prop, value) {
323
- const desc = getDescriptorFromProto(latest(state), prop);
324
- if (desc?.set) {
325
- desc.set.call(state.draft_, value);
326
- return true;
327
- }
328
- if (!state.modified_) {
329
- const current2 = peek(latest(state), prop);
330
- const currentState = current2?.[DRAFT_STATE];
331
- if (currentState && currentState.base_ === value) {
332
- state.copy_[prop] = value;
333
- state.assigned_[prop] = false;
334
- return true;
335
- }
336
- if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) return true;
337
- prepareCopy(state);
338
- markChanged(state);
339
- }
340
- if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
341
- state.copy_[prop] = value;
342
- state.assigned_[prop] = true;
343
- return true;
344
- },
345
- deleteProperty(state, prop) {
346
- if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
347
- state.assigned_[prop] = false;
348
- prepareCopy(state);
349
- markChanged(state);
350
- } else delete state.assigned_[prop];
351
- if (state.copy_) delete state.copy_[prop];
352
- return true;
353
- },
354
- getOwnPropertyDescriptor(state, prop) {
355
- const owner = latest(state);
356
- const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
357
- if (!desc) return desc;
358
- return {
359
- writable: true,
360
- configurable: state.type_ !== 1 || prop !== "length",
361
- enumerable: desc.enumerable,
362
- value: owner[prop]
363
- };
364
- },
365
- defineProperty() {
366
- die(11);
367
- },
368
- getPrototypeOf(state) {
369
- return getPrototypeOf(state.base_);
370
- },
371
- setPrototypeOf() {
372
- die(12);
373
- }
374
- };
375
- var arrayTraps = {};
376
- each(objectTraps, (key, fn) => {
377
- arrayTraps[key] = function() {
378
- arguments[0] = arguments[0][0];
379
- return fn.apply(this, arguments);
380
- };
381
- });
382
- arrayTraps.deleteProperty = function(state, prop) {
383
- if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop))) die(13);
384
- return arrayTraps.set.call(this, state, prop, void 0);
385
- };
386
- arrayTraps.set = function(state, prop, value) {
387
- if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop))) die(14);
388
- return objectTraps.set.call(this, state[0], prop, value, state[0]);
389
- };
390
- function peek(draft, prop) {
391
- const state = draft[DRAFT_STATE];
392
- return (state ? latest(state) : draft)[prop];
393
- }
394
- function readPropFromProto(state, source, prop) {
395
- const desc = getDescriptorFromProto(source, prop);
396
- return desc ? `value` in desc ? desc.value : desc.get?.call(state.draft_) : void 0;
397
- }
398
- function getDescriptorFromProto(source, prop) {
399
- if (!(prop in source)) return void 0;
400
- let proto = getPrototypeOf(source);
401
- while (proto) {
402
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
403
- if (desc) return desc;
404
- proto = getPrototypeOf(proto);
405
- }
406
- }
407
- function markChanged(state) {
408
- if (!state.modified_) {
409
- state.modified_ = true;
410
- if (state.parent_) markChanged(state.parent_);
411
- }
412
- }
413
- function prepareCopy(state) {
414
- if (!state.copy_) state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
415
- }
416
- var Immer2 = class {
417
- constructor(config) {
418
- this.autoFreeze_ = true;
419
- this.useStrictShallowCopy_ = false;
420
- this.useStrictIteration_ = true;
421
- /**
422
- * The `produce` function takes a value and a "recipe function" (whose
423
- * return value often depends on the base state). The recipe function is
424
- * free to mutate its first argument however it wants. All mutations are
425
- * only ever applied to a __copy__ of the base state.
426
- *
427
- * Pass only a function to create a "curried producer" which relieves you
428
- * from passing the recipe function every time.
429
- *
430
- * Only plain objects and arrays are made mutable. All other objects are
431
- * considered uncopyable.
432
- *
433
- * Note: This function is __bound__ to its `Immer` instance.
434
- *
435
- * @param {any} base - the initial state
436
- * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
437
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
438
- * @returns {any} a new state, or the initial state if nothing was modified
439
- */
440
- this.produce = (base, recipe, patchListener) => {
441
- if (typeof base === "function" && typeof recipe !== "function") {
442
- const defaultBase = recipe;
443
- recipe = base;
444
- const self = this;
445
- return function curriedProduce(base2 = defaultBase, ...args) {
446
- return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
447
- };
448
- }
449
- if (typeof recipe !== "function") die(6);
450
- if (patchListener !== void 0 && typeof patchListener !== "function") die(7);
451
- let result;
452
- if (isDraftable(base)) {
453
- const scope = enterScope(this);
454
- const proxy = createProxy(base, void 0);
455
- let hasError = true;
456
- try {
457
- result = recipe(proxy);
458
- hasError = false;
459
- } finally {
460
- if (hasError) revokeScope(scope);
461
- else leaveScope(scope);
462
- }
463
- usePatchesInScope(scope, patchListener);
464
- return processResult(result, scope);
465
- } else if (!base || typeof base !== "object") {
466
- result = recipe(base);
467
- if (result === void 0) result = base;
468
- if (result === NOTHING) result = void 0;
469
- if (this.autoFreeze_) freeze(result, true);
470
- if (patchListener) {
471
- const p = [];
472
- const ip = [];
473
- getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
474
- patchListener(p, ip);
475
- }
476
- return result;
477
- } else die(1, base);
478
- };
479
- this.produceWithPatches = (base, recipe) => {
480
- if (typeof base === "function") return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
481
- let patches, inversePatches;
482
- return [
483
- this.produce(base, recipe, (p, ip) => {
484
- patches = p;
485
- inversePatches = ip;
486
- }),
487
- patches,
488
- inversePatches
489
- ];
490
- };
491
- if (typeof config?.autoFreeze === "boolean") this.setAutoFreeze(config.autoFreeze);
492
- if (typeof config?.useStrictShallowCopy === "boolean") this.setUseStrictShallowCopy(config.useStrictShallowCopy);
493
- if (typeof config?.useStrictIteration === "boolean") this.setUseStrictIteration(config.useStrictIteration);
494
- }
495
- createDraft(base) {
496
- if (!isDraftable(base)) die(8);
497
- if (isDraft(base)) base = current(base);
498
- const scope = enterScope(this);
499
- const proxy = createProxy(base, void 0);
500
- proxy[DRAFT_STATE].isManual_ = true;
501
- leaveScope(scope);
502
- return proxy;
503
- }
504
- finishDraft(draft, patchListener) {
505
- const state = draft && draft[DRAFT_STATE];
506
- if (!state || !state.isManual_) die(9);
507
- const { scope_: scope } = state;
508
- usePatchesInScope(scope, patchListener);
509
- return processResult(void 0, scope);
510
- }
511
- /**
512
- * Pass true to automatically freeze all copies created by Immer.
513
- *
514
- * By default, auto-freezing is enabled.
515
- */
516
- setAutoFreeze(value) {
517
- this.autoFreeze_ = value;
518
- }
519
- /**
520
- * Pass true to enable strict shallow copy.
521
- *
522
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
523
- */
524
- setUseStrictShallowCopy(value) {
525
- this.useStrictShallowCopy_ = value;
526
- }
527
- /**
528
- * Pass false to use faster iteration that skips non-enumerable properties
529
- * but still handles symbols for compatibility.
530
- *
531
- * By default, strict iteration is enabled (includes all own properties).
532
- */
533
- setUseStrictIteration(value) {
534
- this.useStrictIteration_ = value;
535
- }
536
- shouldUseStrictIteration() {
537
- return this.useStrictIteration_;
538
- }
539
- applyPatches(base, patches) {
540
- let i;
541
- for (i = patches.length - 1; i >= 0; i--) {
542
- const patch = patches[i];
543
- if (patch.path.length === 0 && patch.op === "replace") {
544
- base = patch.value;
545
- break;
546
- }
547
- }
548
- if (i > -1) patches = patches.slice(i + 1);
549
- const applyPatchesImpl = getPlugin("Patches").applyPatches_;
550
- if (isDraft(base)) return applyPatchesImpl(base, patches);
551
- return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
552
- }
553
- };
554
- function createProxy(value, parent) {
555
- const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
556
- (parent ? parent.scope_ : getCurrentScope()).drafts_.push(draft);
557
- return draft;
558
- }
559
- function current(value) {
560
- if (!isDraft(value)) die(10, value);
561
- return currentImpl(value);
562
- }
563
- function currentImpl(value) {
564
- if (!isDraftable(value) || isFrozen(value)) return value;
565
- const state = value[DRAFT_STATE];
566
- let copy;
567
- let strict = true;
568
- if (state) {
569
- if (!state.modified_) return state.base_;
570
- state.finalized_ = true;
571
- copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
572
- strict = state.scope_.immer_.shouldUseStrictIteration();
573
- } else copy = shallowCopy(value, true);
574
- each(copy, (key, childValue) => {
575
- set(copy, key, currentImpl(childValue));
576
- }, strict);
577
- if (state) state.finalized_ = false;
578
- return copy;
579
- }
580
- function enableMapSet() {
581
- class DraftMap extends Map {
582
- constructor(target, parent) {
583
- super();
584
- this[DRAFT_STATE] = {
585
- type_: 2,
586
- parent_: parent,
587
- scope_: parent ? parent.scope_ : getCurrentScope(),
588
- modified_: false,
589
- finalized_: false,
590
- copy_: void 0,
591
- assigned_: void 0,
592
- base_: target,
593
- draft_: this,
594
- isManual_: false,
595
- revoked_: false
596
- };
597
- }
598
- get size() {
599
- return latest(this[DRAFT_STATE]).size;
600
- }
601
- has(key) {
602
- return latest(this[DRAFT_STATE]).has(key);
603
- }
604
- set(key, value) {
605
- const state = this[DRAFT_STATE];
606
- assertUnrevoked(state);
607
- if (!latest(state).has(key) || latest(state).get(key) !== value) {
608
- prepareMapCopy(state);
609
- markChanged(state);
610
- state.assigned_.set(key, true);
611
- state.copy_.set(key, value);
612
- state.assigned_.set(key, true);
613
- }
614
- return this;
615
- }
616
- delete(key) {
617
- if (!this.has(key)) return false;
618
- const state = this[DRAFT_STATE];
619
- assertUnrevoked(state);
620
- prepareMapCopy(state);
621
- markChanged(state);
622
- if (state.base_.has(key)) state.assigned_.set(key, false);
623
- else state.assigned_.delete(key);
624
- state.copy_.delete(key);
625
- return true;
626
- }
627
- clear() {
628
- const state = this[DRAFT_STATE];
629
- assertUnrevoked(state);
630
- if (latest(state).size) {
631
- prepareMapCopy(state);
632
- markChanged(state);
633
- state.assigned_ = /* @__PURE__ */ new Map();
634
- each(state.base_, (key) => {
635
- state.assigned_.set(key, false);
636
- });
637
- state.copy_.clear();
638
- }
639
- }
640
- forEach(cb, thisArg) {
641
- const state = this[DRAFT_STATE];
642
- latest(state).forEach((_value, key, _map) => {
643
- cb.call(thisArg, this.get(key), key, this);
644
- });
645
- }
646
- get(key) {
647
- const state = this[DRAFT_STATE];
648
- assertUnrevoked(state);
649
- const value = latest(state).get(key);
650
- if (state.finalized_ || !isDraftable(value)) return value;
651
- if (value !== state.base_.get(key)) return value;
652
- const draft = createProxy(value, state);
653
- prepareMapCopy(state);
654
- state.copy_.set(key, draft);
655
- return draft;
656
- }
657
- keys() {
658
- return latest(this[DRAFT_STATE]).keys();
659
- }
660
- values() {
661
- const iterator = this.keys();
662
- return {
663
- [Symbol.iterator]: () => this.values(),
664
- next: () => {
665
- const r = iterator.next();
666
- if (r.done) return r;
667
- return {
668
- done: false,
669
- value: this.get(r.value)
670
- };
671
- }
672
- };
673
- }
674
- entries() {
675
- const iterator = this.keys();
676
- return {
677
- [Symbol.iterator]: () => this.entries(),
678
- next: () => {
679
- const r = iterator.next();
680
- if (r.done) return r;
681
- const value = this.get(r.value);
682
- return {
683
- done: false,
684
- value: [r.value, value]
685
- };
686
- }
687
- };
688
- }
689
- [Symbol.iterator]() {
690
- return this.entries();
691
- }
692
- }
693
- function proxyMap_(target, parent) {
694
- return new DraftMap(target, parent);
695
- }
696
- function prepareMapCopy(state) {
697
- if (!state.copy_) {
698
- state.assigned_ = /* @__PURE__ */ new Map();
699
- state.copy_ = new Map(state.base_);
700
- }
701
- }
702
- class DraftSet extends Set {
703
- constructor(target, parent) {
704
- super();
705
- this[DRAFT_STATE] = {
706
- type_: 3,
707
- parent_: parent,
708
- scope_: parent ? parent.scope_ : getCurrentScope(),
709
- modified_: false,
710
- finalized_: false,
711
- copy_: void 0,
712
- base_: target,
713
- draft_: this,
714
- drafts_: /* @__PURE__ */ new Map(),
715
- revoked_: false,
716
- isManual_: false
717
- };
718
- }
719
- get size() {
720
- return latest(this[DRAFT_STATE]).size;
721
- }
722
- has(value) {
723
- const state = this[DRAFT_STATE];
724
- assertUnrevoked(state);
725
- if (!state.copy_) return state.base_.has(value);
726
- if (state.copy_.has(value)) return true;
727
- if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value))) return true;
728
- return false;
729
- }
730
- add(value) {
731
- const state = this[DRAFT_STATE];
732
- assertUnrevoked(state);
733
- if (!this.has(value)) {
734
- prepareSetCopy(state);
735
- markChanged(state);
736
- state.copy_.add(value);
737
- }
738
- return this;
739
- }
740
- delete(value) {
741
- if (!this.has(value)) return false;
742
- const state = this[DRAFT_STATE];
743
- assertUnrevoked(state);
744
- prepareSetCopy(state);
745
- markChanged(state);
746
- return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : false);
747
- }
748
- clear() {
749
- const state = this[DRAFT_STATE];
750
- assertUnrevoked(state);
751
- if (latest(state).size) {
752
- prepareSetCopy(state);
753
- markChanged(state);
754
- state.copy_.clear();
755
- }
756
- }
757
- values() {
758
- const state = this[DRAFT_STATE];
759
- assertUnrevoked(state);
760
- prepareSetCopy(state);
761
- return state.copy_.values();
762
- }
763
- entries() {
764
- const state = this[DRAFT_STATE];
765
- assertUnrevoked(state);
766
- prepareSetCopy(state);
767
- return state.copy_.entries();
768
- }
769
- keys() {
770
- return this.values();
771
- }
772
- [Symbol.iterator]() {
773
- return this.values();
774
- }
775
- forEach(cb, thisArg) {
776
- const iterator = this.values();
777
- let result = iterator.next();
778
- while (!result.done) {
779
- cb.call(thisArg, result.value, result.value, this);
780
- result = iterator.next();
781
- }
782
- }
783
- }
784
- function proxySet_(target, parent) {
785
- return new DraftSet(target, parent);
786
- }
787
- function prepareSetCopy(state) {
788
- if (!state.copy_) {
789
- state.copy_ = /* @__PURE__ */ new Set();
790
- state.base_.forEach((value) => {
791
- if (isDraftable(value)) {
792
- const draft = createProxy(value, state);
793
- state.drafts_.set(value, draft);
794
- state.copy_.add(draft);
795
- } else state.copy_.add(value);
796
- });
797
- }
798
- }
799
- function assertUnrevoked(state) {
800
- if (state.revoked_) die(3, JSON.stringify(latest(state)));
801
- }
802
- loadPlugin("MapSet", {
803
- proxyMap_,
804
- proxySet_
805
- });
806
- }
807
- var immer = new Immer2();
808
- var produce = immer.produce;
809
-
810
- //#endregion
811
- export { enableMapSet, produce };
812
- //# sourceMappingURL=immer.js.map