masoneffect 2.0.8 → 2.0.11

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 (182) hide show
  1. package/README.md +23 -25
  2. package/dist/core/index.d.ts +0 -1
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/scrollFadeIn/index.d.ts +4 -11
  5. package/dist/core/scrollFadeIn/index.d.ts.map +1 -1
  6. package/dist/core/typing/index.d.ts +2 -0
  7. package/dist/core/typing/index.d.ts.map +1 -1
  8. package/dist/core/utils/visibilityManager.d.ts +1 -0
  9. package/dist/core/utils/visibilityManager.d.ts.map +1 -1
  10. package/dist/count/core/index.d.ts +0 -1
  11. package/dist/count/core/index.d.ts.map +1 -1
  12. package/dist/count/core/scrollFadeIn/index.d.ts +4 -11
  13. package/dist/count/core/scrollFadeIn/index.d.ts.map +1 -1
  14. package/dist/count/core/typing/index.d.ts +2 -0
  15. package/dist/count/core/typing/index.d.ts.map +1 -1
  16. package/dist/count/core/utils/visibilityManager.d.ts +1 -0
  17. package/dist/count/core/utils/visibilityManager.d.ts.map +1 -1
  18. package/dist/count/index.cjs +1 -1
  19. package/dist/count/index.d.ts +0 -1
  20. package/dist/count/index.d.ts.map +1 -1
  21. package/dist/count/index.mjs +1 -1
  22. package/dist/count/react/index.d.ts +0 -1
  23. package/dist/count/react/index.d.ts.map +1 -1
  24. package/dist/count/react/scrollFadeIn/index.d.ts +0 -1
  25. package/dist/count/react/scrollFadeIn/index.d.ts.map +1 -1
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +0 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.mjs +1 -1
  30. package/dist/index.umd.min.js +1 -1
  31. package/dist/react/core/index.d.ts +0 -1
  32. package/dist/react/core/scrollFadeIn/index.d.ts +4 -11
  33. package/dist/react/core/typing/index.d.ts +2 -0
  34. package/dist/react/core/utils/visibilityManager.d.ts +1 -0
  35. package/dist/react/count/core/index.d.ts +0 -1
  36. package/dist/react/count/core/index.d.ts.map +1 -1
  37. package/dist/react/count/core/scrollFadeIn/index.d.ts +4 -11
  38. package/dist/react/count/core/scrollFadeIn/index.d.ts.map +1 -1
  39. package/dist/react/count/core/typing/index.d.ts +2 -0
  40. package/dist/react/count/core/typing/index.d.ts.map +1 -1
  41. package/dist/react/count/core/utils/visibilityManager.d.ts +1 -0
  42. package/dist/react/count/core/utils/visibilityManager.d.ts.map +1 -1
  43. package/dist/react/count/index.cjs +1 -1
  44. package/dist/react/count/index.d.ts +0 -1
  45. package/dist/react/count/index.d.ts.map +1 -1
  46. package/dist/react/count/index.mjs +1 -1
  47. package/dist/react/count/react/index.d.ts +0 -1
  48. package/dist/react/count/react/index.d.ts.map +1 -1
  49. package/dist/react/count/react/scrollFadeIn/index.d.ts +0 -1
  50. package/dist/react/count/react/scrollFadeIn/index.d.ts.map +1 -1
  51. package/dist/react/index.cjs +0 -4
  52. package/dist/react/index.d.ts.map +1 -1
  53. package/dist/react/index.mjs +1 -1
  54. package/dist/react/react/index.d.ts +0 -1
  55. package/dist/react/react/scrollFadeIn/index.d.ts +0 -1
  56. package/dist/react/scrollFadeIn/core/index.d.ts +0 -1
  57. package/dist/react/scrollFadeIn/core/index.d.ts.map +1 -1
  58. package/dist/react/scrollFadeIn/core/scrollFadeIn/index.d.ts +4 -11
  59. package/dist/react/scrollFadeIn/core/scrollFadeIn/index.d.ts.map +1 -1
  60. package/dist/react/scrollFadeIn/core/typing/index.d.ts +2 -0
  61. package/dist/react/scrollFadeIn/core/typing/index.d.ts.map +1 -1
  62. package/dist/react/scrollFadeIn/core/utils/visibilityManager.d.ts +1 -0
  63. package/dist/react/scrollFadeIn/core/utils/visibilityManager.d.ts.map +1 -1
  64. package/dist/react/scrollFadeIn/index.cjs +1 -1
  65. package/dist/react/scrollFadeIn/index.d.ts +0 -1
  66. package/dist/react/scrollFadeIn/index.d.ts.map +1 -1
  67. package/dist/react/scrollFadeIn/index.mjs +1 -1
  68. package/dist/react/scrollFadeIn/react/index.d.ts +0 -1
  69. package/dist/react/scrollFadeIn/react/index.d.ts.map +1 -1
  70. package/dist/react/scrollFadeIn/react/scrollFadeIn/index.d.ts +0 -1
  71. package/dist/react/scrollFadeIn/react/scrollFadeIn/index.d.ts.map +1 -1
  72. package/dist/react/textToParticle/core/index.d.ts +0 -1
  73. package/dist/react/textToParticle/core/index.d.ts.map +1 -1
  74. package/dist/react/textToParticle/core/scrollFadeIn/index.d.ts +4 -11
  75. package/dist/react/textToParticle/core/scrollFadeIn/index.d.ts.map +1 -1
  76. package/dist/react/textToParticle/core/typing/index.d.ts +2 -0
  77. package/dist/react/textToParticle/core/typing/index.d.ts.map +1 -1
  78. package/dist/react/textToParticle/core/utils/visibilityManager.d.ts +1 -0
  79. package/dist/react/textToParticle/core/utils/visibilityManager.d.ts.map +1 -1
  80. package/dist/react/textToParticle/index.cjs +1 -1
  81. package/dist/react/textToParticle/index.d.ts +0 -1
  82. package/dist/react/textToParticle/index.d.ts.map +1 -1
  83. package/dist/react/textToParticle/index.mjs +1 -1
  84. package/dist/react/textToParticle/react/index.d.ts +0 -1
  85. package/dist/react/textToParticle/react/index.d.ts.map +1 -1
  86. package/dist/react/textToParticle/react/scrollFadeIn/index.d.ts +0 -1
  87. package/dist/react/textToParticle/react/scrollFadeIn/index.d.ts.map +1 -1
  88. package/dist/react/typing/core/index.d.ts +0 -1
  89. package/dist/react/typing/core/index.d.ts.map +1 -1
  90. package/dist/react/typing/core/scrollFadeIn/index.d.ts +4 -11
  91. package/dist/react/typing/core/scrollFadeIn/index.d.ts.map +1 -1
  92. package/dist/react/typing/core/typing/index.d.ts +2 -0
  93. package/dist/react/typing/core/typing/index.d.ts.map +1 -1
  94. package/dist/react/typing/core/utils/visibilityManager.d.ts +1 -0
  95. package/dist/react/typing/core/utils/visibilityManager.d.ts.map +1 -1
  96. package/dist/react/typing/index.cjs +1 -1
  97. package/dist/react/typing/index.d.ts +0 -1
  98. package/dist/react/typing/index.d.ts.map +1 -1
  99. package/dist/react/typing/index.mjs +1 -1
  100. package/dist/react/typing/react/index.d.ts +0 -1
  101. package/dist/react/typing/react/index.d.ts.map +1 -1
  102. package/dist/react/typing/react/scrollFadeIn/index.d.ts +0 -1
  103. package/dist/react/typing/react/scrollFadeIn/index.d.ts.map +1 -1
  104. package/dist/scrollFadeIn/core/index.d.ts +0 -1
  105. package/dist/scrollFadeIn/core/index.d.ts.map +1 -1
  106. package/dist/scrollFadeIn/core/scrollFadeIn/index.d.ts +4 -11
  107. package/dist/scrollFadeIn/core/scrollFadeIn/index.d.ts.map +1 -1
  108. package/dist/scrollFadeIn/core/typing/index.d.ts +2 -0
  109. package/dist/scrollFadeIn/core/typing/index.d.ts.map +1 -1
  110. package/dist/scrollFadeIn/core/utils/visibilityManager.d.ts +1 -0
  111. package/dist/scrollFadeIn/core/utils/visibilityManager.d.ts.map +1 -1
  112. package/dist/scrollFadeIn/index.cjs +1 -1
  113. package/dist/scrollFadeIn/index.d.ts +0 -1
  114. package/dist/scrollFadeIn/index.d.ts.map +1 -1
  115. package/dist/scrollFadeIn/index.mjs +1 -1
  116. package/dist/scrollFadeIn/react/index.d.ts +0 -1
  117. package/dist/scrollFadeIn/react/index.d.ts.map +1 -1
  118. package/dist/scrollFadeIn/react/scrollFadeIn/index.d.ts +0 -1
  119. package/dist/scrollFadeIn/react/scrollFadeIn/index.d.ts.map +1 -1
  120. package/dist/svelte/count/index.cjs +1 -1
  121. package/dist/svelte/count/index.d.ts +8 -6
  122. package/dist/svelte/count/index.mjs +5 -1
  123. package/dist/svelte/index.cjs +1 -1
  124. package/dist/svelte/index.d.ts +8 -6
  125. package/dist/svelte/index.mjs +88 -27
  126. package/dist/svelte/scrollFadeIn/index.cjs +1 -1
  127. package/dist/svelte/scrollFadeIn/index.d.ts +8 -6
  128. package/dist/svelte/scrollFadeIn/index.mjs +35 -24
  129. package/dist/svelte/textToParticle/index.cjs +1 -1
  130. package/dist/svelte/textToParticle/index.d.ts +8 -6
  131. package/dist/svelte/textToParticle/index.mjs +5 -1
  132. package/dist/svelte/typing/index.cjs +1 -1
  133. package/dist/svelte/typing/index.d.ts +8 -6
  134. package/dist/svelte/typing/index.mjs +56 -2
  135. package/dist/textToParticle/core/index.d.ts +0 -1
  136. package/dist/textToParticle/core/index.d.ts.map +1 -1
  137. package/dist/textToParticle/core/scrollFadeIn/index.d.ts +4 -11
  138. package/dist/textToParticle/core/scrollFadeIn/index.d.ts.map +1 -1
  139. package/dist/textToParticle/core/typing/index.d.ts +2 -0
  140. package/dist/textToParticle/core/typing/index.d.ts.map +1 -1
  141. package/dist/textToParticle/core/utils/visibilityManager.d.ts +1 -0
  142. package/dist/textToParticle/core/utils/visibilityManager.d.ts.map +1 -1
  143. package/dist/textToParticle/index.cjs +1 -1
  144. package/dist/textToParticle/index.d.ts +0 -1
  145. package/dist/textToParticle/index.d.ts.map +1 -1
  146. package/dist/textToParticle/index.mjs +1 -1
  147. package/dist/textToParticle/react/index.d.ts +0 -1
  148. package/dist/textToParticle/react/index.d.ts.map +1 -1
  149. package/dist/textToParticle/react/scrollFadeIn/index.d.ts +0 -1
  150. package/dist/textToParticle/react/scrollFadeIn/index.d.ts.map +1 -1
  151. package/dist/typing/core/index.d.ts +0 -1
  152. package/dist/typing/core/index.d.ts.map +1 -1
  153. package/dist/typing/core/scrollFadeIn/index.d.ts +4 -11
  154. package/dist/typing/core/scrollFadeIn/index.d.ts.map +1 -1
  155. package/dist/typing/core/typing/index.d.ts +2 -0
  156. package/dist/typing/core/typing/index.d.ts.map +1 -1
  157. package/dist/typing/core/utils/visibilityManager.d.ts +1 -0
  158. package/dist/typing/core/utils/visibilityManager.d.ts.map +1 -1
  159. package/dist/typing/index.cjs +1 -1
  160. package/dist/typing/index.d.ts +0 -1
  161. package/dist/typing/index.d.ts.map +1 -1
  162. package/dist/typing/index.mjs +1 -1
  163. package/dist/typing/react/index.d.ts +0 -1
  164. package/dist/typing/react/index.d.ts.map +1 -1
  165. package/dist/typing/react/scrollFadeIn/index.d.ts +0 -1
  166. package/dist/typing/react/scrollFadeIn/index.d.ts.map +1 -1
  167. package/dist/vue/count/index.cjs +1 -1
  168. package/dist/vue/count/index.d.ts +8 -6
  169. package/dist/vue/count/index.mjs +5 -1
  170. package/dist/vue/index.cjs +1 -1
  171. package/dist/vue/index.d.ts +8 -6
  172. package/dist/vue/index.mjs +81 -20
  173. package/dist/vue/scrollFadeIn/index.cjs +1 -1
  174. package/dist/vue/scrollFadeIn/index.d.ts +8 -6
  175. package/dist/vue/scrollFadeIn/index.mjs +28 -17
  176. package/dist/vue/textToParticle/index.cjs +1 -1
  177. package/dist/vue/textToParticle/index.d.ts +8 -6
  178. package/dist/vue/textToParticle/index.mjs +5 -1
  179. package/dist/vue/typing/index.cjs +1 -1
  180. package/dist/vue/typing/index.d.ts +8 -6
  181. package/dist/vue/typing/index.mjs +56 -2
  182. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("svelte");function n(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function h(t,i){return t!=t?i==i:t!==i||t&&"object"==typeof t||"function"==typeof t}function l(t,i,e){t.$$.on_destroy.push(function(t,...i){if(null==t){for(const t of i)t(void 0);return n}const e=t.subscribe(...i);return e.unsubscribe?()=>e.unsubscribe():e}(i,e))}function c(t,i,e,n){return t[1]&&n?function(t,i){for(const e in i)t[e]=i[e];return t}(e.ctx.slice(),t[1](n(i))):e.ctx}function u(t,i,e){t.insertBefore(i,e||null)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function f(t,i,e){null==e?t.removeAttribute(i):t.getAttribute(i)!==e&&t.setAttribute(i,e)}let p;function m(t){p=t}const y=[],x=[];let b=[];const v=[],M=Promise.resolve();let $=!1;function C(t){b.push(t)}const w=new Set;let R=0;function V(){if(0!==R)return;const t=p;do{try{for(;R<y.length;){const t=y[R];R++,m(t),T(t.$$)}}catch(i){throw y.length=0,R=0,i}for(m(null),y.length=0,R=0;x.length;)x.pop()();for(let t=0;t<b.length;t+=1){const i=b[t];w.has(i)||(w.add(i),i())}b.length=0}while(y.length);for(;v.length;)v.pop()();$=!1,w.clear(),m(t)}function T(t){if(null!==t.fragment){t.update(),r(t.before_update);const i=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,i),t.after_update.forEach(C)}}const S=new Set;function D(t,i){t&&t.i&&(S.delete(t),t.i(i))}function P(t,i){const e=t.$$;null!==e.fragment&&(!function(t){const i=[],e=[];b.forEach(n=>-1===t.indexOf(n)?i.push(n):e.push(n)),e.forEach(t=>t()),b=i}(e.after_update),r(e.on_destroy),e.fragment&&e.fragment.d(i),e.on_destroy=e.fragment=null,e.ctx=[])}function I(t,i){-1===t.$$.dirty[0]&&(y.push(t),$||($=!0,M.then(V)),t.$$.dirty.fill(0)),t.$$.dirty[i/31|0]|=1<<i%31}function O(t,i,e,h,l,c,u=null,g=[-1]){const f=p;m(t);const y=t.$$={fragment:null,ctx:[],props:c,update:n,not_equal:l,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(f?f.$$.context:[])),callbacks:o(),dirty:g,skip_bound:!1,root:i.target||f.$$.root};u&&u(y.root);let x=!1;if(y.ctx=e?e(t,i.props||{},(i,e,...n)=>{const s=n.length?n[0]:e;return y.ctx&&l(y.ctx[i],y.ctx[i]=s)&&(!y.skip_bound&&y.bound[i]&&y.bound[i](s),x&&I(t,i)),e}):[],y.update(),x=!0,r(y.before_update),y.fragment=!!h&&h(y.ctx),i.target){if(i.hydrate){const t=(b=i.target,Array.from(b.childNodes));y.fragment&&y.fragment.l(t),t.forEach(d)}else y.fragment&&y.fragment.c();i.intro&&D(t.$$.fragment),function(t,i,e){const{fragment:n,after_update:o}=t.$$;n&&n.m(i,e),C(()=>{const i=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...i):r(i),t.$$.on_mount=[]}),o.forEach(C)}(t,i.target,i.anchor),V()}var b;m(f)}class F{constructor(){i(this,"$$"),i(this,"$$set")}$destroy(){P(this,1),this.$destroy=n}$on(t,i){if(!a(i))return n;const e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(i),()=>{const t=e.indexOf(i);-1!==t&&e.splice(t,1)}}$set(t){var i;this.$$set&&(i=t,0!==Object.keys(i).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class H{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function U(t,i){let e=null;return function(...n){null!==e&&clearTimeout(e),e=setTimeout(()=>{e=null,t.apply(this,n)},i)}}class E{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={text:i.text||"mason effect",densityStep:i.densityStep??2,maxParticles:i.maxParticles??3200,pointSize:i.pointSize??.5,ease:i.ease??.05,repelRadius:i.repelRadius??150,repelStrength:i.repelStrength??1,particleColor:i.particleColor||"#fff",fontFamily:i.fontFamily||"Inter, system-ui, Arial",fontSize:i.fontSize||null,width:i.width||null,height:i.height||null,devicePixelRatio:i.devicePixelRatio??null,onReady:i.onReady||null,onUpdate:i.onUpdate||null},this.canvas=document.createElement("canvas");const e=this.canvas.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("Canvas context not available");this.ctx=e,this.container.appendChild(this.canvas),this.canvas.style.display="block",this.offCanvas=document.createElement("canvas");const n=this.offCanvas.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("Offscreen canvas context not available");this.offCtx=n,this.W=0,this.H=0,this.DPR=this.config.devicePixelRatio||Math.min(window.devicePixelRatio||1,1.8),this.particles=[],this.mouse={x:0,y:0,down:!1},this.animationId=null,this.isRunning=!1,this.visibilityManager=null,this.debounceDelay=i.debounceDelay??150;const s=this.handleResize.bind(this);this.handleResize=U(s,this.debounceDelay),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this._debouncedMorph=U(this._morphInternal.bind(this),this.debounceDelay),this._debouncedUpdateConfig=U(this._updateConfigInternal.bind(this),this.debounceDelay),this.init()}init(){this.resize(),this.setupEventListeners(),this.setupVisibilityManager(),this.config.onReady&&this.config.onReady(this)}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:.1,onVisible:()=>{this.start()},onHidden:()=>{this.stop()}})}resize(){const t=this.container.getBoundingClientRect(),i=this.config.width||t.width||this.container.clientWidth||window.innerWidth,e=this.config.height||t.height||this.container.clientHeight||.7*window.innerHeight;if(i<=0||e<=0)return;this.W=Math.floor(i*this.DPR),this.H=Math.floor(e*this.DPR);const n=4096;if(this.W>n||this.H>n){const t=Math.min(n/this.W,n/this.H);this.W=Math.floor(this.W*t),this.H=Math.floor(this.H*t),this.DPR=this.DPR*t}this.canvas.width=this.W,this.canvas.height=this.H,this.canvas.style.width=i+"px",this.canvas.style.height=e+"px",this.W>0&&this.H>0&&(this.buildTargets(),this.particles.length||this.initParticles())}measureTextFit(t,i,e,n){this.offCtx.font=`400 ${t}px ${this.config.fontFamily}`;const s=i.split("\n"),o=t,r=.1*t,a=.05*t;let h=0;for(const c of s){if(0===c.length)continue;const t=this.offCtx.measureText(c).width+a*(c.length>0?c.length-1:0);h=Math.max(h,t)}const l=s.length>0?o*s.length+r*(s.length-1):o;return{width:h,height:l,fits:h<=e&&l<=n}}findOptimalFontSize(t,i,e,n){if(this.measureTextFit(n,t,i,e).fits)return n;if(n<=12)return 12;let s=12,o=n,r=12;for(;s<=o;){const n=Math.floor((s+o)/2);this.measureTextFit(n,t,i,e).fits?(r=n,s=n+1):o=n-1}return r}buildTargets(){if(this.W<=0||this.H<=0)return;const t=this.config.text;this.offCanvas.width=this.W,this.offCanvas.height=this.H,this.offCtx.clearRect(0,0,this.offCanvas.width,this.offCanvas.height);const i=Math.min(this.W,this.H),e=this.config.fontSize||Math.max(80,Math.floor(.18*i)),n=this.W-80,s=this.H-80,o=this.findOptimalFontSize(t,n,s,e);this.offCtx.fillStyle="#ffffff",this.offCtx.textAlign="center",this.offCtx.textBaseline="middle",this.offCtx.font=`400 ${o}px ${this.config.fontFamily}`;const r=t.split("\n"),a=o,h=.1*o,l=.05*o,c=r.length>0?a*r.length+h*(r.length-1):a;let u=this.H/2-c/2+a/2;for(const p of r){if(0===p.length){u+=a+h;continue}const t=p.split(""),i=this.offCtx.measureText(p).width+l*(t.length>0?t.length-1:0);let e=this.W/2-i/2;for(const n of t)this.offCtx.fillText(n,e+this.offCtx.measureText(n).width/2,u),e+=this.offCtx.measureText(n).width+l;u+=a+h}const d=Math.max(2,this.config.densityStep),g=this.offCtx.getImageData(0,0,this.W,this.H).data,f=[];for(let p=0;p<this.H;p+=d)for(let t=0;t<this.W;t+=d){const i=4*(p*this.W+t);g[i]+g[i+1]+g[i+2]>600&&f.push({x:t,y:p})}for(;f.length>this.config.maxParticles;)f.splice(Math.floor(Math.random()*f.length),1);if(this.particles.length<f.length){const t=f.length-this.particles.length;for(let i=0;i<t;i++)this.particles.push(this.makeParticle())}else this.particles.length>f.length&&(this.particles.length=f.length);for(let p=0;p<this.particles.length;p++){const t=this.particles[p],i=f[p];t.tx=i.x,t.ty=i.y}}makeParticle(){const t=Math.random()*this.W,i=Math.random()*this.H;return{x:t,y:i,vx:0,vy:0,tx:t,ty:i,initialX:t,initialY:i,j:Math.random()*Math.PI*2}}initParticles(){for(const t of this.particles){const i=Math.random()*this.W,e=Math.random()*this.H;t.x=i,t.y=e,t.vx=t.vy=0,t.initialX=i,t.initialY=e}}scatter(){for(const t of this.particles)void 0!==t.initialX&&void 0!==t.initialY?(t.tx=t.initialX,t.ty=t.initialY):(t.initialX=t.x,t.initialY=t.y,t.tx=t.initialX,t.ty=t.initialY)}morph(t){this._debouncedMorph(t)}_morphInternal(t){if(0!==this.W&&0!==this.H||this.resize(),"string"==typeof t)this.config.text=t,this.buildTargets();else if(t&&"object"==typeof t){const i=void 0!==t.text;this.config={...this.config,...t},i&&this.buildTargets()}else this.buildTargets()}update(){this.ctx.clearRect(0,0,this.W,this.H);for(const n of this.particles){let t=(n.tx-n.x)*this.config.ease,i=(n.ty-n.y)*this.config.ease;if(this.mouse.x||this.mouse.y){const e=n.x-this.mouse.x,s=n.y-this.mouse.y,o=e*e+s*s,r=this.config.repelRadius*this.DPR;if(o<r*r){const n=Math.sqrt(o)+1e-4,a=(this.mouse.down?-1:1)*this.config.repelStrength*(1-n/r);t+=e/n*a*6,i+=s/n*a*6}}n.j+=2,t+=.05*Math.cos(n.j),i+=.05*Math.sin(1.3*n.j),n.vx=(n.vx+t)*Math.random(),n.vy=(n.vy+i)*Math.random(),n.x+=n.vx,n.y+=n.vy}this.ctx.fillStyle=this.config.particleColor;const t=Math.min(this.W,this.H)/this.DPR,i=Math.max(.5,Math.min(2,t/1920)),e=this.config.pointSize*this.DPR*i;for(const n of this.particles)this.ctx.beginPath(),this.ctx.arc(n.x,n.y,e,0,2*Math.PI),this.ctx.fill();this.config.onUpdate&&this.config.onUpdate(this)}animate(){this.isRunning&&(this.update(),this.animationId=requestAnimationFrame(()=>this.animate()))}start(){this.isRunning||(this.isRunning=!0,this.animate())}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setupEventListeners(){window.addEventListener("resize",this.handleResize),this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mouseleave",this.handleMouseLeave),this.canvas.addEventListener("mousedown",this.handleMouseDown),window.addEventListener("mouseup",this.handleMouseUp)}removeEventListeners(){window.removeEventListener("resize",this.handleResize),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseleave",this.handleMouseLeave),this.canvas.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("mouseup",this.handleMouseUp)}handleResize(){this.resize()}handleMouseMove(t){const i=this.canvas.getBoundingClientRect();this.mouse.x=(t.clientX-i.left)*this.DPR,this.mouse.y=(t.clientY-i.top)*this.DPR}handleMouseLeave(){this.mouse.x=this.mouse.y=0}handleMouseDown(){this.mouse.down=!0}handleMouseUp(){this.mouse.down=!1}updateConfig(t){this._debouncedUpdateConfig(t)}_updateConfigInternal(t){this.config={...this.config,...t},t.text&&this.buildTargets()}destroy(){this.stop(),this.removeEventListeners(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}const _={linear:t=>t};class z{constructor(t,i){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={targetValue:i.targetValue,duration:i.duration??2e3,startValue:i.startValue??0,enabled:i.enabled??!0,easing:i.easing??_.linear,threshold:i.threshold??.2,rootMargin:i.rootMargin??"0px 0px -100px 0px",triggerOnce:i.triggerOnce??!1,onUpdate:i.onUpdate||null,onComplete:i.onComplete||null},this.currentValue=this.config.startValue,this.startTime=null,this.animationFrameId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(this.config.startValue),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){if(this.isRunning)return;if(!this.config.enabled)return;this.isRunning=!0,this.startTime=null,this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue);const t=i=>{null===this.startTime&&(this.startTime=i);const e=i-this.startTime,n=Math.min(e/this.config.duration,1),s=this.config.easing(n);this.currentValue=Math.floor(this.config.startValue+(this.config.targetValue-this.config.startValue)*s),this.updateDisplay(this.currentValue),this.config.onUpdate&&this.config.onUpdate(this.currentValue),n<1?this.animationFrameId=requestAnimationFrame(t):(this.currentValue=this.config.targetValue,this.updateDisplay(this.currentValue),this.isRunning=!1,this.config.onComplete&&this.config.onComplete())};this.animationFrameId=requestAnimationFrame(t)}stop(){this.isRunning=!1,null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}reset(){this.stop(),this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue),this.hasTriggered=!1,this.startTime=null}updateDisplay(t){this.container.textContent=this.formatNumber(t)}formatNumber(t){return Math.floor(t).toLocaleString()}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onUpdate:void 0!==t.onUpdate?t.onUpdate:this.config.onUpdate,onComplete:void 0!==t.onComplete?t.onComplete:this.config.onComplete},void 0!==t.targetValue?(this.reset(),i&&this.config.enabled&&this.start()):i&&this.config.enabled&&this.start()}getValue(){return this.currentValue}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}function W(t){const i=t.charCodeAt(0);if(i<44032||i>55203)return[t];const e=i-44032,n=Math.floor(e/588),s=Math.floor(e%588/28),o=e%28,r=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=[];return a.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][n]),a.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][s]),o>0&&a.push(r[o]),a}function N(t,i,e){const n=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(t),s=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"].indexOf(i),o=e?["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(e):0;if(-1===n||-1===s)return t+(i||"")+(e||"");const r=44032+21*n*28+28*s+o;return String.fromCharCode(r)}function L(t){const i=[],e=[];for(let n=0;n<t.length;n++){const s=t[n],o=s.charCodeAt(0),r=i.length;if(o>=44032&&o<=55203){const t=W(s);i.push(...t),e.push({start:r,end:i.length,isHangul:!0})}else i.push(s),e.push({start:r,end:i.length,isHangul:!1})}return{units:i,charUnitRanges:e}}class k{constructor(t,i){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=i.text,this.config={text:i.text,speed:i.speed??50,delay:i.delay??0,enabled:i.enabled??!0,threshold:i.threshold??.2,rootMargin:i.rootMargin??"0px 0px -100px 0px",triggerOnce:i.triggerOnce??!1,showCursor:i.showCursor??!0,cursorChar:i.cursorChar??"|",onUpdate:i.onUpdate||null,onComplete:i.onComplete||null};const e=L(this.config.text);this.textUnits=e.units,this.charUnitRanges=e.charUnitRanges,this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,setTimeout(()=>this.start(),this.config.delay))},onHidden:()=>{}})}buildTextFromUnits(t){if(0===t)return"";let i="";for(let e=0;e<this.charUnitRanges.length;e++){const n=this.charUnitRanges[e];if(n.start>=t)break;const s=Math.min(t-n.start,n.end-n.start);if(s<=0)break;if(n.isHangul){const t=this.textUnits.slice(n.start,n.start+s);1===t.length?i+=t[0]:2===t.length?i+=N(t[0],t[1]):t.length>=3&&(i+=N(t[0],t[1],t[2]))}else s>0&&(i+=this.textUnits[n.start])}return i}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());this.displayedText=this.buildTextFromUnits(this.currentIndex+1);let t=this.displayedText;this.config.showCursor&&(t+=this.config.cursorChar),this.updateDisplay(t),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){this.container.textContent=t}setText(t){this.originalText=t,this.config.text=t;const i=L(t);this.textUnits=i.units,this.charUnitRanges=i.charUnitRanges,this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}const A={easeOutCubic:t=>--t*t*t+1};class q{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:i.direction??"bottom",distance:i.distance??"50px",duration:i.duration??800,easing:i.easing??A.easeOutCubic,threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",triggerOnce:i.triggerOnce??!1,enabled:i.enabled??!0,onStart:i.onStart||null,onComplete:i.onComplete||null},this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i){return parseFloat(t)||50}const e=parseFloat(i[1]);switch(i[2]){case"px":default:return e;case"rem":case"em":return e*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return e/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return e/100*window.innerHeight;case"vw":return e/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const e=this.initialTransform||"",n=`translate(${t}px, ${i}px)`;this.container.style.transform=e&&"none"!==e?`${n} ${e}`:n,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),e=this.config.easing(i);let n=0,s=0;switch(this.config.direction){case"top":s=-this.targetDistance*(1-e);break;case"right":n=this.targetDistance*(1-e);break;case"bottom":s=this.targetDistance*(1-e);break;case"left":n=-this.targetDistance*(1-e)}const o=this.initialTransform||"",r=`translate(${n}px, ${s}px)`;this.container.style.transform=o&&"none"!==o?`${r} ${o}`:r,this.container.style.opacity=String(e),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,easing:t.easing??this.config.easing,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}function j(t){let i;return{c(){i=g("div"),f(i,"class",t[0]),f(i,"style",t[1])},m(e,n){u(e,i,n),t[21](i)},p(t,[e]){1&e&&f(i,"class",t[0]),2&e&&f(i,"style",t[1])},i:n,o:n,d(e){e&&d(i),t[21](null)}}}function X(t,i,n){let{text:s="mason effect"}=i,{densityStep:o=2}=i,{maxParticles:r=3200}=i,{pointSize:a=.5}=i,{ease:h=.05}=i,{repelRadius:l=150}=i,{repelStrength:c=1}=i,{particleColor:u="#fff"}=i,{fontFamily:d="Inter, system-ui, Arial"}=i,{fontSize:g=null}=i,{width:f=null}=i,{height:p=null}=i,{devicePixelRatio:m=null}=i,{className:y=""}=i,{style:b={}}=i;const v=e.createEventDispatcher();let M,$=null;return e.onMount(()=>{if(!M)return;n(20,$=new E(M,{text:s,densityStep:o,maxParticles:r,pointSize:a,ease:h,repelRadius:l,repelStrength:c,particleColor:u,fontFamily:d,fontSize:g,width:f,height:p,devicePixelRatio:m,onReady:t=>{v("ready",t)},onUpdate:t=>{v("update",t)}}))}),e.onDestroy(()=>{$&&($.destroy(),n(20,$=null))}),t.$$set=t=>{"text"in t&&n(3,s=t.text),"densityStep"in t&&n(4,o=t.densityStep),"maxParticles"in t&&n(5,r=t.maxParticles),"pointSize"in t&&n(6,a=t.pointSize),"ease"in t&&n(7,h=t.ease),"repelRadius"in t&&n(8,l=t.repelRadius),"repelStrength"in t&&n(9,c=t.repelStrength),"particleColor"in t&&n(10,u=t.particleColor),"fontFamily"in t&&n(11,d=t.fontFamily),"fontSize"in t&&n(12,g=t.fontSize),"width"in t&&n(13,f=t.width),"height"in t&&n(14,p=t.height),"devicePixelRatio"in t&&n(15,m=t.devicePixelRatio),"className"in t&&n(0,y=t.className),"style"in t&&n(1,b=t.style)},t.$$.update=()=>{1114104&t.$$.dirty&&$&&$.updateConfig({text:s,densityStep:o,maxParticles:r,pointSize:a,ease:h,repelRadius:l,repelStrength:c,particleColor:u,fontFamily:d,fontSize:g,width:f,height:p,devicePixelRatio:m})},[y,b,M,s,o,r,a,h,l,c,u,d,g,f,p,m,function(t){$&&$.morph(t)},function(){$&&$.scatter()},function(t){$&&$.updateConfig(t)},function(){$&&($.destroy(),n(20,$=null))},$,function(t){x[t?"unshift":"push"](()=>{M=t,n(2,M)})}]}class Y extends F{constructor(t){super(),O(this,t,X,j,h,{text:3,densityStep:4,maxParticles:5,pointSize:6,ease:7,repelRadius:8,repelStrength:9,particleColor:10,fontFamily:11,fontSize:12,width:13,height:14,devicePixelRatio:15,className:0,style:1,morph:16,scatter:17,updateConfig:18,destroy:19})}get morph(){return this.$$.ctx[16]}get scatter(){return this.$$.ctx[17]}get updateConfig(){return this.$$.ctx[18]}get destroy(){return this.$$.ctx[19]}}function B(t){let i;return{c(){i=g("div"),f(i,"class",t[0]),f(i,"style",t[1])},m(e,n){u(e,i,n),t[18](i)},p(t,[e]){1&e&&f(i,"class",t[0]),2&e&&f(i,"style",t[1])},i:n,o:n,d(e){e&&d(i),t[18](null)}}}function G(t,i,n){let{targetValue:s=0}=i,{duration:o=2e3}=i,{startValue:r=0}=i,{enabled:a=!0}=i,{easing:h=t=>t}=i,{threshold:l=.2}=i,{rootMargin:c="0px 0px -100px 0px"}=i,{triggerOnce:u=!1}=i,{className:d=""}=i,{style:g={}}=i;const f=e.createEventDispatcher();let p,m=null;return e.onMount(()=>{if(!p)return;n(17,m=new z(p,{targetValue:s,duration:o,startValue:r,enabled:a,easing:h,threshold:l,rootMargin:c,triggerOnce:u,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}}))}),e.onDestroy(()=>{m&&(m.destroy(),n(17,m=null))}),t.$$set=t=>{"targetValue"in t&&n(3,s=t.targetValue),"duration"in t&&n(4,o=t.duration),"startValue"in t&&n(5,r=t.startValue),"enabled"in t&&n(6,a=t.enabled),"easing"in t&&n(7,h=t.easing),"threshold"in t&&n(8,l=t.threshold),"rootMargin"in t&&n(9,c=t.rootMargin),"triggerOnce"in t&&n(10,u=t.triggerOnce),"className"in t&&n(0,d=t.className),"style"in t&&n(1,g=t.style)},t.$$.update=()=>{133112&t.$$.dirty&&m&&m.updateConfig({targetValue:s,duration:o,startValue:r,enabled:a,easing:h,threshold:l,rootMargin:c,triggerOnce:u,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}})},[d,g,p,s,o,r,a,h,l,c,u,function(){m&&m.start()},function(){m&&m.stop()},function(){m&&m.reset()},function(){return m?m.getValue():0},function(t){m&&m.updateConfig(t)},function(){m&&(m.destroy(),n(17,m=null))},m,function(t){x[t?"unshift":"push"](()=>{p=t,n(2,p)})}]}function J(t){let i;return{c(){i=g("div"),f(i,"class",t[1]),f(i,"style",t[2])},m(e,n){u(e,i,n),t[8](i)},p:n,i:n,o:n,d(e){e&&d(i),t[8](null)}}}function K(t,i,n){let s,o;l(t,effect,t=>n(10,s=t)),l(t,props,t=>n(11,o=t));let{text:r,speed:a=50,delay:h=0,enabled:c=!0,threshold:u=.2,rootMargin:d="0px 0px -100px 0px",triggerOnce:g=!1,showCursor:f=!0,cursorChar:p="|",className:m="",style:y="",onUpdate:b,onComplete:v}=o(),M=null,$=null;return e.onMount(()=>{if(!M)return;$=new k(M,{text:r,speed:a,delay:h,enabled:c,threshold:u,rootMargin:d,triggerOnce:g,showCursor:f,cursorChar:p,onUpdate:b,onComplete:v})}),e.onDestroy(()=>{$&&($.destroy(),$=null)}),s(()=>{$&&r!==$.originalText&&$.setText(r)}),[M,m,y,function(){null==$||$.start()},function(){null==$||$.stop()},function(){null==$||$.reset()},function(t){null==$||$.setText(t)},function(){$&&($.destroy(),$=null)},function(t){x[t?"unshift":"push"](()=>{M=t,n(0,M)})}]}function Q(t){let i,e;const n=t[18].default,s=function(t,i,e,n){if(t){const s=c(t,i,e,n);return t[0](s)}}(n,t,t[17],null);return{c(){i=g("div"),s&&s.c(),f(i,"class",t[0]),f(i,"style",t[1])},m(n,o){u(n,i,o),s&&s.m(i,null),t[19](i),e=!0},p(t,[o]){var r,a;s&&s.p&&(!e||131072&o)&&function(t,i,e,n,s,o){if(s){const r=c(i,e,n,o);t.p(r,s)}}(s,n,t,t[17],e?(r=n,a=t[17],r[2],a.dirty):function(t){if(t.ctx.length>32){const i=[],e=t.ctx.length/32;for(let t=0;t<e;t++)i[t]=-1;return i}return-1}(t[17]),null),(!e||1&o)&&f(i,"class",t[0]),(!e||2&o)&&f(i,"style",t[1])},i(t){e||(D(s,t),e=!0)},o(t){!function(t,i){if(t&&t.o){if(S.has(t))return;S.add(t),(void 0).c.push(()=>{S.delete(t)}),t.o(i)}}(s,t),e=!1},d(e){e&&d(i),s&&s.d(e),t[19](null)}}}function Z(t,i,n){let{$$slots:s={},$$scope:o}=i,{direction:r="bottom"}=i,{distance:a="50px"}=i,{duration:h=800}=i,{easing:l=t=>t}=i,{threshold:c=.1}=i,{rootMargin:u="0px"}=i,{triggerOnce:d=!1}=i,{enabled:g=!0}=i,{className:f=""}=i,{style:p={}}=i;const m=e.createEventDispatcher();let y,b=null;return e.onMount(()=>{if(!y)return;n(16,b=new q(y,{direction:r,distance:a,duration:h,easing:l,threshold:c,rootMargin:u,triggerOnce:d,enabled:g,onStart:()=>{m("start")},onComplete:()=>{m("complete")}}))}),e.onDestroy(()=>{b&&(b.destroy(),n(16,b=null))}),t.$$set=t=>{"direction"in t&&n(3,r=t.direction),"distance"in t&&n(4,a=t.distance),"duration"in t&&n(5,h=t.duration),"easing"in t&&n(6,l=t.easing),"threshold"in t&&n(7,c=t.threshold),"rootMargin"in t&&n(8,u=t.rootMargin),"triggerOnce"in t&&n(9,d=t.triggerOnce),"enabled"in t&&n(10,g=t.enabled),"className"in t&&n(0,f=t.className),"style"in t&&n(1,p=t.style),"$$scope"in t&&n(17,o=t.$$scope)},t.$$.update=()=>{67576&t.$$.dirty&&b&&b.updateConfig({direction:r,distance:a,duration:h,easing:l,threshold:c,rootMargin:u,triggerOnce:d,enabled:g,onStart:()=>{m("start")},onComplete:()=>{m("complete")}})},[f,p,y,r,a,h,l,c,u,d,g,function(){b&&b.start()},function(){b&&b.stop()},function(){b&&b.reset()},function(t){b&&b.updateConfig(t)},function(){b&&(b.destroy(),n(16,b=null))},b,o,s,function(t){x[t?"unshift":"push"](()=>{y=t,n(2,y)})}]}exports.Count=class extends F{constructor(t){super(),O(this,t,G,B,h,{targetValue:3,duration:4,startValue:5,enabled:6,easing:7,threshold:8,rootMargin:9,triggerOnce:10,className:0,style:1,start:11,stop:12,reset:13,getValue:14,updateConfig:15,destroy:16})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get getValue(){return this.$$.ctx[14]}get updateConfig(){return this.$$.ctx[15]}get destroy(){return this.$$.ctx[16]}},exports.MasonEffect=Y,exports.ScrollFadeIn=class extends F{constructor(t){super(),O(this,t,Z,Q,h,{direction:3,distance:4,duration:5,easing:6,threshold:7,rootMargin:8,triggerOnce:9,enabled:10,className:0,style:1,start:11,stop:12,reset:13,updateConfig:14,destroy:15})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get updateConfig(){return this.$$.ctx[14]}get destroy(){return this.$$.ctx[15]}},exports.TextToParticle=Y,exports.Typing=class extends F{constructor(t){super(),O(this,t,K,J,h,{start:3,stop:4,reset:5,setText:6,destroy:7})}get start(){return this.$$.ctx[3]}get stop(){return this.$$.ctx[4]}get reset(){return this.$$.ctx[5]}get setText(){return this.$$.ctx[6]}get destroy(){return this.$$.ctx[7]}},exports.default=Y;
1
+ "use strict";var t=Object.defineProperty,i=(i,e,n)=>((i,e,n)=>e in i?t(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n)(i,"symbol"!=typeof e?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("svelte");function n(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function h(t,i){return t!=t?i==i:t!==i||t&&"object"==typeof t||"function"==typeof t}function l(t,i,e){t.$$.on_destroy.push(function(t,...i){if(null==t){for(const t of i)t(void 0);return n}const e=t.subscribe(...i);return e.unsubscribe?()=>e.unsubscribe():e}(i,e))}function c(t,i,e,n){return t[1]&&n?function(t,i){for(const e in i)t[e]=i[e];return t}(e.ctx.slice(),t[1](n(i))):e.ctx}function u(t,i,e){t.insertBefore(i,e||null)}function d(t){t.parentNode&&t.parentNode.removeChild(t)}function g(t){return document.createElement(t)}function f(t,i,e){null==e?t.removeAttribute(i):t.getAttribute(i)!==e&&t.setAttribute(i,e)}let p;function m(t){p=t}const y=[],x=[];let b=[];const v=[],M=Promise.resolve();let $=!1;function C(t){b.push(t)}const w=new Set;let R=0;function V(){if(0!==R)return;const t=p;do{try{for(;R<y.length;){const t=y[R];R++,m(t),T(t.$$)}}catch(i){throw y.length=0,R=0,i}for(m(null),y.length=0,R=0;x.length;)x.pop()();for(let t=0;t<b.length;t+=1){const i=b[t];w.has(i)||(w.add(i),i())}b.length=0}while(y.length);for(;v.length;)v.pop()();$=!1,w.clear(),m(t)}function T(t){if(null!==t.fragment){t.update(),r(t.before_update);const i=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,i),t.after_update.forEach(C)}}const S=new Set;function P(t,i){t&&t.i&&(S.delete(t),t.i(i))}function D(t,i){const e=t.$$;null!==e.fragment&&(!function(t){const i=[],e=[];b.forEach(n=>-1===t.indexOf(n)?i.push(n):e.push(n)),e.forEach(t=>t()),b=i}(e.after_update),r(e.on_destroy),e.fragment&&e.fragment.d(i),e.on_destroy=e.fragment=null,e.ctx=[])}function I(t,i){-1===t.$$.dirty[0]&&(y.push(t),$||($=!0,M.then(V)),t.$$.dirty.fill(0)),t.$$.dirty[i/31|0]|=1<<i%31}function H(t,i,e,h,l,c,u=null,g=[-1]){const f=p;m(t);const y=t.$$={fragment:null,ctx:[],props:c,update:n,not_equal:l,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(f?f.$$.context:[])),callbacks:o(),dirty:g,skip_bound:!1,root:i.target||f.$$.root};u&&u(y.root);let x=!1;if(y.ctx=e?e(t,i.props||{},(i,e,...n)=>{const s=n.length?n[0]:e;return y.ctx&&l(y.ctx[i],y.ctx[i]=s)&&(!y.skip_bound&&y.bound[i]&&y.bound[i](s),x&&I(t,i)),e}):[],y.update(),x=!0,r(y.before_update),y.fragment=!!h&&h(y.ctx),i.target){if(i.hydrate){const t=(b=i.target,Array.from(b.childNodes));y.fragment&&y.fragment.l(t),t.forEach(d)}else y.fragment&&y.fragment.c();i.intro&&P(t.$$.fragment),function(t,i,e){const{fragment:n,after_update:o}=t.$$;n&&n.m(i,e),C(()=>{const i=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...i):r(i),t.$$.on_mount=[]}),o.forEach(C)}(t,i.target,i.anchor),V()}var b;m(f)}class O{constructor(){i(this,"$$"),i(this,"$$set")}$destroy(){D(this,1),this.$destroy=n}$on(t,i){if(!a(i))return n;const e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(i),()=>{const t=e.indexOf(i);-1!==t&&e.splice(t,1)}}$set(t){var i;this.$$set&&(i=t,0!==Object.keys(i).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class F{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}function E(t,i){let e=null;return function(...n){null!==e&&clearTimeout(e),e=setTimeout(()=>{e=null,t.apply(this,n)},i)}}class U{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={text:i.text||"mason effect",densityStep:i.densityStep??2,maxParticles:i.maxParticles??3200,pointSize:i.pointSize??.5,ease:i.ease??.05,repelRadius:i.repelRadius??150,repelStrength:i.repelStrength??1,particleColor:i.particleColor||"#fff",fontFamily:i.fontFamily||"Inter, system-ui, Arial",fontSize:i.fontSize||null,width:i.width||null,height:i.height||null,devicePixelRatio:i.devicePixelRatio??null,onReady:i.onReady||null,onUpdate:i.onUpdate||null},this.canvas=document.createElement("canvas");const e=this.canvas.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("Canvas context not available");this.ctx=e,this.container.appendChild(this.canvas),this.canvas.style.display="block",this.offCanvas=document.createElement("canvas");const n=this.offCanvas.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("Offscreen canvas context not available");this.offCtx=n,this.W=0,this.H=0,this.DPR=this.config.devicePixelRatio||Math.min(window.devicePixelRatio||1,1.8),this.particles=[],this.mouse={x:0,y:0,down:!1},this.animationId=null,this.isRunning=!1,this.visibilityManager=null,this.debounceDelay=i.debounceDelay??150;const s=this.handleResize.bind(this);this.handleResize=E(s,this.debounceDelay),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this._debouncedMorph=E(this._morphInternal.bind(this),this.debounceDelay),this._debouncedUpdateConfig=E(this._updateConfigInternal.bind(this),this.debounceDelay),this.init()}init(){this.resize(),this.setupEventListeners(),this.setupVisibilityManager(),this.config.onReady&&this.config.onReady(this)}setupVisibilityManager(){this.visibilityManager=new F(this.container,{threshold:.1,onVisible:()=>{this.start()},onHidden:()=>{this.stop()}})}resize(){const t=this.container.getBoundingClientRect(),i=this.config.width||t.width||this.container.clientWidth||window.innerWidth,e=this.config.height||t.height||this.container.clientHeight||.7*window.innerHeight;if(i<=0||e<=0)return;this.W=Math.floor(i*this.DPR),this.H=Math.floor(e*this.DPR);const n=4096;if(this.W>n||this.H>n){const t=Math.min(n/this.W,n/this.H);this.W=Math.floor(this.W*t),this.H=Math.floor(this.H*t),this.DPR=this.DPR*t}this.canvas.width=this.W,this.canvas.height=this.H,this.canvas.style.width=i+"px",this.canvas.style.height=e+"px",this.W>0&&this.H>0&&(this.buildTargets(),this.particles.length||this.initParticles())}measureTextFit(t,i,e,n){this.offCtx.font=`400 ${t}px ${this.config.fontFamily}`;const s=i.split("\n"),o=t,r=.1*t,a=.05*t;let h=0;for(const c of s){if(0===c.length)continue;const t=this.offCtx.measureText(c).width+a*(c.length>0?c.length-1:0);h=Math.max(h,t)}const l=s.length>0?o*s.length+r*(s.length-1):o;return{width:h,height:l,fits:h<=e&&l<=n}}findOptimalFontSize(t,i,e,n){if(this.measureTextFit(n,t,i,e).fits)return n;if(n<=12)return 12;let s=12,o=n,r=12;for(;s<=o;){const n=Math.floor((s+o)/2);this.measureTextFit(n,t,i,e).fits?(r=n,s=n+1):o=n-1}return r}buildTargets(){if(this.W<=0||this.H<=0)return;const t=this.config.text;this.offCanvas.width=this.W,this.offCanvas.height=this.H,this.offCtx.clearRect(0,0,this.offCanvas.width,this.offCanvas.height);const i=Math.min(this.W,this.H),e=this.config.fontSize||Math.max(80,Math.floor(.18*i)),n=this.W-80,s=this.H-80,o=this.findOptimalFontSize(t,n,s,e);this.offCtx.fillStyle="#ffffff",this.offCtx.textAlign="center",this.offCtx.textBaseline="middle",this.offCtx.font=`400 ${o}px ${this.config.fontFamily}`;const r=t.split("\n"),a=o,h=.1*o,l=.05*o,c=r.length>0?a*r.length+h*(r.length-1):a;let u=this.H/2-c/2+a/2;for(const p of r){if(0===p.length){u+=a+h;continue}const t=p.split(""),i=this.offCtx.measureText(p).width+l*(t.length>0?t.length-1:0);let e=this.W/2-i/2;for(const n of t)this.offCtx.fillText(n,e+this.offCtx.measureText(n).width/2,u),e+=this.offCtx.measureText(n).width+l;u+=a+h}const d=Math.max(2,this.config.densityStep),g=this.offCtx.getImageData(0,0,this.W,this.H).data,f=[];for(let p=0;p<this.H;p+=d)for(let t=0;t<this.W;t+=d){const i=4*(p*this.W+t);g[i]+g[i+1]+g[i+2]>600&&f.push({x:t,y:p})}for(;f.length>this.config.maxParticles;)f.splice(Math.floor(Math.random()*f.length),1);if(this.particles.length<f.length){const t=f.length-this.particles.length;for(let i=0;i<t;i++)this.particles.push(this.makeParticle())}else this.particles.length>f.length&&(this.particles.length=f.length);for(let p=0;p<this.particles.length;p++){const t=this.particles[p],i=f[p];t.tx=i.x,t.ty=i.y}}makeParticle(){const t=Math.random()*this.W,i=Math.random()*this.H;return{x:t,y:i,vx:0,vy:0,tx:t,ty:i,initialX:t,initialY:i,j:Math.random()*Math.PI*2}}initParticles(){for(const t of this.particles){const i=Math.random()*this.W,e=Math.random()*this.H;t.x=i,t.y=e,t.vx=t.vy=0,t.initialX=i,t.initialY=e}}scatter(){for(const t of this.particles)void 0!==t.initialX&&void 0!==t.initialY?(t.tx=t.initialX,t.ty=t.initialY):(t.initialX=t.x,t.initialY=t.y,t.tx=t.initialX,t.ty=t.initialY)}morph(t){this._debouncedMorph(t)}_morphInternal(t){if(0!==this.W&&0!==this.H||this.resize(),"string"==typeof t)this.config.text=t,this.buildTargets();else if(t&&"object"==typeof t){const i=void 0!==t.text;this.config={...this.config,...t},i&&this.buildTargets()}else this.buildTargets()}update(){this.ctx.clearRect(0,0,this.W,this.H);for(const n of this.particles){let t=(n.tx-n.x)*this.config.ease,i=(n.ty-n.y)*this.config.ease;if(this.mouse.x||this.mouse.y){const e=n.x-this.mouse.x,s=n.y-this.mouse.y,o=e*e+s*s,r=this.config.repelRadius*this.DPR;if(o<r*r){const n=Math.sqrt(o)+1e-4,a=(this.mouse.down?-1:1)*this.config.repelStrength*(1-n/r);t+=e/n*a*6,i+=s/n*a*6}}n.j+=2,t+=.05*Math.cos(n.j),i+=.05*Math.sin(1.3*n.j),n.vx=(n.vx+t)*Math.random(),n.vy=(n.vy+i)*Math.random(),n.x+=n.vx,n.y+=n.vy}this.ctx.fillStyle=this.config.particleColor;const t=Math.min(this.W,this.H)/this.DPR,i=Math.max(.5,Math.min(2,t/1920)),e=this.config.pointSize*this.DPR*i;for(const n of this.particles)this.ctx.beginPath(),this.ctx.arc(n.x,n.y,e,0,2*Math.PI),this.ctx.fill();this.config.onUpdate&&this.config.onUpdate(this)}animate(){this.isRunning&&(this.update(),this.animationId=requestAnimationFrame(()=>this.animate()))}start(){this.isRunning||(this.isRunning=!0,this.animate())}stop(){this.isRunning=!1,this.animationId&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setupEventListeners(){window.addEventListener("resize",this.handleResize),this.canvas.addEventListener("mousemove",this.handleMouseMove),this.canvas.addEventListener("mouseleave",this.handleMouseLeave),this.canvas.addEventListener("mousedown",this.handleMouseDown),window.addEventListener("mouseup",this.handleMouseUp)}removeEventListeners(){window.removeEventListener("resize",this.handleResize),this.canvas.removeEventListener("mousemove",this.handleMouseMove),this.canvas.removeEventListener("mouseleave",this.handleMouseLeave),this.canvas.removeEventListener("mousedown",this.handleMouseDown),window.removeEventListener("mouseup",this.handleMouseUp)}handleResize(){this.resize()}handleMouseMove(t){const i=this.canvas.getBoundingClientRect();this.mouse.x=(t.clientX-i.left)*this.DPR,this.mouse.y=(t.clientY-i.top)*this.DPR}handleMouseLeave(){this.mouse.x=this.mouse.y=0}handleMouseDown(){this.mouse.down=!0}handleMouseUp(){this.mouse.down=!1}updateConfig(t){this._debouncedUpdateConfig(t)}_updateConfigInternal(t){this.config={...this.config,...t},t.text&&this.buildTargets()}destroy(){this.stop(),this.removeEventListeners(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}const _={linear:t=>t};class z{constructor(t,i){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={targetValue:i.targetValue,duration:i.duration??2e3,startValue:i.startValue??0,enabled:i.enabled??!0,easing:i.easing??_.linear,threshold:i.threshold??.2,rootMargin:i.rootMargin??"0px 0px -100px 0px",triggerOnce:i.triggerOnce??!1,onUpdate:i.onUpdate||null,onComplete:i.onComplete||null},this.currentValue=this.config.startValue,this.startTime=null,this.animationFrameId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(this.config.startValue),this.setupVisibilityManager()}setupVisibilityManager(){this.visibilityManager=new F(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){if(this.isRunning)return;if(!this.config.enabled)return;this.isRunning=!0,this.startTime=null,this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue);const t=i=>{null===this.startTime&&(this.startTime=i);const e=i-this.startTime,n=Math.min(e/this.config.duration,1),s=this.config.easing(n);this.currentValue=Math.floor(this.config.startValue+(this.config.targetValue-this.config.startValue)*s),this.updateDisplay(this.currentValue),this.config.onUpdate&&this.config.onUpdate(this.currentValue),n<1?this.animationFrameId=requestAnimationFrame(t):(this.currentValue=this.config.targetValue,this.updateDisplay(this.currentValue),this.isRunning=!1,this.config.onComplete&&this.config.onComplete())};this.animationFrameId=requestAnimationFrame(t)}stop(){this.isRunning=!1,null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}reset(){this.stop(),this.currentValue=this.config.startValue,this.updateDisplay(this.currentValue),this.hasTriggered=!1,this.startTime=null}updateDisplay(t){this.container.textContent=this.formatNumber(t)}formatNumber(t){return Math.floor(t).toLocaleString()}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onUpdate:void 0!==t.onUpdate?t.onUpdate:this.config.onUpdate,onComplete:void 0!==t.onComplete?t.onComplete:this.config.onComplete},void 0!==t.targetValue?(this.reset(),i&&this.config.enabled&&this.start()):i&&this.config.enabled&&this.start()}getValue(){return this.currentValue}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}function L(t){const i=t.charCodeAt(0);if(i<44032||i>55203)return[t];const e=i-44032,n=Math.floor(e/588),s=Math.floor(e%588/28),o=e%28,r=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=[];return a.push(["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"][n]),a.push(["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"][s]),o>0&&a.push(r[o]),a}function W(t,i,e){const n=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(t),s=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"].indexOf(i),o=e?["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"].indexOf(e):0;if(-1===n||-1===s)return t+(i||"")+(e||"");const r=44032+21*n*28+28*s+o;return String.fromCharCode(r)}function N(t){const i=[],e=[];for(let n=0;n<t.length;n++){const s=t[n],o=s.charCodeAt(0),r=i.length;if(o>=44032&&o<=55203){const t=L(s);i.push(...t),e.push({start:r,end:i.length,isHangul:!0})}else i.push(s),e.push({start:r,end:i.length,isHangul:!1})}return{units:i,charUnitRanges:e}}class k{constructor(t,i){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.originalText=i.text,this.config={text:i.text,speed:i.speed??50,delay:i.delay??0,enabled:i.enabled??!0,threshold:i.threshold??.2,rootMargin:i.rootMargin??"0px 0px -100px 0px",triggerOnce:i.triggerOnce??!1,showCursor:i.showCursor??!0,cursorChar:i.cursorChar??"|",onUpdate:i.onUpdate||null,onComplete:i.onComplete||null};const e=N(this.config.text);this.textUnits=e.units,this.charUnitRanges=e.charUnitRanges,this.currentIndex=0,this.displayedText="",this.timeoutId=null,this.visibilityManager=null,this.isRunning=!1,this.hasTriggered=!1,this.init()}init(){this.updateDisplay(""),this.injectStyles(),this.setupVisibilityManager()}injectStyles(){if(document.getElementById("masoneffect-typing-styles"))return;const t=document.createElement("style");t.id="masoneffect-typing-styles",t.textContent="\n .typing-char {\n transition: opacity 0.2s ease-in;\n display: inline-block;\n }\n .typing-cursor {\n display: inline-block;\n }\n ",document.head.appendChild(t)}setupVisibilityManager(){this.visibilityManager=new F(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,setTimeout(()=>this.start(),this.config.delay))},onHidden:()=>{}})}buildTextFromUnits(t){if(0===t)return"";let i="";for(let e=0;e<this.charUnitRanges.length;e++){const n=this.charUnitRanges[e];if(n.start>=t)break;const s=Math.min(t-n.start,n.end-n.start);if(s<=0)break;if(n.isHangul){const t=this.textUnits.slice(n.start,n.start+s);1===t.length?i+=t[0]:2===t.length?i+=W(t[0],t[1]):t.length>=3&&(i+=W(t[0],t[1],t[2]))}else s>0&&(i+=this.textUnits[n.start])}return i}start(){this.isRunning||(this.isRunning=!0,this.currentIndex=0,this.displayedText="",this.typeNext())}typeNext(){if(this.currentIndex>=this.textUnits.length)return this.isRunning=!1,this.config.showCursor&&this.updateDisplay(this.originalText),void(this.config.onComplete&&this.config.onComplete());this.displayedText=this.buildTextFromUnits(this.currentIndex+1);let t=this.displayedText;this.config.showCursor&&(t+=this.config.cursorChar),this.updateDisplay(t),this.config.onUpdate&&this.config.onUpdate(this.displayedText),this.currentIndex++,this.timeoutId=setTimeout(()=>{this.typeNext()},this.config.speed)}stop(){this.isRunning=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}reset(){this.stop(),this.currentIndex=0,this.displayedText="",this.hasTriggered=!1,this.updateDisplay("")}updateDisplay(t){const i=t.replace(new RegExp(this.escapeHtml(this.config.cursorChar)+"$"),""),e=t.endsWith(this.config.cursorChar),n=(this.container.textContent||"").replace(new RegExp(this.config.cursorChar+"$"),"");let s="";for(let r=0;r<i.length;r++){const t=i[r];s+=r>=n.length?`<span class="typing-char typing-fade-in" style="opacity: 0;">${this.escapeHtml(t)}</span>`:`<span class="typing-char" style="opacity: 1;">${this.escapeHtml(t)}</span>`}e&&(s+=`<span class="typing-cursor">${this.escapeHtml(this.config.cursorChar)}</span>`),this.container.innerHTML=s;const o=this.container.querySelectorAll(".typing-fade-in");o.length>0&&requestAnimationFrame(()=>{o.forEach(t=>{t.style.opacity="1",t.classList.remove("typing-fade-in")})})}escapeHtml(t){const i=document.createElement("div");return i.textContent=t,i.innerHTML}setText(t){this.originalText=t,this.config.text=t;const i=N(t);this.textUnits=i.units,this.charUnitRanges=i.charUnitRanges,this.reset(),this.config.enabled&&setTimeout(()=>this.start(),this.config.delay)}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null)}}const A=t=>--t*t*t+1;class q{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:i.direction??"bottom",distance:i.distance??"50px",duration:i.duration??800,threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,triggerOnce:i.triggerOnce??!1,enabled:i.enabled??!0,onStart:i.onStart||null,onComplete:i.onComplete||null},this.easing=A,this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i){return parseFloat(t)||50}const e=parseFloat(i[1]);switch(i[2]){case"px":default:return e;case"rem":case"em":return e*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return e/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return e/100*window.innerHeight;case"vw":return e/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const e=this.initialTransform||"",n=`translate(${t}px, ${i}px)`;this.container.style.transform=e&&"none"!==e?`${n} ${e}`:n,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new F(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,root:this.config.root,onVisible:()=>{this.config.enabled&&(this.config.triggerOnce&&this.hasTriggered||(this.hasTriggered=!0,this.start()))},onHidden:()=>{this.config.enabled&&(this.stop(),this.config.triggerOnce||(this.hasTriggered=!1),this.setInitialPosition())}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),e=this.easing(i);let n=0,s=0;switch(this.config.direction){case"top":s=-this.targetDistance*(1-e);break;case"right":n=this.targetDistance*(1-e);break;case"bottom":s=this.targetDistance*(1-e);break;case"left":n=-this.targetDistance*(1-e)}const o=this.initialTransform||"",r=`translate(${n}px, ${s}px)`;this.container.style.transform=o&&"none"!==o?`${r} ${o}`:r,this.container.style.opacity=String(e),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin&&void 0===t.root||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}function j(t){let i;return{c(){i=g("div"),f(i,"class",t[0]),f(i,"style",t[1])},m(e,n){u(e,i,n),t[21](i)},p(t,[e]){1&e&&f(i,"class",t[0]),2&e&&f(i,"style",t[1])},i:n,o:n,d(e){e&&d(i),t[21](null)}}}function X(t,i,n){let{text:s="mason effect"}=i,{densityStep:o=2}=i,{maxParticles:r=3200}=i,{pointSize:a=.5}=i,{ease:h=.05}=i,{repelRadius:l=150}=i,{repelStrength:c=1}=i,{particleColor:u="#fff"}=i,{fontFamily:d="Inter, system-ui, Arial"}=i,{fontSize:g=null}=i,{width:f=null}=i,{height:p=null}=i,{devicePixelRatio:m=null}=i,{className:y=""}=i,{style:b={}}=i;const v=e.createEventDispatcher();let M,$=null;return e.onMount(()=>{if(!M)return;n(20,$=new U(M,{text:s,densityStep:o,maxParticles:r,pointSize:a,ease:h,repelRadius:l,repelStrength:c,particleColor:u,fontFamily:d,fontSize:g,width:f,height:p,devicePixelRatio:m,onReady:t=>{v("ready",t)},onUpdate:t=>{v("update",t)}}))}),e.onDestroy(()=>{$&&($.destroy(),n(20,$=null))}),t.$$set=t=>{"text"in t&&n(3,s=t.text),"densityStep"in t&&n(4,o=t.densityStep),"maxParticles"in t&&n(5,r=t.maxParticles),"pointSize"in t&&n(6,a=t.pointSize),"ease"in t&&n(7,h=t.ease),"repelRadius"in t&&n(8,l=t.repelRadius),"repelStrength"in t&&n(9,c=t.repelStrength),"particleColor"in t&&n(10,u=t.particleColor),"fontFamily"in t&&n(11,d=t.fontFamily),"fontSize"in t&&n(12,g=t.fontSize),"width"in t&&n(13,f=t.width),"height"in t&&n(14,p=t.height),"devicePixelRatio"in t&&n(15,m=t.devicePixelRatio),"className"in t&&n(0,y=t.className),"style"in t&&n(1,b=t.style)},t.$$.update=()=>{1114104&t.$$.dirty&&$&&$.updateConfig({text:s,densityStep:o,maxParticles:r,pointSize:a,ease:h,repelRadius:l,repelStrength:c,particleColor:u,fontFamily:d,fontSize:g,width:f,height:p,devicePixelRatio:m})},[y,b,M,s,o,r,a,h,l,c,u,d,g,f,p,m,function(t){$&&$.morph(t)},function(){$&&$.scatter()},function(t){$&&$.updateConfig(t)},function(){$&&($.destroy(),n(20,$=null))},$,function(t){x[t?"unshift":"push"](()=>{M=t,n(2,M)})}]}class Y extends O{constructor(t){super(),H(this,t,X,j,h,{text:3,densityStep:4,maxParticles:5,pointSize:6,ease:7,repelRadius:8,repelStrength:9,particleColor:10,fontFamily:11,fontSize:12,width:13,height:14,devicePixelRatio:15,className:0,style:1,morph:16,scatter:17,updateConfig:18,destroy:19})}get morph(){return this.$$.ctx[16]}get scatter(){return this.$$.ctx[17]}get updateConfig(){return this.$$.ctx[18]}get destroy(){return this.$$.ctx[19]}}function B(t){let i;return{c(){i=g("div"),f(i,"class",t[0]),f(i,"style",t[1])},m(e,n){u(e,i,n),t[18](i)},p(t,[e]){1&e&&f(i,"class",t[0]),2&e&&f(i,"style",t[1])},i:n,o:n,d(e){e&&d(i),t[18](null)}}}function G(t,i,n){let{targetValue:s=0}=i,{duration:o=2e3}=i,{startValue:r=0}=i,{enabled:a=!0}=i,{easing:h=t=>t}=i,{threshold:l=.2}=i,{rootMargin:c="0px 0px -100px 0px"}=i,{triggerOnce:u=!1}=i,{className:d=""}=i,{style:g={}}=i;const f=e.createEventDispatcher();let p,m=null;return e.onMount(()=>{if(!p)return;n(17,m=new z(p,{targetValue:s,duration:o,startValue:r,enabled:a,easing:h,threshold:l,rootMargin:c,triggerOnce:u,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}}))}),e.onDestroy(()=>{m&&(m.destroy(),n(17,m=null))}),t.$$set=t=>{"targetValue"in t&&n(3,s=t.targetValue),"duration"in t&&n(4,o=t.duration),"startValue"in t&&n(5,r=t.startValue),"enabled"in t&&n(6,a=t.enabled),"easing"in t&&n(7,h=t.easing),"threshold"in t&&n(8,l=t.threshold),"rootMargin"in t&&n(9,c=t.rootMargin),"triggerOnce"in t&&n(10,u=t.triggerOnce),"className"in t&&n(0,d=t.className),"style"in t&&n(1,g=t.style)},t.$$.update=()=>{133112&t.$$.dirty&&m&&m.updateConfig({targetValue:s,duration:o,startValue:r,enabled:a,easing:h,threshold:l,rootMargin:c,triggerOnce:u,onUpdate:t=>{f("update",t)},onComplete:()=>{f("complete")}})},[d,g,p,s,o,r,a,h,l,c,u,function(){m&&m.start()},function(){m&&m.stop()},function(){m&&m.reset()},function(){return m?m.getValue():0},function(t){m&&m.updateConfig(t)},function(){m&&(m.destroy(),n(17,m=null))},m,function(t){x[t?"unshift":"push"](()=>{p=t,n(2,p)})}]}function J(t){let i;return{c(){i=g("div"),f(i,"class",t[1]),f(i,"style",t[2])},m(e,n){u(e,i,n),t[8](i)},p:n,i:n,o:n,d(e){e&&d(i),t[8](null)}}}function K(t,i,n){let s,o;l(t,effect,t=>n(10,s=t)),l(t,props,t=>n(11,o=t));let{text:r,speed:a=50,delay:h=0,enabled:c=!0,threshold:u=.2,rootMargin:d="0px 0px -100px 0px",triggerOnce:g=!1,showCursor:f=!0,cursorChar:p="|",className:m="",style:y="",onUpdate:b,onComplete:v}=o(),M=null,$=null;return e.onMount(()=>{if(!M)return;$=new k(M,{text:r,speed:a,delay:h,enabled:c,threshold:u,rootMargin:d,triggerOnce:g,showCursor:f,cursorChar:p,onUpdate:b,onComplete:v})}),e.onDestroy(()=>{$&&($.destroy(),$=null)}),s(()=>{$&&r!==$.originalText&&$.setText(r)}),[M,m,y,function(){null==$||$.start()},function(){null==$||$.stop()},function(){null==$||$.reset()},function(t){null==$||$.setText(t)},function(){$&&($.destroy(),$=null)},function(t){x[t?"unshift":"push"](()=>{M=t,n(0,M)})}]}function Q(t){let i,e;const n=t[18].default,s=function(t,i,e,n){if(t){const s=c(t,i,e,n);return t[0](s)}}(n,t,t[17],null);return{c(){i=g("div"),s&&s.c(),f(i,"class",t[0]),f(i,"style",t[1])},m(n,o){u(n,i,o),s&&s.m(i,null),t[19](i),e=!0},p(t,[o]){var r,a;s&&s.p&&(!e||131072&o)&&function(t,i,e,n,s,o){if(s){const r=c(i,e,n,o);t.p(r,s)}}(s,n,t,t[17],e?(r=n,a=t[17],r[2],a.dirty):function(t){if(t.ctx.length>32){const i=[],e=t.ctx.length/32;for(let t=0;t<e;t++)i[t]=-1;return i}return-1}(t[17]),null),(!e||1&o)&&f(i,"class",t[0]),(!e||2&o)&&f(i,"style",t[1])},i(t){e||(P(s,t),e=!0)},o(t){!function(t,i){if(t&&t.o){if(S.has(t))return;S.add(t),(void 0).c.push(()=>{S.delete(t)}),t.o(i)}}(s,t),e=!1},d(e){e&&d(i),s&&s.d(e),t[19](null)}}}function Z(t,i,n){let{$$slots:s={},$$scope:o}=i,{direction:r="bottom"}=i,{distance:a="50px"}=i,{duration:h=800}=i,{threshold:l=.1}=i,{rootMargin:c="0px"}=i,{root:u=null}=i,{triggerOnce:d=!1}=i,{enabled:g=!0}=i,{className:f=""}=i,{style:p={}}=i;const m=e.createEventDispatcher();let y,b=null;return e.onMount(()=>{if(!y)return;n(16,b=new q(y,{direction:r,distance:a,duration:h,threshold:l,rootMargin:c,root:u,triggerOnce:d,enabled:g,onStart:()=>{m("start")},onComplete:()=>{m("complete")}}))}),e.onDestroy(()=>{b&&(b.destroy(),n(16,b=null))}),t.$$set=t=>{"direction"in t&&n(3,r=t.direction),"distance"in t&&n(4,a=t.distance),"duration"in t&&n(5,h=t.duration),"threshold"in t&&n(6,l=t.threshold),"rootMargin"in t&&n(7,c=t.rootMargin),"root"in t&&n(8,u=t.root),"triggerOnce"in t&&n(9,d=t.triggerOnce),"enabled"in t&&n(10,g=t.enabled),"className"in t&&n(0,f=t.className),"style"in t&&n(1,p=t.style),"$$scope"in t&&n(17,o=t.$$scope)},t.$$.update=()=>{67576&t.$$.dirty&&b&&b.updateConfig({direction:r,distance:a,duration:h,threshold:l,rootMargin:c,root:u,triggerOnce:d,enabled:g,onStart:()=>{m("start")},onComplete:()=>{m("complete")}})},[f,p,y,r,a,h,l,c,u,d,g,function(){b&&b.start()},function(){b&&b.stop()},function(){b&&b.reset()},function(t){b&&b.updateConfig(t)},function(){b&&(b.destroy(),n(16,b=null))},b,o,s,function(t){x[t?"unshift":"push"](()=>{y=t,n(2,y)})}]}exports.Count=class extends O{constructor(t){super(),H(this,t,G,B,h,{targetValue:3,duration:4,startValue:5,enabled:6,easing:7,threshold:8,rootMargin:9,triggerOnce:10,className:0,style:1,start:11,stop:12,reset:13,getValue:14,updateConfig:15,destroy:16})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get getValue(){return this.$$.ctx[14]}get updateConfig(){return this.$$.ctx[15]}get destroy(){return this.$$.ctx[16]}},exports.MasonEffect=Y,exports.ScrollFadeIn=class extends O{constructor(t){super(),H(this,t,Z,Q,h,{direction:3,distance:4,duration:5,threshold:6,rootMargin:7,root:8,triggerOnce:9,enabled:10,className:0,style:1,start:11,stop:12,reset:13,updateConfig:14,destroy:15})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get updateConfig(){return this.$$.ctx[14]}get destroy(){return this.$$.ctx[15]}},exports.TextToParticle=Y,exports.Typing=class extends O{constructor(t){super(),H(this,t,K,J,h,{start:3,stop:4,reset:5,setText:6,destroy:7})}get start(){return this.$$.ctx[3]}get stop(){return this.$$.ctx[4]}get reset(){return this.$$.ctx[5]}get setText(){return this.$$.ctx[6]}get destroy(){return this.$$.ctx[7]}},exports.default=Y;
@@ -36,15 +36,13 @@ export declare interface CountOptions {
36
36
  onComplete?: () => void;
37
37
  }
38
38
 
39
- declare const easingFunctions: {
39
+ export declare const easingFunctions: {
40
40
  linear: (t: number) => number;
41
41
  easeInQuad: (t: number) => number;
42
42
  easeOutQuad: (t: number) => number;
43
43
  easeInOutQuad: (t: number) => number;
44
44
  easeOutCubic: (t: number) => number;
45
45
  };
46
- export { easingFunctions }
47
- export { easingFunctions as scrollFadeInEasingFunctions }
48
46
 
49
47
  export declare interface Particle {
50
48
  x: number;
@@ -60,11 +58,12 @@ export declare interface Particle {
60
58
 
61
59
  export declare class ScrollFadeIn {
62
60
  container: HTMLElement;
63
- config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'easing'>> & {
64
- easing: (t: number) => number;
61
+ config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'root'>> & {
62
+ root: HTMLElement | null;
65
63
  onStart: ScrollFadeInOptions['onStart'];
66
64
  onComplete: ScrollFadeInOptions['onComplete'];
67
65
  };
66
+ private easing;
68
67
  visibilityManager: VisibilityManager | null;
69
68
  animationFrameId: number | null;
70
69
  startTime: number | null;
@@ -90,9 +89,9 @@ export declare interface ScrollFadeInOptions {
90
89
  direction?: 'top' | 'right' | 'bottom' | 'left';
91
90
  distance?: string;
92
91
  duration?: number;
93
- easing?: (t: number) => number;
94
92
  threshold?: number;
95
93
  rootMargin?: string;
94
+ root?: HTMLElement | null;
96
95
  triggerOnce?: boolean;
97
96
  enabled?: boolean;
98
97
  onStart?: () => void;
@@ -209,6 +208,7 @@ declare class TextToParticle {
209
208
  originalText: string;
210
209
  constructor(container: HTMLElement | string, options: TypingOptions);
211
210
  init(): void;
211
+ private injectStyles;
212
212
  setupVisibilityManager(): void;
213
213
  private buildTextFromUnits;
214
214
  start(): void;
@@ -216,6 +216,7 @@ declare class TextToParticle {
216
216
  stop(): void;
217
217
  reset(): void;
218
218
  updateDisplay(text: string): void;
219
+ private escapeHtml;
219
220
  setText(newText: string): void;
220
221
  destroy(): void;
221
222
  }
@@ -265,6 +266,7 @@ declare class TextToParticle {
265
266
  declare interface VisibilityManagerOptions {
266
267
  threshold?: number;
267
268
  rootMargin?: string;
269
+ root?: HTMLElement | null;
268
270
  onVisible?: () => void;
269
271
  onHidden?: () => void;
270
272
  }
@@ -330,6 +330,8 @@ class VisibilityManager {
330
330
  this.options = {
331
331
  threshold: options.threshold ?? 0.1,
332
332
  rootMargin: options.rootMargin ?? "0px",
333
+ root: options.root ?? null,
334
+ // 기본값은 null (viewport 기준)
333
335
  onVisible: options.onVisible,
334
336
  onHidden: options.onHidden
335
337
  };
@@ -367,7 +369,9 @@ class VisibilityManager {
367
369
  },
368
370
  {
369
371
  threshold: this.options.threshold,
370
- rootMargin: this.options.rootMargin
372
+ rootMargin: this.options.rootMargin,
373
+ root: this.options.root || null
374
+ // null이면 viewport 기준, HTMLElement면 해당 요소 기준
371
375
  }
372
376
  );
373
377
  this.intersectionObserver.observe(this.container);
@@ -834,7 +838,7 @@ class TextToParticle {
834
838
  }
835
839
  }
836
840
  }
837
- const easingFunctions$1 = {
841
+ const easingFunctions = {
838
842
  linear: (t) => t
839
843
  };
840
844
  class Count {
@@ -848,7 +852,7 @@ class Count {
848
852
  duration: options.duration ?? 2e3,
849
853
  startValue: options.startValue ?? 0,
850
854
  enabled: options.enabled ?? true,
851
- easing: options.easing ?? easingFunctions$1.linear,
855
+ easing: options.easing ?? easingFunctions.linear,
852
856
  threshold: options.threshold ?? 0.2,
853
857
  rootMargin: options.rootMargin ?? "0px 0px -100px 0px",
854
858
  triggerOnce: options.triggerOnce ?? false,
@@ -1065,8 +1069,26 @@ class Typing {
1065
1069
  }
1066
1070
  init() {
1067
1071
  this.updateDisplay("");
1072
+ this.injectStyles();
1068
1073
  this.setupVisibilityManager();
1069
1074
  }
1075
+ injectStyles() {
1076
+ if (document.getElementById("masoneffect-typing-styles")) {
1077
+ return;
1078
+ }
1079
+ const style = document.createElement("style");
1080
+ style.id = "masoneffect-typing-styles";
1081
+ style.textContent = `
1082
+ .typing-char {
1083
+ transition: opacity 0.2s ease-in;
1084
+ display: inline-block;
1085
+ }
1086
+ .typing-cursor {
1087
+ display: inline-block;
1088
+ }
1089
+ `;
1090
+ document.head.appendChild(style);
1091
+ }
1070
1092
  setupVisibilityManager() {
1071
1093
  this.visibilityManager = new VisibilityManager(this.container, {
1072
1094
  threshold: this.config.threshold,
@@ -1159,7 +1181,39 @@ class Typing {
1159
1181
  this.updateDisplay("");
1160
1182
  }
1161
1183
  updateDisplay(text) {
1162
- this.container.textContent = text;
1184
+ const textWithoutCursor = text.replace(new RegExp(this.escapeHtml(this.config.cursorChar) + "$"), "");
1185
+ const hasCursor = text.endsWith(this.config.cursorChar);
1186
+ const previousTextContent = this.container.textContent || "";
1187
+ const previousTextWithoutCursor = previousTextContent.replace(new RegExp(this.config.cursorChar + "$"), "");
1188
+ let html = "";
1189
+ for (let i = 0; i < textWithoutCursor.length; i++) {
1190
+ const char = textWithoutCursor[i];
1191
+ const isNewChar = i >= previousTextWithoutCursor.length;
1192
+ if (isNewChar) {
1193
+ html += `<span class="typing-char typing-fade-in" style="opacity: 0;">${this.escapeHtml(char)}</span>`;
1194
+ } else {
1195
+ html += `<span class="typing-char" style="opacity: 1;">${this.escapeHtml(char)}</span>`;
1196
+ }
1197
+ }
1198
+ if (hasCursor) {
1199
+ html += `<span class="typing-cursor">${this.escapeHtml(this.config.cursorChar)}</span>`;
1200
+ }
1201
+ this.container.innerHTML = html;
1202
+ const newChars = this.container.querySelectorAll(".typing-fade-in");
1203
+ if (newChars.length > 0) {
1204
+ requestAnimationFrame(() => {
1205
+ newChars.forEach((char) => {
1206
+ char.style.opacity = "1";
1207
+ char.classList.remove("typing-fade-in");
1208
+ });
1209
+ });
1210
+ }
1211
+ }
1212
+ // HTML 이스케이프 유틸리티
1213
+ escapeHtml(text) {
1214
+ const div = document.createElement("div");
1215
+ div.textContent = text;
1216
+ return div.innerHTML;
1163
1217
  }
1164
1218
  // 텍스트 변경
1165
1219
  setText(newText) {
@@ -1181,9 +1235,7 @@ class Typing {
1181
1235
  }
1182
1236
  }
1183
1237
  }
1184
- const easingFunctions = {
1185
- easeOutCubic: (t) => --t * t * t + 1
1186
- };
1238
+ const defaultEasing = (t) => --t * t * t + 1;
1187
1239
  class ScrollFadeIn {
1188
1240
  // 계산된 거리 (px)
1189
1241
  constructor(container, options = {}) {
@@ -1195,14 +1247,16 @@ class ScrollFadeIn {
1195
1247
  direction: options.direction ?? "bottom",
1196
1248
  distance: options.distance ?? "50px",
1197
1249
  duration: options.duration ?? 800,
1198
- easing: options.easing ?? easingFunctions.easeOutCubic,
1199
1250
  threshold: options.threshold ?? 0.1,
1200
1251
  rootMargin: options.rootMargin ?? "0px",
1252
+ root: options.root ?? null,
1253
+ // 기본값은 null (viewport 기준)
1201
1254
  triggerOnce: options.triggerOnce ?? false,
1202
1255
  enabled: options.enabled ?? true,
1203
1256
  onStart: options.onStart || null,
1204
1257
  onComplete: options.onComplete || null
1205
1258
  };
1259
+ this.easing = defaultEasing;
1206
1260
  this.visibilityManager = null;
1207
1261
  this.animationFrameId = null;
1208
1262
  this.startTime = null;
@@ -1278,15 +1332,23 @@ class ScrollFadeIn {
1278
1332
  this.visibilityManager = new VisibilityManager(this.container, {
1279
1333
  threshold: this.config.threshold,
1280
1334
  rootMargin: this.config.rootMargin,
1335
+ root: this.config.root,
1336
+ // 내부 스크롤 컨테이너 지원
1281
1337
  onVisible: () => {
1282
- if (!this.hasTriggered && this.config.enabled) {
1283
- this.hasTriggered = true;
1284
- this.start();
1338
+ if (this.config.enabled) {
1339
+ if (!this.config.triggerOnce || !this.hasTriggered) {
1340
+ this.hasTriggered = true;
1341
+ this.start();
1342
+ }
1285
1343
  }
1286
1344
  },
1287
1345
  onHidden: () => {
1288
- if (!this.config.triggerOnce && this.isRunning) {
1289
- this.reset();
1346
+ if (this.config.enabled) {
1347
+ this.stop();
1348
+ if (!this.config.triggerOnce) {
1349
+ this.hasTriggered = false;
1350
+ }
1351
+ this.setInitialPosition();
1290
1352
  }
1291
1353
  }
1292
1354
  });
@@ -1306,7 +1368,7 @@ class ScrollFadeIn {
1306
1368
  const currentTime = performance.now();
1307
1369
  const elapsed = currentTime - (this.startTime || 0);
1308
1370
  const progress = Math.min(elapsed / this.config.duration, 1);
1309
- const easedProgress = this.config.easing(progress);
1371
+ const easedProgress = this.easing(progress);
1310
1372
  const direction = this.config.direction;
1311
1373
  let translateX = 0;
1312
1374
  let translateY = 0;
@@ -1373,7 +1435,6 @@ class ScrollFadeIn {
1373
1435
  this.config = {
1374
1436
  ...this.config,
1375
1437
  ...newConfig,
1376
- easing: newConfig.easing ?? this.config.easing,
1377
1438
  onStart: newConfig.onStart ?? this.config.onStart,
1378
1439
  onComplete: newConfig.onComplete ?? this.config.onComplete
1379
1440
  };
@@ -1381,7 +1442,7 @@ class ScrollFadeIn {
1381
1442
  this.targetDistance = this.parseDistance(this.config.distance);
1382
1443
  }
1383
1444
  this.setInitialPosition();
1384
- if (newConfig.threshold !== void 0 || newConfig.rootMargin !== void 0) {
1445
+ if (newConfig.threshold !== void 0 || newConfig.rootMargin !== void 0 || newConfig.root !== void 0) {
1385
1446
  if (this.visibilityManager) {
1386
1447
  this.visibilityManager.destroy();
1387
1448
  this.visibilityManager = null;
@@ -2104,9 +2165,9 @@ function instance_1($$self, $$props, $$invalidate) {
2104
2165
  let { direction = "bottom" } = $$props;
2105
2166
  let { distance = "50px" } = $$props;
2106
2167
  let { duration = 800 } = $$props;
2107
- let { easing = (t) => t } = $$props;
2108
2168
  let { threshold = 0.1 } = $$props;
2109
2169
  let { rootMargin = "0px" } = $$props;
2170
+ let { root = null } = $$props;
2110
2171
  let { triggerOnce = false } = $$props;
2111
2172
  let { enabled = true } = $$props;
2112
2173
  let { className = "" } = $$props;
@@ -2120,9 +2181,9 @@ function instance_1($$self, $$props, $$invalidate) {
2120
2181
  direction,
2121
2182
  distance,
2122
2183
  duration,
2123
- easing,
2124
2184
  threshold,
2125
2185
  rootMargin,
2186
+ root,
2126
2187
  triggerOnce,
2127
2188
  enabled,
2128
2189
  onStart: () => {
@@ -2176,9 +2237,9 @@ function instance_1($$self, $$props, $$invalidate) {
2176
2237
  if ("direction" in $$props2) $$invalidate(3, direction = $$props2.direction);
2177
2238
  if ("distance" in $$props2) $$invalidate(4, distance = $$props2.distance);
2178
2239
  if ("duration" in $$props2) $$invalidate(5, duration = $$props2.duration);
2179
- if ("easing" in $$props2) $$invalidate(6, easing = $$props2.easing);
2180
- if ("threshold" in $$props2) $$invalidate(7, threshold = $$props2.threshold);
2181
- if ("rootMargin" in $$props2) $$invalidate(8, rootMargin = $$props2.rootMargin);
2240
+ if ("threshold" in $$props2) $$invalidate(6, threshold = $$props2.threshold);
2241
+ if ("rootMargin" in $$props2) $$invalidate(7, rootMargin = $$props2.rootMargin);
2242
+ if ("root" in $$props2) $$invalidate(8, root = $$props2.root);
2182
2243
  if ("triggerOnce" in $$props2) $$invalidate(9, triggerOnce = $$props2.triggerOnce);
2183
2244
  if ("enabled" in $$props2) $$invalidate(10, enabled = $$props2.enabled);
2184
2245
  if ("className" in $$props2) $$invalidate(0, className = $$props2.className);
@@ -2186,7 +2247,7 @@ function instance_1($$self, $$props, $$invalidate) {
2186
2247
  if ("$$scope" in $$props2) $$invalidate(17, $$scope = $$props2.$$scope);
2187
2248
  };
2188
2249
  $$self.$$.update = () => {
2189
- if ($$self.$$.dirty & /*instance, direction, distance, duration, easing, threshold, rootMargin, triggerOnce, enabled*/
2250
+ if ($$self.$$.dirty & /*instance, direction, distance, duration, threshold, rootMargin, root, triggerOnce, enabled*/
2190
2251
  67576) {
2191
2252
  {
2192
2253
  if (instance2) {
@@ -2194,9 +2255,9 @@ function instance_1($$self, $$props, $$invalidate) {
2194
2255
  direction,
2195
2256
  distance,
2196
2257
  duration,
2197
- easing,
2198
2258
  threshold,
2199
2259
  rootMargin,
2260
+ root,
2200
2261
  triggerOnce,
2201
2262
  enabled,
2202
2263
  onStart: () => {
@@ -2217,9 +2278,9 @@ function instance_1($$self, $$props, $$invalidate) {
2217
2278
  direction,
2218
2279
  distance,
2219
2280
  duration,
2220
- easing,
2221
2281
  threshold,
2222
2282
  rootMargin,
2283
+ root,
2223
2284
  triggerOnce,
2224
2285
  enabled,
2225
2286
  start,
@@ -2240,9 +2301,9 @@ class ScrollFadeIn_1 extends SvelteComponent {
2240
2301
  direction: 3,
2241
2302
  distance: 4,
2242
2303
  duration: 5,
2243
- easing: 6,
2244
- threshold: 7,
2245
- rootMargin: 8,
2304
+ threshold: 6,
2305
+ rootMargin: 7,
2306
+ root: 8,
2246
2307
  triggerOnce: 9,
2247
2308
  enabled: 10,
2248
2309
  className: 0,
@@ -1 +1 @@
1
- "use strict";var t=Object.defineProperty,i=(i,n,e)=>((i,n,e)=>n in i?t(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e)(i,"symbol"!=typeof n?n+"":n,e);const n=require("svelte");function e(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function c(t,i){return t!=t?i==i:t!==i||t&&"object"==typeof t||"function"==typeof t}function h(t,i,n,e){return t[1]&&e?function(t,i){for(const n in i)t[n]=i[n];return t}(n.ctx.slice(),t[1](e(i))):n.ctx}function l(t){t.parentNode&&t.parentNode.removeChild(t)}function d(t,i,n){null==n?t.removeAttribute(i):t.getAttribute(i)!==n&&t.setAttribute(i,n)}let u;function g(t){u=t}const f=[],p=[];let m=[];const b=[],y=Promise.resolve();let $=!1;function v(t){m.push(t)}const w=new Set;let x=0;function O(){if(0!==x)return;const t=u;do{try{for(;x<f.length;){const t=f[x];x++,g(t),M(t.$$)}}catch(i){throw f.length=0,x=0,i}for(g(null),f.length=0,x=0;p.length;)p.pop()();for(let t=0;t<m.length;t+=1){const i=m[t];w.has(i)||(w.add(i),i())}m.length=0}while(f.length);for(;b.length;)b.pop()();$=!1,w.clear(),g(t)}function M(t){if(null!==t.fragment){t.update(),r(t.before_update);const i=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,i),t.after_update.forEach(v)}}const V=new Set;function C(t,i){t&&t.i&&(V.delete(t),t.i(i))}function _(t,i){const n=t.$$;null!==n.fragment&&(!function(t){const i=[],n=[];m.forEach(e=>-1===t.indexOf(e)?i.push(e):n.push(e)),n.forEach(t=>t()),m=i}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(i),n.on_destroy=n.fragment=null,n.ctx=[])}function I(t,i){-1===t.$$.dirty[0]&&(f.push(t),$||($=!0,y.then(O)),t.$$.dirty.fill(0)),t.$$.dirty[i/31|0]|=1<<i%31}function S(t,i,n,c,h,d,f=null,p=[-1]){const m=u;g(t);const b=t.$$={fragment:null,ctx:[],props:d,update:e,not_equal:h,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(m?m.$$.context:[])),callbacks:o(),dirty:p,skip_bound:!1,root:i.target||m.$$.root};f&&f(b.root);let y=!1;if(b.ctx=n?n(t,i.props||{},(i,n,...e)=>{const s=e.length?e[0]:n;return b.ctx&&h(b.ctx[i],b.ctx[i]=s)&&(!b.skip_bound&&b.bound[i]&&b.bound[i](s),y&&I(t,i)),n}):[],b.update(),y=!0,r(b.before_update),b.fragment=!!c&&c(b.ctx),i.target){if(i.hydrate){const t=($=i.target,Array.from($.childNodes));b.fragment&&b.fragment.l(t),t.forEach(l)}else b.fragment&&b.fragment.c();i.intro&&C(t.$$.fragment),function(t,i,n){const{fragment:e,after_update:o}=t.$$;e&&e.m(i,n),v(()=>{const i=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...i):r(i),t.$$.on_mount=[]}),o.forEach(v)}(t,i.target,i.anchor),O()}var $;g(m)}class D{constructor(){i(this,"$$"),i(this,"$$set")}$destroy(){_(this,1),this.$destroy=e}$on(t,i){if(!a(i))return e;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const t=n.indexOf(i);-1!==t&&n.splice(t,1)}}$set(t){var i;this.$$set&&(i=t,0!==Object.keys(i).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class H{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const P={easeOutCubic:t=>--t*t*t+1};class T{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:i.direction??"bottom",distance:i.distance??"50px",duration:i.duration??800,easing:i.easing??P.easeOutCubic,threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",triggerOnce:i.triggerOnce??!1,enabled:i.enabled??!0,onStart:i.onStart||null,onComplete:i.onComplete||null},this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i){return parseFloat(t)||50}const n=parseFloat(i[1]);switch(i[2]){case"px":default:return n;case"rem":case"em":return n*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return n/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return n/100*window.innerHeight;case"vw":return n/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const n=this.initialTransform||"",e=`translate(${t}px, ${i}px)`;this.container.style.transform=n&&"none"!==n?`${e} ${n}`:e,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,onVisible:()=>{!this.hasTriggered&&this.config.enabled&&(this.hasTriggered=!0,this.start())},onHidden:()=>{!this.config.triggerOnce&&this.isRunning&&this.reset()}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),n=this.config.easing(i);let e=0,s=0;switch(this.config.direction){case"top":s=-this.targetDistance*(1-n);break;case"right":e=this.targetDistance*(1-n);break;case"bottom":s=this.targetDistance*(1-n);break;case"left":e=-this.targetDistance*(1-n)}const o=this.initialTransform||"",r=`translate(${e}px, ${s}px)`;this.container.style.transform=o&&"none"!==o?`${r} ${o}`:r,this.container.style.opacity=String(n),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,easing:t.easing??this.config.easing,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}function k(t){let i,n;const e=t[18].default,s=function(t,i,n,e){if(t){const s=h(t,i,n,e);return t[0](s)}}(e,t,t[17],null);return{c(){var n;n="div",i=document.createElement(n),s&&s.c(),d(i,"class",t[0]),d(i,"style",t[1])},m(e,o){!function(t,i,n){t.insertBefore(i,n||null)}(e,i,o),s&&s.m(i,null),t[19](i),n=!0},p(t,[o]){var r,a;s&&s.p&&(!n||131072&o)&&function(t,i,n,e,s,o){if(s){const r=h(i,n,e,o);t.p(r,s)}}(s,e,t,t[17],n?(r=e,a=t[17],r[2],a.dirty):function(t){if(t.ctx.length>32){const i=[],n=t.ctx.length/32;for(let t=0;t<n;t++)i[t]=-1;return i}return-1}(t[17]),null),(!n||1&o)&&d(i,"class",t[0]),(!n||2&o)&&d(i,"style",t[1])},i(t){n||(C(s,t),n=!0)},o(t){!function(t,i){if(t&&t.o){if(V.has(t))return;V.add(t),(void 0).c.push(()=>{V.delete(t)}),t.o(i)}}(s,t),n=!1},d(n){n&&l(i),s&&s.d(n),t[19](null)}}}function F(t,i,e){let{$$slots:s={},$$scope:o}=i,{direction:r="bottom"}=i,{distance:a="50px"}=i,{duration:c=800}=i,{easing:h=t=>t}=i,{threshold:l=.1}=i,{rootMargin:d="0px"}=i,{triggerOnce:u=!1}=i,{enabled:g=!0}=i,{className:f=""}=i,{style:m={}}=i;const b=n.createEventDispatcher();let y,$=null;return n.onMount(()=>{if(!y)return;e(16,$=new T(y,{direction:r,distance:a,duration:c,easing:h,threshold:l,rootMargin:d,triggerOnce:u,enabled:g,onStart:()=>{b("start")},onComplete:()=>{b("complete")}}))}),n.onDestroy(()=>{$&&($.destroy(),e(16,$=null))}),t.$$set=t=>{"direction"in t&&e(3,r=t.direction),"distance"in t&&e(4,a=t.distance),"duration"in t&&e(5,c=t.duration),"easing"in t&&e(6,h=t.easing),"threshold"in t&&e(7,l=t.threshold),"rootMargin"in t&&e(8,d=t.rootMargin),"triggerOnce"in t&&e(9,u=t.triggerOnce),"enabled"in t&&e(10,g=t.enabled),"className"in t&&e(0,f=t.className),"style"in t&&e(1,m=t.style),"$$scope"in t&&e(17,o=t.$$scope)},t.$$.update=()=>{67576&t.$$.dirty&&$&&$.updateConfig({direction:r,distance:a,duration:c,easing:h,threshold:l,rootMargin:d,triggerOnce:u,enabled:g,onStart:()=>{b("start")},onComplete:()=>{b("complete")}})},[f,m,y,r,a,c,h,l,d,u,g,function(){$&&$.start()},function(){$&&$.stop()},function(){$&&$.reset()},function(t){$&&$.updateConfig(t)},function(){$&&($.destroy(),e(16,$=null))},$,o,s,function(t){p[t?"unshift":"push"](()=>{y=t,e(2,y)})}]}module.exports=class extends D{constructor(t){super(),S(this,t,F,k,c,{direction:3,distance:4,duration:5,easing:6,threshold:7,rootMargin:8,triggerOnce:9,enabled:10,className:0,style:1,start:11,stop:12,reset:13,updateConfig:14,destroy:15})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get updateConfig(){return this.$$.ctx[14]}get destroy(){return this.$$.ctx[15]}};
1
+ "use strict";var t=Object.defineProperty,i=(i,n,e)=>((i,n,e)=>n in i?t(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e)(i,"symbol"!=typeof n?n+"":n,e);const n=require("svelte");function e(){}function s(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(s)}function a(t){return"function"==typeof t}function c(t,i){return t!=t?i==i:t!==i||t&&"object"==typeof t||"function"==typeof t}function h(t,i,n,e){return t[1]&&e?function(t,i){for(const n in i)t[n]=i[n];return t}(n.ctx.slice(),t[1](e(i))):n.ctx}function l(t){t.parentNode&&t.parentNode.removeChild(t)}function d(t,i,n){null==n?t.removeAttribute(i):t.getAttribute(i)!==n&&t.setAttribute(i,n)}let u;function g(t){u=t}const f=[],p=[];let m=[];const b=[],y=Promise.resolve();let $=!1;function v(t){m.push(t)}const w=new Set;let x=0;function O(){if(0!==x)return;const t=u;do{try{for(;x<f.length;){const t=f[x];x++,g(t),M(t.$$)}}catch(i){throw f.length=0,x=0,i}for(g(null),f.length=0,x=0;p.length;)p.pop()();for(let t=0;t<m.length;t+=1){const i=m[t];w.has(i)||(w.add(i),i())}m.length=0}while(f.length);for(;b.length;)b.pop()();$=!1,w.clear(),g(t)}function M(t){if(null!==t.fragment){t.update(),r(t.before_update);const i=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,i),t.after_update.forEach(v)}}const V=new Set;function C(t,i){t&&t.i&&(V.delete(t),t.i(i))}function _(t,i){const n=t.$$;null!==n.fragment&&(!function(t){const i=[],n=[];m.forEach(e=>-1===t.indexOf(e)?i.push(e):n.push(e)),n.forEach(t=>t()),m=i}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(i),n.on_destroy=n.fragment=null,n.ctx=[])}function I(t,i){-1===t.$$.dirty[0]&&(f.push(t),$||($=!0,y.then(O)),t.$$.dirty.fill(0)),t.$$.dirty[i/31|0]|=1<<i%31}function S(t,i,n,c,h,d,f=null,p=[-1]){const m=u;g(t);const b=t.$$={fragment:null,ctx:[],props:d,update:e,not_equal:h,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(m?m.$$.context:[])),callbacks:o(),dirty:p,skip_bound:!1,root:i.target||m.$$.root};f&&f(b.root);let y=!1;if(b.ctx=n?n(t,i.props||{},(i,n,...e)=>{const s=e.length?e[0]:n;return b.ctx&&h(b.ctx[i],b.ctx[i]=s)&&(!b.skip_bound&&b.bound[i]&&b.bound[i](s),y&&I(t,i)),n}):[],b.update(),y=!0,r(b.before_update),b.fragment=!!c&&c(b.ctx),i.target){if(i.hydrate){const t=($=i.target,Array.from($.childNodes));b.fragment&&b.fragment.l(t),t.forEach(l)}else b.fragment&&b.fragment.c();i.intro&&C(t.$$.fragment),function(t,i,n){const{fragment:e,after_update:o}=t.$$;e&&e.m(i,n),v(()=>{const i=t.$$.on_mount.map(s).filter(a);t.$$.on_destroy?t.$$.on_destroy.push(...i):r(i),t.$$.on_mount=[]}),o.forEach(v)}(t,i.target,i.anchor),O()}var $;g(m)}class D{constructor(){i(this,"$$"),i(this,"$$set")}$destroy(){_(this,1),this.$destroy=e}$on(t,i){if(!a(i))return e;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(i),()=>{const t=n.indexOf(i);-1!==t&&n.splice(t,1)}}$set(t){var i;this.$$set&&(i=t,0!==Object.keys(i).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");class H{constructor(t,i={}){this.container=t,this.options={threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,onVisible:i.onVisible,onHidden:i.onHidden},this.intersectionObserver=null,this.visibilityChangeHandler=null,this.isVisible=!1,this.isPageVisible="undefined"==typeof document||!document.hidden,this.setupIntersectionObserver(),this.setupPageVisibility()}setupIntersectionObserver(){if("undefined"==typeof window||void 0===window.IntersectionObserver)return this.isVisible=!0,void(this.isPageVisible&&this.options.onVisible&&this.options.onVisible());this.intersectionObserver=new IntersectionObserver(t=>{for(const i of t)i.target===this.container&&(i.isIntersecting?(this.isVisible=!0,this.isPageVisible&&this.options.onVisible&&this.options.onVisible()):(this.isVisible=!1,this.options.onHidden&&this.options.onHidden()))},{threshold:this.options.threshold,rootMargin:this.options.rootMargin,root:this.options.root||null}),this.intersectionObserver.observe(this.container)}setupPageVisibility(){"undefined"!=typeof document&&(this.visibilityChangeHandler=()=>{const t=this.isPageVisible;this.isPageVisible=!document.hidden,document.hidden?this.options.onHidden&&this.options.onHidden():t!==this.isPageVisible&&this.isVisible&&this.options.onVisible&&this.options.onVisible()},document.addEventListener("visibilitychange",this.visibilityChangeHandler),document.hidden&&this.isVisible&&this.options.onHidden&&this.options.onHidden())}getIsVisible(){return this.isVisible&&this.isPageVisible}updateOptions(t){this.options={...this.options,...t},this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.setupIntersectionObserver()}destroy(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null),this.visibilityChangeHandler&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=null)}}const P=t=>--t*t*t+1;class T{constructor(t,i={}){if(this.container="string"==typeof t?document.querySelector(t):t,!this.container)throw new Error("Container element not found");this.config={direction:i.direction??"bottom",distance:i.distance??"50px",duration:i.duration??800,threshold:i.threshold??.1,rootMargin:i.rootMargin??"0px",root:i.root??null,triggerOnce:i.triggerOnce??!1,enabled:i.enabled??!0,onStart:i.onStart||null,onComplete:i.onComplete||null},this.easing=P,this.visibilityManager=null,this.animationFrameId=null,this.startTime=null,this.isRunning=!1,this.hasTriggered=!1,this.initialTransform="",this.targetDistance=0,this.init()}init(){const t=window.getComputedStyle(this.container);this.initialTransform="none"!==t.transform?t.transform:this.container.style.transform||"",this.targetDistance=this.parseDistance(this.config.distance),this.setInitialPosition(),this.setupVisibilityManager()}parseDistance(t){const i=t.match(/^(-?\d+\.?\d*)(px|rem|em|%|vh|vw)$/);if(!i){return parseFloat(t)||50}const n=parseFloat(i[1]);switch(i[2]){case"px":default:return n;case"rem":case"em":return n*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16);case"%":const t=this.container.getBoundingClientRect();return n/100*("top"===this.config.direction||"bottom"===this.config.direction?t.height:t.width);case"vh":return n/100*window.innerHeight;case"vw":return n/100*window.innerWidth}}setInitialPosition(){let t=0,i=0;switch(this.config.direction){case"top":i=-this.targetDistance;break;case"right":t=this.targetDistance;break;case"bottom":i=this.targetDistance;break;case"left":t=-this.targetDistance}const n=this.initialTransform||"",e=`translate(${t}px, ${i}px)`;this.container.style.transform=n&&"none"!==n?`${e} ${n}`:e,this.container.style.opacity="0",this.container.style.transition="none"}setupVisibilityManager(){this.visibilityManager=new H(this.container,{threshold:this.config.threshold,rootMargin:this.config.rootMargin,root:this.config.root,onVisible:()=>{this.config.enabled&&(this.config.triggerOnce&&this.hasTriggered||(this.hasTriggered=!0,this.start()))},onHidden:()=>{this.config.enabled&&(this.stop(),this.config.triggerOnce||(this.hasTriggered=!1),this.setInitialPosition())}})}start(){this.isRunning||(this.isRunning=!0,this.startTime=performance.now(),this.config.onStart&&this.config.onStart(),this.container.style.transition="none",this.animate())}animate(){if(!this.isRunning)return;const t=performance.now()-(this.startTime||0),i=Math.min(t/this.config.duration,1),n=this.easing(i);let e=0,s=0;switch(this.config.direction){case"top":s=-this.targetDistance*(1-n);break;case"right":e=this.targetDistance*(1-n);break;case"bottom":s=this.targetDistance*(1-n);break;case"left":e=-this.targetDistance*(1-n)}const o=this.initialTransform||"",r=`translate(${e}px, ${s}px)`;this.container.style.transform=o&&"none"!==o?`${r} ${o}`:r,this.container.style.opacity=String(n),i<1?this.animationFrameId=requestAnimationFrame(()=>this.animate()):this.complete()}complete(){this.isRunning=!1,this.initialTransform&&"none"!==this.initialTransform?this.container.style.transform=this.initialTransform:this.container.style.transform="",this.container.style.opacity="1",this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.config.onComplete&&this.config.onComplete()}reset(){this.stop(),this.hasTriggered=!1,this.setInitialPosition()}stop(){this.isRunning=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}updateConfig(t){const i=this.isRunning;this.stop(),this.config={...this.config,...t,onStart:t.onStart??this.config.onStart,onComplete:t.onComplete??this.config.onComplete},t.distance&&(this.targetDistance=this.parseDistance(this.config.distance)),this.setInitialPosition(),void 0===t.threshold&&void 0===t.rootMargin&&void 0===t.root||(this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.setupVisibilityManager()),i&&this.config.enabled&&this.start()}destroy(){this.stop(),this.visibilityManager&&(this.visibilityManager.destroy(),this.visibilityManager=null),this.container.style.transform=this.initialTransform||"",this.container.style.opacity="",this.container.style.transition=""}}function k(t){let i,n;const e=t[18].default,s=function(t,i,n,e){if(t){const s=h(t,i,n,e);return t[0](s)}}(e,t,t[17],null);return{c(){var n;n="div",i=document.createElement(n),s&&s.c(),d(i,"class",t[0]),d(i,"style",t[1])},m(e,o){!function(t,i,n){t.insertBefore(i,n||null)}(e,i,o),s&&s.m(i,null),t[19](i),n=!0},p(t,[o]){var r,a;s&&s.p&&(!n||131072&o)&&function(t,i,n,e,s,o){if(s){const r=h(i,n,e,o);t.p(r,s)}}(s,e,t,t[17],n?(r=e,a=t[17],r[2],a.dirty):function(t){if(t.ctx.length>32){const i=[],n=t.ctx.length/32;for(let t=0;t<n;t++)i[t]=-1;return i}return-1}(t[17]),null),(!n||1&o)&&d(i,"class",t[0]),(!n||2&o)&&d(i,"style",t[1])},i(t){n||(C(s,t),n=!0)},o(t){!function(t,i){if(t&&t.o){if(V.has(t))return;V.add(t),(void 0).c.push(()=>{V.delete(t)}),t.o(i)}}(s,t),n=!1},d(n){n&&l(i),s&&s.d(n),t[19](null)}}}function F(t,i,e){let{$$slots:s={},$$scope:o}=i,{direction:r="bottom"}=i,{distance:a="50px"}=i,{duration:c=800}=i,{threshold:h=.1}=i,{rootMargin:l="0px"}=i,{root:d=null}=i,{triggerOnce:u=!1}=i,{enabled:g=!0}=i,{className:f=""}=i,{style:m={}}=i;const b=n.createEventDispatcher();let y,$=null;return n.onMount(()=>{if(!y)return;e(16,$=new T(y,{direction:r,distance:a,duration:c,threshold:h,rootMargin:l,root:d,triggerOnce:u,enabled:g,onStart:()=>{b("start")},onComplete:()=>{b("complete")}}))}),n.onDestroy(()=>{$&&($.destroy(),e(16,$=null))}),t.$$set=t=>{"direction"in t&&e(3,r=t.direction),"distance"in t&&e(4,a=t.distance),"duration"in t&&e(5,c=t.duration),"threshold"in t&&e(6,h=t.threshold),"rootMargin"in t&&e(7,l=t.rootMargin),"root"in t&&e(8,d=t.root),"triggerOnce"in t&&e(9,u=t.triggerOnce),"enabled"in t&&e(10,g=t.enabled),"className"in t&&e(0,f=t.className),"style"in t&&e(1,m=t.style),"$$scope"in t&&e(17,o=t.$$scope)},t.$$.update=()=>{67576&t.$$.dirty&&$&&$.updateConfig({direction:r,distance:a,duration:c,threshold:h,rootMargin:l,root:d,triggerOnce:u,enabled:g,onStart:()=>{b("start")},onComplete:()=>{b("complete")}})},[f,m,y,r,a,c,h,l,d,u,g,function(){$&&$.start()},function(){$&&$.stop()},function(){$&&$.reset()},function(t){$&&$.updateConfig(t)},function(){$&&($.destroy(),e(16,$=null))},$,o,s,function(t){p[t?"unshift":"push"](()=>{y=t,e(2,y)})}]}module.exports=class extends D{constructor(t){super(),S(this,t,F,k,c,{direction:3,distance:4,duration:5,threshold:6,rootMargin:7,root:8,triggerOnce:9,enabled:10,className:0,style:1,start:11,stop:12,reset:13,updateConfig:14,destroy:15})}get start(){return this.$$.ctx[11]}get stop(){return this.$$.ctx[12]}get reset(){return this.$$.ctx[13]}get updateConfig(){return this.$$.ctx[14]}get destroy(){return this.$$.ctx[15]}};
@@ -36,15 +36,13 @@ export declare interface CountOptions {
36
36
  onComplete?: () => void;
37
37
  }
38
38
 
39
- declare const easingFunctions: {
39
+ export declare const easingFunctions: {
40
40
  linear: (t: number) => number;
41
41
  easeInQuad: (t: number) => number;
42
42
  easeOutQuad: (t: number) => number;
43
43
  easeInOutQuad: (t: number) => number;
44
44
  easeOutCubic: (t: number) => number;
45
45
  };
46
- export { easingFunctions }
47
- export { easingFunctions as scrollFadeInEasingFunctions }
48
46
 
49
47
  export declare interface Particle {
50
48
  x: number;
@@ -60,11 +58,12 @@ export declare interface Particle {
60
58
 
61
59
  export declare class ScrollFadeIn {
62
60
  container: HTMLElement;
63
- config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'easing'>> & {
64
- easing: (t: number) => number;
61
+ config: Required<Omit<ScrollFadeInOptions, 'onStart' | 'onComplete' | 'root'>> & {
62
+ root: HTMLElement | null;
65
63
  onStart: ScrollFadeInOptions['onStart'];
66
64
  onComplete: ScrollFadeInOptions['onComplete'];
67
65
  };
66
+ private easing;
68
67
  visibilityManager: VisibilityManager | null;
69
68
  animationFrameId: number | null;
70
69
  startTime: number | null;
@@ -90,9 +89,9 @@ export declare interface ScrollFadeInOptions {
90
89
  direction?: 'top' | 'right' | 'bottom' | 'left';
91
90
  distance?: string;
92
91
  duration?: number;
93
- easing?: (t: number) => number;
94
92
  threshold?: number;
95
93
  rootMargin?: string;
94
+ root?: HTMLElement | null;
96
95
  triggerOnce?: boolean;
97
96
  enabled?: boolean;
98
97
  onStart?: () => void;
@@ -209,6 +208,7 @@ declare class TextToParticle {
209
208
  originalText: string;
210
209
  constructor(container: HTMLElement | string, options: TypingOptions);
211
210
  init(): void;
211
+ private injectStyles;
212
212
  setupVisibilityManager(): void;
213
213
  private buildTextFromUnits;
214
214
  start(): void;
@@ -216,6 +216,7 @@ declare class TextToParticle {
216
216
  stop(): void;
217
217
  reset(): void;
218
218
  updateDisplay(text: string): void;
219
+ private escapeHtml;
219
220
  setText(newText: string): void;
220
221
  destroy(): void;
221
222
  }
@@ -265,6 +266,7 @@ declare class TextToParticle {
265
266
  declare interface VisibilityManagerOptions {
266
267
  threshold?: number;
267
268
  rootMargin?: string;
269
+ root?: HTMLElement | null;
268
270
  onVisible?: () => void;
269
271
  onHidden?: () => void;
270
272
  }