@btst/stack 1.1.1 → 1.1.2

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 (289) hide show
  1. package/README.md +1 -1
  2. package/dist/client/components/index.cjs +2 -2
  3. package/dist/client/components/index.mjs +2 -2
  4. package/dist/client/index.cjs +3 -3
  5. package/dist/client/index.mjs +3 -3
  6. package/dist/context/index.cjs +1 -1
  7. package/dist/context/index.mjs +1 -1
  8. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +825 -0
  9. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +814 -0
  10. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +763 -0
  11. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +751 -0
  12. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +375 -0
  13. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs +350 -0
  14. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +160 -0
  15. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +182 -0
  16. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +161 -0
  17. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +137 -0
  18. package/dist/node_modules/.pnpm/@radix-ui_number@1.1.1/node_modules/@radix-ui/number/dist/index.cjs +8 -0
  19. package/dist/node_modules/.pnpm/@radix-ui_number@1.1.1/node_modules/@radix-ui/number/dist/index.mjs +6 -0
  20. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.cjs +13 -0
  21. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.mjs +11 -0
  22. package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6/node_modules/@radix-ui/react-arrow/dist/index.cjs +42 -0
  23. package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6/node_modules/@radix-ui/react-arrow/dist/index.mjs +25 -0
  24. package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45/node_modules/@radix-ui/react-collection/dist/index.cjs +77 -0
  25. package/dist/node_modules/.pnpm/@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45/node_modules/@radix-ui/react-collection/dist/index.mjs +71 -0
  26. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +56 -0
  27. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +39 -0
  28. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +79 -0
  29. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.mjs +63 -0
  30. package/dist/node_modules/.pnpm/@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-direction/dist/index.cjs +27 -0
  31. package/dist/node_modules/.pnpm/@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-direction/dist/index.mjs +11 -0
  32. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +229 -0
  33. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs +212 -0
  34. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +46 -0
  35. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.mjs +30 -0
  36. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +224 -0
  37. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0/node_modules/@radix-ui/react-focus-scope/dist/index.mjs +208 -0
  38. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.cjs +31 -0
  39. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.mjs +15 -0
  40. package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c/node_modules/@radix-ui/react-popper/dist/index.cjs +308 -0
  41. package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c/node_modules/@radix-ui/react-popper/dist/index.mjs +284 -0
  42. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95/node_modules/@radix-ui/react-portal/dist/index.cjs +37 -0
  43. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95/node_modules/@radix-ui/react-portal/dist/index.mjs +18 -0
  44. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e/node_modules/@radix-ui/react-primitive/dist/index.cjs +61 -0
  45. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e/node_modules/@radix-ui/react-primitive/dist/index.mjs +43 -0
  46. package/dist/node_modules/.pnpm/@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07/node_modules/@radix-ui/react-select/dist/index.cjs +1198 -0
  47. package/dist/node_modules/.pnpm/@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07/node_modules/@radix-ui/react-select/dist/index.mjs +1154 -0
  48. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +28 -0
  49. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs +12 -0
  50. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +86 -0
  51. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +70 -0
  52. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +34 -0
  53. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs +18 -0
  54. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +23 -0
  55. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +7 -0
  56. package/dist/node_modules/.pnpm/@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-previous/dist/index.cjs +31 -0
  57. package/dist/node_modules/.pnpm/@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-previous/dist/index.mjs +15 -0
  58. package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-size/dist/index.cjs +56 -0
  59. package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0/node_modules/@radix-ui/react-use-size/dist/index.mjs +40 -0
  60. package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +51 -0
  61. package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs +34 -0
  62. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.cjs +139 -0
  63. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.mjs +137 -0
  64. package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.cjs +39 -0
  65. package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.mjs +37 -0
  66. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.cjs +43 -0
  67. package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.mjs +38 -0
  68. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.cjs +1671 -0
  69. package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.mjs +1669 -0
  70. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.cjs +10 -0
  71. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.mjs +8 -0
  72. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +74 -0
  73. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.mjs +56 -0
  74. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +15 -0
  75. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.mjs +10 -0
  76. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +34 -0
  77. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.mjs +31 -0
  78. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +25 -0
  79. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.mjs +9 -0
  80. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +178 -0
  81. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.mjs +160 -0
  82. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/UI.cjs +54 -0
  83. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/UI.mjs +38 -0
  84. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +23 -0
  85. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.mjs +21 -0
  86. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +113 -0
  87. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.mjs +110 -0
  88. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/medium.cjs +7 -0
  89. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/medium.mjs +5 -0
  90. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +9 -0
  91. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.mjs +7 -0
  92. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/component.cjs +21 -0
  93. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/component.mjs +19 -0
  94. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/hook.cjs +41 -0
  95. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/hook.mjs +25 -0
  96. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/singleton.cjs +53 -0
  97. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0/node_modules/react-style-singleton/dist/es2015/singleton.mjs +51 -0
  98. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.cjs +59 -0
  99. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs +56 -0
  100. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +26 -0
  101. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.mjs +24 -0
  102. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +64 -0
  103. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.mjs +48 -0
  104. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useRef.cjs +44 -0
  105. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useRef.mjs +42 -0
  106. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/use-sidecar/dist/es2015/exports.cjs +37 -0
  107. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/use-sidecar/dist/es2015/exports.mjs +21 -0
  108. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/use-sidecar/dist/es2015/medium.cjs +79 -0
  109. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0/node_modules/use-sidecar/dist/es2015/medium.mjs +77 -0
  110. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/image-field.cjs +3 -3
  111. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/image-field.mjs +3 -3
  112. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/post-forms.cjs +5 -5
  113. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/post-forms.mjs +5 -5
  114. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/tags-multiselect.cjs +2 -6
  115. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/tags-multiselect.mjs +1 -1
  116. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/form-page-skeleton.cjs +1 -1
  117. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/form-page-skeleton.mjs +1 -1
  118. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/list-page-skeleton.cjs +1 -1
  119. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/list-page-skeleton.mjs +1 -1
  120. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/page-header-skeleton.cjs +1 -1
  121. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/page-header-skeleton.mjs +1 -1
  122. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/post-card-skeleton.cjs +2 -2
  123. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/post-card-skeleton.mjs +2 -2
  124. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/post-page-skeleton.cjs +1 -1
  125. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/post-page-skeleton.mjs +1 -1
  126. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/post-page.internal.cjs +1 -1
  127. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/post-page.internal.mjs +1 -1
  128. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/empty-list.cjs +1 -1
  129. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/empty-list.mjs +1 -1
  130. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/on-this-page.cjs +1 -1
  131. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/on-this-page.mjs +1 -1
  132. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/post-card.cjs +2 -2
  133. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/post-card.mjs +2 -2
  134. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/post-navigation.cjs +1 -1
  135. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/post-navigation.mjs +1 -1
  136. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/posts-list.cjs +1 -1
  137. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/posts-list.mjs +1 -1
  138. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/recent-posts-carousel.cjs +1 -1
  139. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/recent-posts-carousel.mjs +1 -1
  140. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/search-modal.cjs +1 -1
  141. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/search-modal.mjs +1 -1
  142. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/tags-list.cjs +1 -1
  143. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/tags-list.mjs +1 -1
  144. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/hooks/blog-hooks.cjs +1 -1
  145. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/hooks/blog-hooks.mjs +1 -1
  146. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/plugin.cjs +1 -1
  147. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/plugin.mjs +1 -1
  148. package/dist/packages/ui/src/components/badge.cjs +42 -0
  149. package/dist/packages/ui/src/components/badge.mjs +39 -0
  150. package/dist/packages/ui/src/components/button.cjs +54 -0
  151. package/dist/packages/ui/src/components/button.mjs +51 -0
  152. package/dist/packages/ui/src/components/card.cjs +67 -0
  153. package/dist/packages/ui/src/components/card.mjs +61 -0
  154. package/dist/packages/ui/src/components/carousel.cjs +215 -0
  155. package/dist/packages/ui/src/components/carousel.mjs +195 -0
  156. package/dist/packages/ui/src/components/command.cjs +142 -0
  157. package/dist/packages/ui/src/components/command.mjs +134 -0
  158. package/dist/packages/ui/src/components/dialog.cjs +127 -0
  159. package/dist/packages/ui/src/components/dialog.mjs +105 -0
  160. package/dist/packages/ui/src/components/empty.cjs +76 -0
  161. package/dist/packages/ui/src/components/empty.mjs +71 -0
  162. package/dist/packages/ui/src/components/form.cjs +133 -0
  163. package/dist/packages/ui/src/components/form.mjs +110 -0
  164. package/dist/packages/ui/src/components/input.cjs +23 -0
  165. package/dist/packages/ui/src/components/input.mjs +21 -0
  166. package/dist/packages/ui/src/components/label.cjs +39 -0
  167. package/dist/packages/ui/src/components/label.mjs +23 -0
  168. package/dist/packages/ui/src/components/multi-select.cjs +555 -0
  169. package/dist/packages/ui/src/components/multi-select.mjs +540 -0
  170. package/dist/packages/ui/src/components/select.cjs +140 -0
  171. package/dist/packages/ui/src/components/select.mjs +132 -0
  172. package/dist/packages/ui/src/components/skeleton.cjs +17 -0
  173. package/dist/packages/ui/src/components/skeleton.mjs +15 -0
  174. package/dist/packages/ui/src/components/switch.cjs +48 -0
  175. package/dist/packages/ui/src/components/switch.mjs +32 -0
  176. package/dist/packages/ui/src/components/textarea.cjs +20 -0
  177. package/dist/packages/ui/src/components/textarea.mjs +18 -0
  178. package/dist/packages/ui/src/hooks/use-debounce.cjs +18 -0
  179. package/dist/packages/ui/src/hooks/use-debounce.mjs +16 -0
  180. package/dist/packages/ui/src/lib/utils.cjs +10 -0
  181. package/dist/packages/ui/src/lib/utils.mjs +8 -0
  182. package/dist/plugins/blog/api/index.cjs +1 -1
  183. package/dist/plugins/blog/api/index.d.cts +1 -1
  184. package/dist/plugins/blog/api/index.d.mts +1 -1
  185. package/dist/plugins/blog/api/index.d.ts +1 -1
  186. package/dist/plugins/blog/api/index.mjs +1 -1
  187. package/dist/plugins/blog/client/components/index.cjs +4 -4
  188. package/dist/plugins/blog/client/components/index.mjs +4 -4
  189. package/dist/plugins/blog/client/hooks/index.cjs +1 -1
  190. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  191. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  192. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  193. package/dist/plugins/blog/client/hooks/index.mjs +1 -1
  194. package/dist/plugins/blog/client/index.cjs +1 -1
  195. package/dist/plugins/blog/client/index.d.cts +1 -1
  196. package/dist/plugins/blog/client/index.d.mts +1 -1
  197. package/dist/plugins/blog/client/index.d.ts +1 -1
  198. package/dist/plugins/blog/client/index.mjs +1 -1
  199. package/dist/plugins/blog/query-keys.d.cts +2 -2
  200. package/dist/plugins/blog/query-keys.d.mts +2 -2
  201. package/dist/plugins/blog/query-keys.d.ts +2 -2
  202. package/dist/plugins/client/index.cjs +1 -1
  203. package/dist/plugins/client/index.mjs +1 -1
  204. package/package.json +5 -5
  205. package/dist/{client → packages/better-stack/src/client}/components/compose.cjs +0 -0
  206. package/dist/{client → packages/better-stack/src/client}/components/compose.mjs +0 -0
  207. package/dist/{client → packages/better-stack/src/client}/components/error-boundary.cjs +0 -0
  208. package/dist/{client → packages/better-stack/src/client}/components/error-boundary.mjs +0 -0
  209. package/dist/{client → packages/better-stack/src/client}/meta-utils.cjs +0 -0
  210. package/dist/{client → packages/better-stack/src/client}/meta-utils.mjs +0 -0
  211. package/dist/{client → packages/better-stack/src/client}/path-utils.cjs +0 -0
  212. package/dist/{client → packages/better-stack/src/client}/path-utils.mjs +0 -0
  213. package/dist/{client → packages/better-stack/src/client}/sitemap-utils.cjs +0 -0
  214. package/dist/{client → packages/better-stack/src/client}/sitemap-utils.mjs +0 -0
  215. package/dist/{context → packages/better-stack/src/context}/provider.cjs +0 -0
  216. package/dist/{context → packages/better-stack/src/context}/provider.mjs +0 -0
  217. package/dist/{plugins → packages/better-stack/src/plugins}/blog/api/plugin.cjs +0 -0
  218. package/dist/{plugins → packages/better-stack/src/plugins}/blog/api/plugin.mjs +0 -0
  219. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/markdown-editor.cjs +0 -0
  220. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/forms/markdown-editor.mjs +0 -0
  221. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/index.cjs +0 -0
  222. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/loading/index.mjs +0 -0
  223. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/404-page.cjs +0 -0
  224. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/404-page.mjs +0 -0
  225. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/edit-post-page.cjs +0 -0
  226. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/edit-post-page.internal.cjs +0 -0
  227. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/edit-post-page.internal.mjs +0 -0
  228. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/edit-post-page.mjs +0 -0
  229. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/home-page.cjs +0 -0
  230. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/home-page.internal.cjs +0 -0
  231. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/home-page.internal.mjs +0 -0
  232. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/home-page.mjs +0 -0
  233. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/new-post-page.cjs +0 -0
  234. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/new-post-page.internal.cjs +0 -0
  235. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/new-post-page.internal.mjs +0 -0
  236. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/new-post-page.mjs +0 -0
  237. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/post-page.cjs +0 -0
  238. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/post-page.mjs +0 -0
  239. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/tag-page.cjs +0 -0
  240. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/tag-page.internal.cjs +0 -0
  241. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/tag-page.internal.mjs +0 -0
  242. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/pages/tag-page.mjs +0 -0
  243. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/better-blog-attribution.cjs +0 -0
  244. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/better-blog-attribution.mjs +0 -0
  245. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/default-error.cjs +0 -0
  246. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/default-error.mjs +0 -0
  247. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/defaults.cjs +0 -0
  248. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/defaults.mjs +0 -0
  249. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/error-placeholder.cjs +0 -0
  250. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/error-placeholder.mjs +0 -0
  251. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/highlight-text.cjs +0 -0
  252. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/highlight-text.mjs +0 -0
  253. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/markdown-content.cjs +0 -0
  254. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/markdown-content.mjs +0 -0
  255. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-header.cjs +0 -0
  256. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-header.mjs +0 -0
  257. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-layout.cjs +0 -0
  258. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-layout.mjs +0 -0
  259. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-wrapper.cjs +0 -0
  260. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/page-wrapper.mjs +0 -0
  261. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/search-input.cjs +0 -0
  262. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/search-input.mjs +0 -0
  263. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/use-route-lifecycle.cjs +0 -0
  264. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/components/shared/use-route-lifecycle.mjs +0 -0
  265. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/hooks/use-debounce.cjs +0 -0
  266. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/hooks/use-debounce.mjs +0 -0
  267. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-card.cjs +0 -0
  268. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-card.mjs +0 -0
  269. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-common.cjs +0 -0
  270. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-common.mjs +0 -0
  271. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-forms.cjs +0 -0
  272. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-forms.mjs +0 -0
  273. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-list.cjs +0 -0
  274. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-list.mjs +0 -0
  275. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-post.cjs +0 -0
  276. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/blog-post.mjs +0 -0
  277. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/index.cjs +0 -0
  278. package/dist/{plugins → packages/better-stack/src/plugins}/blog/client/localization/index.mjs +0 -0
  279. package/dist/{plugins → packages/better-stack/src/plugins}/blog/db.cjs +0 -0
  280. package/dist/{plugins → packages/better-stack/src/plugins}/blog/db.mjs +0 -0
  281. package/dist/{plugins → packages/better-stack/src/plugins}/blog/schemas.cjs +0 -0
  282. package/dist/{plugins → packages/better-stack/src/plugins}/blog/schemas.mjs +0 -0
  283. package/dist/{plugins → packages/better-stack/src/plugins}/blog/utils.cjs +0 -0
  284. package/dist/{plugins → packages/better-stack/src/plugins}/blog/utils.mjs +0 -0
  285. package/dist/{plugins → packages/better-stack/src/plugins}/utils.cjs +0 -0
  286. package/dist/{plugins → packages/better-stack/src/plugins}/utils.mjs +0 -0
  287. package/dist/shared/{stack.CoPoHVfV.d.cts → stack.Cr2JoQdo.d.cts} +1 -1
  288. package/dist/shared/{stack.CoPoHVfV.d.mts → stack.Cr2JoQdo.d.mts} +1 -1
  289. package/dist/shared/{stack.CoPoHVfV.d.ts → stack.Cr2JoQdo.d.ts} +1 -1
