@code0-tech/pictor 0.18.3 → 1.1.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 (464) hide show
  1. package/dist/_virtual/__vite-optional-peer-dep_@emotion/is-prop-valid_framer-motion.js +6 -0
  2. package/dist/_virtual/rolldown_runtime.js +18 -0
  3. package/dist/assets/Alert.style.css +1 -0
  4. package/dist/assets/Aurora.style.css +1 -0
  5. package/dist/assets/Avatar.style.css +1 -0
  6. package/dist/assets/Badge.style.css +1 -0
  7. package/dist/assets/Breadcrumb.style.css +1 -0
  8. package/dist/assets/Button.style.css +1 -0
  9. package/dist/assets/ButtonGroup.style.css +1 -0
  10. package/dist/assets/Card.style.css +1 -0
  11. package/dist/assets/Chart.style.css +1 -0
  12. package/dist/assets/Col.style.css +1 -0
  13. package/dist/assets/ColorInput.style.css +1 -0
  14. package/dist/assets/Command.style.css +1 -0
  15. package/dist/assets/Container.style.css +1 -0
  16. package/dist/assets/ContextMenu.style.css +1 -0
  17. package/dist/assets/DataTable.style.css +1 -0
  18. package/dist/assets/DateInput.style.css +1 -0
  19. package/dist/assets/Dialog.style.css +1 -0
  20. package/dist/assets/Editor.styles.css +1 -0
  21. package/dist/assets/EditorInput.style.css +1 -0
  22. package/dist/assets/FileInput.style.css +1 -0
  23. package/dist/assets/FileTabs.style.css +1 -0
  24. package/dist/assets/FullScreen.style.css +1 -0
  25. package/dist/assets/Gantt.style.css +1 -0
  26. package/dist/assets/Icon.style.css +1 -0
  27. package/dist/assets/Input.style.css +1 -0
  28. package/dist/assets/InputWrapper.style.css +1 -0
  29. package/dist/assets/JsonView.style.css +1 -0
  30. package/dist/assets/Layout.style.css +1 -0
  31. package/dist/assets/Menu.style.css +1 -0
  32. package/dist/assets/Progress.style.css +1 -0
  33. package/dist/assets/Quote.style.css +1 -0
  34. package/dist/assets/Resizable.style.css +1 -0
  35. package/dist/assets/Row.style.css +1 -0
  36. package/dist/assets/ScrollArea.style.css +1 -0
  37. package/dist/assets/SegmentedControl.style.css +1 -0
  38. package/dist/assets/SelectInput.style.css +1 -0
  39. package/dist/assets/Tab.style.css +1 -0
  40. package/dist/assets/Text.style.css +1 -0
  41. package/dist/assets/Toast.style.css +1 -0
  42. package/dist/assets/Tooltip.style.css +1 -0
  43. package/dist/components/alert/Alert.js +34 -41
  44. package/dist/components/aurora/Aurora.js +27 -22
  45. package/dist/components/avatar/Avatar.js +57 -55
  46. package/dist/components/badge/Badge.js +58 -64
  47. package/dist/components/breadcrumb/Breadcrumb.js +16 -20
  48. package/dist/components/button/Button.js +24 -31
  49. package/dist/components/button-group/ButtonGroup.js +29 -31
  50. package/dist/components/card/Card.js +30 -44
  51. package/dist/components/card/CardSection.js +21 -29
  52. package/dist/components/chart/Chart.js +138 -153
  53. package/dist/components/chart/LineChart.js +75 -74
  54. package/dist/components/chart/index.js +3 -8
  55. package/dist/components/col/Col.js +19 -29
  56. package/dist/components/command/Command.js +101 -134
  57. package/dist/components/container/Container.js +19 -23
  58. package/dist/components/context-menu/ContextMenu.d.ts +1 -1
  59. package/dist/components/context-menu/ContextMenu.js +119 -125
  60. package/dist/components/data-table/DataTable.js +53 -63
  61. package/dist/components/data-table/DataTableColumn.js +18 -22
  62. package/dist/components/data-table/DataTableFilterInput.js +208 -205
  63. package/dist/components/data-table/DataTableFilterSuggestionMenu.js +59 -48
  64. package/dist/components/data-table/DataTableHeader.js +34 -38
  65. package/dist/components/data-table/DataTablePagination.js +62 -74
  66. package/dist/components/data-table/index.js +7 -22
  67. package/dist/components/dialog/Dialog.js +107 -102
  68. package/dist/components/editor/Editor.js +352 -322
  69. package/dist/components/file-tabs/FileTabs.js +78 -73
  70. package/dist/components/file-tabs/FileTabs.service.js +85 -87
  71. package/dist/components/file-tabs/FileTabs.view.js +0 -1
  72. package/dist/components/file-tabs/index.js +3 -9
  73. package/dist/components/flex/Flex.js +19 -23
  74. package/dist/components/form/CheckboxInput.js +73 -76
  75. package/dist/components/form/ColorInput.js +378 -353
  76. package/dist/components/form/DateInput.js +315 -265
  77. package/dist/components/form/EditorInput.js +597 -579
  78. package/dist/components/form/EmailInput.js +30 -23
  79. package/dist/components/form/FileInput.js +93 -123
  80. package/dist/components/form/Input.js +64 -57
  81. package/dist/components/form/Input.utils.js +25 -37
  82. package/dist/components/form/InputDescription.js +11 -11
  83. package/dist/components/form/InputLabel.js +18 -22
  84. package/dist/components/form/InputMessage.js +17 -17
  85. package/dist/components/form/InputWrapper.js +56 -65
  86. package/dist/components/form/NumberInput.js +41 -20
  87. package/dist/components/form/PasswordInput.js +71 -54
  88. package/dist/components/form/PinInput.js +50 -65
  89. package/dist/components/form/RadioGroup.js +42 -50
  90. package/dist/components/form/RadioInput.js +31 -29
  91. package/dist/components/form/SelectInput.js +69 -92
  92. package/dist/components/form/SwitchInput.js +17 -18
  93. package/dist/components/form/TagInput.js +108 -122
  94. package/dist/components/form/TextAreaInput.js +24 -21
  95. package/dist/components/form/TextInput.js +30 -22
  96. package/dist/components/form/index.js +22 -87
  97. package/dist/components/form/useForm.js +87 -88
  98. package/dist/components/fullscreen/FullScreen.js +28 -27
  99. package/dist/components/gantt/Gantt.js +100 -98
  100. package/dist/components/gantt/GanttGroup.js +210 -194
  101. package/dist/components/gantt/GanttHeader.js +79 -81
  102. package/dist/components/gantt/GanttItem.js +19 -22
  103. package/dist/components/icon/Icon.d.ts +6 -4
  104. package/dist/components/icon/Icon.js +53 -42
  105. package/dist/components/icon/codezero/codezero.js +10 -0
  106. package/dist/components/icon/codezero/gls.js +9 -0
  107. package/dist/components/icon/codezero/index.js +17 -13
  108. package/dist/components/json-view/JsonView.js +120 -109
  109. package/dist/components/layout/Layout.js +101 -78
  110. package/dist/components/menu/Menu.js +135 -141
  111. package/dist/components/progress/ProgressCircle.js +60 -48
  112. package/dist/components/progress/ProgressLinear.js +39 -42
  113. package/dist/components/quote/Quote.js +52 -43
  114. package/dist/components/resizable/Resizable.js +36 -33
  115. package/dist/components/row/Row.js +19 -23
  116. package/dist/components/scroll-area/ScrollArea.js +66 -76
  117. package/dist/components/segmented-control/SegmentedControl.d.ts +2 -2
  118. package/dist/components/segmented-control/SegmentedControl.js +46 -26
  119. package/dist/components/spacing/Spacing.js +16 -23
  120. package/dist/components/tab/Tab.js +73 -40
  121. package/dist/components/text/Text.js +19 -25
  122. package/dist/components/toast/Toast.d.ts +1 -1
  123. package/dist/components/toast/Toast.js +104 -83
  124. package/dist/components/tooltip/Tooltip.js +66 -60
  125. package/dist/index.js +76 -261
  126. package/dist/node_modules/@lezer/common/dist/index.js +778 -143
  127. package/dist/node_modules/@lezer/highlight/dist/index.js +305 -536
  128. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +55 -55
  129. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +49 -32
  130. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +57 -46
  131. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.js +17 -16
  132. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +8 -11
  133. package/dist/node_modules/framer-motion/dist/es/context/LayoutGroupContext.js +4 -5
  134. package/dist/node_modules/framer-motion/dist/es/context/LazyContext.js +4 -5
  135. package/dist/node_modules/framer-motion/dist/es/context/MotionConfigContext.js +7 -8
  136. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/create.js +13 -11
  137. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/index.js +4 -5
  138. package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +12 -14
  139. package/dist/node_modules/framer-motion/dist/es/context/PresenceContext.js +4 -5
  140. package/dist/node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.js +4 -5
  141. package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +5 -7
  142. package/dist/node_modules/framer-motion/dist/es/events/event-info.js +8 -13
  143. package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +252 -281
  144. package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +19 -21
  145. package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +57 -67
  146. package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +24 -27
  147. package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +16 -19
  148. package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +130 -124
  149. package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +39 -42
  150. package/dist/node_modules/framer-motion/dist/es/gestures/press.js +22 -27
  151. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +36 -44
  152. package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +22 -32
  153. package/dist/node_modules/framer-motion/dist/es/motion/features/animations.js +6 -12
  154. package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +47 -37
  155. package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +12 -16
  156. package/dist/node_modules/framer-motion/dist/es/motion/features/gestures.js +10 -20
  157. package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +58 -59
  158. package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +7 -11
  159. package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +10 -13
  160. package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +42 -43
  161. package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/observers.js +19 -18
  162. package/dist/node_modules/framer-motion/dist/es/motion/index.js +64 -58
  163. package/dist/node_modules/framer-motion/dist/es/motion/utils/symbol.js +2 -4
  164. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +18 -20
  165. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +53 -62
  166. package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +45 -49
  167. package/dist/node_modules/framer-motion/dist/es/motion/utils/valid-prop.js +4 -38
  168. package/dist/node_modules/framer-motion/dist/es/render/components/create-proxy.js +7 -17
  169. package/dist/node_modules/framer-motion/dist/es/render/components/m/proxy.js +3 -0
  170. package/dist/node_modules/framer-motion/dist/es/render/components/motion/feature-bundle.js +10 -12
  171. package/dist/node_modules/framer-motion/dist/es/render/components/motion/proxy.js +5 -7
  172. package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +6 -10
  173. package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +18 -15
  174. package/dist/node_modules/framer-motion/dist/es/render/dom/utils/filter-props.js +14 -18
  175. package/dist/node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.js +4 -23
  176. package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +8 -9
  177. package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +20 -23
  178. package/dist/node_modules/framer-motion/dist/es/render/html/utils/create-render-state.js +6 -8
  179. package/dist/node_modules/framer-motion/dist/es/render/svg/lowercase-elements.js +27 -29
  180. package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +23 -21
  181. package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +8 -9
  182. package/dist/node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.js +5 -7
  183. package/dist/node_modules/framer-motion/dist/es/utils/distance.js +5 -8
  184. package/dist/node_modules/framer-motion/dist/es/utils/get-context-window.js +2 -4
  185. package/dist/node_modules/framer-motion/dist/es/utils/is-browser.js +2 -4
  186. package/dist/node_modules/framer-motion/dist/es/utils/is-ref-object.js +3 -5
  187. package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js +11 -0
  188. package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +20 -25
  189. package/dist/node_modules/framer-motion/dist/es/utils/use-constant.js +6 -7
  190. package/dist/node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.js +5 -6
  191. package/dist/node_modules/motion/dist/es/react.js +196 -0
  192. package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +104 -111
  193. package/dist/node_modules/motion-dom/dist/es/animation/JSAnimation.js +126 -143
  194. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +81 -105
  195. package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +25 -37
  196. package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.js +7 -9
  197. package/dist/node_modules/motion-dom/dist/es/animation/drivers/frame.js +10 -16
  198. package/dist/node_modules/motion-dom/dist/es/animation/generators/inertia.js +29 -36
  199. package/dist/node_modules/motion-dom/dist/es/animation/generators/keyframes.js +18 -28
  200. package/dist/node_modules/motion-dom/dist/es/animation/generators/spring.js +156 -170
  201. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/calc-duration.js +6 -12
  202. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/create-generator-easing.js +13 -12
  203. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/is-generator.js +3 -5
  204. package/dist/node_modules/motion-dom/dist/es/animation/generators/utils/velocity.js +6 -8
  205. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/motion-value.js +42 -45
  206. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-target.js +52 -57
  207. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element-variant.js +22 -27
  208. package/dist/node_modules/motion-dom/dist/es/animation/interfaces/visual-element.js +18 -21
  209. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +58 -67
  210. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/KeyframesResolver.js +61 -70
  211. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/get-final.js +5 -7
  212. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/default.js +5 -7
  213. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/fill.js +9 -11
  214. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/offsets/time.js +3 -5
  215. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.js +3 -6
  216. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/is-none.js +4 -6
  217. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.js +15 -15
  218. package/dist/node_modules/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.js +32 -35
  219. package/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id.js +3 -6
  220. package/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/get-appear-id.js +4 -6
  221. package/dist/node_modules/motion-dom/dist/es/animation/utils/WithPromise.js +19 -26
  222. package/dist/node_modules/motion-dom/dist/es/animation/utils/calc-child-stagger.js +4 -6
  223. package/dist/node_modules/motion-dom/dist/es/animation/utils/can-animate.js +14 -21
  224. package/dist/node_modules/motion-dom/dist/es/animation/utils/css-variables-conversion.js +21 -29
  225. package/dist/node_modules/motion-dom/dist/es/animation/utils/default-transitions.js +25 -22
  226. package/dist/node_modules/motion-dom/dist/es/animation/utils/get-value-transition.js +5 -7
  227. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-animatable.js +3 -7
  228. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +4 -8
  229. package/dist/node_modules/motion-dom/dist/es/animation/utils/is-transition-defined.js +15 -19
  230. package/dist/node_modules/motion-dom/dist/es/animation/utils/make-animation-instant.js +3 -5
  231. package/dist/node_modules/motion-dom/dist/es/animation/utils/replace-transition-type.js +12 -14
  232. package/dist/node_modules/motion-dom/dist/es/animation/utils/resolve-transition.js +10 -9
  233. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.js +2 -4
  234. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/map-easing.js +8 -11
  235. package/dist/node_modules/motion-dom/dist/es/animation/waapi/easing/supported.js +32 -14
  236. package/dist/node_modules/motion-dom/dist/es/animation/waapi/start-waapi-animation.js +16 -20
  237. package/dist/node_modules/motion-dom/dist/es/animation/waapi/supports/waapi.js +21 -32
  238. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/accelerated-values.js +7 -11
  239. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/apply-generator.js +5 -7
  240. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/is-browser-color.js +5 -9
  241. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/linear.js +5 -9
  242. package/dist/node_modules/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.js +12 -14
  243. package/dist/node_modules/motion-dom/dist/es/events/add-dom-event.js +3 -5
  244. package/dist/node_modules/motion-dom/dist/es/frameloop/batcher.js +27 -26
  245. package/dist/node_modules/motion-dom/dist/es/frameloop/frame.js +4 -9
  246. package/dist/node_modules/motion-dom/dist/es/frameloop/microtask.js +3 -5
  247. package/dist/node_modules/motion-dom/dist/es/frameloop/order.js +10 -20
  248. package/dist/node_modules/motion-dom/dist/es/frameloop/render-step.js +29 -42
  249. package/dist/node_modules/motion-dom/dist/es/frameloop/sync-time.js +11 -13
  250. package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/is-active.js +6 -9
  251. package/dist/node_modules/motion-dom/dist/es/gestures/drag/state/set-active.js +8 -10
  252. package/dist/node_modules/motion-dom/dist/es/gestures/hover.js +32 -36
  253. package/dist/node_modules/motion-dom/dist/es/gestures/press/index.js +32 -32
  254. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +16 -15
  255. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/keyboard.js +23 -24
  256. package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/state.js +2 -4
  257. package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-node-or-child.js +2 -4
  258. package/dist/node_modules/motion-dom/dist/es/gestures/utils/is-primary-pointer.js +2 -4
  259. package/dist/node_modules/motion-dom/dist/es/gestures/utils/setup.js +13 -11
  260. package/dist/node_modules/motion-dom/dist/es/projection/animation/mix-values.js +20 -29
  261. package/dist/node_modules/motion-dom/dist/es/projection/geometry/conversion.js +34 -22
  262. package/dist/node_modules/motion-dom/dist/es/projection/geometry/copy.js +7 -11
  263. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-apply.js +41 -53
  264. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-calc.js +28 -38
  265. package/dist/node_modules/motion-dom/dist/es/projection/geometry/delta-remove.js +23 -21
  266. package/dist/node_modules/motion-dom/dist/es/projection/geometry/models.js +15 -17
  267. package/dist/node_modules/motion-dom/dist/es/projection/geometry/utils.js +18 -26
  268. package/dist/node_modules/motion-dom/dist/es/projection/node/DocumentProjectionNode.js +10 -12
  269. package/dist/node_modules/motion-dom/dist/es/projection/node/HTMLProjectionNode.js +19 -24
  270. package/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node.js +554 -592
  271. package/dist/node_modules/motion-dom/dist/es/projection/node/state.js +4 -14
  272. package/dist/node_modules/motion-dom/dist/es/projection/shared/stack.js +48 -52
  273. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-border-radius.js +10 -20
  274. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-box-shadow.js +11 -16
  275. package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +14 -20
  276. package/dist/node_modules/motion-dom/dist/es/projection/styles/transform.js +9 -12
  277. package/dist/node_modules/motion-dom/dist/es/projection/utils/compare-by-depth.js +2 -4
  278. package/dist/node_modules/motion-dom/dist/es/projection/utils/each-axis.js +3 -5
  279. package/dist/node_modules/motion-dom/dist/es/projection/utils/flat-tree.js +16 -18
  280. package/dist/node_modules/motion-dom/dist/es/projection/utils/has-transform.js +11 -15
  281. package/dist/node_modules/motion-dom/dist/es/projection/utils/measure.js +8 -11
  282. package/dist/node_modules/motion-dom/dist/es/render/Feature.js +6 -9
  283. package/dist/node_modules/motion-dom/dist/es/render/VisualElement.js +198 -260
  284. package/dist/node_modules/motion-dom/dist/es/render/dom/DOMVisualElement.js +25 -27
  285. package/dist/node_modules/motion-dom/dist/es/render/dom/is-css-var.js +2 -4
  286. package/dist/node_modules/motion-dom/dist/es/render/dom/parse-transform.js +49 -60
  287. package/dist/node_modules/motion-dom/dist/es/render/dom/style-set.js +4 -6
  288. package/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +3 -5
  289. package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +35 -35
  290. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +25 -28
  291. package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +33 -37
  292. package/dist/node_modules/motion-dom/dist/es/render/html/utils/render.js +5 -11
  293. package/dist/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +8 -12
  294. package/dist/node_modules/motion-dom/dist/es/render/store.js +2 -4
  295. package/dist/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +37 -39
  296. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +18 -30
  297. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/camel-case-attrs.js +25 -27
  298. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/is-svg-tag.js +2 -4
  299. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/path.js +11 -13
  300. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/render.js +6 -10
  301. package/dist/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +11 -14
  302. package/dist/node_modules/motion-dom/dist/es/render/utils/animation-state.js +128 -138
  303. package/dist/node_modules/motion-dom/dist/es/render/utils/get-variant-context.js +16 -19
  304. package/dist/node_modules/motion-dom/dist/es/render/utils/is-animation-controls.js +3 -5
  305. package/dist/node_modules/motion-dom/dist/es/render/utils/is-controlling-variants.js +8 -11
  306. package/dist/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +5 -8
  307. package/dist/node_modules/motion-dom/dist/es/render/utils/is-keyframes-target.js +2 -4
  308. package/dist/node_modules/motion-dom/dist/es/render/utils/is-variant-label.js +3 -5
  309. package/dist/node_modules/motion-dom/dist/es/render/utils/keys-position.js +10 -12
  310. package/dist/node_modules/motion-dom/dist/es/render/utils/keys-transform.js +20 -23
  311. package/dist/node_modules/motion-dom/dist/es/render/utils/motion-values.js +18 -24
  312. package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +8 -14
  313. package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/state.js +2 -5
  314. package/dist/node_modules/motion-dom/dist/es/render/utils/resolve-dynamic-variants.js +5 -7
  315. package/dist/node_modules/motion-dom/dist/es/render/utils/resolve-variants.js +16 -18
  316. package/dist/node_modules/motion-dom/dist/es/render/utils/setters.js +14 -18
  317. package/dist/node_modules/motion-dom/dist/es/render/utils/shallow-compare.js +7 -13
  318. package/dist/node_modules/motion-dom/dist/es/render/utils/variant-props.js +10 -13
  319. package/dist/node_modules/motion-dom/dist/es/resize/handle-element.js +31 -35
  320. package/dist/node_modules/motion-dom/dist/es/resize/handle-window.js +18 -21
  321. package/dist/node_modules/motion-dom/dist/es/resize/index.js +5 -7
  322. package/dist/node_modules/motion-dom/dist/es/stats/buffer.js +5 -0
  323. package/dist/node_modules/motion-dom/dist/es/utils/border-radius.js +7 -0
  324. package/dist/node_modules/motion-dom/dist/es/utils/delay.js +9 -11
  325. package/dist/node_modules/motion-dom/dist/es/utils/interpolate.js +29 -40
  326. package/dist/node_modules/motion-dom/dist/es/utils/is-html-element.js +4 -6
  327. package/dist/node_modules/motion-dom/dist/es/utils/is-svg-element.js +4 -6
  328. package/dist/node_modules/motion-dom/dist/es/utils/is-svg-svg-element.js +4 -6
  329. package/dist/node_modules/motion-dom/dist/es/utils/mix/color.js +26 -27
  330. package/dist/node_modules/motion-dom/dist/es/utils/mix/complex.js +44 -45
  331. package/dist/node_modules/motion-dom/dist/es/utils/mix/immediate.js +3 -5
  332. package/dist/node_modules/motion-dom/dist/es/utils/mix/index.js +5 -7
  333. package/dist/node_modules/motion-dom/dist/es/utils/mix/number.js +2 -4
  334. package/dist/node_modules/motion-dom/dist/es/utils/mix/visibility.js +4 -7
  335. package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +11 -14
  336. package/dist/node_modules/motion-dom/dist/es/utils/supports/flags.js +2 -4
  337. package/dist/node_modules/motion-dom/dist/es/utils/supports/linear-easing.js +9 -11
  338. package/dist/node_modules/motion-dom/dist/es/utils/supports/memo.js +6 -8
  339. package/dist/node_modules/motion-dom/dist/es/utils/supports/scroll-timeline.js +3 -5
  340. package/dist/node_modules/motion-dom/dist/es/value/index.js +89 -211
  341. package/dist/node_modules/motion-dom/dist/es/value/types/auto.js +4 -6
  342. package/dist/node_modules/motion-dom/dist/es/value/types/color/hex.js +15 -17
  343. package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla-to-rgba.js +17 -20
  344. package/dist/node_modules/motion-dom/dist/es/value/types/color/hsla.js +9 -11
  345. package/dist/node_modules/motion-dom/dist/es/value/types/color/index.js +12 -14
  346. package/dist/node_modules/motion-dom/dist/es/value/types/color/rgba.js +12 -15
  347. package/dist/node_modules/motion-dom/dist/es/value/types/color/utils.js +13 -17
  348. package/dist/node_modules/motion-dom/dist/es/value/types/complex/filter.js +22 -22
  349. package/dist/node_modules/motion-dom/dist/es/value/types/complex/index.js +43 -44
  350. package/dist/node_modules/motion-dom/dist/es/value/types/complex/mask.js +11 -10
  351. package/dist/node_modules/motion-dom/dist/es/value/types/dimensions.js +14 -9
  352. package/dist/node_modules/motion-dom/dist/es/value/types/int.js +5 -7
  353. package/dist/node_modules/motion-dom/dist/es/value/types/maps/defaults.js +22 -27
  354. package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +61 -69
  355. package/dist/node_modules/motion-dom/dist/es/value/types/maps/transform.js +29 -36
  356. package/dist/node_modules/motion-dom/dist/es/value/types/numbers/index.js +12 -16
  357. package/dist/node_modules/motion-dom/dist/es/value/types/numbers/units.js +10 -17
  358. package/dist/node_modules/motion-dom/dist/es/value/types/test.js +2 -4
  359. package/dist/node_modules/motion-dom/dist/es/value/types/utils/animatable-none.js +9 -11
  360. package/dist/node_modules/motion-dom/dist/es/value/types/utils/color-regex.js +2 -4
  361. package/dist/node_modules/motion-dom/dist/es/value/types/utils/find.js +10 -8
  362. package/dist/node_modules/motion-dom/dist/es/value/types/utils/float-regex.js +2 -4
  363. package/dist/node_modules/motion-dom/dist/es/value/types/utils/get-as-type.js +2 -4
  364. package/dist/node_modules/motion-dom/dist/es/value/types/utils/is-nullish.js +3 -5
  365. package/dist/node_modules/motion-dom/dist/es/value/types/utils/sanitize.js +2 -4
  366. package/dist/node_modules/motion-dom/dist/es/value/types/utils/single-color-regex.js +2 -4
  367. package/dist/node_modules/motion-dom/dist/es/value/utils/is-motion-value.js +2 -4
  368. package/dist/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +4 -6
  369. package/dist/node_modules/motion-dom/dist/es/value/will-change/add-will-change.js +10 -13
  370. package/dist/node_modules/motion-dom/dist/es/value/will-change/is.js +4 -6
  371. package/dist/node_modules/motion-utils/dist/es/array.js +6 -9
  372. package/dist/node_modules/motion-utils/dist/es/clamp.js +2 -4
  373. package/dist/node_modules/motion-utils/dist/es/easing/anticipate.js +3 -5
  374. package/dist/node_modules/motion-utils/dist/es/easing/back.js +5 -9
  375. package/dist/node_modules/motion-utils/dist/es/easing/circ.js +4 -8
  376. package/dist/node_modules/motion-utils/dist/es/easing/cubic-bezier.js +14 -17
  377. package/dist/node_modules/motion-utils/dist/es/easing/ease.js +3 -7
  378. package/dist/node_modules/motion-utils/dist/es/easing/modifiers/mirror.js +2 -4
  379. package/dist/node_modules/motion-utils/dist/es/easing/modifiers/reverse.js +2 -4
  380. package/dist/node_modules/motion-utils/dist/es/easing/utils/is-bezier-definition.js +2 -4
  381. package/dist/node_modules/motion-utils/dist/es/easing/utils/is-easing-array.js +2 -4
  382. package/dist/node_modules/motion-utils/dist/es/easing/utils/map.js +28 -31
  383. package/dist/node_modules/motion-utils/dist/es/errors.js +7 -13
  384. package/dist/node_modules/motion-utils/dist/es/format-error-message.js +3 -5
  385. package/dist/node_modules/motion-utils/dist/es/global-config.js +2 -4
  386. package/dist/node_modules/motion-utils/dist/es/is-numerical-string.js +2 -4
  387. package/dist/node_modules/motion-utils/dist/es/is-object.js +2 -4
  388. package/dist/node_modules/motion-utils/dist/es/is-zero-value-string.js +2 -4
  389. package/dist/node_modules/motion-utils/dist/es/memo.js +5 -7
  390. package/dist/node_modules/motion-utils/dist/es/noop.js +2 -4
  391. package/dist/node_modules/motion-utils/dist/es/pipe.js +2 -4
  392. package/dist/node_modules/motion-utils/dist/es/progress.js +4 -6
  393. package/dist/node_modules/motion-utils/dist/es/subscription-manager.js +23 -28
  394. package/dist/node_modules/motion-utils/dist/es/time-conversion.js +2 -5
  395. package/dist/node_modules/motion-utils/dist/es/velocity-per-second.js +2 -4
  396. package/dist/node_modules/motion-utils/dist/es/warn-once.js +5 -7
  397. package/dist/node_modules/prettier/plugins/babel.js +9582 -7023
  398. package/dist/node_modules/prettier/plugins/estree.js +6997 -4377
  399. package/dist/node_modules/prettier/standalone.js +3444 -2415
  400. package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +21 -21
  401. package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +18 -14
  402. package/dist/node_modules/react/compiler-runtime.js +8 -10
  403. package/dist/utils/arrayService.js +0 -1
  404. package/dist/utils/color.js +46 -41
  405. package/dist/utils/component.js +60 -129
  406. package/dist/utils/contextStore.js +48 -58
  407. package/dist/utils/index.d.ts +1 -0
  408. package/dist/utils/index.js +7 -18
  409. package/dist/utils/motion.d.ts +55 -0
  410. package/dist/utils/motion.js +87 -0
  411. package/dist/utils/reactiveArrayService.js +80 -76
  412. package/dist/utils/size.js +14 -26
  413. package/dist/utils/utils.js +0 -1
  414. package/dist/utils/view.js +27 -24
  415. package/dist/vite-env.d.js +0 -1
  416. package/package.json +30 -25
  417. package/dist/_virtual/compiler-runtime.js +0 -5
  418. package/dist/_virtual/compiler-runtime2.js +0 -4
  419. package/dist/_virtual/react-compiler-runtime.development.js +0 -4
  420. package/dist/_virtual/react-compiler-runtime.production.js +0 -4
  421. package/dist/assets/components/alert/Alert.style.css +0 -1
  422. package/dist/assets/components/aurora/Aurora.style.css +0 -1
  423. package/dist/assets/components/avatar/Avatar.style.css +0 -1
  424. package/dist/assets/components/badge/Badge.style.css +0 -1
  425. package/dist/assets/components/breadcrumb/Breadcrumb.style.css +0 -1
  426. package/dist/assets/components/button/Button.style.css +0 -1
  427. package/dist/assets/components/button-group/ButtonGroup.style.css +0 -1
  428. package/dist/assets/components/card/Card.style.css +0 -1
  429. package/dist/assets/components/chart/Chart.style.css +0 -1
  430. package/dist/assets/components/col/Col.style.css +0 -1
  431. package/dist/assets/components/command/Command.style.css +0 -1
  432. package/dist/assets/components/container/Container.style.css +0 -1
  433. package/dist/assets/components/context-menu/ContextMenu.style.css +0 -1
  434. package/dist/assets/components/data-table/DataTable.style.css +0 -1
  435. package/dist/assets/components/dialog/Dialog.style.css +0 -1
  436. package/dist/assets/components/editor/Editor.styles.css +0 -1
  437. package/dist/assets/components/file-tabs/FileTabs.style.css +0 -1
  438. package/dist/assets/components/form/ColorInput.style.css +0 -1
  439. package/dist/assets/components/form/DateInput.style.css +0 -1
  440. package/dist/assets/components/form/EditorInput.style.css +0 -1
  441. package/dist/assets/components/form/FileInput.style.css +0 -1
  442. package/dist/assets/components/form/Input.style.css +0 -1
  443. package/dist/assets/components/form/InputWrapper.style.css +0 -1
  444. package/dist/assets/components/form/SelectInput.style.css +0 -1
  445. package/dist/assets/components/fullscreen/FullScreen.style.css +0 -1
  446. package/dist/assets/components/gantt/Gantt.style.css +0 -1
  447. package/dist/assets/components/icon/Icon.style.css +0 -1
  448. package/dist/assets/components/json-view/JsonView.style.css +0 -1
  449. package/dist/assets/components/layout/Layout.style.css +0 -1
  450. package/dist/assets/components/menu/Menu.style.css +0 -1
  451. package/dist/assets/components/progress/Progress.style.css +0 -1
  452. package/dist/assets/components/quote/Quote.style.css +0 -1
  453. package/dist/assets/components/resizable/Resizable.style.css +0 -1
  454. package/dist/assets/components/row/Row.style.css +0 -1
  455. package/dist/assets/components/scroll-area/ScrollArea.style.css +0 -1
  456. package/dist/assets/components/segmented-control/SegmentedControl.style.css +0 -1
  457. package/dist/assets/components/tab/Tab.style.css +0 -1
  458. package/dist/assets/components/text/Text.style.css +0 -1
  459. package/dist/assets/components/toast/Toast.style.css +0 -1
  460. package/dist/assets/components/tooltip/Tooltip.style.css +0 -1
  461. package/dist/components/icon/codezero/codezero.svg.js +0 -5
  462. package/dist/components/icon/codezero/gls.svg.js +0 -5
  463. /package/dist/assets/{components/flex/Flex.style.css → Flex.style.css} +0 -0
  464. /package/dist/assets/{components/spacing/Spacing.style.css → Spacing.style.css} +0 -0
