{"version":3,"file":"elements-why-jamaica.js","mappings":"kKAIAA,EAAAA,GAAKC,eAAeC,EAAAA,EAAkBC,EAAAA,GAEtCC,SAASC,iBAAiB,uBAAuBC,SAASC,IACxD,MAAMC,EAAMD,EAAGE,cAAc,oBAE7B,IAAKD,EACH,OAGF,MAAME,EAAQF,EAAIC,cAAc,UAC1BE,EAAOH,EAAIC,cAAc,eAGzBG,EAAaD,EAAKE,iBAKxB,IAAIC,EAAgB,EAEpB,KAAOA,EAAgBF,GAAY,CACjC,MAAMG,EAAWX,SAASY,gBATd,6BASqC,QACjDD,EAASE,aAAa,QAAS,mBAC/BF,EAASE,aAAa,SAAU,WAChCF,EAASE,aAAa,eAAgB,KACtCF,EAASE,aAAa,OAAQ,QAE9B,IAAIC,EAAQP,EAAKQ,iBAAiBL,GAClCA,GAbiB,GAebA,EAAgBF,IAClBE,EAAgBF,GAGlB,IAAIQ,EAAMT,EAAKQ,iBAAiBL,GAEhCC,EAASE,aAAa,IAAM,KAAIC,EAAMG,KAAKH,EAAMI,OAAOF,EAAIC,KAAKD,EAAIE,KAErEd,EAAIe,aAAaR,EAAUL,GAE3BI,GAxBgB,CAyBlB,CAEA,MAAMU,EAAShB,EAAIH,iBAAiB,oBAEpCL,EAAAA,GAAKyB,IAAID,EAAQ,CAAEE,QAAS,IAE5B1B,EAAAA,GACG2B,SAAS,CACRC,cAAe,CACbC,QAAStB,EACTuB,SAAS,EACTZ,MAAO,gBAGVa,GAAGP,EAAQ,CACVE,QAAS,EACTM,QAAS,MAEVD,GACCrB,EACA,CACEuB,WAAY,CACVtB,KAAM,8CACNuB,YAAY,EACZC,QAAS,GACTC,SAAU,IAEZC,SAAU,GAEZ,OACD,G","sources":["webpack://silverstripe-base/./themes/app/src/elements/why-jamaica.js"],"sourcesContent":["import { gsap } from \"gsap\";\nimport { MotionPathPlugin } from \"gsap/MotionPathPlugin\";\nimport { ScrollTrigger } from \"gsap/ScrollTrigger\";\n\ngsap.registerPlugin(MotionPathPlugin, ScrollTrigger);\n\ndocument.querySelectorAll(\".element-whyjamaica\").forEach((el) => {\n const svg = el.querySelector(\".why-jamaica-svg\");\n\n if (!svg) {\n return;\n }\n\n const plane = svg.querySelector(\".plane\");\n const path = svg.querySelector(\".plane-path\");\n\n const svgNS = \"http://www.w3.org/2000/svg\";\n const pathLength = path.getTotalLength();\n\n const dashLength = 14;\n const gapLength = 7;\n\n let currentLength = 0;\n\n while (currentLength < pathLength) {\n const dashPath = document.createElementNS(svgNS, \"path\");\n dashPath.setAttribute(\"class\", \"plane-path-dash\");\n dashPath.setAttribute(\"stroke\", \"#BFBFBF\");\n dashPath.setAttribute(\"stroke-width\", \"1\");\n dashPath.setAttribute(\"fill\", \"none\");\n\n let start = path.getPointAtLength(currentLength);\n currentLength += dashLength;\n\n if (currentLength > pathLength) {\n currentLength = pathLength;\n }\n\n let end = path.getPointAtLength(currentLength);\n\n dashPath.setAttribute(\"d\", `M ${start.x} ${start.y} L ${end.x} ${end.y}`);\n\n svg.insertBefore(dashPath, plane);\n\n currentLength += gapLength;\n }\n\n const dashes = svg.querySelectorAll(\".plane-path-dash\");\n\n gsap.set(dashes, { opacity: 0 });\n\n gsap\n .timeline({\n scrollTrigger: {\n trigger: el,\n markers: false,\n start: \"top center\",\n },\n })\n .to(dashes, {\n opacity: 1,\n stagger: 0.05,\n })\n .to(\n plane,\n {\n motionPath: {\n path: \"M588 1c180.96 34.935 361.92 200.297 416 361\",\n autoRotate: true,\n offsetX: 15,\n offsetY: -11,\n },\n duration: 3,\n },\n \"<60%\",\n );\n});\n"],"names":["gsap","registerPlugin","MotionPathPlugin","ScrollTrigger","document","querySelectorAll","forEach","el","svg","querySelector","plane","path","pathLength","getTotalLength","currentLength","dashPath","createElementNS","setAttribute","start","getPointAtLength","end","x","y","insertBefore","dashes","set","opacity","timeline","scrollTrigger","trigger","markers","to","stagger","motionPath","autoRotate","offsetX","offsetY","duration"],"sourceRoot":""}