@@ -0,0 +1,1671 @@
1
+ 'use strict';
2
+
3
+ function isNumber(subject) {
4
+ return typeof subject === 'number';
5
+ }
6
+ function isString(subject) {
7
+ return typeof subject === 'string';
8
+ }
9
+ function isBoolean(subject) {
10
+ return typeof subject === 'boolean';
11
+ }
12
+ function isObject(subject) {
13
+ return Object.prototype.toString.call(subject) === '[object Object]';
14
+ }
15
+ function mathAbs(n) {
16
+ return Math.abs(n);
17
+ }
18
+ function mathSign(n) {
19
+ return Math.sign(n);
20
+ }
21
+ function deltaAbs(valueB, valueA) {
22
+ return mathAbs(valueB - valueA);
23
+ }
24
+ function factorAbs(valueB, valueA) {
25
+ if (valueB === 0 || valueA === 0) return 0;
26
+ if (mathAbs(valueB) <= mathAbs(valueA)) return 0;
27
+ const diff = deltaAbs(mathAbs(valueB), mathAbs(valueA));
28
+ return mathAbs(diff / valueB);
29
+ }
30
+ function roundToTwoDecimals(num) {
31
+ return Math.round(num * 100) / 100;
32
+ }
33
+ function arrayKeys(array) {
34
+ return objectKeys(array).map(Number);
35
+ }
36
+ function arrayLast(array) {
37
+ return array[arrayLastIndex(array)];
38
+ }
39
+ function arrayLastIndex(array) {
40
+ return Math.max(0, array.length - 1);
41
+ }
42
+ function arrayIsLastIndex(array, index) {
43
+ return index === arrayLastIndex(array);
44
+ }
45
+ function arrayFromNumber(n, startAt = 0) {
46
+ return Array.from(Array(n), (_, i) => startAt + i);
47
+ }
48
+ function objectKeys(object) {
49
+ return Object.keys(object);
50
+ }
51
+ function objectsMergeDeep(objectA, objectB) {
52
+ return [objectA, objectB].reduce((mergedObjects, currentObject) => {
53
+ objectKeys(currentObject).forEach(key => {
54
+ const valueA = mergedObjects[key];
55
+ const valueB = currentObject[key];
56
+ const areObjects = isObject(valueA) && isObject(valueB);
57
+ mergedObjects[key] = areObjects ? objectsMergeDeep(valueA, valueB) : valueB;
58
+ });
59
+ return mergedObjects;
60
+ }, {});
61
+ }
62
+ function isMouseEvent(evt, ownerWindow) {
63
+ return typeof ownerWindow.MouseEvent !== 'undefined' && evt instanceof ownerWindow.MouseEvent;
64
+ }
65
+
66
+ function Alignment(align, viewSize) {
67
+ const predefined = {
68
+ start,
69
+ center,
70
+ end
71
+ };
72
+ function start() {
73
+ return 0;
74
+ }
75
+ function center(n) {
76
+ return end(n) / 2;
77
+ }
78
+ function end(n) {
79
+ return viewSize - n;
80
+ }
81
+ function measure(n, index) {
82
+ if (isString(align)) return predefined[align](n);
83
+ return align(viewSize, n, index);
84
+ }
85
+ const self = {
86
+ measure
87
+ };
88
+ return self;
89
+ }
90
+
91
+ function EventStore() {
92
+ let listeners = [];
93
+ function add(node, type, handler, options = {
94
+ passive: true
95
+ }) {
96
+ let removeListener;
97
+ if ('addEventListener' in node) {
98
+ node.addEventListener(type, handler, options);
99
+ removeListener = () => node.removeEventListener(type, handler, options);
100
+ } else {
101
+ const legacyMediaQueryList = node;
102
+ legacyMediaQueryList.addListener(handler);
103
+ removeListener = () => legacyMediaQueryList.removeListener(handler);
104
+ }
105
+ listeners.push(removeListener);
106
+ return self;
107
+ }
108
+ function clear() {
109
+ listeners = listeners.filter(remove => remove());
110
+ }
111
+ const self = {
112
+ add,
113
+ clear
114
+ };
115
+ return self;
116
+ }
117
+
118
+ function Animations(ownerDocument, ownerWindow, update, render) {
119
+ const documentVisibleHandler = EventStore();
120
+ const fixedTimeStep = 1000 / 60;
121
+ let lastTimeStamp = null;
122
+ let accumulatedTime = 0;
123
+ let animationId = 0;
124
+ function init() {
125
+ documentVisibleHandler.add(ownerDocument, 'visibilitychange', () => {
126
+ if (ownerDocument.hidden) reset();
127
+ });
128
+ }
129
+ function destroy() {
130
+ stop();
131
+ documentVisibleHandler.clear();
132
+ }
133
+ function animate(timeStamp) {
134
+ if (!animationId) return;
135
+ if (!lastTimeStamp) {
136
+ lastTimeStamp = timeStamp;
137
+ update();
138
+ update();
139
+ }
140
+ const timeElapsed = timeStamp - lastTimeStamp;
141
+ lastTimeStamp = timeStamp;
142
+ accumulatedTime += timeElapsed;
143
+ while (accumulatedTime >= fixedTimeStep) {
144
+ update();
145
+ accumulatedTime -= fixedTimeStep;
146
+ }
147
+ const alpha = accumulatedTime / fixedTimeStep;
148
+ render(alpha);
149
+ if (animationId) {
150
+ animationId = ownerWindow.requestAnimationFrame(animate);
151
+ }
152
+ }
153
+ function start() {
154
+ if (animationId) return;
155
+ animationId = ownerWindow.requestAnimationFrame(animate);
156
+ }
157
+ function stop() {
158
+ ownerWindow.cancelAnimationFrame(animationId);
159
+ lastTimeStamp = null;
160
+ accumulatedTime = 0;
161
+ animationId = 0;
162
+ }
163
+ function reset() {
164
+ lastTimeStamp = null;
165
+ accumulatedTime = 0;
166
+ }
167
+ const self = {
168
+ init,
169
+ destroy,
170
+ start,
171
+ stop,
172
+ update,
173
+ render
174
+ };
175
+ return self;
176
+ }
177
+
178
+ function Axis(axis, contentDirection) {
179
+ const isRightToLeft = contentDirection === 'rtl';
180
+ const isVertical = axis === 'y';
181
+ const scroll = isVertical ? 'y' : 'x';
182
+ const cross = isVertical ? 'x' : 'y';
183
+ const sign = !isVertical && isRightToLeft ? -1 : 1;
184
+ const startEdge = getStartEdge();
185
+ const endEdge = getEndEdge();
186
+ function measureSize(nodeRect) {
187
+ const {
188
+ height,
189
+ width
190
+ } = nodeRect;
191
+ return isVertical ? height : width;
192
+ }
193
+ function getStartEdge() {
194
+ if (isVertical) return 'top';
195
+ return isRightToLeft ? 'right' : 'left';
196
+ }
197
+ function getEndEdge() {
198
+ if (isVertical) return 'bottom';
199
+ return isRightToLeft ? 'left' : 'right';
200
+ }
201
+ function direction(n) {
202
+ return n * sign;
203
+ }
204
+ const self = {
205
+ scroll,
206
+ cross,
207
+ startEdge,
208
+ endEdge,
209
+ measureSize,
210
+ direction
211
+ };
212
+ return self;
213
+ }
214
+
215
+ function Limit(min = 0, max = 0) {
216
+ const length = mathAbs(min - max);
217
+ function reachedMin(n) {
218
+ return n < min;
219
+ }
220
+ function reachedMax(n) {
221
+ return n > max;
222
+ }
223
+ function reachedAny(n) {
224
+ return reachedMin(n) || reachedMax(n);
225
+ }
226
+ function constrain(n) {
227
+ if (!reachedAny(n)) return n;
228
+ return reachedMin(n) ? min : max;
229
+ }
230
+ function removeOffset(n) {
231
+ if (!length) return n;
232
+ return n - length * Math.ceil((n - max) / length);
233
+ }
234
+ const self = {
235
+ length,
236
+ max,
237
+ min,
238
+ constrain,
239
+ reachedAny,
240
+ reachedMax,
241
+ reachedMin,
242
+ removeOffset
243
+ };
244
+ return self;
245
+ }
246
+
247
+ function Counter(max, start, loop) {
248
+ const {
249
+ constrain
250
+ } = Limit(0, max);
251
+ const loopEnd = max + 1;
252
+ let counter = withinLimit(start);
253
+ function withinLimit(n) {
254
+ return !loop ? constrain(n) : mathAbs((loopEnd + n) % loopEnd);
255
+ }
256
+ function get() {
257
+ return counter;
258
+ }
259
+ function set(n) {
260
+ counter = withinLimit(n);
261
+ return self;
262
+ }
263
+ function add(n) {
264
+ return clone().set(get() + n);
265
+ }
266
+ function clone() {
267
+ return Counter(max, get(), loop);
268
+ }
269
+ const self = {
270
+ get,
271
+ set,
272
+ add,
273
+ clone
274
+ };
275
+ return self;
276
+ }
277
+
278
+ function DragHandler(axis, rootNode, ownerDocument, ownerWindow, target, dragTracker, location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, baseFriction, watchDrag) {
279
+ const {
280
+ cross: crossAxis,
281
+ direction
282
+ } = axis;
283
+ const focusNodes = ['INPUT', 'SELECT', 'TEXTAREA'];
284
+ const nonPassiveEvent = {
285
+ passive: false
286
+ };
287
+ const initEvents = EventStore();
288
+ const dragEvents = EventStore();
289
+ const goToNextThreshold = Limit(50, 225).constrain(percentOfView.measure(20));
290
+ const snapForceBoost = {
291
+ mouse: 300,
292
+ touch: 400
293
+ };
294
+ const freeForceBoost = {
295
+ mouse: 500,
296
+ touch: 600
297
+ };
298
+ const baseSpeed = dragFree ? 43 : 25;
299
+ let isMoving = false;
300
+ let startScroll = 0;
301
+ let startCross = 0;
302
+ let pointerIsDown = false;
303
+ let preventScroll = false;
304
+ let preventClick = false;
305
+ let isMouse = false;
306
+ function init(emblaApi) {
307
+ if (!watchDrag) return;
308
+ function downIfAllowed(evt) {
309
+ if (isBoolean(watchDrag) || watchDrag(emblaApi, evt)) down(evt);
310
+ }
311
+ const node = rootNode;
312
+ initEvents.add(node, 'dragstart', evt => evt.preventDefault(), nonPassiveEvent).add(node, 'touchmove', () => undefined, nonPassiveEvent).add(node, 'touchend', () => undefined).add(node, 'touchstart', downIfAllowed).add(node, 'mousedown', downIfAllowed).add(node, 'touchcancel', up).add(node, 'contextmenu', up).add(node, 'click', click, true);
313
+ }
314
+ function destroy() {
315
+ initEvents.clear();
316
+ dragEvents.clear();
317
+ }
318
+ function addDragEvents() {
319
+ const node = isMouse ? ownerDocument : rootNode;
320
+ dragEvents.add(node, 'touchmove', move, nonPassiveEvent).add(node, 'touchend', up).add(node, 'mousemove', move, nonPassiveEvent).add(node, 'mouseup', up);
321
+ }
322
+ function isFocusNode(node) {
323
+ const nodeName = node.nodeName || '';
324
+ return focusNodes.includes(nodeName);
325
+ }
326
+ function forceBoost() {
327
+ const boost = dragFree ? freeForceBoost : snapForceBoost;
328
+ const type = isMouse ? 'mouse' : 'touch';
329
+ return boost[type];
330
+ }
331
+ function allowedForce(force, targetChanged) {
332
+ const next = index.add(mathSign(force) * -1);
333
+ const baseForce = scrollTarget.byDistance(force, !dragFree).distance;
334
+ if (dragFree || mathAbs(force) < goToNextThreshold) return baseForce;
335
+ if (skipSnaps && targetChanged) return baseForce * 0.5;
336
+ return scrollTarget.byIndex(next.get(), 0).distance;
337
+ }
338
+ function down(evt) {
339
+ const isMouseEvt = isMouseEvent(evt, ownerWindow);
340
+ isMouse = isMouseEvt;
341
+ preventClick = dragFree && isMouseEvt && !evt.buttons && isMoving;
342
+ isMoving = deltaAbs(target.get(), location.get()) >= 2;
343
+ if (isMouseEvt && evt.button !== 0) return;
344
+ if (isFocusNode(evt.target)) return;
345
+ pointerIsDown = true;
346
+ dragTracker.pointerDown(evt);
347
+ scrollBody.useFriction(0).useDuration(0);
348
+ target.set(location);
349
+ addDragEvents();
350
+ startScroll = dragTracker.readPoint(evt);
351
+ startCross = dragTracker.readPoint(evt, crossAxis);
352
+ eventHandler.emit('pointerDown');
353
+ }
354
+ function move(evt) {
355
+ const isTouchEvt = !isMouseEvent(evt, ownerWindow);
356
+ if (isTouchEvt && evt.touches.length >= 2) return up(evt);
357
+ const lastScroll = dragTracker.readPoint(evt);
358
+ const lastCross = dragTracker.readPoint(evt, crossAxis);
359
+ const diffScroll = deltaAbs(lastScroll, startScroll);
360
+ const diffCross = deltaAbs(lastCross, startCross);
361
+ if (!preventScroll && !isMouse) {
362
+ if (!evt.cancelable) return up(evt);
363
+ preventScroll = diffScroll > diffCross;
364
+ if (!preventScroll) return up(evt);
365
+ }
366
+ const diff = dragTracker.pointerMove(evt);
367
+ if (diffScroll > dragThreshold) preventClick = true;
368
+ scrollBody.useFriction(0.3).useDuration(0.75);
369
+ animation.start();
370
+ target.add(direction(diff));
371
+ evt.preventDefault();
372
+ }
373
+ function up(evt) {
374
+ const currentLocation = scrollTarget.byDistance(0, false);
375
+ const targetChanged = currentLocation.index !== index.get();
376
+ const rawForce = dragTracker.pointerUp(evt) * forceBoost();
377
+ const force = allowedForce(direction(rawForce), targetChanged);
378
+ const forceFactor = factorAbs(rawForce, force);
379
+ const speed = baseSpeed - 10 * forceFactor;
380
+ const friction = baseFriction + forceFactor / 50;
381
+ preventScroll = false;
382
+ pointerIsDown = false;
383
+ dragEvents.clear();
384
+ scrollBody.useDuration(speed).useFriction(friction);
385
+ scrollTo.distance(force, !dragFree);
386
+ isMouse = false;
387
+ eventHandler.emit('pointerUp');
388
+ }
389
+ function click(evt) {
390
+ if (preventClick) {
391
+ evt.stopPropagation();
392
+ evt.preventDefault();
393
+ preventClick = false;
394
+ }
395
+ }
396
+ function pointerDown() {
397
+ return pointerIsDown;
398
+ }
399
+ const self = {
400
+ init,
401
+ destroy,
402
+ pointerDown
403
+ };
404
+ return self;
405
+ }
406
+
407
+ function DragTracker(axis, ownerWindow) {
408
+ const logInterval = 170;
409
+ let startEvent;
410
+ let lastEvent;
411
+ function readTime(evt) {
412
+ return evt.timeStamp;
413
+ }
414
+ function readPoint(evt, evtAxis) {
415
+ const property = evtAxis || axis.scroll;
416
+ const coord = `client${property === 'x' ? 'X' : 'Y'}`;
417
+ return (isMouseEvent(evt, ownerWindow) ? evt : evt.touches[0])[coord];
418
+ }
419
+ function pointerDown(evt) {
420
+ startEvent = evt;
421
+ lastEvent = evt;
422
+ return readPoint(evt);
423
+ }
424
+ function pointerMove(evt) {
425
+ const diff = readPoint(evt) - readPoint(lastEvent);
426
+ const expired = readTime(evt) - readTime(startEvent) > logInterval;
427
+ lastEvent = evt;
428
+ if (expired) startEvent = evt;
429
+ return diff;
430
+ }
431
+ function pointerUp(evt) {
432
+ if (!startEvent || !lastEvent) return 0;
433
+ const diffDrag = readPoint(lastEvent) - readPoint(startEvent);
434
+ const diffTime = readTime(evt) - readTime(startEvent);
435
+ const expired = readTime(evt) - readTime(lastEvent) > logInterval;
436
+ const force = diffDrag / diffTime;
437
+ const isFlick = diffTime && !expired && mathAbs(force) > 0.1;
438
+ return isFlick ? force : 0;
439
+ }
440
+ const self = {
441
+ pointerDown,
442
+ pointerMove,
443
+ pointerUp,
444
+ readPoint
445
+ };
446
+ return self;
447
+ }
448
+
449
+ function NodeRects() {
450
+ function measure(node) {
451
+ const {
452
+ offsetTop,
453
+ offsetLeft,
454
+ offsetWidth,
455
+ offsetHeight
456
+ } = node;
457
+ const offset = {
458
+ top: offsetTop,
459
+ right: offsetLeft + offsetWidth,
460
+ bottom: offsetTop + offsetHeight,
461
+ left: offsetLeft,
462
+ width: offsetWidth,
463
+ height: offsetHeight
464
+ };
465
+ return offset;
466
+ }
467
+ const self = {
468
+ measure
469
+ };
470
+ return self;
471
+ }
472
+
473
+ function PercentOfView(viewSize) {
474
+ function measure(n) {
475
+ return viewSize * (n / 100);
476
+ }
477
+ const self = {
478
+ measure
479
+ };
480
+ return self;
481
+ }
482
+
483
+ function ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects) {
484
+ const observeNodes = [container].concat(slides);
485
+ let resizeObserver;
486
+ let containerSize;
487
+ let slideSizes = [];
488
+ let destroyed = false;
489
+ function readSize(node) {
490
+ return axis.measureSize(nodeRects.measure(node));
491
+ }
492
+ function init(emblaApi) {
493
+ if (!watchResize) return;
494
+ containerSize = readSize(container);
495
+ slideSizes = slides.map(readSize);
496
+ function defaultCallback(entries) {
497
+ for (const entry of entries) {
498
+ if (destroyed) return;
499
+ const isContainer = entry.target === container;
500
+ const slideIndex = slides.indexOf(entry.target);
501
+ const lastSize = isContainer ? containerSize : slideSizes[slideIndex];
502
+ const newSize = readSize(isContainer ? container : slides[slideIndex]);
503
+ const diffSize = mathAbs(newSize - lastSize);
504
+ if (diffSize >= 0.5) {
505
+ emblaApi.reInit();
506
+ eventHandler.emit('resize');
507
+ break;
508
+ }
509
+ }
510
+ }
511
+ resizeObserver = new ResizeObserver(entries => {
512
+ if (isBoolean(watchResize) || watchResize(emblaApi, entries)) {
513
+ defaultCallback(entries);
514
+ }
515
+ });
516
+ ownerWindow.requestAnimationFrame(() => {
517
+ observeNodes.forEach(node => resizeObserver.observe(node));
518
+ });
519
+ }
520
+ function destroy() {
521
+ destroyed = true;
522
+ if (resizeObserver) resizeObserver.disconnect();
523
+ }
524
+ const self = {
525
+ init,
526
+ destroy
527
+ };
528
+ return self;
529
+ }
530
+
531
+ function ScrollBody(location, offsetLocation, previousLocation, target, baseDuration, baseFriction) {
532
+ let scrollVelocity = 0;
533
+ let scrollDirection = 0;
534
+ let scrollDuration = baseDuration;
535
+ let scrollFriction = baseFriction;
536
+ let rawLocation = location.get();
537
+ let rawLocationPrevious = 0;
538
+ function seek() {
539
+ const displacement = target.get() - location.get();
540
+ const isInstant = !scrollDuration;
541
+ let scrollDistance = 0;
542
+ if (isInstant) {
543
+ scrollVelocity = 0;
544
+ previousLocation.set(target);
545
+ location.set(target);
546
+ scrollDistance = displacement;
547
+ } else {
548
+ previousLocation.set(location);
549
+ scrollVelocity += displacement / scrollDuration;
550
+ scrollVelocity *= scrollFriction;
551
+ rawLocation += scrollVelocity;
552
+ location.add(scrollVelocity);
553
+ scrollDistance = rawLocation - rawLocationPrevious;
554
+ }
555
+ scrollDirection = mathSign(scrollDistance);
556
+ rawLocationPrevious = rawLocation;
557
+ return self;
558
+ }
559
+ function settled() {
560
+ const diff = target.get() - offsetLocation.get();
561
+ return mathAbs(diff) < 0.001;
562
+ }
563
+ function duration() {
564
+ return scrollDuration;
565
+ }
566
+ function direction() {
567
+ return scrollDirection;
568
+ }
569
+ function velocity() {
570
+ return scrollVelocity;
571
+ }
572
+ function useBaseDuration() {
573
+ return useDuration(baseDuration);
574
+ }
575
+ function useBaseFriction() {
576
+ return useFriction(baseFriction);
577
+ }
578
+ function useDuration(n) {
579
+ scrollDuration = n;
580
+ return self;
581
+ }
582
+ function useFriction(n) {
583
+ scrollFriction = n;
584
+ return self;
585
+ }
586
+ const self = {
587
+ direction,
588
+ duration,
589
+ velocity,
590
+ seek,
591
+ settled,
592
+ useBaseFriction,
593
+ useBaseDuration,
594
+ useFriction,
595
+ useDuration
596
+ };
597
+ return self;
598
+ }
599
+
600
+ function ScrollBounds(limit, location, target, scrollBody, percentOfView) {
601
+ const pullBackThreshold = percentOfView.measure(10);
602
+ const edgeOffsetTolerance = percentOfView.measure(50);
603
+ const frictionLimit = Limit(0.1, 0.99);
604
+ let disabled = false;
605
+ function shouldConstrain() {
606
+ if (disabled) return false;
607
+ if (!limit.reachedAny(target.get())) return false;
608
+ if (!limit.reachedAny(location.get())) return false;
609
+ return true;
610
+ }
611
+ function constrain(pointerDown) {
612
+ if (!shouldConstrain()) return;
613
+ const edge = limit.reachedMin(location.get()) ? 'min' : 'max';
614
+ const diffToEdge = mathAbs(limit[edge] - location.get());
615
+ const diffToTarget = target.get() - location.get();
616
+ const friction = frictionLimit.constrain(diffToEdge / edgeOffsetTolerance);
617
+ target.subtract(diffToTarget * friction);
618
+ if (!pointerDown && mathAbs(diffToTarget) < pullBackThreshold) {
619
+ target.set(limit.constrain(target.get()));
620
+ scrollBody.useDuration(25).useBaseFriction();
621
+ }
622
+ }
623
+ function toggleActive(active) {
624
+ disabled = !active;
625
+ }
626
+ const self = {
627
+ shouldConstrain,
628
+ constrain,
629
+ toggleActive
630
+ };
631
+ return self;
632
+ }
633
+
634
+ function ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance) {
635
+ const scrollBounds = Limit(-contentSize + viewSize, 0);
636
+ const snapsBounded = measureBounded();
637
+ const scrollContainLimit = findScrollContainLimit();
638
+ const snapsContained = measureContained();
639
+ function usePixelTolerance(bound, snap) {
640
+ return deltaAbs(bound, snap) <= 1;
641
+ }
642
+ function findScrollContainLimit() {
643
+ const startSnap = snapsBounded[0];
644
+ const endSnap = arrayLast(snapsBounded);
645
+ const min = snapsBounded.lastIndexOf(startSnap);
646
+ const max = snapsBounded.indexOf(endSnap) + 1;
647
+ return Limit(min, max);
648
+ }
649
+ function measureBounded() {
650
+ return snapsAligned.map((snapAligned, index) => {
651
+ const {
652
+ min,
653
+ max
654
+ } = scrollBounds;
655
+ const snap = scrollBounds.constrain(snapAligned);
656
+ const isFirst = !index;
657
+ const isLast = arrayIsLastIndex(snapsAligned, index);
658
+ if (isFirst) return max;
659
+ if (isLast) return min;
660
+ if (usePixelTolerance(min, snap)) return min;
661
+ if (usePixelTolerance(max, snap)) return max;
662
+ return snap;
663
+ }).map(scrollBound => parseFloat(scrollBound.toFixed(3)));
664
+ }
665
+ function measureContained() {
666
+ if (contentSize <= viewSize + pixelTolerance) return [scrollBounds.max];
667
+ if (containScroll === 'keepSnaps') return snapsBounded;
668
+ const {
669
+ min,
670
+ max
671
+ } = scrollContainLimit;
672
+ return snapsBounded.slice(min, max);
673
+ }
674
+ const self = {
675
+ snapsContained,
676
+ scrollContainLimit
677
+ };
678
+ return self;
679
+ }
680
+
681
+ function ScrollLimit(contentSize, scrollSnaps, loop) {
682
+ const max = scrollSnaps[0];
683
+ const min = loop ? max - contentSize : arrayLast(scrollSnaps);
684
+ const limit = Limit(min, max);
685
+ const self = {
686
+ limit
687
+ };
688
+ return self;
689
+ }
690
+
691
+ function ScrollLooper(contentSize, limit, location, vectors) {
692
+ const jointSafety = 0.1;
693
+ const min = limit.min + jointSafety;
694
+ const max = limit.max + jointSafety;
695
+ const {
696
+ reachedMin,
697
+ reachedMax
698
+ } = Limit(min, max);
699
+ function shouldLoop(direction) {
700
+ if (direction === 1) return reachedMax(location.get());
701
+ if (direction === -1) return reachedMin(location.get());
702
+ return false;
703
+ }
704
+ function loop(direction) {
705
+ if (!shouldLoop(direction)) return;
706
+ const loopDistance = contentSize * (direction * -1);
707
+ vectors.forEach(v => v.add(loopDistance));
708
+ }
709
+ const self = {
710
+ loop
711
+ };
712
+ return self;
713
+ }
714
+
715
+ function ScrollProgress(limit) {
716
+ const {
717
+ max,
718
+ length
719
+ } = limit;
720
+ function get(n) {
721
+ const currentLocation = n - max;
722
+ return length ? currentLocation / -length : 0;
723
+ }
724
+ const self = {
725
+ get
726
+ };
727
+ return self;
728
+ }
729
+
730
+ function ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll) {
731
+ const {
732
+ startEdge,
733
+ endEdge
734
+ } = axis;
735
+ const {
736
+ groupSlides
737
+ } = slidesToScroll;
738
+ const alignments = measureSizes().map(alignment.measure);
739
+ const snaps = measureUnaligned();
740
+ const snapsAligned = measureAligned();
741
+ function measureSizes() {
742
+ return groupSlides(slideRects).map(rects => arrayLast(rects)[endEdge] - rects[0][startEdge]).map(mathAbs);
743
+ }
744
+ function measureUnaligned() {
745
+ return slideRects.map(rect => containerRect[startEdge] - rect[startEdge]).map(snap => -mathAbs(snap));
746
+ }
747
+ function measureAligned() {
748
+ return groupSlides(snaps).map(g => g[0]).map((snap, index) => snap + alignments[index]);
749
+ }
750
+ const self = {
751
+ snaps,
752
+ snapsAligned
753
+ };
754
+ return self;
755
+ }
756
+
757
+ function SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes) {
758
+ const {
759
+ groupSlides
760
+ } = slidesToScroll;
761
+ const {
762
+ min,
763
+ max
764
+ } = scrollContainLimit;
765
+ const slideRegistry = createSlideRegistry();
766
+ function createSlideRegistry() {
767
+ const groupedSlideIndexes = groupSlides(slideIndexes);
768
+ const doNotContain = !containSnaps || containScroll === 'keepSnaps';
769
+ if (scrollSnaps.length === 1) return [slideIndexes];
770
+ if (doNotContain) return groupedSlideIndexes;
771
+ return groupedSlideIndexes.slice(min, max).map((group, index, groups) => {
772
+ const isFirst = !index;
773
+ const isLast = arrayIsLastIndex(groups, index);
774
+ if (isFirst) {
775
+ const range = arrayLast(groups[0]) + 1;
776
+ return arrayFromNumber(range);
777
+ }
778
+ if (isLast) {
779
+ const range = arrayLastIndex(slideIndexes) - arrayLast(groups)[0] + 1;
780
+ return arrayFromNumber(range, arrayLast(groups)[0]);
781
+ }
782
+ return group;
783
+ });
784
+ }
785
+ const self = {
786
+ slideRegistry
787
+ };
788
+ return self;
789
+ }
790
+
791
+ function ScrollTarget(loop, scrollSnaps, contentSize, limit, targetVector) {
792
+ const {
793
+ reachedAny,
794
+ removeOffset,
795
+ constrain
796
+ } = limit;
797
+ function minDistance(distances) {
798
+ return distances.concat().sort((a, b) => mathAbs(a) - mathAbs(b))[0];
799
+ }
800
+ function findTargetSnap(target) {
801
+ const distance = loop ? removeOffset(target) : constrain(target);
802
+ const ascDiffsToSnaps = scrollSnaps.map((snap, index) => ({
803
+ diff: shortcut(snap - distance, 0),
804
+ index
805
+ })).sort((d1, d2) => mathAbs(d1.diff) - mathAbs(d2.diff));
806
+ const {
807
+ index
808
+ } = ascDiffsToSnaps[0];
809
+ return {
810
+ index,
811
+ distance
812
+ };
813
+ }
814
+ function shortcut(target, direction) {
815
+ const targets = [target, target + contentSize, target - contentSize];
816
+ if (!loop) return target;
817
+ if (!direction) return minDistance(targets);
818
+ const matchingTargets = targets.filter(t => mathSign(t) === direction);
819
+ if (matchingTargets.length) return minDistance(matchingTargets);
820
+ return arrayLast(targets) - contentSize;
821
+ }
822
+ function byIndex(index, direction) {
823
+ const diffToSnap = scrollSnaps[index] - targetVector.get();
824
+ const distance = shortcut(diffToSnap, direction);
825
+ return {
826
+ index,
827
+ distance
828
+ };
829
+ }
830
+ function byDistance(distance, snap) {
831
+ const target = targetVector.get() + distance;
832
+ const {
833
+ index,
834
+ distance: targetSnapDistance
835
+ } = findTargetSnap(target);
836
+ const reachedBound = !loop && reachedAny(target);
837
+ if (!snap || reachedBound) return {
838
+ index,
839
+ distance
840
+ };
841
+ const diffToSnap = scrollSnaps[index] - targetSnapDistance;
842
+ const snapDistance = distance + shortcut(diffToSnap, 0);
843
+ return {
844
+ index,
845
+ distance: snapDistance
846
+ };
847
+ }
848
+ const self = {
849
+ byDistance,
850
+ byIndex,
851
+ shortcut
852
+ };
853
+ return self;
854
+ }
855
+
856
+ function ScrollTo(animation, indexCurrent, indexPrevious, scrollBody, scrollTarget, targetVector, eventHandler) {
857
+ function scrollTo(target) {
858
+ const distanceDiff = target.distance;
859
+ const indexDiff = target.index !== indexCurrent.get();
860
+ targetVector.add(distanceDiff);
861
+ if (distanceDiff) {
862
+ if (scrollBody.duration()) {
863
+ animation.start();
864
+ } else {
865
+ animation.update();
866
+ animation.render(1);
867
+ animation.update();
868
+ }
869
+ }
870
+ if (indexDiff) {
871
+ indexPrevious.set(indexCurrent.get());
872
+ indexCurrent.set(target.index);
873
+ eventHandler.emit('select');
874
+ }
875
+ }
876
+ function distance(n, snap) {
877
+ const target = scrollTarget.byDistance(n, snap);
878
+ scrollTo(target);
879
+ }
880
+ function index(n, direction) {
881
+ const targetIndex = indexCurrent.clone().set(n);
882
+ const target = scrollTarget.byIndex(targetIndex.get(), direction);
883
+ scrollTo(target);
884
+ }
885
+ const self = {
886
+ distance,
887
+ index
888
+ };
889
+ return self;
890
+ }
891
+
892
+ function SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus) {
893
+ const focusListenerOptions = {
894
+ passive: true,
895
+ capture: true
896
+ };
897
+ let lastTabPressTime = 0;
898
+ function init(emblaApi) {
899
+ if (!watchFocus) return;
900
+ function defaultCallback(index) {
901
+ const nowTime = new Date().getTime();
902
+ const diffTime = nowTime - lastTabPressTime;
903
+ if (diffTime > 10) return;
904
+ eventHandler.emit('slideFocusStart');
905
+ root.scrollLeft = 0;
906
+ const group = slideRegistry.findIndex(group => group.includes(index));
907
+ if (!isNumber(group)) return;
908
+ scrollBody.useDuration(0);
909
+ scrollTo.index(group, 0);
910
+ eventHandler.emit('slideFocus');
911
+ }
912
+ eventStore.add(document, 'keydown', registerTabPress, false);
913
+ slides.forEach((slide, slideIndex) => {
914
+ eventStore.add(slide, 'focus', evt => {
915
+ if (isBoolean(watchFocus) || watchFocus(emblaApi, evt)) {
916
+ defaultCallback(slideIndex);
917
+ }
918
+ }, focusListenerOptions);
919
+ });
920
+ }
921
+ function registerTabPress(event) {
922
+ if (event.code === 'Tab') lastTabPressTime = new Date().getTime();
923
+ }
924
+ const self = {
925
+ init
926
+ };
927
+ return self;
928
+ }
929
+
930
+ function Vector1D(initialValue) {
931
+ let value = initialValue;
932
+ function get() {
933
+ return value;
934
+ }
935
+ function set(n) {
936
+ value = normalizeInput(n);
937
+ }
938
+ function add(n) {
939
+ value += normalizeInput(n);
940
+ }
941
+ function subtract(n) {
942
+ value -= normalizeInput(n);
943
+ }
944
+ function normalizeInput(n) {
945
+ return isNumber(n) ? n : n.get();
946
+ }
947
+ const self = {
948
+ get,
949
+ set,
950
+ add,
951
+ subtract
952
+ };
953
+ return self;
954
+ }
955
+
956
+ function Translate(axis, container) {
957
+ const translate = axis.scroll === 'x' ? x : y;
958
+ const containerStyle = container.style;
959
+ let previousTarget = null;
960
+ let disabled = false;
961
+ function x(n) {
962
+ return `translate3d(${n}px,0px,0px)`;
963
+ }
964
+ function y(n) {
965
+ return `translate3d(0px,${n}px,0px)`;
966
+ }
967
+ function to(target) {
968
+ if (disabled) return;
969
+ const newTarget = roundToTwoDecimals(axis.direction(target));
970
+ if (newTarget === previousTarget) return;
971
+ containerStyle.transform = translate(newTarget);
972
+ previousTarget = newTarget;
973
+ }
974
+ function toggleActive(active) {
975
+ disabled = !active;
976
+ }
977
+ function clear() {
978
+ if (disabled) return;
979
+ containerStyle.transform = '';
980
+ if (!container.getAttribute('style')) container.removeAttribute('style');
981
+ }
982
+ const self = {
983
+ clear,
984
+ to,
985
+ toggleActive
986
+ };
987
+ return self;
988
+ }
989
+
990
+ function SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, location, slides) {
991
+ const roundingSafety = 0.5;
992
+ const ascItems = arrayKeys(slideSizesWithGaps);
993
+ const descItems = arrayKeys(slideSizesWithGaps).reverse();
994
+ const loopPoints = startPoints().concat(endPoints());
995
+ function removeSlideSizes(indexes, from) {
996
+ return indexes.reduce((a, i) => {
997
+ return a - slideSizesWithGaps[i];
998
+ }, from);
999
+ }
1000
+ function slidesInGap(indexes, gap) {
1001
+ return indexes.reduce((a, i) => {
1002
+ const remainingGap = removeSlideSizes(a, gap);
1003
+ return remainingGap > 0 ? a.concat([i]) : a;
1004
+ }, []);
1005
+ }
1006
+ function findSlideBounds(offset) {
1007
+ return snaps.map((snap, index) => ({
1008
+ start: snap - slideSizes[index] + roundingSafety + offset,
1009
+ end: snap + viewSize - roundingSafety + offset
1010
+ }));
1011
+ }
1012
+ function findLoopPoints(indexes, offset, isEndEdge) {
1013
+ const slideBounds = findSlideBounds(offset);
1014
+ return indexes.map(index => {
1015
+ const initial = isEndEdge ? 0 : -contentSize;
1016
+ const altered = isEndEdge ? contentSize : 0;
1017
+ const boundEdge = isEndEdge ? 'end' : 'start';
1018
+ const loopPoint = slideBounds[index][boundEdge];
1019
+ return {
1020
+ index,
1021
+ loopPoint,
1022
+ slideLocation: Vector1D(-1),
1023
+ translate: Translate(axis, slides[index]),
1024
+ target: () => location.get() > loopPoint ? initial : altered
1025
+ };
1026
+ });
1027
+ }
1028
+ function startPoints() {
1029
+ const gap = scrollSnaps[0];
1030
+ const indexes = slidesInGap(descItems, gap);
1031
+ return findLoopPoints(indexes, contentSize, false);
1032
+ }
1033
+ function endPoints() {
1034
+ const gap = viewSize - scrollSnaps[0] - 1;
1035
+ const indexes = slidesInGap(ascItems, gap);
1036
+ return findLoopPoints(indexes, -contentSize, true);
1037
+ }
1038
+ function canLoop() {
1039
+ return loopPoints.every(({
1040
+ index
1041
+ }) => {
1042
+ const otherIndexes = ascItems.filter(i => i !== index);
1043
+ return removeSlideSizes(otherIndexes, viewSize) <= 0.1;
1044
+ });
1045
+ }
1046
+ function loop() {
1047
+ loopPoints.forEach(loopPoint => {
1048
+ const {
1049
+ target,
1050
+ translate,
1051
+ slideLocation
1052
+ } = loopPoint;
1053
+ const shiftLocation = target();
1054
+ if (shiftLocation === slideLocation.get()) return;
1055
+ translate.to(shiftLocation);
1056
+ slideLocation.set(shiftLocation);
1057
+ });
1058
+ }
1059
+ function clear() {
1060
+ loopPoints.forEach(loopPoint => loopPoint.translate.clear());
1061
+ }
1062
+ const self = {
1063
+ canLoop,
1064
+ clear,
1065
+ loop,
1066
+ loopPoints
1067
+ };
1068
+ return self;
1069
+ }
1070
+
1071
+ function SlidesHandler(container, eventHandler, watchSlides) {
1072
+ let mutationObserver;
1073
+ let destroyed = false;
1074
+ function init(emblaApi) {
1075
+ if (!watchSlides) return;
1076
+ function defaultCallback(mutations) {
1077
+ for (const mutation of mutations) {
1078
+ if (mutation.type === 'childList') {
1079
+ emblaApi.reInit();
1080
+ eventHandler.emit('slidesChanged');
1081
+ break;
1082
+ }
1083
+ }
1084
+ }
1085
+ mutationObserver = new MutationObserver(mutations => {
1086
+ if (destroyed) return;
1087
+ if (isBoolean(watchSlides) || watchSlides(emblaApi, mutations)) {
1088
+ defaultCallback(mutations);
1089
+ }
1090
+ });
1091
+ mutationObserver.observe(container, {
1092
+ childList: true
1093
+ });
1094
+ }
1095
+ function destroy() {
1096
+ if (mutationObserver) mutationObserver.disconnect();
1097
+ destroyed = true;
1098
+ }
1099
+ const self = {
1100
+ init,
1101
+ destroy
1102
+ };
1103
+ return self;
1104
+ }
1105
+
1106
+ function SlidesInView(container, slides, eventHandler, threshold) {
1107
+ const intersectionEntryMap = {};
1108
+ let inViewCache = null;
1109
+ let notInViewCache = null;
1110
+ let intersectionObserver;
1111
+ let destroyed = false;
1112
+ function init() {
1113
+ intersectionObserver = new IntersectionObserver(entries => {
1114
+ if (destroyed) return;
1115
+ entries.forEach(entry => {
1116
+ const index = slides.indexOf(entry.target);
1117
+ intersectionEntryMap[index] = entry;
1118
+ });
1119
+ inViewCache = null;
1120
+ notInViewCache = null;
1121
+ eventHandler.emit('slidesInView');
1122
+ }, {
1123
+ root: container.parentElement,
1124
+ threshold
1125
+ });
1126
+ slides.forEach(slide => intersectionObserver.observe(slide));
1127
+ }
1128
+ function destroy() {
1129
+ if (intersectionObserver) intersectionObserver.disconnect();
1130
+ destroyed = true;
1131
+ }
1132
+ function createInViewList(inView) {
1133
+ return objectKeys(intersectionEntryMap).reduce((list, slideIndex) => {
1134
+ const index = parseInt(slideIndex);
1135
+ const {
1136
+ isIntersecting
1137
+ } = intersectionEntryMap[index];
1138
+ const inViewMatch = inView && isIntersecting;
1139
+ const notInViewMatch = !inView && !isIntersecting;
1140
+ if (inViewMatch || notInViewMatch) list.push(index);
1141
+ return list;
1142
+ }, []);
1143
+ }
1144
+ function get(inView = true) {
1145
+ if (inView && inViewCache) return inViewCache;
1146
+ if (!inView && notInViewCache) return notInViewCache;
1147
+ const slideIndexes = createInViewList(inView);
1148
+ if (inView) inViewCache = slideIndexes;
1149
+ if (!inView) notInViewCache = slideIndexes;
1150
+ return slideIndexes;
1151
+ }
1152
+ const self = {
1153
+ init,
1154
+ destroy,
1155
+ get
1156
+ };
1157
+ return self;
1158
+ }
1159
+
1160
+ function SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow) {
1161
+ const {
1162
+ measureSize,
1163
+ startEdge,
1164
+ endEdge
1165
+ } = axis;
1166
+ const withEdgeGap = slideRects[0] && readEdgeGap;
1167
+ const startGap = measureStartGap();
1168
+ const endGap = measureEndGap();
1169
+ const slideSizes = slideRects.map(measureSize);
1170
+ const slideSizesWithGaps = measureWithGaps();
1171
+ function measureStartGap() {
1172
+ if (!withEdgeGap) return 0;
1173
+ const slideRect = slideRects[0];
1174
+ return mathAbs(containerRect[startEdge] - slideRect[startEdge]);
1175
+ }
1176
+ function measureEndGap() {
1177
+ if (!withEdgeGap) return 0;
1178
+ const style = ownerWindow.getComputedStyle(arrayLast(slides));
1179
+ return parseFloat(style.getPropertyValue(`margin-${endEdge}`));
1180
+ }
1181
+ function measureWithGaps() {
1182
+ return slideRects.map((rect, index, rects) => {
1183
+ const isFirst = !index;
1184
+ const isLast = arrayIsLastIndex(rects, index);
1185
+ if (isFirst) return slideSizes[index] + startGap;
1186
+ if (isLast) return slideSizes[index] + endGap;
1187
+ return rects[index + 1][startEdge] - rect[startEdge];
1188
+ }).map(mathAbs);
1189
+ }
1190
+ const self = {
1191
+ slideSizes,
1192
+ slideSizesWithGaps,
1193
+ startGap,
1194
+ endGap
1195
+ };
1196
+ return self;
1197
+ }
1198
+
1199
+ function SlidesToScroll(axis, viewSize, slidesToScroll, loop, containerRect, slideRects, startGap, endGap, pixelTolerance) {
1200
+ const {
1201
+ startEdge,
1202
+ endEdge,
1203
+ direction
1204
+ } = axis;
1205
+ const groupByNumber = isNumber(slidesToScroll);
1206
+ function byNumber(array, groupSize) {
1207
+ return arrayKeys(array).filter(i => i % groupSize === 0).map(i => array.slice(i, i + groupSize));
1208
+ }
1209
+ function bySize(array) {
1210
+ if (!array.length) return [];
1211
+ return arrayKeys(array).reduce((groups, rectB, index) => {
1212
+ const rectA = arrayLast(groups) || 0;
1213
+ const isFirst = rectA === 0;
1214
+ const isLast = rectB === arrayLastIndex(array);
1215
+ const edgeA = containerRect[startEdge] - slideRects[rectA][startEdge];
1216
+ const edgeB = containerRect[startEdge] - slideRects[rectB][endEdge];
1217
+ const gapA = !loop && isFirst ? direction(startGap) : 0;
1218
+ const gapB = !loop && isLast ? direction(endGap) : 0;
1219
+ const chunkSize = mathAbs(edgeB - gapB - (edgeA + gapA));
1220
+ if (index && chunkSize > viewSize + pixelTolerance) groups.push(rectB);
1221
+ if (isLast) groups.push(array.length);
1222
+ return groups;
1223
+ }, []).map((currentSize, index, groups) => {
1224
+ const previousSize = Math.max(groups[index - 1] || 0);
1225
+ return array.slice(previousSize, currentSize);
1226
+ });
1227
+ }
1228
+ function groupSlides(array) {
1229
+ return groupByNumber ? byNumber(array, slidesToScroll) : bySize(array);
1230
+ }
1231
+ const self = {
1232
+ groupSlides
1233
+ };
1234
+ return self;
1235
+ }
1236
+
1237
+ function Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler) {
1238
+ // Options
1239
+ const {
1240
+ align,
1241
+ axis: scrollAxis,
1242
+ direction,
1243
+ startIndex,
1244
+ loop,
1245
+ duration,
1246
+ dragFree,
1247
+ dragThreshold,
1248
+ inViewThreshold,
1249
+ slidesToScroll: groupSlides,
1250
+ skipSnaps,
1251
+ containScroll,
1252
+ watchResize,
1253
+ watchSlides,
1254
+ watchDrag,
1255
+ watchFocus
1256
+ } = options;
1257
+ // Measurements
1258
+ const pixelTolerance = 2;
1259
+ const nodeRects = NodeRects();
1260
+ const containerRect = nodeRects.measure(container);
1261
+ const slideRects = slides.map(nodeRects.measure);
1262
+ const axis = Axis(scrollAxis, direction);
1263
+ const viewSize = axis.measureSize(containerRect);
1264
+ const percentOfView = PercentOfView(viewSize);
1265
+ const alignment = Alignment(align, viewSize);
1266
+ const containSnaps = !loop && !!containScroll;
1267
+ const readEdgeGap = loop || !!containScroll;
1268
+ const {
1269
+ slideSizes,
1270
+ slideSizesWithGaps,
1271
+ startGap,
1272
+ endGap
1273
+ } = SlideSizes(axis, containerRect, slideRects, slides, readEdgeGap, ownerWindow);
1274
+ const slidesToScroll = SlidesToScroll(axis, viewSize, groupSlides, loop, containerRect, slideRects, startGap, endGap, pixelTolerance);
1275
+ const {
1276
+ snaps,
1277
+ snapsAligned
1278
+ } = ScrollSnaps(axis, alignment, containerRect, slideRects, slidesToScroll);
1279
+ const contentSize = -arrayLast(snaps) + arrayLast(slideSizesWithGaps);
1280
+ const {
1281
+ snapsContained,
1282
+ scrollContainLimit
1283
+ } = ScrollContain(viewSize, contentSize, snapsAligned, containScroll, pixelTolerance);
1284
+ const scrollSnaps = containSnaps ? snapsContained : snapsAligned;
1285
+ const {
1286
+ limit
1287
+ } = ScrollLimit(contentSize, scrollSnaps, loop);
1288
+ // Indexes
1289
+ const index = Counter(arrayLastIndex(scrollSnaps), startIndex, loop);
1290
+ const indexPrevious = index.clone();
1291
+ const slideIndexes = arrayKeys(slides);
1292
+ // Animation
1293
+ const update = ({
1294
+ dragHandler,
1295
+ scrollBody,
1296
+ scrollBounds,
1297
+ options: {
1298
+ loop
1299
+ }
1300
+ }) => {
1301
+ if (!loop) scrollBounds.constrain(dragHandler.pointerDown());
1302
+ scrollBody.seek();
1303
+ };
1304
+ const render = ({
1305
+ scrollBody,
1306
+ translate,
1307
+ location,
1308
+ offsetLocation,
1309
+ previousLocation,
1310
+ scrollLooper,
1311
+ slideLooper,
1312
+ dragHandler,
1313
+ animation,
1314
+ eventHandler,
1315
+ scrollBounds,
1316
+ options: {
1317
+ loop
1318
+ }
1319
+ }, alpha) => {
1320
+ const shouldSettle = scrollBody.settled();
1321
+ const withinBounds = !scrollBounds.shouldConstrain();
1322
+ const hasSettled = loop ? shouldSettle : shouldSettle && withinBounds;
1323
+ const hasSettledAndIdle = hasSettled && !dragHandler.pointerDown();
1324
+ if (hasSettledAndIdle) animation.stop();
1325
+ const interpolatedLocation = location.get() * alpha + previousLocation.get() * (1 - alpha);
1326
+ offsetLocation.set(interpolatedLocation);
1327
+ if (loop) {
1328
+ scrollLooper.loop(scrollBody.direction());
1329
+ slideLooper.loop();
1330
+ }
1331
+ translate.to(offsetLocation.get());
1332
+ if (hasSettledAndIdle) eventHandler.emit('settle');
1333
+ if (!hasSettled) eventHandler.emit('scroll');
1334
+ };
1335
+ const animation = Animations(ownerDocument, ownerWindow, () => update(engine), alpha => render(engine, alpha));
1336
+ // Shared
1337
+ const friction = 0.68;
1338
+ const startLocation = scrollSnaps[index.get()];
1339
+ const location = Vector1D(startLocation);
1340
+ const previousLocation = Vector1D(startLocation);
1341
+ const offsetLocation = Vector1D(startLocation);
1342
+ const target = Vector1D(startLocation);
1343
+ const scrollBody = ScrollBody(location, offsetLocation, previousLocation, target, duration, friction);
1344
+ const scrollTarget = ScrollTarget(loop, scrollSnaps, contentSize, limit, target);
1345
+ const scrollTo = ScrollTo(animation, index, indexPrevious, scrollBody, scrollTarget, target, eventHandler);
1346
+ const scrollProgress = ScrollProgress(limit);
1347
+ const eventStore = EventStore();
1348
+ const slidesInView = SlidesInView(container, slides, eventHandler, inViewThreshold);
1349
+ const {
1350
+ slideRegistry
1351
+ } = SlideRegistry(containSnaps, containScroll, scrollSnaps, scrollContainLimit, slidesToScroll, slideIndexes);
1352
+ const slideFocus = SlideFocus(root, slides, slideRegistry, scrollTo, scrollBody, eventStore, eventHandler, watchFocus);
1353
+ // Engine
1354
+ const engine = {
1355
+ ownerDocument,
1356
+ ownerWindow,
1357
+ eventHandler,
1358
+ containerRect,
1359
+ slideRects,
1360
+ animation,
1361
+ axis,
1362
+ dragHandler: DragHandler(axis, root, ownerDocument, ownerWindow, target, DragTracker(axis, ownerWindow), location, animation, scrollTo, scrollBody, scrollTarget, index, eventHandler, percentOfView, dragFree, dragThreshold, skipSnaps, friction, watchDrag),
1363
+ eventStore,
1364
+ percentOfView,
1365
+ index,
1366
+ indexPrevious,
1367
+ limit,
1368
+ location,
1369
+ offsetLocation,
1370
+ previousLocation,
1371
+ options,
1372
+ resizeHandler: ResizeHandler(container, eventHandler, ownerWindow, slides, axis, watchResize, nodeRects),
1373
+ scrollBody,
1374
+ scrollBounds: ScrollBounds(limit, offsetLocation, target, scrollBody, percentOfView),
1375
+ scrollLooper: ScrollLooper(contentSize, limit, offsetLocation, [location, offsetLocation, previousLocation, target]),
1376
+ scrollProgress,
1377
+ scrollSnapList: scrollSnaps.map(scrollProgress.get),
1378
+ scrollSnaps,
1379
+ scrollTarget,
1380
+ scrollTo,
1381
+ slideLooper: SlideLooper(axis, viewSize, contentSize, slideSizes, slideSizesWithGaps, snaps, scrollSnaps, offsetLocation, slides),
1382
+ slideFocus,
1383
+ slidesHandler: SlidesHandler(container, eventHandler, watchSlides),
1384
+ slidesInView,
1385
+ slideIndexes,
1386
+ slideRegistry,
1387
+ slidesToScroll,
1388
+ target,
1389
+ translate: Translate(axis, container)
1390
+ };
1391
+ return engine;
1392
+ }
1393
+
1394
+ function EventHandler() {
1395
+ let listeners = {};
1396
+ let api;
1397
+ function init(emblaApi) {
1398
+ api = emblaApi;
1399
+ }
1400
+ function getListeners(evt) {
1401
+ return listeners[evt] || [];
1402
+ }
1403
+ function emit(evt) {
1404
+ getListeners(evt).forEach(e => e(api, evt));
1405
+ return self;
1406
+ }
1407
+ function on(evt, cb) {
1408
+ listeners[evt] = getListeners(evt).concat([cb]);
1409
+ return self;
1410
+ }
1411
+ function off(evt, cb) {
1412
+ listeners[evt] = getListeners(evt).filter(e => e !== cb);
1413
+ return self;
1414
+ }
1415
+ function clear() {
1416
+ listeners = {};
1417
+ }
1418
+ const self = {
1419
+ init,
1420
+ emit,
1421
+ off,
1422
+ on,
1423
+ clear
1424
+ };
1425
+ return self;
1426
+ }
1427
+
1428
+ const defaultOptions = {
1429
+ align: 'center',
1430
+ axis: 'x',
1431
+ container: null,
1432
+ slides: null,
1433
+ containScroll: 'trimSnaps',
1434
+ direction: 'ltr',
1435
+ slidesToScroll: 1,
1436
+ inViewThreshold: 0,
1437
+ breakpoints: {},
1438
+ dragFree: false,
1439
+ dragThreshold: 10,
1440
+ loop: false,
1441
+ skipSnaps: false,
1442
+ duration: 25,
1443
+ startIndex: 0,
1444
+ active: true,
1445
+ watchDrag: true,
1446
+ watchResize: true,
1447
+ watchSlides: true,
1448
+ watchFocus: true
1449
+ };
1450
+
1451
+ function OptionsHandler(ownerWindow) {
1452
+ function mergeOptions(optionsA, optionsB) {
1453
+ return objectsMergeDeep(optionsA, optionsB || {});
1454
+ }
1455
+ function optionsAtMedia(options) {
1456
+ const optionsAtMedia = options.breakpoints || {};
1457
+ const matchedMediaOptions = objectKeys(optionsAtMedia).filter(media => ownerWindow.matchMedia(media).matches).map(media => optionsAtMedia[media]).reduce((a, mediaOption) => mergeOptions(a, mediaOption), {});
1458
+ return mergeOptions(options, matchedMediaOptions);
1459
+ }
1460
+ function optionsMediaQueries(optionsList) {
1461
+ return optionsList.map(options => objectKeys(options.breakpoints || {})).reduce((acc, mediaQueries) => acc.concat(mediaQueries), []).map(ownerWindow.matchMedia);
1462
+ }
1463
+ const self = {
1464
+ mergeOptions,
1465
+ optionsAtMedia,
1466
+ optionsMediaQueries
1467
+ };
1468
+ return self;
1469
+ }
1470
+
1471
+ function PluginsHandler(optionsHandler) {
1472
+ let activePlugins = [];
1473
+ function init(emblaApi, plugins) {
1474
+ activePlugins = plugins.filter(({
1475
+ options
1476
+ }) => optionsHandler.optionsAtMedia(options).active !== false);
1477
+ activePlugins.forEach(plugin => plugin.init(emblaApi, optionsHandler));
1478
+ return plugins.reduce((map, plugin) => Object.assign(map, {
1479
+ [plugin.name]: plugin
1480
+ }), {});
1481
+ }
1482
+ function destroy() {
1483
+ activePlugins = activePlugins.filter(plugin => plugin.destroy());
1484
+ }
1485
+ const self = {
1486
+ init,
1487
+ destroy
1488
+ };
1489
+ return self;
1490
+ }
1491
+
1492
+ function EmblaCarousel(root, userOptions, userPlugins) {
1493
+ const ownerDocument = root.ownerDocument;
1494
+ const ownerWindow = ownerDocument.defaultView;
1495
+ const optionsHandler = OptionsHandler(ownerWindow);
1496
+ const pluginsHandler = PluginsHandler(optionsHandler);
1497
+ const mediaHandlers = EventStore();
1498
+ const eventHandler = EventHandler();
1499
+ const {
1500
+ mergeOptions,
1501
+ optionsAtMedia,
1502
+ optionsMediaQueries
1503
+ } = optionsHandler;
1504
+ const {
1505
+ on,
1506
+ off,
1507
+ emit
1508
+ } = eventHandler;
1509
+ const reInit = reActivate;
1510
+ let destroyed = false;
1511
+ let engine;
1512
+ let optionsBase = mergeOptions(defaultOptions, EmblaCarousel.globalOptions);
1513
+ let options = mergeOptions(optionsBase);
1514
+ let pluginList = [];
1515
+ let pluginApis;
1516
+ let container;
1517
+ let slides;
1518
+ function storeElements() {
1519
+ const {
1520
+ container: userContainer,
1521
+ slides: userSlides
1522
+ } = options;
1523
+ const customContainer = isString(userContainer) ? root.querySelector(userContainer) : userContainer;
1524
+ container = customContainer || root.children[0];
1525
+ const customSlides = isString(userSlides) ? container.querySelectorAll(userSlides) : userSlides;
1526
+ slides = [].slice.call(customSlides || container.children);
1527
+ }
1528
+ function createEngine(options) {
1529
+ const engine = Engine(root, container, slides, ownerDocument, ownerWindow, options, eventHandler);
1530
+ if (options.loop && !engine.slideLooper.canLoop()) {
1531
+ const optionsWithoutLoop = Object.assign({}, options, {
1532
+ loop: false
1533
+ });
1534
+ return createEngine(optionsWithoutLoop);
1535
+ }
1536
+ return engine;
1537
+ }
1538
+ function activate(withOptions, withPlugins) {
1539
+ if (destroyed) return;
1540
+ optionsBase = mergeOptions(optionsBase, withOptions);
1541
+ options = optionsAtMedia(optionsBase);
1542
+ pluginList = withPlugins || pluginList;
1543
+ storeElements();
1544
+ engine = createEngine(options);
1545
+ optionsMediaQueries([optionsBase, ...pluginList.map(({
1546
+ options
1547
+ }) => options)]).forEach(query => mediaHandlers.add(query, 'change', reActivate));
1548
+ if (!options.active) return;
1549
+ engine.translate.to(engine.location.get());
1550
+ engine.animation.init();
1551
+ engine.slidesInView.init();
1552
+ engine.slideFocus.init(self);
1553
+ engine.eventHandler.init(self);
1554
+ engine.resizeHandler.init(self);
1555
+ engine.slidesHandler.init(self);
1556
+ if (engine.options.loop) engine.slideLooper.loop();
1557
+ if (container.offsetParent && slides.length) engine.dragHandler.init(self);
1558
+ pluginApis = pluginsHandler.init(self, pluginList);
1559
+ }
1560
+ function reActivate(withOptions, withPlugins) {
1561
+ const startIndex = selectedScrollSnap();
1562
+ deActivate();
1563
+ activate(mergeOptions({
1564
+ startIndex
1565
+ }, withOptions), withPlugins);
1566
+ eventHandler.emit('reInit');
1567
+ }
1568
+ function deActivate() {
1569
+ engine.dragHandler.destroy();
1570
+ engine.eventStore.clear();
1571
+ engine.translate.clear();
1572
+ engine.slideLooper.clear();
1573
+ engine.resizeHandler.destroy();
1574
+ engine.slidesHandler.destroy();
1575
+ engine.slidesInView.destroy();
1576
+ engine.animation.destroy();
1577
+ pluginsHandler.destroy();
1578
+ mediaHandlers.clear();
1579
+ }
1580
+ function destroy() {
1581
+ if (destroyed) return;
1582
+ destroyed = true;
1583
+ mediaHandlers.clear();
1584
+ deActivate();
1585
+ eventHandler.emit('destroy');
1586
+ eventHandler.clear();
1587
+ }
1588
+ function scrollTo(index, jump, direction) {
1589
+ if (!options.active || destroyed) return;
1590
+ engine.scrollBody.useBaseFriction().useDuration(jump === true ? 0 : options.duration);
1591
+ engine.scrollTo.index(index, direction || 0);
1592
+ }
1593
+ function scrollNext(jump) {
1594
+ const next = engine.index.add(1).get();
1595
+ scrollTo(next, jump, -1);
1596
+ }
1597
+ function scrollPrev(jump) {
1598
+ const prev = engine.index.add(-1).get();
1599
+ scrollTo(prev, jump, 1);
1600
+ }
1601
+ function canScrollNext() {
1602
+ const next = engine.index.add(1).get();
1603
+ return next !== selectedScrollSnap();
1604
+ }
1605
+ function canScrollPrev() {
1606
+ const prev = engine.index.add(-1).get();
1607
+ return prev !== selectedScrollSnap();
1608
+ }
1609
+ function scrollSnapList() {
1610
+ return engine.scrollSnapList;
1611
+ }
1612
+ function scrollProgress() {
1613
+ return engine.scrollProgress.get(engine.offsetLocation.get());
1614
+ }
1615
+ function selectedScrollSnap() {
1616
+ return engine.index.get();
1617
+ }
1618
+ function previousScrollSnap() {
1619
+ return engine.indexPrevious.get();
1620
+ }
1621
+ function slidesInView() {
1622
+ return engine.slidesInView.get();
1623
+ }
1624
+ function slidesNotInView() {
1625
+ return engine.slidesInView.get(false);
1626
+ }
1627
+ function plugins() {
1628
+ return pluginApis;
1629
+ }
1630
+ function internalEngine() {
1631
+ return engine;
1632
+ }
1633
+ function rootNode() {
1634
+ return root;
1635
+ }
1636
+ function containerNode() {
1637
+ return container;
1638
+ }
1639
+ function slideNodes() {
1640
+ return slides;
1641
+ }
1642
+ const self = {
1643
+ canScrollNext,
1644
+ canScrollPrev,
1645
+ containerNode,
1646
+ internalEngine,
1647
+ destroy,
1648
+ off,
1649
+ on,
1650
+ emit,
1651
+ plugins,
1652
+ previousScrollSnap,
1653
+ reInit,
1654
+ rootNode,
1655
+ scrollNext,
1656
+ scrollPrev,
1657
+ scrollProgress,
1658
+ scrollSnapList,
1659
+ scrollTo,
1660
+ selectedScrollSnap,
1661
+ slideNodes,
1662
+ slidesInView,
1663
+ slidesNotInView
1664
+ };
1665
+ activate(userOptions, userPlugins);
1666
+ setTimeout(() => eventHandler.emit('init'), 0);
1667
+ return self;
1668
+ }
1669
+ EmblaCarousel.globalOptions = undefined;
1670
+
1671
+ module.exports = EmblaCarousel;