@@ -1,618 +1,580 @@
1
- import { animateSingleValue as lt } from "../../animation/animate/single-value.js";
2
- import { getOptimisedAppearId as ht } from "../../animation/optimized-appear/get-appear-id.js";
3
- import { getValueTransition as ut } from "../../animation/utils/get-value-transition.js";
4
- import { microtask as ct } from "../../frameloop/microtask.js";
5
- import { time as ft } from "../../frameloop/sync-time.js";
6
- import { scaleCorrectors as z } from "../styles/scale-correction.js";
7
- import { delay as dt } from "../../utils/delay.js";
8
- import { isSVGElement as mt } from "../../utils/is-svg-element.js";
9
- import { isSVGSVGElement as pt } from "../../utils/is-svg-svg-element.js";
10
- import { mixNumber as L } from "../../utils/mix/number.js";
11
- import { motionValue as yt } from "../../value/index.js";
12
- import { resolveMotionValue as C } from "../../value/utils/resolve-motion-value.js";
13
- import { mixValues as gt } from "../animation/mix-values.js";
14
- import { copyBoxInto as p, copyAxisDeltaInto as W, copyAxisInto as vt } from "../geometry/copy.js";
15
- import { translateAxis as R, transformBox as F, applyBoxDelta as Tt, applyTreeDeltas as xt } from "../geometry/delta-apply.js";
16
- import { calcLength as j, calcRelativeBox as Dt, calcRelativePosition as U, calcBoxDelta as w, isNear as Pt } from "../geometry/delta-calc.js";
17
- import { removeBoxTransforms as N } from "../geometry/delta-remove.js";
18
- import { createBox as f, createDelta as k } from "../geometry/models.js";
19
- import { boxEqualsRounded as it, isDeltaZero as st, axisDeltaEquals as H, boxEquals as Bt, aspectRatio as G } from "../geometry/utils.js";
20
- import { NodeStack as St } from "../shared/stack.js";
21
- import { buildProjectionTransform as At } from "../styles/transform.js";
22
- import { eachAxis as q } from "../utils/each-axis.js";
23
- import { FlatTree as Rt } from "../utils/flat-tree.js";
24
- import { hasTransform as V, hasScale as X, has2DTranslate as Vt } from "../utils/has-transform.js";
25
- import { globalProjectionState as O } from "./state.js";
26
- import { frame as E, cancelFrame as Y, frameSteps as I, frameData as y } from "../../frameloop/frame.js";
27
- import { SubscriptionManager as jt } from "../../../../../motion-utils/dist/es/subscription-manager.js";
28
- import { clamp as kt } from "../../../../../motion-utils/dist/es/clamp.js";
29
- import { noop as Lt } from "../../../../../motion-utils/dist/es/noop.js";
30
- const M = ["", "X", "Y", "Z"], Et = 1e3;
31
- let wt = 0;
32
- function b(e, l, h, c) {
33
- const { latestValues: m } = l;
34
- m[e] && (h[e] = m[e], l.setStaticValue(e, 0), c && (c[e] = 0));
1
+ import { clamp } from "../../../../../motion-utils/dist/es/clamp.js";
2
+ import { noop } from "../../../../../motion-utils/dist/es/noop.js";
3
+ import { SubscriptionManager } from "../../../../../motion-utils/dist/es/subscription-manager.js";
4
+ import { cancelFrame, frame, frameData, frameSteps } from "../../frameloop/frame.js";
5
+ import { time } from "../../frameloop/sync-time.js";
6
+ import { mixNumber } from "../../utils/mix/number.js";
7
+ import { motionValue } from "../../value/index.js";
8
+ import { getValueTransition } from "../../animation/utils/get-value-transition.js";
9
+ import { getOptimisedAppearId } from "../../animation/optimized-appear/get-appear-id.js";
10
+ import { microtask } from "../../frameloop/microtask.js";
11
+ import { isSVGElement } from "../../utils/is-svg-element.js";
12
+ import { statsBuffer } from "../../stats/buffer.js";
13
+ import { isSVGSVGElement } from "../../utils/is-svg-svg-element.js";
14
+ import { createBox, createDelta } from "../geometry/models.js";
15
+ import { has2DTranslate, hasScale, hasTransform } from "../utils/has-transform.js";
16
+ import { applyBoxDelta, applyTreeDeltas, transformBox, translateAxis } from "../geometry/delta-apply.js";
17
+ import { scaleCorrectors } from "../styles/scale-correction.js";
18
+ import { copyAxisDeltaInto, copyAxisInto, copyBoxInto } from "../geometry/copy.js";
19
+ import { calcBoxDelta, calcLength, calcRelativeBox, calcRelativePosition, isNear } from "../geometry/delta-calc.js";
20
+ import { removeBoxTransforms } from "../geometry/delta-remove.js";
21
+ import { aspectRatio, axisDeltaEquals, boxEquals, boxEqualsRounded, isDeltaZero } from "../geometry/utils.js";
22
+ import { eachAxis } from "../utils/each-axis.js";
23
+ import { buildProjectionTransform } from "../styles/transform.js";
24
+ import { mixValues } from "../animation/mix-values.js";
25
+ import { animateSingleValue } from "../../animation/animate/single-value.js";
26
+ import { FlatTree } from "../utils/flat-tree.js";
27
+ import { delay } from "../../utils/delay.js";
28
+ import { resolveMotionValue } from "../../value/utils/resolve-motion-value.js";
29
+ import { NodeStack } from "../shared/stack.js";
30
+ import { globalProjectionState } from "./state.js";
31
+ var metrics = {
32
+ nodes: 0,
33
+ calculatedTargetDeltas: 0,
34
+ calculatedProjections: 0
35
+ }, transformAxes = [
36
+ "",
37
+ "X",
38
+ "Y",
39
+ "Z"
40
+ ], animationTarget = 1e3, id = 0;
41
+ function resetDistortingTransform(c, L, R, z) {
42
+ let { latestValues: B } = L;
43
+ B[c] && (R[c] = B[c], L.setStaticValue(c, 0), z && (z[c] = 0));
35
44
  }
36
- function ot(e) {
37
- if (e.hasCheckedOptimisedAppear = !0, e.root === e)
38
- return;
39
- const { visualElement: l } = e.options;
40
- if (!l)
41
- return;
42
- const h = ht(l);
43
- if (window.MotionHasOptimisedAnimation(h, "transform")) {
44
- const { layout: m, layoutId: B } = e.options;
45
- window.MotionCancelOptimisedAnimation(h, "transform", E, !(m || B));
46
- }
47
- const { parent: c } = e;
48
- c && !c.hasCheckedOptimisedAppear && ot(c);
45
+ function cancelTreeOptimisedTransformAnimations(c) {
46
+ if (c.hasCheckedOptimisedAppear = !0, c.root === c) return;
47
+ let { visualElement: L } = c.options;
48
+ if (!L) return;
49
+ let R = getOptimisedAppearId(L);
50
+ if (window.MotionHasOptimisedAnimation(R, "transform")) {
51
+ let { layout: L, layoutId: z } = c.options;
52
+ window.MotionCancelOptimisedAnimation(R, "transform", frame, !(L || z));
53
+ }
54
+ let { parent: z } = c;
55
+ z && !z.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(z);
49
56
  }
50
- function Re({ attachResizeListener: e, defaultParent: l, measureScroll: h, checkIsScrollRoot: c, resetTransform: m }) {
51
- return class {
52
- constructor(t = {}, i = l?.()) {
53
- this.id = wt++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
54
- this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
55
- }, this.updateProjection = () => {
56
- this.projectionUpdateScheduled = !1, this.nodes.forEach(Ft), this.nodes.forEach(Wt), this.nodes.forEach(Nt), this.nodes.forEach(Ot);
57
- }, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = t, this.root = i ? i.root || i : this, this.path = i ? [...i.path, i] : [], this.parent = i, this.depth = i ? i.depth + 1 : 0;
58
- for (let s = 0; s < this.path.length; s++)
59
- this.path[s].shouldResetTransform = !0;
60
- this.root === this && (this.nodes = new Rt());
61
- }
62
- addEventListener(t, i) {
63
- return this.eventHandlers.has(t) || this.eventHandlers.set(t, new jt()), this.eventHandlers.get(t).add(i);
64
- }
65
- notifyListeners(t, ...i) {
66
- const s = this.eventHandlers.get(t);
67
- s && s.notify(...i);
68
- }
69
- hasListeners(t) {
70
- return this.eventHandlers.has(t);
71
- }
72
- /**
73
- * Lifecycles
74
- */
75
- mount(t) {
76
- if (this.instance)
77
- return;
78
- this.isSVG = mt(t) && !pt(t), this.instance = t;
79
- const { layoutId: i, layout: s, visualElement: o } = this.options;
80
- if (o && !o.current && o.mount(t), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (s || i) && (this.isLayoutDirty = !0), e) {
81
- let a, r = 0;
82
- const n = () => this.root.updateBlockedByResize = !1;
83
- E.read(() => {
84
- r = window.innerWidth;
85
- }), e(t, () => {
86
- const u = window.innerWidth;
87
- u !== r && (r = u, this.root.updateBlockedByResize = !0, a && a(), a = dt(n, 250), O.hasAnimatedSinceResize && (O.hasAnimatedSinceResize = !1, this.nodes.forEach(J)));
88
- });
89
- }
90
- i && this.root.registerSharedNode(i, this), this.options.animate !== !1 && o && (i || s) && this.addEventListener("didUpdate", ({ delta: a, hasLayoutChanged: r, hasRelativeLayoutChanged: n, layout: u }) => {
91
- if (this.isTreeAnimationBlocked()) {
92
- this.target = void 0, this.relativeTarget = void 0;
93
- return;
94
- }
95
- const d = this.options.transition || o.getDefaultTransition() || Yt, { onLayoutAnimationStart: g, onLayoutAnimationComplete: x } = o.getProps(), S = !this.targetLayout || !it(this.targetLayout, u), v = !r && n;
96
- if (this.options.layoutRoot || this.resumeFrom || v || r && (S || !this.currentAnimation)) {
97
- this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
98
- const D = {
99
- ...ut(d, "layout"),
100
- onPlay: g,
101
- onComplete: x
102
- };
103
- (o.shouldReduceMotion || this.options.layoutRoot) && (D.delay = 0, D.type = !1), this.startAnimation(D), this.setAnimationOrigin(a, v, D.path);
104
- } else
105
- r || J(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
106
- this.targetLayout = u;
107
- });
108
- }
109
- unmount() {
110
- this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
111
- const t = this.getStack();
112
- t && t.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), Y(this.updateProjection);
113
- }
114
- // only on the root
115
- blockUpdate() {
116
- this.updateManuallyBlocked = !0;
117
- }
118
- unblockUpdate() {
119
- this.updateManuallyBlocked = !1;
120
- }
121
- isUpdateBlocked() {
122
- return this.updateManuallyBlocked || this.updateBlockedByResize;
123
- }
124
- isTreeAnimationBlocked() {
125
- return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
126
- }
127
- // Note: currently only running on root node
128
- startUpdate() {
129
- this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Ht), this.animationId++);
130
- }
131
- getTransformTemplate() {
132
- const { visualElement: t } = this.options;
133
- return t && t.getProps().transformTemplate;
134
- }
135
- willUpdate(t = !0) {
136
- if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
137
- this.options.onExitComplete && this.options.onExitComplete();
138
- return;
139
- }
140
- if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && ot(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
141
- return;
142
- this.isLayoutDirty = !0;
143
- for (let a = 0; a < this.path.length; a++) {
144
- const r = this.path[a];
145
- r.shouldResetTransform = !0, (typeof r.latestValues.x == "string" || typeof r.latestValues.y == "string") && (r.isLayoutDirty = !0), r.updateScroll("snapshot"), r.options.layoutRoot && r.willUpdate(!1);
146
- }
147
- const { layoutId: i, layout: s } = this.options;
148
- if (i === void 0 && !s)
149
- return;
150
- const o = this.getTransformTemplate();
151
- this.prevTransformTemplateValue = o ? o(this.latestValues, "") : void 0, this.updateSnapshot(), t && this.notifyListeners("willUpdate");
152
- }
153
- update() {
154
- if (this.updateScheduled = !1, this.isUpdateBlocked()) {
155
- const s = this.updateBlockedByResize;
156
- this.unblockUpdate(), this.updateBlockedByResize = !1, this.clearAllSnapshots(), s && this.nodes.forEach(Mt), this.nodes.forEach($);
157
- return;
158
- }
159
- if (this.animationId <= this.animationCommitId) {
160
- this.nodes.forEach(Z);
161
- return;
162
- }
163
- this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(bt), this.nodes.forEach(zt), this.nodes.forEach(Ut), this.nodes.forEach(Ct)) : this.nodes.forEach(Z), this.clearAllSnapshots();
164
- const i = ft.now();
165
- y.delta = kt(0, 1e3 / 60, i - y.timestamp), y.timestamp = i, y.isProcessing = !0, I.update.process(y), I.preRender.process(y), I.render.process(y), y.isProcessing = !1;
166
- }
167
- didUpdate() {
168
- this.updateScheduled || (this.updateScheduled = !0, ct.read(this.scheduleUpdate));
169
- }
170
- clearAllSnapshots() {
171
- this.nodes.forEach(It), this.sharedNodes.forEach(Gt);
172
- }
173
- scheduleUpdateProjection() {
174
- this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, E.preRender(this.updateProjection, !1, !0));
175
- }
176
- scheduleCheckAfterUnmount() {
177
- E.postRender(() => {
178
- this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
179
- });
180
- }
181
- /**
182
- * Update measurements
183
- */
184
- updateSnapshot() {
185
- this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !j(this.snapshot.measuredBox.x) && !j(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
186
- }
187
- updateLayout() {
188
- if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
189
- return;
190
- if (this.resumeFrom && !this.resumeFrom.instance)
191
- for (let s = 0; s < this.path.length; s++)
192
- this.path[s].updateScroll();
193
- const t = this.layout;
194
- this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected || (this.layoutCorrected = f()), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
195
- const { visualElement: i } = this.options;
196
- i && i.notify("LayoutMeasure", this.layout.layoutBox, t ? t.layoutBox : void 0);
197
- }
198
- updateScroll(t = "measure") {
199
- let i = !!(this.options.layoutScroll && this.instance);
200
- if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === t && (i = !1), i && this.instance) {
201
- const s = c(this.instance);
202
- this.scroll = {
203
- animationId: this.root.animationId,
204
- phase: t,
205
- isRoot: s,
206
- offset: h(this.instance),
207
- wasRoot: this.scroll ? this.scroll.isRoot : s
208
- };
209
- }
210
- }
211
- resetTransform() {
212
- if (!m)
213
- return;
214
- const t = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, i = this.projectionDelta && !st(this.projectionDelta), s = this.getTransformTemplate(), o = s ? s(this.latestValues, "") : void 0, a = o !== this.prevTransformTemplateValue;
215
- t && this.instance && (i || V(this.latestValues) || a) && (m(this.instance, o), this.shouldResetTransform = !1, this.scheduleRender());
216
- }
217
- measure(t = !0) {
218
- const i = this.measurePageBox();
219
- let s = this.removeElementScroll(i);
220
- return t && (s = this.removeTransform(s)), $t(s), {
221
- animationId: this.root.animationId,
222
- measuredBox: i,
223
- layoutBox: s,
224
- latestValues: {},
225
- source: this.id
226
- };
227
- }
228
- measurePageBox() {
229
- const { visualElement: t } = this.options;
230
- if (!t)
231
- return f();
232
- const i = t.measureViewportBox();
233
- if (!(this.scroll?.wasRoot || this.path.some(Zt))) {
234
- const { scroll: o } = this.root;
235
- o && (R(i.x, o.offset.x), R(i.y, o.offset.y));
236
- }
237
- return i;
238
- }
239
- removeElementScroll(t) {
240
- const i = f();
241
- if (p(i, t), this.scroll?.wasRoot)
242
- return i;
243
- for (let s = 0; s < this.path.length; s++) {
244
- const o = this.path[s], { scroll: a, options: r } = o;
245
- o !== this.root && a && r.layoutScroll && (a.wasRoot && p(i, t), R(i.x, a.offset.x), R(i.y, a.offset.y));
246
- }
247
- return i;
248
- }
249
- applyTransform(t, i = !1, s) {
250
- const o = s || f();
251
- p(o, t);
252
- for (let a = 0; a < this.path.length; a++) {
253
- const r = this.path[a];
254
- !i && r.options.layoutScroll && r.scroll && r !== r.root && (R(o.x, -r.scroll.offset.x), R(o.y, -r.scroll.offset.y)), V(r.latestValues) && F(o, r.latestValues, r.layout?.layoutBox);
255
- }
256
- return V(this.latestValues) && F(o, this.latestValues, this.layout?.layoutBox), o;
257
- }
258
- removeTransform(t) {
259
- const i = f();
260
- p(i, t);
261
- for (let s = 0; s < this.path.length; s++) {
262
- const o = this.path[s];
263
- if (!V(o.latestValues))
264
- continue;
265
- let a;
266
- o.instance && (X(o.latestValues) && o.updateSnapshot(), a = f(), p(a, o.measurePageBox())), N(i, o.latestValues, o.snapshot?.layoutBox, a);
267
- }
268
- return V(this.latestValues) && N(i, this.latestValues), i;
269
- }
270
- setTargetDelta(t) {
271
- this.targetDelta = t, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
272
- }
273
- setOptions(t) {
274
- this.options = {
275
- ...this.options,
276
- ...t,
277
- crossfade: t.crossfade !== void 0 ? t.crossfade : !0
278
- };
279
- }
280
- clearMeasurements() {
281
- this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
282
- }
283
- forceRelativeParentToResolveTarget() {
284
- this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== y.timestamp && this.relativeParent.resolveTargetDelta(!0);
285
- }
286
- resolveTargetDelta(t = !1) {
287
- const i = this.getLead();
288
- this.isProjectionDirty || (this.isProjectionDirty = i.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = i.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = i.isSharedProjectionDirty);
289
- const s = !!this.resumingFrom || this !== i;
290
- if (!(t || s && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
291
- return;
292
- const { layout: a, layoutId: r } = this.options;
293
- if (!this.layout || !(a || r))
294
- return;
295
- this.resolvedRelativeTargetAt = y.timestamp;
296
- const n = this.getClosestProjectingParent();
297
- n && this.linkedParentVersion !== n.layoutVersion && !n.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (this.options.layoutAnchor !== !1 && n && n.layout ? this.createRelativeTarget(n, this.layout.layoutBox, n.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = f(), this.targetWithTransforms = f()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Dt(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0)) : this.targetDelta ? (this.resumingFrom ? this.applyTransform(this.layout.layoutBox, !1, this.target) : p(this.target, this.layout.layoutBox), Tt(this.target, this.targetDelta)) : p(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, this.options.layoutAnchor !== !1 && n && !!n.resumingFrom == !!this.resumingFrom && !n.options.layoutScroll && n.target && this.animationProgress !== 1 ? this.createRelativeTarget(n, this.target, n.target) : this.relativeParent = this.relativeTarget = void 0));
298
- }
299
- getClosestProjectingParent() {
300
- if (!(!this.parent || X(this.parent.latestValues) || Vt(this.parent.latestValues)))
301
- return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
302
- }
303
- isProjecting() {
304
- return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
305
- }
306
- createRelativeTarget(t, i, s) {
307
- this.relativeParent = t, this.linkedParentVersion = t.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = f(), this.relativeTargetOrigin = f(), U(this.relativeTargetOrigin, i, s, this.options.layoutAnchor || void 0), p(this.relativeTarget, this.relativeTargetOrigin);
308
- }
309
- removeRelativeTarget() {
310
- this.relativeParent = this.relativeTarget = void 0;
311
- }
312
- calcProjection() {
313
- const t = this.getLead(), i = !!this.resumingFrom || this !== t;
314
- let s = !0;
315
- if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (s = !1), i && (this.isSharedProjectionDirty || this.isTransformDirty) && (s = !1), this.resolvedRelativeTargetAt === y.timestamp && (s = !1), s)
316
- return;
317
- const { layout: o, layoutId: a } = this.options;
318
- if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(o || a))
319
- return;
320
- p(this.layoutCorrected, this.layout.layoutBox);
321
- const r = this.treeScale.x, n = this.treeScale.y;
322
- xt(this.layoutCorrected, this.treeScale, this.path, i), t.layout && !t.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (t.target = t.layout.layoutBox, t.targetWithTransforms = f());
323
- const { target: u } = t;
324
- if (!u) {
325
- this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
326
- return;
327
- }
328
- !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (W(this.prevProjectionDelta.x, this.projectionDelta.x), W(this.prevProjectionDelta.y, this.projectionDelta.y)), w(this.projectionDelta, this.layoutCorrected, u, this.latestValues), (this.treeScale.x !== r || this.treeScale.y !== n || !H(this.projectionDelta.x, this.prevProjectionDelta.x) || !H(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", u));
329
- }
330
- hide() {
331
- this.isVisible = !1;
332
- }
333
- show() {
334
- this.isVisible = !0;
335
- }
336
- scheduleRender(t = !0) {
337
- if (this.options.visualElement?.scheduleRender(), t) {
338
- const i = this.getStack();
339
- i && i.scheduleRender();
340
- }
341
- this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
342
- }
343
- createProjectionDeltas() {
344
- this.prevProjectionDelta = k(), this.projectionDelta = k(), this.projectionDeltaWithTransform = k();
345
- }
346
- setAnimationOrigin(t, i = !1, s) {
347
- const o = this.snapshot, a = o ? o.latestValues : {}, r = { ...this.latestValues }, n = k();
348
- (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !i;
349
- const u = f(), d = o ? o.source : void 0, g = this.layout ? this.layout.source : void 0, x = d !== g, S = this.getStack(), v = !S || S.members.length <= 1, D = !!(x && !v && this.options.crossfade === !0 && !this.path.some(Xt));
350
- this.animationProgress = 0;
351
- let T;
352
- const rt = s?.interpolateProjection(t);
353
- this.mixTargetDelta = (nt) => {
354
- const P = nt / 1e3, A = rt?.(P);
355
- A ? (n.x.translate = A.x, n.x.scale = L(t.x.scale, 1, P), n.x.origin = t.x.origin, n.x.originPoint = t.x.originPoint, n.y.translate = A.y, n.y.scale = L(t.y.scale, 1, P), n.y.origin = t.y.origin, n.y.originPoint = t.y.originPoint) : (K(n.x, t.x, P), K(n.y, t.y, P)), this.setTargetDelta(n), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (U(u, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0), qt(this.relativeTarget, this.relativeTargetOrigin, u, P), T && Bt(this.relativeTarget, T) && (this.isProjectionDirty = !1), T || (T = f()), p(T, this.relativeTarget)), x && (this.animationValues = r, gt(r, a, this.latestValues, P, D, v)), A && A.rotate !== void 0 && (this.animationValues || (this.animationValues = r), this.animationValues.pathRotation = A.rotate), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = P;
356
- }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
357
- }
358
- startAnimation(t) {
359
- this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (Y(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = E.update(() => {
360
- O.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = yt(0)), this.motionValue.jump(0, !1), this.currentAnimation = lt(this.motionValue, [0, 1e3], {
361
- ...t,
362
- velocity: 0,
363
- isSync: !0,
364
- onUpdate: (i) => {
365
- this.mixTargetDelta(i), t.onUpdate && t.onUpdate(i);
366
- },
367
- onStop: () => {
368
- },
369
- onComplete: () => {
370
- t.onComplete && t.onComplete(), this.completeAnimation();
371
- }
372
- }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
373
- });
374
- }
375
- completeAnimation() {
376
- this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
377
- const t = this.getStack();
378
- t && t.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
379
- }
380
- finishAnimation() {
381
- this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Et), this.currentAnimation.stop()), this.completeAnimation();
382
- }
383
- applyTransformsToTarget() {
384
- const t = this.getLead();
385
- let { targetWithTransforms: i, target: s, layout: o, latestValues: a } = t;
386
- if (!(!i || !s || !o)) {
387
- if (this !== t && this.layout && o && at(this.options.animationType, this.layout.layoutBox, o.layoutBox)) {
388
- s = this.target || f();
389
- const r = j(this.layout.layoutBox.x);
390
- s.x.min = t.target.x.min, s.x.max = s.x.min + r;
391
- const n = j(this.layout.layoutBox.y);
392
- s.y.min = t.target.y.min, s.y.max = s.y.min + n;
393
- }
394
- p(i, s), F(i, a), w(this.projectionDeltaWithTransform, this.layoutCorrected, i, a);
395
- }
396
- }
397
- registerSharedNode(t, i) {
398
- this.sharedNodes.has(t) || this.sharedNodes.set(t, new St()), this.sharedNodes.get(t).add(i);
399
- const o = i.options.initialPromotionConfig;
400
- i.promote({
401
- transition: o ? o.transition : void 0,
402
- preserveFollowOpacity: o && o.shouldPreserveFollowOpacity ? o.shouldPreserveFollowOpacity(i) : void 0
403
- });
404
- }
405
- isLead() {
406
- const t = this.getStack();
407
- return t ? t.lead === this : !0;
408
- }
409
- getLead() {
410
- const { layoutId: t } = this.options;
411
- return t ? this.getStack()?.lead || this : this;
412
- }
413
- getPrevLead() {
414
- const { layoutId: t } = this.options;
415
- return t ? this.getStack()?.prevLead : void 0;
416
- }
417
- getStack() {
418
- const { layoutId: t } = this.options;
419
- if (t)
420
- return this.root.sharedNodes.get(t);
421
- }
422
- promote({ needsReset: t, transition: i, preserveFollowOpacity: s } = {}) {
423
- const o = this.getStack();
424
- o && o.promote(this, s), t && (this.projectionDelta = void 0, this.needsReset = !0), i && this.setOptions({ transition: i });
425
- }
426
- relegate() {
427
- const t = this.getStack();
428
- return t ? t.relegate(this) : !1;
429
- }
430
- resetSkewAndRotation() {
431
- const { visualElement: t } = this.options;
432
- if (!t)
433
- return;
434
- let i = !1;
435
- const { latestValues: s } = t;
436
- if ((s.z || s.rotate || s.rotateX || s.rotateY || s.rotateZ || s.skewX || s.skewY) && (i = !0), !i)
437
- return;
438
- const o = {};
439
- s.z && b("z", t, o, this.animationValues);
440
- for (let a = 0; a < M.length; a++)
441
- b(`rotate${M[a]}`, t, o, this.animationValues), b(`skew${M[a]}`, t, o, this.animationValues);
442
- t.render();
443
- for (const a in o)
444
- t.setStaticValue(a, o[a]), this.animationValues && (this.animationValues[a] = o[a]);
445
- t.scheduleRender();
446
- }
447
- applyProjectionStyles(t, i) {
448
- if (!this.instance || this.isSVG)
449
- return;
450
- if (!this.isVisible) {
451
- t.visibility = "hidden";
452
- return;
453
- }
454
- const s = this.getTransformTemplate();
455
- if (this.needsReset) {
456
- this.needsReset = !1, t.visibility = "", t.opacity = "", t.pointerEvents = C(i?.pointerEvents) || "", t.transform = s ? s(this.latestValues, "") : "none";
457
- return;
458
- }
459
- const o = this.getLead();
460
- if (!this.projectionDelta || !this.layout || !o.target) {
461
- this.options.layoutId && (t.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, t.pointerEvents = C(i?.pointerEvents) || ""), this.hasProjected && !V(this.latestValues) && (t.transform = s ? s({}, "") : "none", this.hasProjected = !1);
462
- return;
463
- }
464
- t.visibility = "";
465
- const a = o.animationValues || o.latestValues;
466
- this.applyTransformsToTarget();
467
- let r = At(this.projectionDeltaWithTransform, this.treeScale, a);
468
- s && (r = s(a, r)), t.transform = r;
469
- const { x: n, y: u } = this.projectionDelta;
470
- t.transformOrigin = `${n.origin * 100}% ${u.origin * 100}% 0`, o.animationValues ? t.opacity = o === this ? a.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : a.opacityExit : t.opacity = o === this ? a.opacity !== void 0 ? a.opacity : "" : a.opacityExit !== void 0 ? a.opacityExit : 0;
471
- for (const d in z) {
472
- if (a[d] === void 0)
473
- continue;
474
- const { correct: g, applyTo: x, isCSSVariable: S } = z[d], v = r === "none" ? a[d] : g(a[d], o);
475
- if (x) {
476
- const D = x.length;
477
- for (let T = 0; T < D; T++)
478
- t[x[T]] = v;
479
- } else
480
- S ? this.options.visualElement.renderState.vars[d] = v : t[d] = v;
481
- }
482
- this.options.layoutId && (t.pointerEvents = o === this ? C(i?.pointerEvents) || "" : "none");
483
- }
484
- clearSnapshot() {
485
- this.resumeFrom = this.snapshot = void 0;
486
- }
487
- // Only run on root
488
- resetTree() {
489
- this.root.nodes.forEach((t) => t.currentAnimation?.stop()), this.root.nodes.forEach($), this.root.sharedNodes.clear();
490
- }
491
- };
57
+ function createProjectionNode({ attachResizeListener: L, defaultParent: q, measureScroll: Z, checkIsScrollRoot: Q, resetTransform: $ }) {
58
+ return class {
59
+ constructor(c = {}, L = q?.()) {
60
+ this.id = id++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = {
61
+ x: 1,
62
+ y: 1
63
+ }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
64
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
65
+ }, this.updateProjection = () => {
66
+ this.projectionUpdateScheduled = !1, statsBuffer.value && (metrics.nodes = metrics.calculatedTargetDeltas = metrics.calculatedProjections = 0), this.nodes.forEach(propagateDirtyNodes), this.nodes.forEach(resolveTargetDelta), this.nodes.forEach(calcProjection), this.nodes.forEach(cleanDirtyNodes), statsBuffer.addProjectionMetrics && statsBuffer.addProjectionMetrics(metrics);
67
+ }, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = c, this.root = L ? L.root || L : this, this.path = L ? [...L.path, L] : [], this.parent = L, this.depth = L ? L.depth + 1 : 0;
68
+ for (let c = 0; c < this.path.length; c++) this.path[c].shouldResetTransform = !0;
69
+ this.root === this && (this.nodes = new FlatTree());
70
+ }
71
+ addEventListener(c, L) {
72
+ return this.eventHandlers.has(c) || this.eventHandlers.set(c, new SubscriptionManager()), this.eventHandlers.get(c).add(L);
73
+ }
74
+ notifyListeners(c, ...L) {
75
+ let R = this.eventHandlers.get(c);
76
+ R && R.notify(...L);
77
+ }
78
+ hasListeners(c) {
79
+ return this.eventHandlers.has(c);
80
+ }
81
+ mount(c) {
82
+ if (this.instance) return;
83
+ this.isSVG = isSVGElement(c) && !isSVGSVGElement(c), this.instance = c;
84
+ let { layoutId: R, layout: z, visualElement: V } = this.options;
85
+ if (V && !V.current && V.mount(c), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (z || R) && (this.isLayoutDirty = !0), L) {
86
+ let R, z = 0, V = () => this.root.updateBlockedByResize = !1;
87
+ frame.read(() => {
88
+ z = window.innerWidth;
89
+ }), L(c, () => {
90
+ let c = window.innerWidth;
91
+ c !== z && (z = c, this.root.updateBlockedByResize = !0, R && R(), R = delay(V, 250), globalProjectionState.hasAnimatedSinceResize && (globalProjectionState.hasAnimatedSinceResize = !1, this.nodes.forEach(finishAnimation)));
92
+ });
93
+ }
94
+ R && this.root.registerSharedNode(R, this), this.options.animate !== !1 && V && (R || z) && this.addEventListener("didUpdate", ({ delta: c, hasLayoutChanged: L, hasRelativeLayoutChanged: R, layout: z }) => {
95
+ if (this.isTreeAnimationBlocked()) {
96
+ this.target = void 0, this.relativeTarget = void 0;
97
+ return;
98
+ }
99
+ let B = this.options.transition || V.getDefaultTransition() || defaultLayoutTransition, { onLayoutAnimationStart: H, onLayoutAnimationComplete: U } = V.getProps(), W = !this.targetLayout || !boxEqualsRounded(this.targetLayout, z), G = !L && R;
100
+ if (this.options.layoutRoot || this.resumeFrom || G || L && (W || !this.currentAnimation)) {
101
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
102
+ let L = {
103
+ ...getValueTransition(B, "layout"),
104
+ onPlay: H,
105
+ onComplete: U
106
+ };
107
+ (V.shouldReduceMotion || this.options.layoutRoot) && (L.delay = 0, L.type = !1), this.startAnimation(L), this.setAnimationOrigin(c, G, L.path);
108
+ } else L || finishAnimation(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
109
+ this.targetLayout = z;
110
+ });
111
+ }
112
+ unmount() {
113
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
114
+ let c = this.getStack();
115
+ c && c.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), cancelFrame(this.updateProjection);
116
+ }
117
+ blockUpdate() {
118
+ this.updateManuallyBlocked = !0;
119
+ }
120
+ unblockUpdate() {
121
+ this.updateManuallyBlocked = !1;
122
+ }
123
+ isUpdateBlocked() {
124
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
125
+ }
126
+ isTreeAnimationBlocked() {
127
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
128
+ }
129
+ startUpdate() {
130
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(resetSkewAndRotation), this.animationId++);
131
+ }
132
+ getTransformTemplate() {
133
+ let { visualElement: c } = this.options;
134
+ return c && c.getProps().transformTemplate;
135
+ }
136
+ willUpdate(c = !0) {
137
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
138
+ this.options.onExitComplete && this.options.onExitComplete();
139
+ return;
140
+ }
141
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && cancelTreeOptimisedTransformAnimations(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return;
142
+ this.isLayoutDirty = !0;
143
+ for (let c = 0; c < this.path.length; c++) {
144
+ let L = this.path[c];
145
+ L.shouldResetTransform = !0, (typeof L.latestValues.x == "string" || typeof L.latestValues.y == "string") && (L.isLayoutDirty = !0), L.updateScroll("snapshot"), L.options.layoutRoot && L.willUpdate(!1);
146
+ }
147
+ let { layoutId: L, layout: R } = this.options;
148
+ if (L === void 0 && !R) return;
149
+ let z = this.getTransformTemplate();
150
+ this.prevTransformTemplateValue = z ? z(this.latestValues, "") : void 0, this.updateSnapshot(), c && this.notifyListeners("willUpdate");
151
+ }
152
+ update() {
153
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
154
+ let c = this.updateBlockedByResize;
155
+ this.unblockUpdate(), this.updateBlockedByResize = !1, this.clearAllSnapshots(), c && this.nodes.forEach(forceLayoutMeasure), this.nodes.forEach(clearMeasurements);
156
+ return;
157
+ }
158
+ if (this.animationId <= this.animationCommitId) {
159
+ this.nodes.forEach(clearIsLayoutDirty);
160
+ return;
161
+ }
162
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(ensureDraggedNodesSnapshotted), this.nodes.forEach(resetTransformStyle), this.nodes.forEach(updateLayout), this.nodes.forEach(notifyLayoutUpdate)) : this.nodes.forEach(clearIsLayoutDirty), this.clearAllSnapshots();
163
+ let L = time.now();
164
+ frameData.delta = clamp(0, 1e3 / 60, L - frameData.timestamp), frameData.timestamp = L, frameData.isProcessing = !0, frameSteps.update.process(frameData), frameSteps.preRender.process(frameData), frameSteps.render.process(frameData), frameData.isProcessing = !1;
165
+ }
166
+ didUpdate() {
167
+ this.updateScheduled || (this.updateScheduled = !0, microtask.read(this.scheduleUpdate));
168
+ }
169
+ clearAllSnapshots() {
170
+ this.nodes.forEach(clearSnapshot), this.sharedNodes.forEach(removeLeadSnapshots);
171
+ }
172
+ scheduleUpdateProjection() {
173
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, frame.preRender(this.updateProjection, !1, !0));
174
+ }
175
+ scheduleCheckAfterUnmount() {
176
+ frame.postRender(() => {
177
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
178
+ });
179
+ }
180
+ updateSnapshot() {
181
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !calcLength(this.snapshot.measuredBox.x) && !calcLength(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
182
+ }
183
+ updateLayout() {
184
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) return;
185
+ if (this.resumeFrom && !this.resumeFrom.instance) for (let c = 0; c < this.path.length; c++) this.path[c].updateScroll();
186
+ let c = this.layout;
187
+ this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected ||= createBox(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
188
+ let { visualElement: L } = this.options;
189
+ L && L.notify("LayoutMeasure", this.layout.layoutBox, c ? c.layoutBox : void 0);
190
+ }
191
+ updateScroll(c = "measure") {
192
+ let L = !!(this.options.layoutScroll && this.instance);
193
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === c && (L = !1), L && this.instance) {
194
+ let L = Q(this.instance);
195
+ this.scroll = {
196
+ animationId: this.root.animationId,
197
+ phase: c,
198
+ isRoot: L,
199
+ offset: Z(this.instance),
200
+ wasRoot: this.scroll ? this.scroll.isRoot : L
201
+ };
202
+ }
203
+ }
204
+ resetTransform() {
205
+ if (!$) return;
206
+ let c = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, L = this.projectionDelta && !isDeltaZero(this.projectionDelta), R = this.getTransformTemplate(), z = R ? R(this.latestValues, "") : void 0, B = z !== this.prevTransformTemplateValue;
207
+ c && this.instance && (L || hasTransform(this.latestValues) || B) && ($(this.instance, z), this.shouldResetTransform = !1, this.scheduleRender());
208
+ }
209
+ measure(c = !0) {
210
+ let L = this.measurePageBox(), R = this.removeElementScroll(L);
211
+ return c && (R = this.removeTransform(R)), roundBox(R), {
212
+ animationId: this.root.animationId,
213
+ measuredBox: L,
214
+ layoutBox: R,
215
+ latestValues: {},
216
+ source: this.id
217
+ };
218
+ }
219
+ measurePageBox() {
220
+ let { visualElement: c } = this.options;
221
+ if (!c) return createBox();
222
+ let L = c.measureViewportBox();
223
+ if (!(this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot))) {
224
+ let { scroll: c } = this.root;
225
+ c && (translateAxis(L.x, c.offset.x), translateAxis(L.y, c.offset.y));
226
+ }
227
+ return L;
228
+ }
229
+ removeElementScroll(c) {
230
+ let L = createBox();
231
+ if (copyBoxInto(L, c), this.scroll?.wasRoot) return L;
232
+ for (let R = 0; R < this.path.length; R++) {
233
+ let z = this.path[R], { scroll: B, options: V } = z;
234
+ z !== this.root && B && V.layoutScroll && (B.wasRoot && copyBoxInto(L, c), translateAxis(L.x, B.offset.x), translateAxis(L.y, B.offset.y));
235
+ }
236
+ return L;
237
+ }
238
+ applyTransform(c, L = !1, R) {
239
+ let z = R || createBox();
240
+ copyBoxInto(z, c);
241
+ for (let c = 0; c < this.path.length; c++) {
242
+ let R = this.path[c];
243
+ !L && R.options.layoutScroll && R.scroll && R !== R.root && (translateAxis(z.x, -R.scroll.offset.x), translateAxis(z.y, -R.scroll.offset.y)), hasTransform(R.latestValues) && transformBox(z, R.latestValues, R.layout?.layoutBox);
244
+ }
245
+ return hasTransform(this.latestValues) && transformBox(z, this.latestValues, this.layout?.layoutBox), z;
246
+ }
247
+ removeTransform(c) {
248
+ let L = createBox();
249
+ copyBoxInto(L, c);
250
+ for (let c = 0; c < this.path.length; c++) {
251
+ let R = this.path[c];
252
+ if (!hasTransform(R.latestValues)) continue;
253
+ let z;
254
+ R.instance && (hasScale(R.latestValues) && R.updateSnapshot(), z = createBox(), copyBoxInto(z, R.measurePageBox())), removeBoxTransforms(L, R.latestValues, R.snapshot?.layoutBox, z);
255
+ }
256
+ return hasTransform(this.latestValues) && removeBoxTransforms(L, this.latestValues), L;
257
+ }
258
+ setTargetDelta(c) {
259
+ this.targetDelta = c, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
260
+ }
261
+ setOptions(c) {
262
+ this.options = {
263
+ ...this.options,
264
+ ...c,
265
+ crossfade: c.crossfade === void 0 ? !0 : c.crossfade
266
+ };
267
+ }
268
+ clearMeasurements() {
269
+ this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
270
+ }
271
+ forceRelativeParentToResolveTarget() {
272
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp && this.relativeParent.resolveTargetDelta(!0);
273
+ }
274
+ resolveTargetDelta(c = !1) {
275
+ let L = this.getLead();
276
+ this.isProjectionDirty ||= L.isProjectionDirty, this.isTransformDirty ||= L.isTransformDirty, this.isSharedProjectionDirty ||= L.isSharedProjectionDirty;
277
+ let R = !!this.resumingFrom || this !== L;
278
+ if (!(c || R && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return;
279
+ let { layout: z, layoutId: B } = this.options;
280
+ if (!this.layout || !(z || B)) return;
281
+ this.resolvedRelativeTargetAt = frameData.timestamp;
282
+ let H = this.getClosestProjectingParent();
283
+ H && this.linkedParentVersion !== H.layoutVersion && !H.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (this.options.layoutAnchor !== !1 && H && H.layout ? this.createRelativeTarget(H, this.layout.layoutBox, H.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = createBox(), this.targetWithTransforms = createBox()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0)) : this.targetDelta ? (this.resumingFrom ? this.applyTransform(this.layout.layoutBox, !1, this.target) : copyBoxInto(this.target, this.layout.layoutBox), applyBoxDelta(this.target, this.targetDelta)) : copyBoxInto(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, this.options.layoutAnchor !== !1 && H && !!H.resumingFrom == !!this.resumingFrom && !H.options.layoutScroll && H.target && this.animationProgress !== 1 ? this.createRelativeTarget(H, this.target, H.target) : this.relativeParent = this.relativeTarget = void 0), statsBuffer.value && metrics.calculatedTargetDeltas++);
284
+ }
285
+ getClosestProjectingParent() {
286
+ if (!(!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues))) return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
287
+ }
288
+ isProjecting() {
289
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
290
+ }
291
+ createRelativeTarget(c, L, R) {
292
+ this.relativeParent = c, this.linkedParentVersion = c.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = createBox(), this.relativeTargetOrigin = createBox(), calcRelativePosition(this.relativeTargetOrigin, L, R, this.options.layoutAnchor || void 0), copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
293
+ }
294
+ removeRelativeTarget() {
295
+ this.relativeParent = this.relativeTarget = void 0;
296
+ }
297
+ calcProjection() {
298
+ let c = this.getLead(), L = !!this.resumingFrom || this !== c, R = !0;
299
+ if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (R = !1), L && (this.isSharedProjectionDirty || this.isTransformDirty) && (R = !1), this.resolvedRelativeTargetAt === frameData.timestamp && (R = !1), R) return;
300
+ let { layout: z, layoutId: B } = this.options;
301
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(z || B)) return;
302
+ copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
303
+ let H = this.treeScale.x, U = this.treeScale.y;
304
+ applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, L), c.layout && !c.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (c.target = c.layout.layoutBox, c.targetWithTransforms = createBox());
305
+ let { target: W } = c;
306
+ if (!W) {
307
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
308
+ return;
309
+ }
310
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x), copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y)), calcBoxDelta(this.projectionDelta, this.layoutCorrected, W, this.latestValues), (this.treeScale.x !== H || this.treeScale.y !== U || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", W)), statsBuffer.value && metrics.calculatedProjections++;
311
+ }
312
+ hide() {
313
+ this.isVisible = !1;
314
+ }
315
+ show() {
316
+ this.isVisible = !0;
317
+ }
318
+ scheduleRender(c = !0) {
319
+ if (this.options.visualElement?.scheduleRender(), c) {
320
+ let c = this.getStack();
321
+ c && c.scheduleRender();
322
+ }
323
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
324
+ }
325
+ createProjectionDeltas() {
326
+ this.prevProjectionDelta = createDelta(), this.projectionDelta = createDelta(), this.projectionDeltaWithTransform = createDelta();
327
+ }
328
+ setAnimationOrigin(c, L = !1, R) {
329
+ let z = this.snapshot, B = z ? z.latestValues : {}, V = { ...this.latestValues }, H = createDelta();
330
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !L;
331
+ let U = createBox(), G = (z ? z.source : void 0) !== (this.layout ? this.layout.source : void 0), K = this.getStack(), q = !K || K.members.length <= 1, J = !!(G && !q && this.options.crossfade === !0 && !this.path.some(hasOpacityCrossfade));
332
+ this.animationProgress = 0;
333
+ let Y, X = R?.interpolateProjection(c);
334
+ this.mixTargetDelta = (L) => {
335
+ let R = L / 1e3, z = X?.(R);
336
+ z ? (H.x.translate = z.x, H.x.scale = mixNumber(c.x.scale, 1, R), H.x.origin = c.x.origin, H.x.originPoint = c.x.originPoint, H.y.translate = z.y, H.y.scale = mixNumber(c.y.scale, 1, R), H.y.origin = c.y.origin, H.y.originPoint = c.y.originPoint) : (mixAxisDeltaLinear(H.x, c.x, R), mixAxisDeltaLinear(H.y, c.y, R)), this.setTargetDelta(H), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (calcRelativePosition(U, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0), mixBox(this.relativeTarget, this.relativeTargetOrigin, U, R), Y && boxEquals(this.relativeTarget, Y) && (this.isProjectionDirty = !1), Y ||= createBox(), copyBoxInto(Y, this.relativeTarget)), G && (this.animationValues = V, mixValues(V, B, this.latestValues, R, J, q)), z && z.rotate !== void 0 && (this.animationValues ||= V, this.animationValues.pathRotation = z.rotate), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = R;
337
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
338
+ }
339
+ startAnimation(c) {
340
+ this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation &&= (cancelFrame(this.pendingAnimation), void 0), this.pendingAnimation = frame.update(() => {
341
+ globalProjectionState.hasAnimatedSinceResize = !0, this.motionValue ||= motionValue(0), this.motionValue.jump(0, !1), this.currentAnimation = animateSingleValue(this.motionValue, [0, 1e3], {
342
+ ...c,
343
+ velocity: 0,
344
+ isSync: !0,
345
+ onUpdate: (L) => {
346
+ this.mixTargetDelta(L), c.onUpdate && c.onUpdate(L);
347
+ },
348
+ onComplete: () => {
349
+ c.onComplete && c.onComplete(), this.completeAnimation();
350
+ }
351
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
352
+ });
353
+ }
354
+ completeAnimation() {
355
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
356
+ let c = this.getStack();
357
+ c && c.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
358
+ }
359
+ finishAnimation() {
360
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(animationTarget), this.currentAnimation.stop()), this.completeAnimation();
361
+ }
362
+ applyTransformsToTarget() {
363
+ let c = this.getLead(), { targetWithTransforms: L, target: R, layout: z, latestValues: B } = c;
364
+ if (!(!L || !R || !z)) {
365
+ if (this !== c && this.layout && z && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, z.layoutBox)) {
366
+ R = this.target || createBox();
367
+ let L = calcLength(this.layout.layoutBox.x);
368
+ R.x.min = c.target.x.min, R.x.max = R.x.min + L;
369
+ let z = calcLength(this.layout.layoutBox.y);
370
+ R.y.min = c.target.y.min, R.y.max = R.y.min + z;
371
+ }
372
+ copyBoxInto(L, R), transformBox(L, B), calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, L, B);
373
+ }
374
+ }
375
+ registerSharedNode(c, L) {
376
+ this.sharedNodes.has(c) || this.sharedNodes.set(c, new NodeStack()), this.sharedNodes.get(c).add(L);
377
+ let R = L.options.initialPromotionConfig;
378
+ L.promote({
379
+ transition: R ? R.transition : void 0,
380
+ preserveFollowOpacity: R && R.shouldPreserveFollowOpacity ? R.shouldPreserveFollowOpacity(L) : void 0
381
+ });
382
+ }
383
+ isLead() {
384
+ let c = this.getStack();
385
+ return c ? c.lead === this : !0;
386
+ }
387
+ getLead() {
388
+ let { layoutId: c } = this.options;
389
+ return c && this.getStack()?.lead || this;
390
+ }
391
+ getPrevLead() {
392
+ let { layoutId: c } = this.options;
393
+ return c ? this.getStack()?.prevLead : void 0;
394
+ }
395
+ getStack() {
396
+ let { layoutId: c } = this.options;
397
+ if (c) return this.root.sharedNodes.get(c);
398
+ }
399
+ promote({ needsReset: c, transition: L, preserveFollowOpacity: R } = {}) {
400
+ let z = this.getStack();
401
+ z && z.promote(this, R), c && (this.projectionDelta = void 0, this.needsReset = !0), L && this.setOptions({ transition: L });
402
+ }
403
+ relegate() {
404
+ let c = this.getStack();
405
+ return c ? c.relegate(this) : !1;
406
+ }
407
+ resetSkewAndRotation() {
408
+ let { visualElement: c } = this.options;
409
+ if (!c) return;
410
+ let L = !1, { latestValues: R } = c;
411
+ if ((R.z || R.rotate || R.rotateX || R.rotateY || R.rotateZ || R.skewX || R.skewY) && (L = !0), !L) return;
412
+ let z = {};
413
+ R.z && resetDistortingTransform("z", c, z, this.animationValues);
414
+ for (let L = 0; L < transformAxes.length; L++) resetDistortingTransform(`rotate${transformAxes[L]}`, c, z, this.animationValues), resetDistortingTransform(`skew${transformAxes[L]}`, c, z, this.animationValues);
415
+ for (let L in c.render(), z) c.setStaticValue(L, z[L]), this.animationValues && (this.animationValues[L] = z[L]);
416
+ c.scheduleRender();
417
+ }
418
+ applyProjectionStyles(c, L) {
419
+ if (!this.instance || this.isSVG) return;
420
+ if (!this.isVisible) {
421
+ c.visibility = "hidden";
422
+ return;
423
+ }
424
+ let R = this.getTransformTemplate();
425
+ if (this.needsReset) {
426
+ this.needsReset = !1, c.visibility = "", c.opacity = "", c.pointerEvents = resolveMotionValue(L?.pointerEvents) || "", c.transform = R ? R(this.latestValues, "") : "none";
427
+ return;
428
+ }
429
+ let z = this.getLead();
430
+ if (!this.projectionDelta || !this.layout || !z.target) {
431
+ this.options.layoutId && (c.opacity = this.latestValues.opacity === void 0 ? 1 : this.latestValues.opacity, c.pointerEvents = resolveMotionValue(L?.pointerEvents) || ""), this.hasProjected && !hasTransform(this.latestValues) && (c.transform = R ? R({}, "") : "none", this.hasProjected = !1);
432
+ return;
433
+ }
434
+ c.visibility = "";
435
+ let B = z.animationValues || z.latestValues;
436
+ this.applyTransformsToTarget();
437
+ let V = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, B);
438
+ R && (V = R(B, V)), c.transform = V;
439
+ let { x: H, y: U } = this.projectionDelta;
440
+ for (let L in c.transformOrigin = `${H.origin * 100}% ${U.origin * 100}% 0`, z.animationValues ? c.opacity = z === this ? B.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : B.opacityExit : c.opacity = z === this ? B.opacity === void 0 ? "" : B.opacity : B.opacityExit === void 0 ? 0 : B.opacityExit, scaleCorrectors) {
441
+ if (B[L] === void 0) continue;
442
+ let { correct: R, applyTo: H, isCSSVariable: U } = scaleCorrectors[L], W = V === "none" ? B[L] : R(B[L], z);
443
+ if (H) {
444
+ let L = H.length;
445
+ for (let R = 0; R < L; R++) c[H[R]] = W;
446
+ } else U ? this.options.visualElement.renderState.vars[L] = W : c[L] = W;
447
+ }
448
+ this.options.layoutId && (c.pointerEvents = z === this ? resolveMotionValue(L?.pointerEvents) || "" : "none");
449
+ }
450
+ clearSnapshot() {
451
+ this.resumeFrom = this.snapshot = void 0;
452
+ }
453
+ resetTree() {
454
+ this.root.nodes.forEach((c) => c.currentAnimation?.stop()), this.root.nodes.forEach(clearMeasurements), this.root.sharedNodes.clear();
455
+ }
456
+ };
492
457
  }
