/* @license GPL-2.0-or-later https://www.drupal.org/licensing/faq */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TORUS={});}(this,(function(t){"use strict";var e=e||{};const s=["bg","bg-opacity","bg-lighten","bg-darken","bg-brightness","block","border","border-opacity","blur","blur.to","blur.from","clip","push.up","push.down","push.left","push.right","pull.up","pull.left","pull.right","pull.down","fade.in","fade.out","fade.to","fade.from","opacity","reveal","reveal.hide","rotate.to","rotate.from","rotateX.to","rotateX.from","rotateY.to","rotateY.from","scale.to","scale.from","scaleX.to","scaleX.from","scaleY.to","scaleY.from","shadow","svg-shadow","shadow-offset.down","shadow-offset.up","shadow-offset.left","shadow-offset.right","shadow-intensity","shadow-color","skew.to","skew.from","skewX.to","skewX.from","skewY.to","skewY.from","text","text-opacity","delay","duration","top","bottom","up","down","left","right","shift.up","shift.right","shift.down","shift.left","originX","originY","originZ","wait","place.top","place.right","place.bottom","place.left"],i={activeValue:{block:"var(--tor-block);","fade.in":"0;","fade.out":"0;",clip:"var(--tor-clip-idle);",block:"var(--tor-block-idle);",reveal:"var(--tor-reveal-idle);","reveal.hide":"var(--tor-reveal-idle);"},additionalRules:{block:"--tor-block-scale: var(--tor-block-scale-idle); --tor-clip-delay: calc(var(--tor-duration-all) + var(--tor-delay-all, 0ms)); --tor-block-delay: var(--tor-delay-all, 0ms); --tor-block: var(--tor-block-idle);",reveal:"--tor-translateX: var(--tor-translateX-idle); --tor-translateY: var(--tor-translateY-idle);","reveal.hide":"--tor-translateX: var(--tor-translateX-idle); --tor-translateY: var(--tor-translateY-idle);"},alias:{"blur*":"blur","push*":"push-pull","pull*":"push-pull","shadow-offset*":"shadow-offset"},calc:{"push.up":-1,"push.left":-1,"pull.down":-1,"pull.right":-1,"shadow-offset.up":-1,"shadow-offset.left":-1,"shift.up":-1,"shift.left":-1},propertyAlias:{bg:"background-color","bg-lighten":"--tor-bg-lightness","bg-darken":"--tor-bg-lightness","bg-brightness":"--tor-bg-lightness",border:"border-color","push.up":"--tor-translateY","push.down":"--tor-translateY","push.left":"--tor-translateX","push.right":"--tor-translateX","pull.up":"--tor-translateY","pull.down":"--tor-translateY","pull.left":"--tor-translateX","pull.right":"--tor-translateX","fade*":"--tor-opacity",shadow:"box-shadow","svg-shadow":"filter","shadow-offset.down":"--tor-shadow-offsetY","shadow-offset.up":"--tor-shadow-offsetY","shadow-offset.left":"--tor-shadow-offsetX","shadow-offset.right":"--tor-shadow-offsetX",text:"color","shift.up":"--tor-shiftY","shift.down":"--tor-shiftY","shift.left":"--tor-shiftX","shift.right":"--tor-shiftX","place.top":"--tor-top","place.right":"--tor-right","place.bottom":"--tor-bottom","place.left":"--tor-left"},cssNot:["blur.from","block","pull*","clip","fade.in","reveal","rotate.from","rotateX.from","rotateY.from","scale.from","scaleX.from","scaleY.from","skew.from","skewX.from","skewY.from"],percentage:["bg-opacity","bg-brightness","fade.to","fade.from","opacity","scale*","scaleX*","scaleY*","text-opacity"]},r={computedStyle:window.getComputedStyle(document.documentElement,null),height:window.innerHeight||document.documentElement.clientHeight,width:window.innerWidth||document.documentElement.clientWidth,resolution:{},resizing:!1,scroll:{running:!1,tick:0,y:0,x:0},mouse:{running:!1,tick:0,x:0,y:0},idleCallback:!!window.requestIdleCallback,isChrome:!!window.chrome,isUnsupportedSVG:!!window.chrome||/AppleWebKit/i.test(navigator.userAgent),isSafari:/Safari/i.test(navigator.userAgent)&&!/Chrome/i.test(navigator.userAgent),mutationDone:!1},n=()=>{for(const [t,e] of Object.entries(x))if(r.width>=e.value){r.resolution.name=t,r.resolution.value=e.value;break;}},o=(t)=>("string"==typeof t&&(t=[...document.querySelectorAll(t)]),t instanceof Node&&(t=[t]),t instanceof NodeList&&(t=[].slice.call(t)),t instanceof Set&&(t=[...t]),!!t.length&&(!!t.length&&t)),a=(t)=>{t.elements&&async function(){let s;for(const i in t.elements){let r=t.elements[i];r.TORUS||(r.TORUS=r.TORUS||{}),r.TORUS[t.name]?(r.TORUS[t.name].refresh&&r.TORUS[t.name].refresh(),s=await r.TORUS[t.name].refresh):(r.TORUS[t.name]=new e[t.name](r,t.options),s=await r.TORUS[t.name]);}}();};String.prototype.replaceAll=function(t){let e=this;for(let s in t)e=e.replace(new RegExp(s,"g"),t[s]);return e;};const l=(t,e)=>{if(!t)return "";if(e&&(e=t.match(/(scroll|mouse|mouseX|mouseY|sensorX|sensorY)(.*?):(.*?)(@parallax|@tilt)\(.*?\)/g))){for(const s of e){let e=/@(.*?)\)/.exec(s)[0],i=/\((.*?)\)/.exec(e)[1],r={"@parallax":{name:"translate",method:"continuous",unit:"px",events:{mouseX:"X",mouseY:"Y",scroll:"Y"}},"@tilt":{name:"rotate",method:"self-continuous",unit:"deg",events:{mouseX:"Y",mouseY:"X"}}};for(const [n,o] of Object.entries(r)){for(let [r,a] of Object.entries(o.events)){let l=new RegExp(`${r}(.*?)${n}`);if(l.test(s))i="@tilt"===n&&"mouseY"===r?i:i.replace(/\d*/g,(t)=>t&&t.replace(t,"-"+t)),t=t.replace(e,`@T=${o.name}${a}(${i}${o.unit};0${o.unit},{method:${o.method}})`);else{if(l=new RegExp("^mouse:"),l.test(s)){let r=[],a=new RegExp(`(mouse)(.*?)(${e.replace(/\(/g,"\\(").replace(/\)/g,"\\)")})`,"g").exec(s);for(const [t,e] of Object.entries(o.events)){let s="@tilt"===n&&"mouseY"===t?"":"-";r.push(a[1].replace(a[1],t)+a[2]+`@T=${o.name}${e}(${s}${i}${o.unit};0${o.unit}, {method:${o.method}})`);}new RegExp(n).test(s)&&(t=t.replace(s,r.join(" ")));}}}}}}return p(t.replace(/\s\s+/g," ").replace(/ $/g,""),"\\[ | \\]|{ | }| { | : |: | :| ; |; | ;| ,|, | , |\\( | \\)|\\(\\( | \\(\\(| \\(\\( | \\)\\)| =>|=> | => | \\+| \\+ |\\+ | ~| ~ |~ | \\(").replace(/\((.*?)\)+/g,(t)=>t.replace(/ +/g,"░")).replace(/\\/g,"").replace(/@T=/g,"@transform=").replace(/@F=/g,"@filter=").trim();},c=(t)=>{let e=null;if(/(xs|sm|md|lg|xl|xxl)::/g.test(t=t)){let s=t.split("::");e=s[0],t=s[1];}return {resolution:e,value:t};},h=(t)=>{let e=null;if(!/^@/.test(t)&&/^(-|\+|\/\+|\/-|\/~|\.|.*?)\d/g.test(t)&&!Number(t)){let s=/(?!\d)(px|deg|%|cm|mm|in|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|ms|s)+/g.exec(t.replace(/\/+/g,""));s&&(e=s[1],t=t.replace(e,""));}return t=m(t),/^--/.test(t)&&(t=`var(${t})`),{value:t,unit:e};},d=(t)=>{let e,s,i=t.property,r=t.value,n=t.unit?t.unit:"",o=t.wrap;return S.includes(r)?(s=k[i]&&k[i].alias&&k[i].alias?k[i].alias:i,e=k[i]&&k[i].calc?`calc(var(--tor-${s}-${r}) * ${k[i].calc})`:`var(--tor-${s}-${r})`):e=k[i]&&k[i].calc?`${r*k[i].calc}${n}`:o?`${o}(${r}${n})`:`${r}${n}`,k[i]&&k[i].activeValue&&(e=k[i].activeValue),e;},u=(t)=>{let e=t.match(/\b([^\s]+)\[(.*?)\]/g);if(e){for(let i of e){let e=[],r=i,n=/,{(?:.(?!,{))+}(?=\])/g.exec(i);n&&(i=i.replace(n[0],""),n=/,{(.*?)}/.exec(n[0])[1]);let o=/^(.*?)\:/.exec(i)[1],a=/\[(.*?)\]+/g.exec(i)[1].split(" ");for(let t of a)/^!/.test(t)?e.push(`!${o}:${s(n,t.replace("!",""))}`):e.push(`${o}:${s(n,t)}`);t=t.replace(r,e.join(" "));}}function s(t,e){return t&&(e=/}\)/.test(e)?e.replace("})",`,${t}})`):e.replace(")",`,{${t}})`)),e;}return t;},m=(t)=>t=/(^(\d.*?)|^()|^(-\d.*?))\.(\d)+/g.test(t)?parseFloat(/((-|\+|)[0-9]*[.])?[0-9]+/g.exec(t)[0]):/^[-+]?\d+$/.test(t)?parseInt(/[+-]?(\d)+/g.exec(t)[0]):t,p=(t,e)=>{let s,i,r,n=t;for(const t of e.split("|"))r=t.replace(/ /g,""),i=new RegExp(t,"g"),s=n.replace(i,r),n=s.replace(/\\+/g,"");return s;},g=(t)=>{C.sheet.insertRule(t,C.sheet.cssRules.length);},f=(t,e)=>{let s={};switch(e.event){case "mouse":switch(e.options.method){case "middle":s={x:1-Math.abs((r.width/2-r.mouse.x)/(r.width/2)),y:1-Math.abs((r.height/2-r.mouse.y)/(r.height/2)),all:1-Math.sqrt(Math.pow(r.width/2-r.mouse.x,2)+Math.pow(r.height/2-r.mouse.y,2))/Math.sqrt(Math.pow(r.width/2,2)+Math.pow(r.height/2,2))};break;case "continuous":s={x:1-(r.width/2-r.mouse.x)/(r.width/2),y:1-(r.height/2-r.mouse.y)/(r.height/2)};break;case "self":{let e=t&&1-Math.abs((r.mouse.x-t.bounds.centerX)/t.bounds.maxXSide),i=t&&1-Math.abs((r.mouse.y-t.bounds.centerY)/t.bounds.maxYSide);s={x:Math.min(1,Math.max(0,e)),y:Math.min(1,Math.max(0,i)),all:t&&v(t,t.bounds.centerX,t.bounds.centerY)};break;}case "self-continuous":s={x:t&&1+(r.mouse.x-t.bounds.centerX)/t.bounds.maxXSide,y:t&&1+(r.mouse.y-t.bounds.centerY)/t.bounds.maxYSide};break;case "parallax":s={x:(r.mouse.x-r.width/2)/(r.width/2),y:(r.mouse.y-r.height/2)/(r.height/2)};break;case "start":{let t=r.mouse.x/r.width,e=r.mouse.y/r.height;s={x:t,y:e,all:(t+e)/2};break;}}break;case "scroll":{let i,n,o,a,l=0,c=0,h=e.options.end,d=e.options.start;switch("middle"===h&&(c=t.bounds.height/2,h=50),"shifted"===d&&(d=0,l=t.bounds.height/2,c=0),i=r.height/100*d+l,n=r.height/100*(h-d)+c,o=null,a=(r.height+r.scroll.y-t.bounds.offsetTop-i)/n,e.options.method){case "continuous":s={x:o,y:a};break;case "regular":s={x:o,y:Math.min(1,Math.max(0,a))};}break;}}return {x:Math.round(1e3*s.x)/1e3,y:Math.round(1e3*s.y)/1e3,all:Math.round(1e3*s.all)/1e3};},v=(t,e,s)=>1-Math.abs(Math.sqrt(Math.pow(Math.abs(e-r.mouse.x),2)+Math.pow(Math.abs(s-r.mouse.y),2))/t.bounds.maxDiagonal),b=()=>{r.scroll.y=window.scrollY,r.scroll.x=window.scrollX;},y=(t,e)=>{e=e.replace(/\//g,"");let s=/(.).*?(?=\+|-|~)/.exec(e);s&&(e=e.replace(s[0],""),s=h(s[0]).value);let i=/\+|-|~/.exec(e);i&&(i=i[0],e=e.replace(i,""));let r=h(e).value,n=h(e).unit;switch(i){case "+":t=t;break;case "-":t=-t;break;case "~":t=1,r=Math.round(Math.random()*(r-0)+0);}return `${s+t*r}${n||""}`;},w=(t)=>{if(t.elements&&t.elements.length){for(const e of o(t.elements))e.TORUS&&e.TORUS[t.object]&&e.TORUS[t.object][t.fn](t.argument);}},S=r.computedStyle.getPropertyValue("--tor-predefined-values").trim().split(","),x={},O=r.computedStyle.getPropertyValue("--tor-resolutions").replace(/"| +/g,"").split(",");let _=O.length-1;for(const t of O){let e=t.split(":"),s=h(e[1]);x[e[0]]={},x[e[0]].value=s.value,x[e[0]].unit=s.unit,x[e[0]].id=_--;}n();const $={inview:".inview",active:".active",show:".show",hover:":hover",focus:":focus","focus-within":":focus-within"},k=(()=>{const t={};for(const i of s){t[i]={};let s=/^(.*?)\./.exec(i),r=s?s[1]:i;t[i].propertyAlias="--tor-"+r,e("propertyAlias",i),e("activeValue",i),e("additionalRules",i),e("alias",i),e("calc",i),e("percentage",i),e("cssNot",i);}function e(e,s){let r=i[e] instanceof Array;for(const [n,o] of Object.entries(i[e])){let i=r?o:n,a=!!r||o;if(/\*/g.test(i)){let r=/^(.*?)\*/.exec(i)[1],n=/^(.*?)\./.exec(s);n&&r===n[1]&&(t[s][e]=a);}else i===s&&(t[s][e]=a);}}return t;})(),C=document.createElement("style"),L={priority:{indexReplace:0,indexValue:0,regex:/^!(.*?)/},trigger:{indexReplace:0,indexValue:0,regex:/^((?:.)(?:((?!::)+(?!{))))*?(?:\:)/},resolution:{indexReplace:0,indexValue:2,regex:/^(<|=|)(xs|sm|md|lg|xl|xxl)(.*?)::/},property:{indexReplace:1,indexValue:1,regex:/^(?:@|)(.*?)(\(|$)/},values:{indexReplace:0,indexValue:1,regex:/^\((.*?)\)$/}},M=(t,e,s)=>{let i={};t.attributes[s]=t.attributes[s]||{};for(const r of e){let e,n=/^((?:.)(?:((?!::)+(?!{))))*?(?=\:)/g.exec(r);t.attributes[s]=t.attributes[s]||{},n?(n=n[0].replace("!",""),i[s]=i[s]||{},/^(mouse|scroll|sensor)/.test(n)?(e=/^.*?(?=(X|Y))/.exec(n),e=e?e[0]:n,t.attributes[s][e]=t.attributes[s][e]||{},t.attributes[s][e][n]=t.attributes[s][e][n]||{},i[s][e]=i[s][e]||{},i[s][e][n]=i[s][e][n]||[],i[s][e][n].push(r)):(t.attributes[s][n]=t.attributes[s][n]||{},i[s][n]=i[s][n]||[],i[s][n].push(r))):(t.attributes[s].idle=t.attributes[s].idle||{},i[s]=i[s]||{},i[s].idle=i[s].idle||[],i[s].idle.push(r));}for(const [e,s] of Object.entries(i)){for(const [i,n] of Object.entries(s))if(/mouse|scroll|sensor/.test(i)){for(const [s,o] of Object.entries(n))r(t,e,i,o,s);}else r(t,e,i,n);}function r(t,e,s,i,r){for(const [n,o] of Object.entries(i)){let i,a=o;i=r?t.attributes[e][s][r][n]={}:t.attributes[e][s][n]={},i.original=o,/@/.test(a)&&(i.isCustom=!0,a=a.replace("@",""));for(let [e,s] of Object.entries(L)){let r=s.regex.exec(a);r?(a=a.replace(r[s.indexReplace],""),E(t,i,r,e,s)):E(t,i,r,e+":default",s);}}}},E=(t,s,i,r,n)=>{switch(r){case "priority":s.priority="important";break;case "trigger":{s.trigger={};let r=i[n.indexValue].replace(":",""),o=/\((.*?)\)/.exec(r);if(o){if(s.trigger.name=r.replace(o[0],""),s.trigger.argument=o[1],"p"===o[1]&&(s.trigger.argument="parent"),/^#/.test(o[1]))switch(s.trigger.name){case "scroll":document.querySelector(o[1]).addEventListener("scroll",W,{passive:!0});break;default:e.Parent.init(document.querySelector(o[1]),{trigger:s.trigger.name});}}else s.trigger.name=r;s.trigger.alias=$[s.trigger.name];let a=/X$|Y$/i.exec(s.trigger.name);s.trigger.direction=a?a[0].toLowerCase():"all","scroll"===s.trigger.name&&(s.trigger.direction="y");break;}case "resolution":s.resolution=i[n.indexValue];break;case "property":if(s.property={},s.property.name=i[n.indexValue],/=/.test(s.property.name)){let t=s.property.name.split("=");s.property.cssFunction=t[0],s.property.name=t[1];}/^bg$|^border$|^color$|^shadow$/.test(s.property.name)&&(s.priority=!0),/^background-color$/.test(s.property.name)?s.joinSymbol=",":s.joinSymbol=" ",j(t,s);break;case "values":switch(T(t,s,i,n),s.property.name){case "offset":t.is.inviewOffset=s.values.all.end.value;}break;case "resolution:default":s.resolution="all";}},j=(t,e)=>{let s=k[e.property.name];if(s)e.property.alias=s.propertyAlias||"",s.cssNot&&e.trigger&&(e.trigger.alias=`:not(${$[e.trigger.name]})`);else{if(!e.isCustom)switch(e.noCSSProcess=!0,e.original){case "inview:revert":t.is.inviewRevert=!0;}}},T=(t,e,s,i)=>{let r,n,o,a={};if(e.values={},e.values.all=e.values.all||{},/\.\.\./.test(e.original)){e.values.multi=!0;let t=/\((.*?)\(/.exec(e.original);t&&(e.values.cssFunction=t[1]);}if(o=s[i.indexValue],e.options={},e.trigger&&(/mouse/.test(e.original)&&(e.options.method="middle"),/scroll(?!(.*?)class)/.test(e.original)&&(e.options.start=0,e.options.end="middle",e.options.method="regular")),n=/(,{|^{)(.*?)}/.exec(o),n){for(const t of n[2].split(",")){let s=t.split(":"),i=s[0],r=s[1];switch(i){case "target":r=r.replace(/\|+/g,",").replace(/░+/g," "),e.options[i]=document.querySelectorAll(r);break;default:/^--/.test(r)?e.options[i]=`var(${r})`:S.includes(r)?e.options[i]=`var(--tor-${r})`:e.options[i]=/true|false/.test(r)?JSON.parse(r):r;}}o=o.replace(n[0],"");}r=o.split(";"),a.end=r[1],a.end?(a.start=u(r[0]),a.end=u(r[1])):(a.start=null,a.end=r[0]);for(const t of ["start","end"])if(a[t])if(/(xs|sm|md|lg|xl|xxl)::/g.test(a[t])){for(const s of a[t].split("░")){const i=c(s);let r=d(h(i.value));i.resolution?(e.values[i.resolution]=e.values[i.resolution]||{},l(i.resolution,t,r)):l("all",t,r);}}else l("all",t,d(h(a[t])));function l(t,s,i){e.values[t][s]={},e.values[t].original=o;for(const [r,n] of Object.entries({value:i.value,unit:i.unit}))e.values[t][s][r]=n||0===n?n:null;}function d(t){let s,i;return k[e.property.name]&&k[e.property.name].percentage?(s="%"===t.unit?t.value/100:t.value,i=null):(s=t.value,i=t.unit),{value:s,unit:i};}function u(t){let s=t;if(/\.\.\./.test(s)){s={},t=t.replace("...",""),t=e.values.cssFunction?t.replace(e.values.cssFunction,"").replace(/\(|\)/g,""):t;for(const [e,i] of Object.entries(t.split(","))){let t=h(i);s[e]={},s[e].value=t.value,s[e].unit=t.unit;}}return s;}/:class./.test(e.original)&&(e.options.target||(e.options.target=t.element));},A=(t,e,s)=>{if(!t.values)return {value:null,unit:null};let i,n,o,a=0;for(let l=0;l<=x[r.resolution.name].id;l++){let r=Object.keys(x).find((t)=>x[t].id===l),c=t.values[r];c&&(c.start&&(a=s?c.start.value[s].value:c.start.value),c.end&&(n=s?c.end.value[s].value:c.end.value,i=s?c.end.value[s].unit?c.end.value[s].unit:"":c.end.unit?c.end.unit:"")),o="string"==typeof a||"string"==typeof n?e<1?a:n:Math.round(1e3*(a+(n-a)*e))/1e3;}return /true|false/.test(o)&&(o=JSON.parse(o)),{value:o,unit:i,start:a,end:n};},P=(t,e,s)=>{if(t instanceof Node&&(t=[t]),e instanceof Object){let i=document.createElement("div");for(const e of t)i.appendChild(e);e.appendChild(i),s&&i.classList.add(s);}else{for(let i of t){let t,r,n;n=i.nextElementSibling,"svg"===e?(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.setAttribute("xmlns","http://www.w3.org/2000/svg")):t=document.createElement(e),r=i.parentElement,t.appendChild(i),s&&t.classList.add(s),r.insertBefore(t,n);}}};String.prototype.toCamelCase=function(){return this.replace(/[-_]+/g," ").replace(/ (.)/g,(function(t){return t.toUpperCase();})).replace(/ /g,"");};const R=(t,e)=>{let s=0;return "intersecting"===e&&(s=r.height/2),r.scroll.y+r.height+s>=t.offsetTop&&r.scroll.y+r.height-s<=t.offsetTop+t.height+r.height;},Y=(t)=>{function e(t){if(/svg/i.test(t.target.nodeName)){t.target.TORUS=t.target.TORUS||{},t.target.TORUS.svg=t.target.TORUS.svg||{};let e=t.boundingClientRect,s=t.target.TORUS.svg,i=t.target.width.baseVal.value,n=t.target.viewBox.baseVal.width?t.target.viewBox.baseVal.width:i;s.rect={offsetLeft:e.left+r.scroll.x,offsetTop:e.top+r.scroll.y};for(const t of s.children)t.set.bounds(t.element.getBBox(),{rect:s.rect,ratio:i/n}),t.set.intersecting(R(t.bounds,"intersecting")),t.is.inviewElement&&t.set.inview(R(t.bounds,"inview"));s.calculated=!0;}}r.idleCallback?requestIdleCallback(()=>{e(t);}):requestAnimationFrame(()=>{setTimeout(()=>{e(t);},0);});},X=(t)=>{let e=(r.scroll.y+r.height-t.bounds.offsetTopOriginal)/r.height*100,s=(r.scroll.y+r.height-t.bounds.offsetBottom)/r.height*100;e>=0&&s<100?!t.is.inview&&t.set.inview(!0,!0):t.is.inview&&t.set.inview(!1,!0);},I={breakpoints:{},styles:new Set()};for(const t of Object.keys(x))I.breakpoints[t]=new Set();const N=new Set(),q=new Set(),F=new Set(),U=new Set(),D=new Set(),B=new Set(),V=(t,e)=>{for(const s of t){const t=s.target.TORUS;t&&(t.Main&&(t.Main.bounds.calculated||void 0!==r.scroll.y&&(t.Main.set.bounds(s.boundingClientRect),t.Main.is.svgChild||s.isIntersecting&&t.Main.set.intersecting(s.isIntersecting)),/ 50%/.test(e.rootMargin)&&(t.Main.is.svgChild||t.Main.set.intersecting(s.isIntersecting)),/ 0%/.test(e.rootMargin)&&(t.Main.has.originalPosition?X(t.Main):t.Main.set.inview(s.isIntersecting))),t.Parent&&(t.Parent.is.inviewElement&&t.Parent.run.inview(),/ 0%/.test(e.rootMargin)&&t.Parent.set.inview(s.isIntersecting)),r.isUnsupportedSVG&&t.svg&&Y(s));}},z=new IntersectionObserver(V,{root:null,rootMargin:"50%"}),G=new IntersectionObserver(V,{root:null,rootMargin:"0%"});let H;const W=(t)=>{console.log(t.target.scrollTop);},J=()=>{let t=function(t){t.tick>=5?t.running=!1:t.tick+=1;return t;}(r.mouse).running,e=function(t){t.tick>=10?t.running=!1:t.tick+=1;return t;}(r.scroll).running;if(t){for(const t of F)t.run.event("mouse");}if(e){for(const t of q)t.run.event("scroll");for(const t of F)t.is.intersecting&&t._setBounds(!1);for(const t of D)t.run.classScroll();if(r.isUnsupportedSVG){for(const t of B)t.set.intersecting(R(t.bounds,"intersecting")),t.is.inviewElement&&t.set.inview(R(t.bounds,"inview"));}for(const t of N)if(t.is.intersecting&&t.is.inviewOffset)(r.scroll.y+r.height-t.bounds.offsetTop)/r.height*100>=t.is.inviewOffset?!t.is.inview&&t.set.inview(!0,!0):t.is.inview&&t.set.inview(!1,!0);else t.has.originalPosition?X(t):G.observe(t.element);}e||t?requestAnimationFrame(J):cancelAnimationFrame(J);};window.addEventListener("scroll",()=>{let t=r.scroll;t.tick=0,b(),t.running||(requestAnimationFrame(J),t.running=!0);},{passive:!0}),window.addEventListener("pointermove",(t)=>{let e=r.mouse;e.tick=0,e.x=t.clientX,e.y=t.clientY,e.running||(requestAnimationFrame(J),e.running=!0);},{passive:!0}),window.addEventListener("resize",(function(){let t=0;r.resizing||(requestAnimationFrame((function s(){t>=50?(r.resizing=!1,cancelAnimationFrame(s),r.height=window.innerHeight||document.documentElement.clientHeight,r.width=window.innerWidth||document.documentElement.clientWidth,n(),e.Main&&e.Main.refresh(),e.Loop&&e.Loop.refresh(),e.Slider&&e.Slider.refresh()):(t+=1,requestAnimationFrame(s));})),r.resizing=!0);})),window.addEventListener("DOMContentLoaded",()=>{r.DOMReady=!0;const t=new ResizeObserver((t)=>{for(const s of t)s.target===document.documentElement&&(r.idleCallback?requestIdleCallback(()=>e.Main.refresh()):requestAnimationFrame(()=>e.Main.refresh()));});requestAnimationFrame(()=>{document.body.classList.add("tor-loaded"),r.isChrome&&document.body.classList.add("tor-chrome"),r.isSafari&&document.body.classList.add("tor-safari"),H.disconnect(),e.BgImage.init(),t.observe(document.documentElement);}),r.idleCallback?requestIdleCallback(()=>b()):requestAnimationFrame(()=>b());}),e.Group=class{constructor(t){this.element=t,this.element.dataset.torGroup&&(this.element.dataset.torGroup=l(this.element.dataset.torGroup),this.dataset=this.element.dataset.torGroup.replace(/\((.*?)\)+/g,(t)=>t.replace(/ +/g,"░")),this.attributes=this.attributes||{},this.targets=[],this._sortAttributes(),this._assignAttributes(),e.Main.init(this.targets));}_sortAttributes(){let t=this.dataset.match(/(.*?);(?![^()]*\))/g);if(t){for(const e of t){let t=/^(.*?)=>/.exec(e)[1],s=/=>(.*?)$/.exec(e)[1].replace(/;$/,"").replace(/\s+(?=[^[\]]*\])/g,"░");this.attributes[t]=this.attributes[t]||{};for(const [e,i] of Object.entries(s.split(" ")))this.attributes[t][e]=i;}}else console.error("Missing semicolon at the end of "+this.dataset);}_assignAttributes(){for(const [t,e] of Object.entries(this.attributes)){let s=0,i=this.element.querySelectorAll(t);for(const t of i){let i=[];for(let t of Object.values(e))t=t.replace(/░+/g," "),/\/(.*?)\//.test(t)?i.push(this._counting(s,t)):i.push(t);s+=1,t.dataset.tor?t.dataset.tor=t.dataset.tor+" "+i.join(" "):t.dataset.tor=i.join(" "),U.add(t),this.targets.push(t);}}}_counting(t,e){let s,i;const r=e.match(/\/(.*?)\/+/g);for(const n of r){const r=n.split(";");let o=r[0],a=r[1];a||(a=o,o=null),s=/\/(.*?)\//.test(o)?y(t,o):o,i=/\/(.*?)\//.test(a)?y(t,a):a,e=e.replace(n,`${s?s+";":""}${i}`);}return e;}static init(t){t=o(t||"[data-tor-group]"),a({name:"Group",elements:t});}};var K=e.Group;e.Parent=class{constructor(t,e){this.element=t,this.element.torusInitializedParent=!0,e&&e.trigger&&(this.element.dataset.torParent=this.element.dataset.torParent?this.element.dataset.torParent+" "+e.trigger:e.trigger),this.element.dataset.torParent=u(l(this.element.dataset.torParent,!0)),this.dataset=this.element.dataset.torParent.replace(/\((.*?)\)+/g,(t)=>t.replace(/ +/g,"░")).split(" "),this.is=this.is||{},this.has=this.has||{},this.attributes=this.attributes||{},this._getterSetter(),this._sortAttributes(),this._addToElementsSet();}_getterSetter(){this.set={inview:(t,e)=>{this.is.inviewOffset&&!e||(this.is.inview=t,t?requestAnimationFrame(()=>this.element.classList.add("inview")):this.is.inviewRevert&&this.element.classList.remove("inview"));}},this.run={inview:()=>{G.observe(this.element);}};}_sortAttributes(){let t={};for(const e of this.dataset)t.static=t.static||[],t.static.push(e);for(const [e,s] of Object.entries(t))M(this,s,e);}_addToElementsSet(){/inview/.test(this.dataset)&&(this.is.inviewElement=!0,N.add(this),this.run.inview());}static init(t,e){(t=o(t||"[data-tor-parent~='inview']"))&&a({name:"Parent",elements:t,options:e});}};var Z=e.Parent;e.Main=class{constructor(t){this.element=t,this.element.torMainInit=!0,this.element.dataset.tor=u(l(this.element.dataset.tor,!0)),this.dataset=this.element.dataset.tor.replace(/\((.*?)\)+/g,(t)=>t.replace(/ +/g,"░")).split(" "),this.is=this.is||{},this.has=this.has||{},this.attributes=this.attributes||{},this.bounds=this.bounds||{},this._getterSetter(),this._sortAttributes(),this.get.bounds(),this._addToElementsSet();}_getterSetter(){this.get={bounds:()=>{this._getBounds();}},this.set={bounds:(t,e)=>{this._setBounds(t,e);},intersecting:(t)=>{this.is.intersecting=t;},inview:(t,e)=>{if(!this.is.inviewOffset||e)if(this.is.inview=t,t){let t=0;r.isChrome&&(t=r.DOMReady?0:200),requestAnimationFrame(()=>{setTimeout(()=>{this.element.classList.add("inview");},t);});}else this.is.inviewRevert&&requestAnimationFrame(()=>this.element.classList.remove("inview"));}},this.run={inview:()=>{G.observe(this.element);},event:(t,e)=>{this._runEvent(t,e);},classScroll:()=>{this._onClassScroll();}};}_sortAttributes(){let t={};for(const e of this.dataset)/class./.test(e)?(t.class=t.class||[],t.class.push(e)):/mouse|scroll|sensor/.test(e)?(t.dynamic=t.dynamic||[],t.dynamic.push(e),this.is.dynamicAttribute=!0):/loop:/.test(e)?(t.loop=t.loop||[],t.loop.push(e)):(t.static=t.static||[],t.static.push(e),/^inview(.*?)(pull\.up|@transform=translateY\(\d)/.test(e)&&(this.has.originalPosition=!0,this.element.classList.add("tor-original-position")));for(const [e,s] of Object.entries(t))M(this,s,e),"static"===e&&this._CSSAddToSet(this.attributes.static),"loop"===e&&this._LOOPCreate(),"class"===e&&this._CLASSAddListeners(s);if(this.attributes.dynamic&&this.is.dynamicAttribute&&(this.attributes.dynamic.styles={},this.attributes.dynamic.currentStyles=new Set()),/hover:(.*?)(push|pull|rotate)/.test(this.dataset)&&!this.element.querySelector(".tor-hit-area")){const t=document.createElement("span");t.classList.add("tor-hit-area"),this.element.appendChild(t);}if(/:block\(/.test(this.dataset)){let t=document.createElement("span");t.classList.add("tor-block-element"),this.element.appendChild(t);}}_LOOPCreate(){if(!this.attributes.loop)return;let t=[],e=[],s=[],i=[],r=[],n={},o=!1,a={};for(const [l,c] of Object.entries(this.attributes.loop.loop)){let d=/(radiate)(.*?)+/.exec(c.property.name);d&&(c.property.name=c.property.name.replace(d[0],d[1]));let u="loop-"+c.property.name.replace(/\./g,"-"),m=`calc(var(--tor-${u}-duration) * var(--tor-${u}-speed,1))`,p=`var(--tor-${u}-timing)`,g=`var(--tor-${u}-direction)`,f=A(c,1),v=A(c,1).start;if(n[u]={index:Number(l),pause:null,iterations:0,currentIteration:0},a[l]=!1,f.value?this.element.style.setProperty(`--tor-${u}-value`,`${f.value}${f.unit}`):this.element.style.removeProperty(`--tor-${u}-value`),v&&this.element.style.setProperty(`--tor-${u}-value-start`,`${v}${f.unit}`),c.options){for(const [t,e] of Object.entries(c.options))switch(t){case "pause":{let s=h(c.options.pause);n[u].pause="s"===s.unit?1e3*s.value:s.value,o=!0;break;}case "iterations":n[u].iterations=Number(c.options.iterations);break;case "delay":r.push(`var(--tor-${u}-delay)`),this.element.style.setProperty(`--tor-${u}-delay`,""+e);break;default:this.element.style.setProperty(`--tor-${u}-${t}`,""+e);}}t.push(u),e.push(m),s.push(p),i.push(g);}this.element.style.setProperty("animation-name",t.join(", ")),this.element.style.setProperty("animation-duration",e.join(", ")),this.element.style.setProperty("animation-timing-function",s.join(", ")),this.element.style.setProperty("animation-direction",i.join(", ")),r.length&&this.element.style.setProperty("animation-delay",r.join(", ")),o&&(this.element.onanimationiteration=(t)=>{if(t.target===this.element&&(n[t.animationName].iterations&&n[t.animationName].currentIteration++,n[t.animationName].iterations===n[t.animationName].currentIteration&&(n[t.animationName].currentIteration=0,n[t.animationName].pause))){let e=n[t.animationName].pause;a[n[t.animationName].index]=!0;let s=[...Object.values(a)].map((t)=>t?"paused":"running");this.element.style.setProperty("animation-play-state",s.join(", "));let i=setTimeout(()=>{a[n[t.animationName].index]=!1,s=[...Object.values(a)].map((t)=>t?"paused":"running"),this.element.style.setProperty("animation-play-state",s.join(", ")),clearTimeout(i);},e);}});}_CSSAddToSet(t){for(const s of Object.values(t)){for(const t of Object.values(s)){if(t.noCSSProcess)continue;let s="",i="",r="",n=[],o=null,a=t.trigger?"-"+t.trigger.name:"",l=t.trigger?t.trigger.alias:"",c=t.priority?" !important":"",h=t.property.name,u=t.property.alias;if(t.values||(t.values={all:{end:{value:"0%"}}}),t.trigger&&t.trigger.argument&&(r="parent"===t.trigger.argument?`[data-tor-parent~="${t.trigger.name}"]`:""+t.trigger.argument),t.property.cssFunction&&(o=h,h=t.property.cssFunction),t.isCustom){for(const s of ["start","end"])if(t.values.all[s]){let i="end"===s?l:"",n=r?r+i:"";e({triggerAlias:i,rule:h,value:t.values.all[s].value,unit:t.values.all[s].unit,cssParent:n});for(const [r,o] of Object.entries(t.values))e({resolution:r,triggerAlias:i,rule:h,value:o[s].value,unit:o[s].unit,cssParent:n});}}else{let o="",c="";if(t.values&&(t.values.all.end?o=t.values.all.end.value:(console.warn(`No default responsive value in "${t.original}" attribute. Setting "0" as default.`),o="0"),t.values.all.end&&(c=t.values.all.end.unit)),t.options){for(const [e,s] of Object.entries(t.options))"target"!==e&&n.push(`--tor-${t.property.name}-${e}: ${d({property:e,value:s})}`);s=""+(1===n.length?n+";":n.join(";"));}k[t.property.name].additionalRules&&(i=k[t.property.name].additionalRules);let h=r?r+l:"";e.call(this,{trigger:a,triggerAlias:l,rule:u,value:o,unit:c,cssParent:h});for(const [s,i] of Object.entries(t.values))"all"!==s&&e.call(this,{resolution:s,triggerAlias:l,rule:u,value:i.end.value,unit:i.end.unit,cssParent:h});}function e(e){const r=d({property:e.propertyName||h,value:e.value,unit:e.unit,wrap:o});let n=`${e.cssParent?e.cssParent:""} [data-tor${e.selector||"~"}="${e.original||t.original}"]${e.cssParent?"":e.triggerAlias} {\n ${e.rule}: ${r}${e.priority||c};\n ${/\:not/.test(e.triggerAlias)?"":e.options||s}\n ${i}\n }\n ${e.options||s?`[data-tor${e.selector||"~"}="${e.original||t.original}"]{\n ${e.options||s}\n }`:""}\n `.replace(/ +/g," ").replace(/\t|\n|\r+/g,"").replace(/\s*{\s*/g,"{").replace(/\s*}\s*/g,"}").replace(";;",";").trim(),a=e.resolution||t.resolution,l=I.breakpoints[a];l.has(n)||(g(`@media (min-width: ${x[a].value}${x[a].unit}) { ${n} }`),l.add(n));}}}}_getBounds(){this.bounds.calculated=!1;let t=this.element.ownerSVGElement;if(/^inview(.*?)(pull\.up|@transform=translateY\(\d)/.test(this.dataset)&&this.element.classList.add("tor-original-position"),r.isUnsupportedSVG&&t){if(t){let e;t.TORUS=t.TORUS||{},t.TORUS.svg=t.TORUS.svg||{},this.is.svgChild=!0,this.has.svgParent=t,e=t.TORUS.svg,e.children=e.children||new Set(),e.children.add(this),r.isSafari?setTimeout(()=>{z.observe(t);},50):z.observe(t);}}else z.observe(this.element);}_setBounds(t,e){let s,i=this.bounds,n=1,o=r.scroll.x,a=r.scroll.y;r.isUnsupportedSVG&&e&&(n=e.ratio,o=e.rect.offsetLeft,a=e.rect.offsetTop),t?(i.calculated=!0,i.rect=t,i.width=i.rect.width*n,i.height=i.rect.height*n,i.top=i.rect.y*n,i.left=i.rect.x*n,i.right=i.rect.right||i.left+i.width,i.bottom=i.rect.bottom||i.top+i.height,i.offsetLeft=i.left+o,i.offsetTop=i.top+a,i.offsetBottom=i.bottom+a,i.centerX=i.offsetLeft+i.width/2-r.scroll.x,i.centerY=i.offsetTop+i.height/2-r.scroll.y,/^inview(.*?)(pull\.up|@transform=translateY\(\d)/.test(this.dataset)&&(i.offsetTopOriginal=i.offsetTop,this.element.classList.remove("tor-original-position"))):(i.centerX=i.offsetLeft+i.width/2-r.scroll.x,i.centerY=i.offsetTop+i.height/2-r.scroll.y,this._runAllEvents("mouse")),s=((t)=>{let e=Math.sqrt(Math.pow(t.bounds.centerX,2)+Math.pow(t.bounds.centerY,2)),s=Math.sqrt(Math.pow(t.bounds.centerX,2)+Math.pow(r.height-t.bounds.centerY,2)),i=Math.sqrt(Math.pow(r.width-t.bounds.centerX,2)+Math.pow(t.bounds.centerY,2)),n=Math.sqrt(Math.pow(r.width-t.bounds.centerX,2)+Math.pow(r.height-t.bounds.centerY,2)),o=t.bounds.centerX,a=r.width-t.bounds.centerX,l=t.bounds.centerY,c=r.height-t.bounds.centerY;return {corner:Math.max(e,s,i,n),xSide:Math.max(o,a),ySide:Math.max(l,c)};})(this),this.bounds.maxDiagonal=Math.round(s.corner),this.bounds.maxXSide=s.xSide,this.bounds.maxYSide=s.ySide;}_addToElementsSet(){/scroll(.*?)\:(?!(.*?)class)/.test(this.dataset)&&q.add(this),/scroll(.*?)class/.test(this.dataset)&&D.add(this),/mouse(.*?)\:/.test(this.dataset)&&F.add(this),/inview(?!\()/.test(this.dataset)&&(this.is.inviewElement=!0,N.add(this)),this.element.ownerSVGElement&&B.add(this);}_runAllEvents(t){if(t)this.attributes.dynamic&&this.attributes.dynamic[t]&&this.run.event(t,!0);else{for(const t of ["mouse","scroll","sensor","inview"])"inview"===t&&this.is.inviewElement&&this.run.inview(),this.attributes.dynamic&&this.attributes.dynamic[t]&&this.run.event(t,!0);}}_runEvent(t,e){if(!this.is.intersecting&&!e)return;let s,i,n=[],o=this.attributes.dynamic;if(o){o.allStyles=o.allStyles||{};for(const e of Object.values(o[t])){for(const s of Object.values(e)){let e,i=f(this,{event:t,options:s.options})[s.trigger.direction];if(o.styles[s.resolution]=o.styles[s.resolution]||{},o.styles[s.resolution][s.property.name]=o.styles[s.resolution][s.property.name]||{},s.values.multi){e=[];for(let t in s.values.all.start.value){let r=A(s,i,t);e.push(`${r.value}${r.unit}`);}e=s.values.cssFunction?`${s.values.cssFunction}(${e.join(s.joinSymbol)})`:e.join(" ");}else{let t=A(s,i);o.styles[s.resolution][s.property.name].cssFunction=s.property.cssFunction,e=`${t.value}${t.unit}`;}o.styles[s.resolution][s.property.name][`${t}${s.trigger.direction}`]=e,o.styles[s.resolution][s.property.name].targets=s.options.target,o.styles[s.resolution][s.property.name].priority=s.priority||"";}}for(let t=x[r.resolution.name].id;t>=0;t--){let e=Object.keys(x).find((e)=>x[e].id===t);if(o.styles[e]){o.currentStyles.add(Object.keys(o.styles[e])[0]),o.allStyles[Object.keys(o.styles[e])[0]]=o.styles[e];break;}o.currentStyles.clear();}for(const [t,e] of Object.entries(o.allStyles))o.currentStyles.has(t)?a.call(this,e,"add"):a.call(this,e,"remove");}function a(t,e){let r={};for(const [a,l] of Object.entries(t)){let t=[];switch(s=a,e){case "add":{for(const e of ["mouseall","mousex","mousey","scrollall","scrollx","scrolly","sensorall","sensorx","sensory"])l[e]&&t.push(l[e]);if(i=t.length>1?`calc(${t.join(" + ")})`:t[0],l.cssFunction){s=l.cssFunction;let t=/rotate/.test(a)?" perspective(1000px)":"";n.push(`${a}(${i}) ${t}`);}if(r[s]={value:l.cssFunction?n.join(" "):i,priority:l.priority},l.targets){for(const t of l.targets){for(const [e,s] of Object.entries(r))t.style.setProperty(e,s.value,s.priority);}}else{for(const [t,e] of Object.entries(r))this.element.style.setProperty(t,e.value,e.priority);}break;}case "remove":if(l.targets){for(const t of l.targets)l.cssFunction&&(t.style.this.element.style[l.cssFunction]=t.style[l.cssFunction].replace(t.style[l.cssFunction],"")),t.style.removeProperty(s);}else l.cssFunction&&(this.element.style[l.cssFunction]=this.element.style[l.cssFunction].replace(this.element.style[l.cssFunction],"")),this.element.style.removeProperty(s);delete o.allStyles[s];}}}}_CLASSAddListeners(t){new IntersectionObserver((e)=>{r.documentHeight=Math.round(e[0].boundingClientRect.height),this._CLASSCreateActions(),t.some((t)=>/click:/.test(t))&&this.element.addEventListener("click",this._onClassClick.bind(this)),t.some((t)=>/hover:/.test(t))&&(this.element.addEventListener("mouseenter",this._onClassMouseEnter.bind(this)),this.element.addEventListener("mouseleave",this._onClassMouseLeave.bind(this))),t.some((t)=>/timeout:/.test(t))&&this._onClassTimeout();}).observe(document.documentElement);}_CLASSCreateActions(){for(const t of Object.values(this.attributes.class)){for(const e of Object.values(t.scroll?t.scroll:t)){let t=null,s=null,i=null;switch(e.options.start&&(t=h(e.options.start)),e.options.end&&(s=h(e.options.end)),e.trigger.name){case "timeout":t&&(t="s"===t.unit?1e3*t.value:t.value),s&&(s="s"===s.unit?1e3*s.value:s.value);break;default:t&&(i=t.unit,t=t.value),s&&(i=s.unit,s=s.value);}e.actions={method:/class\.(.*?)$/.exec(e.property.name)[1],classes:e.values.all.original.split("░"),target:e.options.target,trigger:e.trigger.name,start:t,end:s,unit:i,disable:e.options.disable};}}}_onClassClick(){for(const t of Object.values(this.attributes.class.click))this._CLASSTriggerNewState(t);}_onClassMouseEnter(){for(const t of Object.values(this.attributes.class.hover))this._CLASSTriggerNewState(t);}_onClassMouseLeave(){for(const t of Object.values(this.attributes.class.hover))"toggle"===t.actions.method&&this._CLASSTriggerOldState(t);}_onClassTimeout(){for(const t of Object.values(this.attributes.class.timeout)){let e=t.actions.start,s=t.actions.end;t.time=setTimeout(()=>{this._CLASSTriggerNewState(t),s?t.time=setTimeout(()=>{this._CLASSTriggerOldState(t),clearTimeout(t.time);},s):clearTimeout(t.time);},e);}}_onClassScroll(){for(const s of Object.values(this.attributes.class.scroll.scroll))if(s.actions){let i=r.scroll.y;"%"===s.actions.unit&&(i=r.scroll.y/(r.documentHeight-r.height)*100),s.actions.end?i>=s.actions.start&&i<=s.actions.end?t.call(this,s,"in"):t.call(this,s,"out"):i>=s.actions.start?t.call(this,s,"in"):"toggle"===s.actions.method&&s.actions.done&&e.call(this,s,!0);}function t(t,s){switch(s){case "in":"toggle"===t.actions.method?!t.actions.done&&e.call(this,t,!1):e.call(this,t,!1);break;case "out":"toggle"===t.actions.method?t.actions.done&&e.call(this,t,!0):e.call(this,t,!0);}}function e(t,e){e||(this._CLASSTriggerNewState(t),t.actions.done=!0),e&&(this._CLASSTriggerOldState(t),t.actions.done=!1);}}_CLASSTriggerNewState(t){if(!this.element.torClassDisabled){for(const e of o(t.actions.target))t.priority?setTimeout(()=>{[...t.actions.classes].map((s)=>e.classList[t.actions.method](s));},10):[...t.actions.classes].map((s)=>e.classList[t.actions.method](s)),t.actions.disable&&(e.torClassDisabled=!0);}}_CLASSTriggerOldState(t){if(this.element.torClassDisabled)return;let e;switch(t.actions.method){case "add":e="remove";break;case "remove":e="add";break;default:e="toggle";}for(const s of o(t.actions.target))[...t.actions.classes].map((t)=>s.classList[e](t));}_refresh(){this.get.bounds(),this._runAllEvents(),this._LOOPCreate();}static refresh(t){z.disconnect(),w({elements:o(t||"[data-tor]"),object:"Main",fn:"_refresh"});}static init(t,e){(t=o(t||"[data-tor]"))&&(t=t.filter((t)=>!t.TORUS||!t.TORUS.Main),a({name:"Main",elements:t}));}},(()=>{document.head.appendChild(C);const t=["Group","Parent","Main","Slider"];H=new MutationObserver(()=>{for(let s=0;st.replace(/ +/g,"░")).split(" "),this.attributes={},this.bounds={},this.items={},this.navigation={},this.defaults={count:1,margin:0,pullArea:20,stretchOnDrag:!0,stretchOnClick:!1,addParent:!1,slide:!0,vertical:!1,drag:!0},this.sliderStart=0,this.activeSlide=0,this.lastSlide=0,this.lastDifferenceStart=0,this.axis="x",this.bounds.lastStart=-1,this.bounds.lastEnd=0,this._getterSetter(),this._setOptions(e),this._wrapItems(),this.get.bounds(),this._addListeners();}_setOptions(t){M(this,this.dataset,"slider"),this.options=Object.assign(this.defaults,t),this.options.additional={};for(const t of Object.values(this.attributes.slider.idle))if(t.values){let e=A(t,1),s=t.property.name.toCamelCase();if(this.options[s]=e.value,Object.keys(t.options).length){for(const [e,i] of Object.entries(t.options))this.options.additional[s]=this.options.additional[s]||{},this.options.additional[s][e]=i;}}if(this.options.stack&&(this.options.slide=!1,this.options.drag=!1,this.options.count=1,this.options.margin=0),this.options.count&&this.element.style.setProperty("--tor-slider-items-count",this.options.count),(this.options.margin||0===this.options.margin)&&this.element.style.setProperty("--tor-slider-margin",this.options.margin+"px"),this.options.additional){let t=this.options.additional;t.controls&&"chevron"===t.controls.icons&&this.element.classList.add("tor-slider-controls-chevron"),t.controls&&"dark"===t.controls.theme&&this.element.classList.add("tor-slider-controls-dark"),t.indicators&&"dark"===t.indicators.theme&&this.element.classList.add("tor-slider-indicators-dark"),t.indicators&&t.indicators.justify&&this.element.style.setProperty("--tor-indicators-justify",t.indicators.justify);}}_wrapItems(){function t([...t]){t.map((t)=>{!/tor-slider/.test(t.classList)&&P(t,"div","tor-slider-item");}),this.itemsElements=this.element.querySelectorAll(".tor-slider-item");}if(this.slider=this.element.querySelector(".tor-slider-wrapper"),this.slider?t.call(this,this.slider.children):(t.call(this,this.element.children),P(this.itemsElements,this.element,"tor-slider-wrapper"),this.slider=this.element.querySelector(".tor-slider-wrapper")),this.options.addParent){for(const [t,e] of Object.entries(this.itemsElements))"0"===t&&e.classList.add("active","show"),e.dataset.torParent=this.options.addParent.replace(/░/g," ");}this.images=[...this.element.querySelectorAll("img")],this.torElements=[...this.element.querySelectorAll("[data-tor]")],this.itemsLength=this.itemsElements.length,this._createItemsObject();}_createItemsObject(){for(const [t,e] of Object.entries(this.itemsElements))this.items[t]={},this.items[t].id=t,this.items[t].element=e,this.items[t].bounds={},this.items[t].element.TORUS=this.items[t].element.TORUS||{},this.items[t].element.TORUS.sliderItem={parent:this,id:t,calculated:!1};}_calculateDefaults(){this.maxStart=0,this.maxEnd=-this.sliderSize+this.bounds.size-this.options.margin,this.maxSlides=this.itemsLength-this.options.count,this.options.vertical&&(this.element.style.setProperty("--tor-slider-height",this.bounds.size+"px"),this.axis="y");}_getterSetter(){this.get={bounds:()=>{this._getBounds();},images:(t)=>new Promise((e,s)=>{const i=new Image();i.onload=()=>e(i),i.onerror=()=>s(i),i.src=t;})},this.set={bounds:(t,e)=>{this._setBounds(t,e);}};}_getBounds(t){this.promises=[],this.sliderSize=0,this.bounds.lastStart=-1;const e=new IntersectionObserver((s)=>{for(const t of s){let e=t.target.TORUS;e.Slider&&this.set.bounds(t.boundingClientRect),e.sliderItem&&this.set.bounds(t.boundingClientRect,e.sliderItem.id);}e.disconnect(),Promise.all(this.promises).then(()=>{this._promisesDone(t);});});function s(){e.observe(this.element);for(const t of Object.values(this.items))e.observe(t.element);}this.images.length?Promise.allSettled(this.images.map((t)=>t.src).map(this.get.images)).then(()=>{s.call(this);}):s.call(this);}_setBounds(t,e){let s=new Promise((s)=>{let i;i=e?this.items[e].bounds:this.bounds,i.calculated=!0,i.rect=t,i.bottom=Math.round(i.rect.bottom),i.width=Math.round(i.rect.width),i.height=Math.round(i.rect.height),e?(this.options.vertical?i.size=i.height+(Number(e)0&&e.bounds.center+this.sliderStart0&&(this.activeSlide--,e.call(this));break;default:Number(t){0===t.button&&(this.isDown=!0,this.startX=t.clientX,this.startY=t.clientY,this._checkBounds());});}_onMove(t){requestAnimationFrame(()=>{this.isDown&&(this.element.classList.add("tor-dragging"),this.options.vertical?this.differenceStart=t.clientY-this.startY:this.differenceStart=t.clientX-this.startX,this.sliderStart=this.lastDifferenceStart+this.differenceStart,this.sliderStart>this.maxStart&&(this.sliderStart=this.maxStart),this.sliderStart-this.options.pullArea){t.call(this,e);break;}}if(this.differenceStart>0){for(let e=this.itemsLength-1;e>=0;e--)if(this.items[e].bounds.start+this.sliderStart=0,this.reachedEnd=this.sliderStart<=this.maxEnd;}_translate(t){if(!this.options.stack){let e="x"===this.axis?t:0,s="y"===this.axis?t:0;this.slider.style.setProperty("transform",`translate3d(${e}px, ${s}px, 0px)`);}this._setClass("show");}_addListeners(){this.options.drag&&(document.addEventListener("pointerup",this._onUp.bind(this)),document.addEventListener("pointermove",this._onMove.bind(this),{passive:!0}),this.slider.addEventListener("pointerdown",this._onDown.bind(this))),this.slider.addEventListener("transitionend",this._onTransitionEnd.bind(this)),this.slider.addEventListener("dragstart",this._onDragStart.bind(this));}_setIndicatorsClass(){this.options.indicators&&this.navigation.indicatorsElements&&this.navigation.indicatorsElements[this.activeSlide]&&([...Object.values(this.navigation.indicatorsElements)].map((t)=>t.classList.remove("active")),this.navigation.indicatorsElements[this.activeSlide].classList.add("active"));}_createNavigation(){if(this.options.controls){this.navigation.controls&&this.navigation.controls.remove(),this.navigation.controls=document.createElement("nav"),this.navigation.controls.classList.add("tor-slider-controls"),this.element.appendChild(this.navigation.controls);for(const t of ["prev","next"]){let e;e=document.createElement("div"),e.addEventListener("click",this._slideTo.bind(this,t)),e.classList.add("tor-slider-"+t),e.setAttribute("role","button"),e.setAttribute("aria-label",`Slider ${t} button`),this.navigation.controls.appendChild(e);}}else this.navigation.controls&&this.navigation.controls.remove();if(this.options.indicators){this.navigation.indicators&&([...Object.values(this.navigation.indicatorsElements)].map((t)=>t.remove()),this.navigation.indicators.remove()),this.navigation.indicatorsElements={},this.navigation.indicators=document.createElement("ul"),this.navigation.indicators.classList.add("tor-slider-indicators"),this.navigation.indicators.addEventListener("click",function(t){this._slideTo(Number(t.target.dataset.torSlideTo));}.bind(this)),this.element.appendChild(this.navigation.indicators);for(let t=0;t{t.preventDefault();let i=t.target.dataset.torSlideTo;i&&[...s].map((t)=>e.Slider.slideTo(t,i));});}}static init(t,e){t=o(t||"[data-tor-slider]"),a({name:"Slider",elements:t,options:e}),this.externalNavigation();}};var tt=e.Slider;e.BgImage=class{constructor(t,e){this.element=t,this.bgImageElement=t.querySelector(".bg-img"),this.bgImageElement&&this.element.style.setProperty("background-image",`url('${this.bgImageElement.getAttribute("src")}')`),e&&this.element.style.setProperty("background-image",`url('${e}')`);}static init(t,e){t=o(t||".has-bg-img, .has-bg-pattern"),a({name:"BgImage",elements:t,options:e});}};var et=e.BgImage;t.Bg=et,t.Group=K,t.Main=Q,t.Parent=Z,t.Slider=tt,Object.defineProperty(t,"__esModule",{value:!0});}));;