493
- function Ut(e) {
494
- e.updateLayout();
458
+ function updateLayout(c) {
459
+ c.updateLayout();
495
460
  }
496
- function Ct(e) {
497
- const l = e.resumeFrom?.snapshot || e.snapshot;
498
- if (e.isLead() && e.layout && l && e.hasListeners("didUpdate")) {
499
- const { layoutBox: h, measuredBox: c } = e.layout, { animationType: m } = e.options, B = l.source !== e.layout.source;
500
- if (m === "size")
501
- q((a) => {
502
- const r = B ? l.measuredBox[a] : l.layoutBox[a], n = j(r);
503
- r.min = h[a].min, r.max = r.min + n;
504
- });
505
- else if (m === "x" || m === "y") {
506
- const a = m === "x" ? "y" : "x";
507
- vt(B ? l.measuredBox[a] : l.layoutBox[a], h[a]);
508
- } else at(m, l.layoutBox, h) && q((a) => {
509
- const r = B ? l.measuredBox[a] : l.layoutBox[a], n = j(h[a]);
510
- r.max = r.min + n, e.relativeTarget && !e.currentAnimation && (e.isProjectionDirty = !0, e.relativeTarget[a].max = e.relativeTarget[a].min + n);
511
- });
512
- const t = k();
513
- w(t, h, l.layoutBox);
514
- const i = k();
515
- B ? w(i, e.applyTransform(c, !0), l.measuredBox) : w(i, h, l.layoutBox);
516
- const s = !st(t);
517
- let o = !1;
518
- if (!e.resumeFrom) {
519
- const a = e.getClosestProjectingParent();
520
- if (a && !a.resumeFrom) {
521
- const { snapshot: r, layout: n } = a;
522
- if (r && n) {
523
- const u = e.options.layoutAnchor || void 0, d = f();
524
- U(d, l.layoutBox, r.layoutBox, u);
525
- const g = f();
526
- U(g, h, n.layoutBox, u), it(d, g) || (o = !0), a.options.layoutRoot && (e.relativeTarget = g, e.relativeTargetOrigin = d, e.relativeParent = a);
527
- }
528
- }
529
- }
530
- e.notifyListeners("didUpdate", {
531
- layout: h,
532
- snapshot: l,
533
- delta: i,
534
- layoutDelta: t,
535
- hasLayoutChanged: s,
536
- hasRelativeLayoutChanged: o
537
- });
538
- } else if (e.isLead()) {
539
- const { onExitComplete: h } = e.options;
540
- h && h();
541
- }
542
- e.options.transition = void 0;
461
+ function notifyLayoutUpdate(c) {
462
+ let L = c.resumeFrom?.snapshot || c.snapshot;
463
+ if (c.isLead() && c.layout && L && c.hasListeners("didUpdate")) {
464
+ let { layoutBox: R, measuredBox: z } = c.layout, { animationType: B } = c.options, V = L.source !== c.layout.source;
465
+ if (B === "size") eachAxis((c) => {
466
+ let z = V ? L.measuredBox[c] : L.layoutBox[c], B = calcLength(z);
467
+ z.min = R[c].min, z.max = z.min + B;
468
+ });
469
+ else if (B === "x" || B === "y") {
470
+ let c = B === "x" ? "y" : "x";
471
+ copyAxisInto(V ? L.measuredBox[c] : L.layoutBox[c], R[c]);
472
+ } else shouldAnimatePositionOnly(B, L.layoutBox, R) && eachAxis((z) => {
473
+ let B = V ? L.measuredBox[z] : L.layoutBox[z], H = calcLength(R[z]);
474
+ B.max = B.min + H, c.relativeTarget && !c.currentAnimation && (c.isProjectionDirty = !0, c.relativeTarget[z].max = c.relativeTarget[z].min + H);
475
+ });
476
+ let H = createDelta();
477
+ calcBoxDelta(H, R, L.layoutBox);
478
+ let U = createDelta();
479
+ V ? calcBoxDelta(U, c.applyTransform(z, !0), L.measuredBox) : calcBoxDelta(U, R, L.layoutBox);
480
+ let W = !isDeltaZero(H), G = !1;
481
+ if (!c.resumeFrom) {
482
+ let z = c.getClosestProjectingParent();
483
+ if (z && !z.resumeFrom) {
484
+ let { snapshot: B, layout: V } = z;
485
+ if (B && V) {
486
+ let H = c.options.layoutAnchor || void 0, U = createBox();
487
+ calcRelativePosition(U, L.layoutBox, B.layoutBox, H);
488
+ let W = createBox();
489
+ calcRelativePosition(W, R, V.layoutBox, H), boxEqualsRounded(U, W) || (G = !0), z.options.layoutRoot && (c.relativeTarget = W, c.relativeTargetOrigin = U, c.relativeParent = z);
490
+ }
491
+ }
492
+ }
493
+ c.notifyListeners("didUpdate", {
494
+ layout: R,
495
+ snapshot: L,
496
+ delta: U,
497
+ layoutDelta: H,
498
+ hasLayoutChanged: W,
499
+ hasRelativeLayoutChanged: G
500
+ });
501
+ } else if (c.isLead()) {
502
+ let { onExitComplete: L } = c.options;
503
+ L && L();
504
+ }
505
+ c.options.transition = void 0;
543
506
  }
544
- function Ft(e) {
545
- e.parent && (e.isProjecting() || (e.isProjectionDirty = e.parent.isProjectionDirty), e.isSharedProjectionDirty || (e.isSharedProjectionDirty = !!(e.isProjectionDirty || e.parent.isProjectionDirty || e.parent.isSharedProjectionDirty)), e.isTransformDirty || (e.isTransformDirty = e.parent.isTransformDirty));
507
+ function propagateDirtyNodes(c) {
508
+ statsBuffer.value && metrics.nodes++, c.parent && (c.isProjecting() || (c.isProjectionDirty = c.parent.isProjectionDirty), c.isSharedProjectionDirty ||= !!(c.isProjectionDirty || c.parent.isProjectionDirty || c.parent.isSharedProjectionDirty), c.isTransformDirty ||= c.parent.isTransformDirty);
546
509
  }
547
- function Ot(e) {
548
- e.isProjectionDirty = e.isSharedProjectionDirty = e.isTransformDirty = !1;
510
+ function cleanDirtyNodes(c) {
511
+ c.isProjectionDirty = c.isSharedProjectionDirty = c.isTransformDirty = !1;
549
512
  }
550
- function It(e) {
551
- e.clearSnapshot();
513
+ function clearSnapshot(c) {
514
+ c.clearSnapshot();
552
515
  }
553
- function $(e) {
554
- e.clearMeasurements();
516
+ function clearMeasurements(c) {
517
+ c.clearMeasurements();
555
518
  }
556
- function Mt(e) {
557
- e.isLayoutDirty = !0, e.updateLayout();
519
+ function forceLayoutMeasure(c) {
520
+ c.isLayoutDirty = !0, c.updateLayout();
558
521
  }
559
- function Z(e) {
560
- e.isLayoutDirty = !1;
522
+ function clearIsLayoutDirty(c) {
523
+ c.isLayoutDirty = !1;
561
524
  }
562
- function bt(e) {
563
- e.isAnimationBlocked && e.layout && !e.isLayoutDirty && (e.snapshot = e.layout, e.isLayoutDirty = !0);
525
+ function ensureDraggedNodesSnapshotted(c) {
526
+ c.isAnimationBlocked && c.layout && !c.isLayoutDirty && (c.snapshot = c.layout, c.isLayoutDirty = !0);
564
527
  }
565
- function zt(e) {
566
- const { visualElement: l } = e.options;
567
- l && l.getProps().onBeforeLayoutMeasure && l.notify("BeforeLayoutMeasure"), e.resetTransform();
528
+ function resetTransformStyle(c) {
529
+ let { visualElement: L } = c.options;
530
+ L && L.getProps().onBeforeLayoutMeasure && L.notify("BeforeLayoutMeasure"), c.resetTransform();
568
531
  }
569
- function J(e) {
570
- e.finishAnimation(), e.targetDelta = e.relativeTarget = e.target = void 0, e.isProjectionDirty = !0;
532
+ function finishAnimation(c) {
533
+ c.finishAnimation(), c.targetDelta = c.relativeTarget = c.target = void 0, c.isProjectionDirty = !0;
571
534
  }
572
- function Wt(e) {
573
- e.resolveTargetDelta();
535
+ function resolveTargetDelta(c) {
536
+ c.resolveTargetDelta();
574
537
  }
575
- function Nt(e) {
576
- e.calcProjection();
538
+ function calcProjection(c) {
539
+ c.calcProjection();
577
540
  }
578
- function Ht(e) {
579
- e.resetSkewAndRotation();
541
+ function resetSkewAndRotation(c) {
542
+ c.resetSkewAndRotation();
580
543
  }
581
- function Gt(e) {
582
- e.removeLeadSnapshot();
544
+ function removeLeadSnapshots(c) {
545
+ c.removeLeadSnapshot();
583
546
  }
584
- function K(e, l, h) {
585
- e.translate = L(l.translate, 0, h), e.scale = L(l.scale, 1, h), e.origin = l.origin, e.originPoint = l.originPoint;
547
+ function mixAxisDeltaLinear(c, L, R) {
548
+ c.translate = mixNumber(L.translate, 0, R), c.scale = mixNumber(L.scale, 1, R), c.origin = L.origin, c.originPoint = L.originPoint;
586
549
  }
587
- function Q(e, l, h, c) {
588
- e.min = L(l.min, h.min, c), e.max = L(l.max, h.max, c);
550
+ function mixAxis(c, L, R, z) {
551
+ c.min = mixNumber(L.min, R.min, z), c.max = mixNumber(L.max, R.max, z);
589
552
  }
590
- function qt(e, l, h, c) {
591
- Q(e.x, l.x, h.x, c), Q(e.y, l.y, h.y, c);
553
+ function mixBox(c, L, R, z) {
554
+ mixAxis(c.x, L.x, R.x, z), mixAxis(c.y, L.y, R.y, z);
592
555
  }
593
- function Xt(e) {
594
- return e.animationValues && e.animationValues.opacityExit !== void 0;
556
+ function hasOpacityCrossfade(c) {
557
+ return c.animationValues && c.animationValues.opacityExit !== void 0;
595
558
  }
596
- const Yt = {
597
- duration: 0.45,
598
- ease: [0.4, 0, 0.1, 1]
599
- }, _ = (e) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(e), tt = _("applewebkit/") && !_("chrome/") ? Math.round : Lt;
600
- function et(e) {
601
- e.min = tt(e.min), e.max = tt(e.max);
559
+ var defaultLayoutTransition = {
560
+ duration: .45,
561
+ ease: [
562
+ .4,
563
+ 0,
564
+ .1,
565
+ 1
566
+ ]
567
+ }, userAgentContains = (c) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(c), roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop;
568
+ function roundAxis(c) {
569
+ c.min = roundPoint(c.min), c.max = roundPoint(c.max);
602
570
  }
603
- function $t(e) {
604
- et(e.x), et(e.y);
571
+ function roundBox(c) {
572
+ roundAxis(c.x), roundAxis(c.y);
605
573
  }
606
- function at(e, l, h) {
607
- return e === "position" || e === "preserve-aspect" && !Pt(G(l), G(h), 0.2);
574
+ function shouldAnimatePositionOnly(c, L, R) {
575
+ return c === "position" || c === "preserve-aspect" && !isNear(aspectRatio(L), aspectRatio(R), .2);
608
576
  }
609
- function Zt(e) {
610
- return e !== e.root && e.scroll?.wasRoot;
577
+ function checkNodeWasScrollRoot(c) {
578
+ return c !== c.root && c.scroll?.wasRoot;
611
579
  }
612
- export {
613
- Ot as cleanDirtyNodes,
614
- Re as createProjectionNode,
615
- Q as mixAxis,
616
- qt as mixBox,
617
- Ft as propagateDirtyNodes
618
- };
580
+ export { cleanDirtyNodes, createProjectionNode, propagateDirtyNodes };