Socket
Socket
Sign inDemoInstall

@pelagiccreatures/sargasso

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pelagiccreatures/sargasso - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

2

dist/sargasso.iife.min.js

@@ -1,2 +0,2 @@

var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var s="object"==typeof t&&t&&t.Object===Object&&t,i="object"==typeof self&&self&&self.Object===Object&&self,n=s||i||Function("return this")(),r=n.Symbol;var o=function(e,t){for(var s=-1,i=null==e?0:e.length,n=Array(i);++s<i;)n[s]=t(e[s],s,e);return n},a=Array.isArray,l=Object.prototype,c=l.hasOwnProperty,h=l.toString,u=r?r.toStringTag:void 0;var d=function(e){var t=c.call(e,u),s=e[u];try{e[u]=void 0;var i=!0}catch(e){}var n=h.call(e);return i&&(t?e[u]=s:delete e[u]),n},p=Object.prototype.toString;var f=function(e){return p.call(e)},m=r?r.toStringTag:void 0;var g=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?d(e):f(e)};var w=function(e){return null!=e&&"object"==typeof e};var b=function(e){return"symbol"==typeof e||w(e)&&"[object Symbol]"==g(e)},v=r?r.prototype:void 0,y=v?v.toString:void 0;var x=function e(t){if("string"==typeof t)return t;if(a(t))return o(t,e)+"";if(b(t))return y?y.call(t):"";var s=t+"";return"0"==s&&1/t==-Infinity?"-0":s};var k=function(e){return null==e?"":x(e)};var E=function(e,t,s){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(s=s>n?n:s)<0&&(s+=n),n=t>s?0:s-t>>>0,t>>>=0;for(var r=Array(n);++i<n;)r[i]=e[i+t];return r};var C=function(e,t,s){var i=e.length;return s=void 0===s?i:s,!t&&s>=i?e:E(e,t,s)},O=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var S=function(e){return O.test(e)};var A=function(e){return e.split("")},R="[\\ud800-\\udfff]",M="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",F="\\ud83c[\\udffb-\\udfff]",j="[^\\ud800-\\udfff]",L="(?:\\ud83c[\\udde6-\\uddff]){2}",D="[\\ud800-\\udbff][\\udc00-\\udfff]",T="(?:"+M+"|"+F+")"+"?",z="[\\ufe0e\\ufe0f]?",N=z+T+("(?:\\u200d(?:"+[j,L,D].join("|")+")"+z+T+")*"),P="(?:"+[j+M+"?",M,L,D,R].join("|")+")",H=RegExp(F+"(?="+F+")|"+P+N,"g");var V=function(e){return e.match(H)||[]};var W=function(e){return S(e)?V(e):A(e)};var I=function(e){return function(t){t=k(t);var s=S(t)?W(t):void 0,i=s?s[0]:t.charAt(0),n=s?C(s,1).join(""):t.slice(1);return i[e]()+n}}("toUpperCase");var q=function(e){return I(k(e).toLowerCase())};var U=function(e,t,s,i){var n=-1,r=null==e?0:e.length;for(i&&r&&(s=e[++n]);++n<r;)s=t(s,e[n],n,e);return s};var B=function(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Q=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Z=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var G=function(e){return(e=k(e))&&e.replace(Q,B).replace(Z,"")},$=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var J=function(e){return e.match($)||[]},Y=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var _=function(e){return Y.test(e)},K="\\u2700-\\u27bf",X="a-z\\xdf-\\xf6\\xf8-\\xff",ee="A-Z\\xc0-\\xd6\\xd8-\\xde",te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",se="["+te+"]",ie="\\d+",ne="[\\u2700-\\u27bf]",re="["+X+"]",oe="[^\\ud800-\\udfff"+te+ie+K+X+ee+"]",ae="(?:\\ud83c[\\udde6-\\uddff]){2}",le="[\\ud800-\\udbff][\\udc00-\\udfff]",ce="["+ee+"]",he="(?:"+re+"|"+oe+")",ue="(?:"+ce+"|"+oe+")",de="(?:['’](?:d|ll|m|re|s|t|ve))?",pe="(?:['’](?:D|LL|M|RE|S|T|VE))?",fe="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",me="[\\ufe0e\\ufe0f]?",ge=me+fe+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",ae,le].join("|")+")"+me+fe+")*"),we="(?:"+[ne,ae,le].join("|")+")"+ge,be=RegExp([ce+"?"+re+"+"+de+"(?="+[se,ce,"$"].join("|")+")",ue+"+"+pe+"(?="+[se,ce+he,"$"].join("|")+")",ce+"?"+he+"+"+de,ce+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ie,we].join("|"),"g");var ve=function(e){return e.match(be)||[]};var ye=function(e,t,s){return e=k(e),void 0===(t=s?void 0:t)?_(e)?ve(e):J(e):e.match(t)||[]},xe=RegExp("['’]","g");var ke=function(e){return function(t){return U(ye(G(t).replace(xe,"")),e,"")}},Ee=ke((function(e,t,s){return t=t.toLowerCase(),e+(s?q(t):t)}));var Ce=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Oe=function(){return n.Date.now()},Se=/^\s+|\s+$/g,Ae=/^[-+]0x[0-9a-f]+$/i,Re=/^0b[01]+$/i,Me=/^0o[0-7]+$/i,Fe=parseInt;var je=function(e){if("number"==typeof e)return e;if(b(e))return NaN;if(Ce(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ce(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Se,"");var s=Re.test(e);return s||Me.test(e)?Fe(e.slice(2),s?2:8):Ae.test(e)?NaN:+e},Le=Math.max,De=Math.min;var Te,ze=function(e,t,s){var i,n,r,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var s=i,r=n;return i=n=void 0,c=t,o=e.apply(r,s)}function f(e){return c=e,a=setTimeout(g,t),h?p(e):o}function m(e){var s=e-l;return void 0===l||s>=t||s<0||u&&e-c>=r}function g(){var e=Oe();if(m(e))return w(e);a=setTimeout(g,function(e){var s=t-(e-l);return u?De(s,r-(e-c)):s}(e))}function w(e){return a=void 0,d&&i?p(e):(i=n=void 0,o)}function b(){var e=Oe(),s=m(e);if(i=arguments,n=this,l=e,s){if(void 0===a)return f(l);if(u)return clearTimeout(a),a=setTimeout(g,t),p(l)}return void 0===a&&(a=setTimeout(g,t)),o}return t=je(t)||0,Ce(s)&&(h=!!s.leading,r=(u="maxWait"in s)?Le(je(s.maxWait)||0,t):r,d="trailing"in s?!!s.trailing:d),b.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=n=a=void 0},b.flush=function(){return void 0===a?o:w(Oe())},b},Ne=ke((function(e,t,s){return e+(s?"-":"")+t.toLowerCase()})),Pe=(function(e,t){var s;s=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var s=arguments[e];for(var i in s)t[i]=s[i]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function s(i){function n(){}function r(t,s,r){if("undefined"!=typeof document){"number"==typeof(r=e({path:"/"},n.defaults,r)).expires&&(r.expires=new Date(1*new Date+864e5*r.expires)),r.expires=r.expires?r.expires.toUTCString():"";try{var o=JSON.stringify(s);/^[\{\[]/.test(o)&&(s=o)}catch(e){}s=i.write?i.write(s,t):encodeURIComponent(String(s)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var l in r)r[l]&&(a+="; "+l,!0!==r[l]&&(a+="="+r[l].split(";")[0]));return document.cookie=t+"="+s+a}}function o(e,s){if("undefined"!=typeof document){for(var n={},r=document.cookie?document.cookie.split("; "):[],o=0;o<r.length;o++){var a=r[o].split("="),l=a.slice(1).join("=");s||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=t(a[0]);if(l=(i.read||i)(l,c)||t(l),s)try{l=JSON.parse(l)}catch(e){}if(n[c]=l,e===c)break}catch(e){}}return e?n[e]:n}}return n.set=r,n.get=function(e){return o(e,!1)},n.getJSON=function(e){return o(e,!0)},n.remove=function(t,s){r(t,"",e(s,{expires:-1}))},n.defaults={},n.withConverter=s,n}((function(){}))},e.exports=s()}(Te={exports:{}},Te.exports),Te.exports);const He=new WeakMap,Ve=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),We=(e,t,s)=>{const i=He.get(e)||{};s?i[t]=s:delete i[t],He.set(e,i)},Ie=(e,t)=>(He.get(e)||{})[t],qe=function(e,t,s,i,n,r,o){const a="on:"+e+"-"+s+"-"+i;"function"==typeof i&&(o=r,r=n,n=i,i=null);const l={fn:r=>{o&&Ue(e,t,s,i),i?Array.from(t.querySelectorAll(i)).forEach(e=>{(r.target===e||e.contains(r.target))&&n(r,e)}):n(r)},options:r||!1};We(t,a,l),s.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),l.fn,l.options)})},Ue=function(e,t,s,i){const n="on:"+e+"-"+s+"-"+i,r=Ie(t,n);r&&(s.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),r.fn,r.options)}),We(t,n))},Be={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===s.indexOf(e)&&s.push(e)}),e.className=s.join(" ")},removeClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1)}),e.className=s.join(" ")},isVisible:Ve,inViewPort:(e,t=window)=>{const s=e.getBoundingClientRect(),i=Ve(e),n=s.bottom<0;let r;return r=t.self===window?s.top>(window.innerHeight||document.documentElement.clientHeight):s.top>t.clientHeight,i&&!r&&!n},setCSS:(e,t)=>{for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const i=Ee(s);e.style[i]=t[s]}},setMetaData:We,getMetaData:Ie,on:qe,off:Ue,once:function(e,t,s,i,n,r){qe(e,t,s,i,n,r,!0)}};let Qe,Ze,Ge,$e,Je;class Ye{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[]}subscribe(e){this.observers.length||this.wakeup(),this.observers.push(e)}unSubscribe(e){-1!==this.observers.indexOf(e)&&this.observers.splice(this.observers.indexOf(e),1),this.observers.length||this.sleep()}sleep(){}wakeup(){}notifyObservers(e,t){for(let s=0;s<this.observers.length;s++)this.observers[s][e]&&this.observers[s][e].apply(this.observers[s],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}Qe=new class extends Ye{constructor(e){super(e),this.mutationHandler=ze((e,t)=>{this.observeDOM(e,t)},100,{maxWait:250}),this.mutationObserver=new MutationObserver(this.mutationHandler,!1)}subscribe(e){super.subscribe(e),e.watchDOM()}wakeup(){super.wakeup(),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})}sleep(){super.sleep(),this.mutationObserver.disconnect()}observeDOM(){this.notifyObservers("watchDOM")}},Ze=new class extends Ye{constructor(e={}){super(e),this.scrollElement=this.options.scrollElement||window,this.lastscroll=0,this.scrolling=!1}trigger(){this.scrolling||this.scrollLoop()}scrollLoop(){if(this.lastscroll!==this.scrollTop()){this.scrolling=!0,this.lastscroll=this.scrollTop(),this.watchScroll();const e=()=>{this.scrollLoop()};this.queueFrame(e)}else this.scrolling=!1}setOptions(e={}){this.sleep(),this.scrollElement=e.scrollElement||window,this.wakeup()}subscribe(e){super.subscribe(e),e.watchScroll()}wakeup(){super.wakeup(),Be.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),Be.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Be.inViewPort(e,this.scrollElement)}watchScroll(){this.notifyObservers("watchScroll")}scrollTop(e){if(this.scrollElement===window){if(void 0===e)return window.pageYOffset;window.scrollTo(0,e)}else{if(void 0===e)return this.scrollElement.scrollTop;this.scrollElement.scrollTop=e}}},Ge=new class extends Ye{constructor(e){super(e),this.debounce=ze(()=>{this.watchResize()},250)}subscribe(e){super.subscribe(e),e.watchResize()}wakeup(){super.wakeup(),window.addEventListener("resize",this.debounce,!1)}sleep(){super.sleep(),window.removeEventListener("resize",this.debounce)}watchResize(){this.notifyObservers("watchResize")}},$e=new class extends Ye{constructor(e){super(e),"onorientationchange"in window?Be.addClass(document.body,"have-orientation"):Be.addClass(document.body,"no-orientation"),this.debounce=ze(()=>{this.watchOrientation()},250)}subscribe(e){super.subscribe(e),e.watchOrientation()}wakeup(){super.wakeup(),"onorientationchange"in window&&window.addEventListener("orientationchange",this.debounce,!1)}sleep(){super.sleep(),"onorientationchange"in window&&window.removeEventListener("orientationchange",this.debounce)}watchOrientation(){this.notifyObservers("watchOrientation")}},Je=new class extends Ye{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let s=t,i=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});s=URL.createObjectURL(e),i=!0}this.workers[e]={worker:new Worker(s),observers:[]},i&&URL.revokeObjectURL(s),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const s=this.workers[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),s.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.notifyObservers("workerMessage",[e,t])}wakeup(){super.wakeup()}sleep(){super.sleep()}};let _e=0;const Ke=[],Xe="customElements"in window,et={},tt=(e,t)=>{if(et[e]=t,Xe){const t=`\n\t\t\treturn class ${e}Element extends HTMLElement {\n\t\t\t\tconstructor(element, options = {}) {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.helperClass= '${e}'\n\t\t\t\t\tthis.helper = null\n\t\t\t\t}\n\n\t\t\t\tconnectedCallback () {\n\t\t\t\t\tthis.helper = new registeredClasses[this.helperClass](this,{isCustomElement:true})\n\t\t\t\t\tthis.helper.start()\n\t\t\t\t}\n\n\t\t\t\tdisconnectedCallback () {\n\t\t\t\t\tthis.helper.destroy()\n\t\t\t\t\tthis.helper = null // nuke the reference for trash collection\n\t\t\t\t}\n\t\t\t}`;customElements.define("sargasso-"+Ne(e),new Function("registeredClasses",t)(et))}},st=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class it{constructor(e,t={}){this.uid=++_e,this.element=e,this.options=t,this.pendingAnimationFrame=void 0,this.frameQueue=[],this.isInViewport=!1,this.workers={},this.started=!1}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),Ke.push(this),this.options.watchDOM&&Qe.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Ze.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ge.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&$e.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==st.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this.started=!0}sleep(){this.options.watchDOM&&Qe.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Ze.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ge.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&$e.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),this.started=!1}DOMChanged(){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}setMetaData(e,t){Be.setMetaData(this.element,e,t)}getMetaData(e){return Be.getMetaData(this.element,e)}on(e,t,s,i){Be.on(this.constructor.name+"-"+this.uid,this.element,e,t,s,i)}off(e,t){Be.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,s,i){Be.once(this.constructor.name+"-"+this.uid,this.element,e,t,s,i)}notifyAll(e,t){if(-1===st.indexOf(e))throw new Error("invalid event name "+e);for(let s=0;s<Ke.length;s++){const i=Ke[s];i!==this&&i[e]&&i[e].apply(i,t)}}notifyElement(e,t,s){if(-1===st.indexOf(t))throw new Error("invalid event name "+t);const i=this.getMetaData("registeredResponsiveControllers");if(i)for(let e=0;e<i.length;e++){const n=i[e];n!==this&&n[t]&&n[t].apply(n,s)}}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Be.hasClass(this.element,e)}addClass(e){Be.addClass(this.element,e)}removeClass(e){Be.removeClass(this.element,e)}setCSS(e){Be.setCSS(this.element,e)}isVisible(){return Be.isVisible(this.element)}workerStart(e,t){return this.workers[e]=Je.registerWorker(e,t),Je.subscribe(this,e),this.workers[e]}workerPostMessage(e,t){t.uid||(t.uid=this.uid),this.workers[e]&&this.workers[e].postMessage(t)}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}stopWorker(e){this.workers[e]&&(Je.unSubscribe(this,e),delete this.workers[e])}stopAllWorkers(){for(const e in this.workers)this.stopWorker(e)}destroy(){this.stopAllWorkers(),this.flushQueue(),this.started&&this.sleep();const e=this.getMetaData("registeredResponsiveControllers");e&&-1!==e.indexOf(this)&&(e.splice(e.indexOf(this),1),this.setMetaData("registeredResponsiveControllers",e)),this.setMetaData(this.constructor.name,null),this.element=null,-1!==Ke.indexOf(this)&&Ke.splice(Ke.indexOf(this),1)}watchDOM(){this.DOMChanged()}watchScroll(){this.options.watchViewport&&this.inViewport(),this.didScroll()}watchResize(){this.options.watchViewport&&this.inViewport(),this.didResize()}watchOrientation(){!window.orientation||90!==window.orientation&&-90!==window.orientation?this.wantFullscreen(!1):this.wantFullscreen(!0)}inViewport(){Ze.inViewPort(this.element)?this.isInViewport||(this.enterViewport(),this.isInViewport=!0):this.isInViewport&&(this.exitViewport(),this.isInViewport=!1)}workerMessage(e,t){t.data.uid===this.uid&&this.workerOnMessage(e,t.data)}nativeRequestFullScreen(){if(document.fullscreenElement){if(document.fullscreenElement===this.element)return;document.exitFullscreen()}this.element.requestFullscreen()}nativeExitFullScreen(){document.fullscreenElement&&document.fullscreenElement===this.element&&document.exitFullscreen()}}tt("Sargasso",it);class nt extends it{constructor(e,t={}){t.watchScroll=!0,t.watchResize=!0,t.watchDOM=!0,t.immortal=!0,super(e,t)}didResize(){super.didResize(),this.lazyHandler()}didScroll(){super.didScroll(),this.lazyHandler()}DOMChanged(){super.DOMChanged(),this.lazyHandler()}lazyHandler(){const e=document.querySelectorAll("[data-lazy-sargasso-class]");for(let t=0;t<e.length;t++){const s=e[t];if(Ze.inViewPort(s)){const i=s.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let s=0;s<i.length;s++){new et[i[s]](e[t]).start()}s.removeAttribute("data-lazy-sargasso-class")}}}}tt("LazyInstantiate",nt);class rt extends it{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new nt(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let s=0;s<t.length;s++)try{new et[t[s]](e).start()}catch(e){console.log("error instantiating "+t[s],e,et)}e.removeAttribute("data-sargasso-class")}newPage(){this.doIt()}DOMChanged(){this.doIt()}doIt(){const e=document.querySelectorAll("[data-sargasso-class]");for(const t of e)this.instantiate(t);const t=[];for(let e=0;e<Ke.length;e++)Ke[e].options.immortal||Ke[e].options.isCustomElement||document.body.contains(Ke[e].element)||t.push(Ke[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}tt("SargassoSupervisor",rt);const ot=[{className:"screen-xs",maxWidth:599},{className:"screen-sm",maxWidth:1023},{className:"screen-md",maxWidth:1439},{className:"screen-lg",maxWidth:1999},{className:"screen-xl",maxWidth:void 0}];class at extends it{constructor(e,t={}){t.watchResize=!0,super(e,t),t.widths?this.options.widths=t.widths:this.options.widths=ot,this.scale=void 0,this.disabled=!1,this.forceScale=void 0,this.orientation=void 0,this.widths=[],this.classes=[]}start(){super.start();let e=".show-hide{display:none;}\n";this.widths.push(0);for(let t=0;t<this.options.widths.length;t++)this.options.widths[t].maxWidth&&this.widths.push(this.options.widths[t].maxWidth),this.classes.push(this.options.widths[t].className),e+="."+this.options.widths[t].className+" .hidden-"+this.options.widths[t].className+"{display:none;}\n",e+=".not-"+this.options.widths[t].className+" .hidden-not-"+this.options.widths[t].className+"{display:none;}\n",e+="."+this.options.widths[t].className+" .shown-"+this.options.widths[t].className+"{display:block;}\n",e+=".not-"+this.options.widths[t].className+" .shown-not-"+this.options.widths[t].className+"{display:block;}\n";const t=document.createElement("style");t.type="text/css",t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t),this.detectGeometry()}didResize(){super.didResize(),this.detectGeometry()}disableResponsive(e){Be.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){Be.removeClass(document.body,"disable-responsive"),this.disabled=!1,this.forceScale="",this.detectGeometry()}detectGeometry(){let e=this.classes[this.widths.length-1];if(this.disabled)e=this.forceScale;else{const t=window.innerWidth;if(window.innerHeight>t){if("portrait"!==this.orientation){const e=()=>{Be.removeClass(document.body,"landscape"),Be.addClass(document.body,"portrait")};this.queueFrame(e),this.orientation="portrait"}}else if("landscape"!==this.orientation){const e=()=>{Be.removeClass(document.body,"portrait"),Be.addClass(document.body,"landscape")};this.queueFrame(e),this.orientation="landscape"}for(let s=0;s<this.widths.length-1;s++)if(t>=this.widths[s]&&t<this.widths[s+1]){e=this.classes[s];break}}let t=0;if(e!==this.scale){++t;const s=()=>{for(let t=0;t<this.classes.length;t++)this.classes[t]!==e?(Be.addClass(document.body,"not-"+this.classes[t]),Be.removeClass(document.body,this.classes[t]),Be.removeClass(document.body,"shown-"+this.classes[t]),Be.removeClass(document.body,"hidden-"+this.classes[t])):Be.removeClass(document.body,"not-"+this.classes[t]);Be.addClass(document.body,e),Be.addClass(document.body,"shown-"+e),Be.addClass(document.body,"hidden-"+e),this.notifyAll("didBreakpoint",[e])};this.queueFrame(s)}this.scale=e,t&&this.setHints()}setHints(){let e="";this.scale&&(e&&(e+=" "),e+=this.scale),e!==this.getCookie("responsive")&&this.setCookie("responsive",e)}getCookie(e){return Pe.get(e)}setCookie(e,t,s){const i={path:"/",domain:this.options.cookieDomain||null,expires:s};Pe.set(e,t,i)}deleteCookie(e){this.setCookie(e,null)}}tt("Breakpoints",at);class lt extends it{constructor(e,t={}){t.watchDOM=!0,t.immortal=!0,super(e,t),this.excludeRegex=new RegExp("^(//|http|javascript|mailto|#)","i"),this.currentPage=location.pathname+location.search,this.cachedMarkup={}}start(){const e=document.querySelectorAll("[data-hijax-skip-unchanged]");for(let t=0;t<e.length;t++){const s=e[t],i=s.getAttribute("id");this.cachedMarkup[i]=s.innerHTML}super.start(),window.addEventListener("popstate",e=>{this.watchPopState(e)},!1)}DOMChanged(){super.DOMChanged(),this.hijaxLinks()}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const s=t[e],i=s.getAttribute("href");!i||s.getAttribute("data-hijaxed")||s.getAttribute("target")||s.hasAttribute("data-no-hijax")||this.excludeRegex.exec(i)||(s.setAttribute("data-hijaxed",!0),s.addEventListener("click",e=>{e.preventDefault(),this.setPage(i)},!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,(t,s,i)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),s?this.currentPage=location.pathname+location.search:this.loadPage(i||e)})}loadPage(e){this.queueFrame(()=>{Be.addClass(document.body,"hijax-loading")}),this.options.onExitPage&&this.options.onExitPage();const t=new XMLHttpRequest;t.open("GET",e),t.setRequestHeader("Sargasso-Hijax",1),t.setRequestHeader("x-digitopia-hijax",1),this.options.onLoading&&(this.options.onLoading(),t.onreadystatechange=this.options.onLoading),t.onload=()=>{if(301===t.status||302===t.status||t.getResponseHeader("Sargasso-Location")){const e=t.getResponseHeader("Location")?t.getResponseHeader("Location"):t.getResponseHeader("Sargasso-Location");this.setPage(e)}else if(200===t.status){Ze.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,s=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Be.removeClass(document.body,"hijax-loading")};this.queueFrame(s),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let s=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;s||(s="Could not connect to server."),this.options.onError?this.options.onError(e,s):alert("Error loading page: "+s)}},t.send()}processScripts(e){Array.from(e).forEach(e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)})}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach(e=>{e.remove()});const s=e.split(/(<body[^>]*>|<\/body>)/gi),i=ct(s[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],s=t.getAttribute("id"),r=i.getElementById(s);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[s]===r.innerHTML)continue;this.cachedMarkup[s]=r.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&r.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===r.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(r.querySelectorAll("script"));const a=()=>{t.parentNode.replaceChild(r,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(r)};this.queueFrame(a)}}}tt("HijaxLoader",lt);const ct=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),s=document.createElement("div");return s.insertAdjacentHTML("afterBegin",e),t.appendChild(s),t};e.loadPageHandler=void 0;const ht={registerSargassoClass:tt,bootSargasso:(t={})=>{if(t.scrollElement&&Ze.setOptions(t),t.breakpoints){new at(document.body,t.breakpoints).start()}if(t.hijax){const s=new lt(document.body,t.hijax);s.start(),e.loadPageHandler=s.setPage.bind(s)}else e.loadPageHandler=e=>{document.location.href=e};new rt(document.body,t).start(t)},elementTools:Be},ut={theDOMWatcher:Qe,theScrollWatcher:Ze,theResizeWatcher:Ge,theOrientationWatcher:$e,theWorkerWatcher:Je};return e.Sargasso=it,e.services=ut,e.utils=ht,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var s="object"==typeof t&&t&&t.Object===Object&&t,i="object"==typeof self&&self&&self.Object===Object&&self,n=s||i||Function("return this")(),r=n.Symbol;var o=function(e,t){for(var s=-1,i=null==e?0:e.length,n=Array(i);++s<i;)n[s]=t(e[s],s,e);return n},a=Array.isArray,l=Object.prototype,c=l.hasOwnProperty,h=l.toString,u=r?r.toStringTag:void 0;var d=function(e){var t=c.call(e,u),s=e[u];try{e[u]=void 0;var i=!0}catch(e){}var n=h.call(e);return i&&(t?e[u]=s:delete e[u]),n},p=Object.prototype.toString;var f=function(e){return p.call(e)},m=r?r.toStringTag:void 0;var g=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?d(e):f(e)};var w=function(e){return null!=e&&"object"==typeof e};var v=function(e){return"symbol"==typeof e||w(e)&&"[object Symbol]"==g(e)},b=r?r.prototype:void 0,y=b?b.toString:void 0;var x=function e(t){if("string"==typeof t)return t;if(a(t))return o(t,e)+"";if(v(t))return y?y.call(t):"";var s=t+"";return"0"==s&&1/t==-Infinity?"-0":s};var E=function(e){return null==e?"":x(e)};var k=function(e,t,s){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(s=s>n?n:s)<0&&(s+=n),n=t>s?0:s-t>>>0,t>>>=0;for(var r=Array(n);++i<n;)r[i]=e[i+t];return r};var O=function(e,t,s){var i=e.length;return s=void 0===s?i:s,!t&&s>=i?e:k(e,t,s)},C=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var S=function(e){return C.test(e)};var A=function(e){return e.split("")},R="[\\ud800-\\udfff]",M="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",F="\\ud83c[\\udffb-\\udfff]",j="[^\\ud800-\\udfff]",L="(?:\\ud83c[\\udde6-\\uddff]){2}",D="[\\ud800-\\udbff][\\udc00-\\udfff]",T="(?:"+M+"|"+F+")"+"?",z="[\\ufe0e\\ufe0f]?",P=z+T+("(?:\\u200d(?:"+[j,L,D].join("|")+")"+z+T+")*"),N="(?:"+[j+M+"?",M,L,D,R].join("|")+")",H=RegExp(F+"(?="+F+")|"+N+P,"g");var V=function(e){return e.match(H)||[]};var W=function(e){return S(e)?V(e):A(e)};var I=function(e){return function(t){t=E(t);var s=S(t)?W(t):void 0,i=s?s[0]:t.charAt(0),n=s?O(s,1).join(""):t.slice(1);return i[e]()+n}}("toUpperCase");var q=function(e){return I(E(e).toLowerCase())};var U=function(e,t,s,i){var n=-1,r=null==e?0:e.length;for(i&&r&&(s=e[++n]);++n<r;)s=t(s,e[n],n,e);return s};var B=function(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Q=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Z=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var G=function(e){return(e=E(e))&&e.replace(Q,B).replace(Z,"")},$=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var J=function(e){return e.match($)||[]},Y=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var _=function(e){return Y.test(e)},K="\\u2700-\\u27bf",X="a-z\\xdf-\\xf6\\xf8-\\xff",ee="A-Z\\xc0-\\xd6\\xd8-\\xde",te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",se="["+te+"]",ie="\\d+",ne="[\\u2700-\\u27bf]",re="["+X+"]",oe="[^\\ud800-\\udfff"+te+ie+K+X+ee+"]",ae="(?:\\ud83c[\\udde6-\\uddff]){2}",le="[\\ud800-\\udbff][\\udc00-\\udfff]",ce="["+ee+"]",he="(?:"+re+"|"+oe+")",ue="(?:"+ce+"|"+oe+")",de="(?:['’](?:d|ll|m|re|s|t|ve))?",pe="(?:['’](?:D|LL|M|RE|S|T|VE))?",fe="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",me="[\\ufe0e\\ufe0f]?",ge=me+fe+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",ae,le].join("|")+")"+me+fe+")*"),we="(?:"+[ne,ae,le].join("|")+")"+ge,ve=RegExp([ce+"?"+re+"+"+de+"(?="+[se,ce,"$"].join("|")+")",ue+"+"+pe+"(?="+[se,ce+he,"$"].join("|")+")",ce+"?"+he+"+"+de,ce+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ie,we].join("|"),"g");var be=function(e){return e.match(ve)||[]};var ye=function(e,t,s){return e=E(e),void 0===(t=s?void 0:t)?_(e)?be(e):J(e):e.match(t)||[]},xe=RegExp("['’]","g");var Ee=function(e){return function(t){return U(ye(G(t).replace(xe,"")),e,"")}},ke=Ee((function(e,t,s){return t=t.toLowerCase(),e+(s?q(t):t)}));var Oe=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ce=function(){return n.Date.now()},Se=/\s/;var Ae=function(e){for(var t=e.length;t--&&Se.test(e.charAt(t)););return t},Re=/^\s+/;var Me=function(e){return e?e.slice(0,Ae(e)+1).replace(Re,""):e},Fe=/^[-+]0x[0-9a-f]+$/i,je=/^0b[01]+$/i,Le=/^0o[0-7]+$/i,De=parseInt;var Te=function(e){if("number"==typeof e)return e;if(v(e))return NaN;if(Oe(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Oe(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Me(e);var s=je.test(e);return s||Le.test(e)?De(e.slice(2),s?2:8):Fe.test(e)?NaN:+e},ze=Math.max,Pe=Math.min;var Ne,He=function(e,t,s){var i,n,r,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var s=i,r=n;return i=n=void 0,c=t,o=e.apply(r,s)}function f(e){return c=e,a=setTimeout(g,t),h?p(e):o}function m(e){var s=e-l;return void 0===l||s>=t||s<0||u&&e-c>=r}function g(){var e=Ce();if(m(e))return w(e);a=setTimeout(g,function(e){var s=t-(e-l);return u?Pe(s,r-(e-c)):s}(e))}function w(e){return a=void 0,d&&i?p(e):(i=n=void 0,o)}function v(){var e=Ce(),s=m(e);if(i=arguments,n=this,l=e,s){if(void 0===a)return f(l);if(u)return clearTimeout(a),a=setTimeout(g,t),p(l)}return void 0===a&&(a=setTimeout(g,t)),o}return t=Te(t)||0,Oe(s)&&(h=!!s.leading,r=(u="maxWait"in s)?ze(Te(s.maxWait)||0,t):r,d="trailing"in s?!!s.trailing:d),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,i=l=n=a=void 0},v.flush=function(){return void 0===a?o:w(Ce())},v},Ve=Ee((function(e,t,s){return e+(s?"-":"")+t.toLowerCase()})),We=(function(e,t){var s;s=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var s=arguments[e];for(var i in s)t[i]=s[i]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function s(i){function n(){}function r(t,s,r){if("undefined"!=typeof document){"number"==typeof(r=e({path:"/"},n.defaults,r)).expires&&(r.expires=new Date(1*new Date+864e5*r.expires)),r.expires=r.expires?r.expires.toUTCString():"";try{var o=JSON.stringify(s);/^[\{\[]/.test(o)&&(s=o)}catch(e){}s=i.write?i.write(s,t):encodeURIComponent(String(s)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var l in r)r[l]&&(a+="; "+l,!0!==r[l]&&(a+="="+r[l].split(";")[0]));return document.cookie=t+"="+s+a}}function o(e,s){if("undefined"!=typeof document){for(var n={},r=document.cookie?document.cookie.split("; "):[],o=0;o<r.length;o++){var a=r[o].split("="),l=a.slice(1).join("=");s||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var c=t(a[0]);if(l=(i.read||i)(l,c)||t(l),s)try{l=JSON.parse(l)}catch(e){}if(n[c]=l,e===c)break}catch(e){}}return e?n[e]:n}}return n.set=r,n.get=function(e){return o(e,!1)},n.getJSON=function(e){return o(e,!0)},n.remove=function(t,s){r(t,"",e(s,{expires:-1}))},n.defaults={},n.withConverter=s,n}((function(){}))},e.exports=s()}(Ne={exports:{}},Ne.exports),Ne.exports);const Ie=new WeakMap,qe=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),Ue=(e,t,s)=>{const i=Ie.get(e)||{};s?i[t]=s:delete i[t],Ie.set(e,i)},Be=(e,t)=>(Ie.get(e)||{})[t],Qe=function(e,t,s,i,n,r,o){"function"==typeof i&&(o=r,r=n,n=i,i=null);const a="on:"+e+"-"+s+"-"+i;if(Be(t,a))return void console.error("Error: Sargasso utils.on: duplicate event handler specification. %o %s",t,a);const l={uid:e,events:s,selector:i,fn:r=>{o&&Ze(e,t,s,i),i?Array.from(t.querySelectorAll(i)).forEach(e=>{(r.target===e||e.contains(r.target))&&n(r,e)}):n(r)},options:r||!1};Ue(t,a,l),s.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),l.fn,l.options)})},Ze=function(e,t,s,i){const n="on:"+e+"-"+s+"-"+i,r=Be(t,n);r&&(s.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),r.fn,r.options)}),Ue(t,n))},Ge={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===s.indexOf(e)&&s.push(e)}),e.className=s.join(" ")},removeClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1)}),e.className=s.join(" ")},isVisible:qe,inViewPort:(e,t=window)=>{const s=e.getBoundingClientRect(),i=qe(e),n=s.bottom<0;let r;return r=t.self===window?s.top>(window.innerHeight||document.documentElement.clientHeight):s.top>t.clientHeight,i&&!r&&!n},setCSS:(e,t)=>{for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const i=ke(s);e.style[i]=t[s]}},setMetaData:Ue,getMetaData:Be,on:Qe,off:Ze,once:function(e,t,s,i,n,r){Qe(e,t,s,i,n,r,!0)},offAll:function(e){const t=Ie.get(e)||{},s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&s.push(e);s.forEach(s=>{Ze(t[s].uid,e,t[s].events,t[s].selector)})}};let $e,Je,Ye,_e,Ke;class Xe{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[]}subscribe(e){this.observers.length||this.wakeup(),this.observers.push(e)}unSubscribe(e){-1!==this.observers.indexOf(e)&&this.observers.splice(this.observers.indexOf(e),1),this.observers.length||this.sleep()}sleep(){}wakeup(){}notifyObservers(e,t){for(let s=0;s<this.observers.length;s++)this.observers[s][e]&&this.observers[s][e].apply(this.observers[s],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}$e=new class extends Xe{constructor(e){super(e),this.mutationHandler=He((e,t)=>{this.observeDOM(e,t)},100,{maxWait:250}),this.mutationObserver=new MutationObserver(this.mutationHandler,!1)}subscribe(e){super.subscribe(e),e.watchDOM()}wakeup(){super.wakeup(),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})}sleep(){super.sleep(),this.mutationObserver.disconnect()}observeDOM(){this.notifyObservers("watchDOM")}},Je=new class extends Xe{constructor(e={}){super(e),this.scrollElement=this.options.scrollElement||window,this.lastscroll=0,this.scrolling=!1}trigger(){this.scrolling||this.scrollLoop()}scrollLoop(){if(this.lastscroll!==this.scrollTop()){this.scrolling=!0,this.lastscroll=this.scrollTop(),this.watchScroll();const e=()=>{this.scrollLoop()};this.queueFrame(e)}else this.scrolling=!1}setOptions(e={}){this.sleep(),this.scrollElement=e.scrollElement||window,this.wakeup()}subscribe(e){super.subscribe(e),e.watchScroll()}wakeup(){super.wakeup(),Ge.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),Ge.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Ge.inViewPort(e,this.scrollElement)}watchScroll(){this.notifyObservers("watchScroll")}scrollTop(e){if(this.scrollElement===window){if(void 0===e)return window.pageYOffset;window.scrollTo(0,e)}else{if(void 0===e)return this.scrollElement.scrollTop;this.scrollElement.scrollTop=e}}},Ye=new class extends Xe{constructor(e){super(e),this.debounce=He(()=>{this.watchResize()},250)}subscribe(e){super.subscribe(e),e.watchResize()}wakeup(){super.wakeup(),window.addEventListener("resize",this.debounce,!1)}sleep(){super.sleep(),window.removeEventListener("resize",this.debounce)}watchResize(){this.notifyObservers("watchResize")}},_e=new class extends Xe{constructor(e){super(e),"onorientationchange"in window?Ge.addClass(document.body,"have-orientation"):Ge.addClass(document.body,"no-orientation"),this.debounce=He(()=>{this.watchOrientation()},250)}subscribe(e){super.subscribe(e),e.watchOrientation()}wakeup(){super.wakeup(),"onorientationchange"in window&&window.addEventListener("orientationchange",this.debounce,!1)}sleep(){super.sleep(),"onorientationchange"in window&&window.removeEventListener("orientationchange",this.debounce)}watchOrientation(){this.notifyObservers("watchOrientation")}},Ke=new class extends Xe{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let s=t,i=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});s=URL.createObjectURL(e),i=!0}this.workers[e]={worker:new Worker(s),observers:[]},i&&URL.revokeObjectURL(s),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const s=this.workers[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),s.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.notifyObservers("workerMessage",[e,t])}wakeup(){super.wakeup()}sleep(){super.sleep()}};let et=0;const tt=[],st="customElements"in window,it={},nt=(e,t)=>{if(it[e]=t,st){const t=`\n\t\t\treturn class ${e}Element extends HTMLElement {\n\t\t\t\tconstructor(element, options = {}) {\n\t\t\t\t\tsuper()\n\t\t\t\t\tthis.helperClass= '${e}'\n\t\t\t\t\tthis.helper = null\n\t\t\t\t}\n\n\t\t\t\tconnectedCallback () {\n\t\t\t\t\tthis.helper = new registeredClasses[this.helperClass](this,{isCustomElement:true})\n\t\t\t\t\tthis.helper.start()\n\t\t\t\t}\n\n\t\t\t\tdisconnectedCallback () {\n\t\t\t\t\tthis.helper.destroy()\n\t\t\t\t\tthis.helper = null // nuke the reference for trash collection\n\t\t\t\t}\n\t\t\t}`;customElements.define("sargasso-"+Ve(e),new Function("registeredClasses",t)(it))}},rt=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class ot{constructor(e,t={}){this.uid=++et,this.element=e,this.options=t,this.pendingAnimationFrame=void 0,this.frameQueue=[],this.isInViewport=!1,this.workers={},this.started=!1}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),tt.push(this),this.options.watchDOM&&$e.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Je.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ye.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&_e.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==rt.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this.started=!0}sleep(){this.options.watchDOM&&$e.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Je.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&Ye.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&_e.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),Ge.offAll(this.element),this.started=!1}DOMChanged(){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}setMetaData(e,t){Ge.setMetaData(this.element,e,t)}getMetaData(e){return Ge.getMetaData(this.element,e)}on(e,t,s,i){Ge.on(this.constructor.name+"-"+this.uid,this.element,e,t,s,i)}off(e,t){Ge.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,s,i){Ge.once(this.constructor.name+"-"+this.uid,this.element,e,t,s,i)}notifyAll(e,t){if(-1===rt.indexOf(e))throw new Error("invalid event name "+e);for(let s=0;s<tt.length;s++){const i=tt[s];i!==this&&i[e]&&i[e].apply(i,t)}}notifyElement(e,t,s){if(-1===rt.indexOf(t))throw new Error("invalid event name "+t);const i=this.getMetaData("registeredResponsiveControllers");if(i)for(let e=0;e<i.length;e++){const n=i[e];n!==this&&n[t]&&n[t].apply(n,s)}}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Ge.hasClass(this.element,e)}addClass(e){Ge.addClass(this.element,e)}removeClass(e){Ge.removeClass(this.element,e)}setCSS(e){Ge.setCSS(this.element,e)}isVisible(){return Ge.isVisible(this.element)}workerStart(e,t){return this.workers[e]=Ke.registerWorker(e,t),Ke.subscribe(this,e),this.workers[e]}workerPostMessage(e,t){t.uid||(t.uid=this.uid),this.workers[e]&&this.workers[e].postMessage(t)}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}stopWorker(e){this.workers[e]&&(Ke.unSubscribe(this,e),delete this.workers[e])}stopAllWorkers(){for(const e in this.workers)this.stopWorker(e)}destroy(){this.stopAllWorkers(),this.flushQueue(),this.started&&this.sleep();const e=this.getMetaData("registeredResponsiveControllers");e&&-1!==e.indexOf(this)&&(e.splice(e.indexOf(this),1),this.setMetaData("registeredResponsiveControllers",e)),this.setMetaData(this.constructor.name,null),this.element=null,-1!==tt.indexOf(this)&&tt.splice(tt.indexOf(this),1)}watchDOM(){this.DOMChanged()}watchScroll(){this.options.watchViewport&&this.inViewport(),this.didScroll()}watchResize(){this.options.watchViewport&&this.inViewport(),this.didResize()}watchOrientation(){!window.orientation||90!==window.orientation&&-90!==window.orientation?this.wantFullscreen(!1):this.wantFullscreen(!0)}inViewport(){Je.inViewPort(this.element)?this.isInViewport||(this.enterViewport(),this.isInViewport=!0):this.isInViewport&&(this.exitViewport(),this.isInViewport=!1)}workerMessage(e,t){t.data.uid===this.uid&&this.workerOnMessage(e,t.data)}nativeRequestFullScreen(){if(document.fullscreenElement){if(document.fullscreenElement===this.element)return;document.exitFullscreen()}this.element.requestFullscreen()}nativeExitFullScreen(){document.fullscreenElement&&document.fullscreenElement===this.element&&document.exitFullscreen()}}nt("Sargasso",ot);class at extends ot{constructor(e,t={}){t.watchScroll=!0,t.watchResize=!0,t.watchDOM=!0,t.immortal=!0,super(e,t)}didResize(){super.didResize(),this.lazyHandler()}didScroll(){super.didScroll(),this.lazyHandler()}DOMChanged(){super.DOMChanged(),this.lazyHandler()}lazyHandler(){const e=document.querySelectorAll("[data-lazy-sargasso-class]");for(let t=0;t<e.length;t++){const s=e[t];if(Je.inViewPort(s)){const i=s.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let s=0;s<i.length;s++){new it[i[s]](e[t]).start()}s.removeAttribute("data-lazy-sargasso-class")}}}}nt("LazyInstantiate",at);class lt extends ot{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new at(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let s=0;s<t.length;s++)try{new it[t[s]](e).start()}catch(e){console.log("error instantiating "+t[s],e,it)}e.removeAttribute("data-sargasso-class")}newPage(){this.doIt()}DOMChanged(){this.doIt()}doIt(){const e=document.querySelectorAll("[data-sargasso-class]");for(const t of e)this.instantiate(t);const t=[];for(let e=0;e<tt.length;e++)tt[e].options.immortal||tt[e].options.isCustomElement||document.body.contains(tt[e].element)||t.push(tt[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}nt("SargassoSupervisor",lt);const ct=[{className:"screen-xs",maxWidth:599},{className:"screen-sm",maxWidth:1023},{className:"screen-md",maxWidth:1439},{className:"screen-lg",maxWidth:1999},{className:"screen-xl",maxWidth:void 0}];class ht extends ot{constructor(e,t={}){t.watchResize=!0,super(e,t),t.widths?this.options.widths=t.widths:this.options.widths=ct,this.scale=void 0,this.disabled=!1,this.forceScale=void 0,this.orientation=void 0,this.widths=[],this.classes=[]}start(){super.start();let e=".show-hide{display:none;}\n";this.widths.push(0);for(let t=0;t<this.options.widths.length;t++)this.options.widths[t].maxWidth&&this.widths.push(this.options.widths[t].maxWidth),this.classes.push(this.options.widths[t].className),e+="."+this.options.widths[t].className+" .hidden-"+this.options.widths[t].className+"{display:none;}\n",e+=".not-"+this.options.widths[t].className+" .hidden-not-"+this.options.widths[t].className+"{display:none;}\n",e+="."+this.options.widths[t].className+" .shown-"+this.options.widths[t].className+"{display:block;}\n",e+=".not-"+this.options.widths[t].className+" .shown-not-"+this.options.widths[t].className+"{display:block;}\n";const t=document.createElement("style");t.type="text/css",t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t),this.detectGeometry()}didResize(){super.didResize(),this.detectGeometry()}disableResponsive(e){Ge.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){Ge.removeClass(document.body,"disable-responsive"),this.disabled=!1,this.forceScale="",this.detectGeometry()}detectGeometry(){let e=this.classes[this.widths.length-1];if(this.disabled)e=this.forceScale;else{const t=window.innerWidth;if(window.innerHeight>t){if("portrait"!==this.orientation){const e=()=>{Ge.removeClass(document.body,"landscape"),Ge.addClass(document.body,"portrait")};this.queueFrame(e),this.orientation="portrait"}}else if("landscape"!==this.orientation){const e=()=>{Ge.removeClass(document.body,"portrait"),Ge.addClass(document.body,"landscape")};this.queueFrame(e),this.orientation="landscape"}for(let s=0;s<this.widths.length-1;s++)if(t>=this.widths[s]&&t<this.widths[s+1]){e=this.classes[s];break}}let t=0;if(e!==this.scale){++t;const s=()=>{for(let t=0;t<this.classes.length;t++)this.classes[t]!==e?(Ge.addClass(document.body,"not-"+this.classes[t]),Ge.removeClass(document.body,this.classes[t]),Ge.removeClass(document.body,"shown-"+this.classes[t]),Ge.removeClass(document.body,"hidden-"+this.classes[t])):Ge.removeClass(document.body,"not-"+this.classes[t]);Ge.addClass(document.body,e),Ge.addClass(document.body,"shown-"+e),Ge.addClass(document.body,"hidden-"+e),this.notifyAll("didBreakpoint",[e])};this.queueFrame(s)}this.scale=e,t&&this.setHints()}setHints(){let e="";this.scale&&(e&&(e+=" "),e+=this.scale),e!==this.getCookie("responsive")&&this.setCookie("responsive",e)}getCookie(e){return We.get(e)}setCookie(e,t,s){const i={path:"/",domain:this.options.cookieDomain||null,expires:s};We.set(e,t,i)}deleteCookie(e){this.setCookie(e,null)}}nt("Breakpoints",ht);class ut extends ot{constructor(e,t={}){t.watchDOM=!0,t.immortal=!0,super(e,t),this.excludeRegex=new RegExp("^(//|http|javascript|mailto|#)","i"),this.currentPage=location.pathname+location.search,this.cachedMarkup={}}start(){const e=document.querySelectorAll("[data-hijax-skip-unchanged]");for(let t=0;t<e.length;t++){const s=e[t],i=s.getAttribute("id");this.cachedMarkup[i]=s.innerHTML}super.start(),window.addEventListener("popstate",e=>{this.watchPopState(e)},!1)}DOMChanged(){super.DOMChanged(),this.hijaxLinks()}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const s=t[e],i=s.getAttribute("href");!i||s.getAttribute("data-hijaxed")||s.getAttribute("target")||s.hasAttribute("data-no-hijax")||this.excludeRegex.exec(i)||(s.setAttribute("data-hijaxed",!0),s.addEventListener("click",e=>{e.preventDefault(),this.setPage(i)},!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,(t,s,i)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),s?this.currentPage=location.pathname+location.search:this.loadPage(i||e)})}loadPage(e){this.queueFrame(()=>{Ge.addClass(document.body,"hijax-loading")}),this.options.onExitPage&&this.options.onExitPage();const t=new XMLHttpRequest;t.open("GET",e),t.setRequestHeader("Sargasso-Hijax",1),t.setRequestHeader("x-digitopia-hijax",1),this.options.onLoading&&(this.options.onLoading(),t.onreadystatechange=this.options.onLoading),t.onload=()=>{if(301===t.status||302===t.status||t.getResponseHeader("Sargasso-Location")){const e=t.getResponseHeader("Location")?t.getResponseHeader("Location"):t.getResponseHeader("Sargasso-Location");this.setPage(e)}else if(200===t.status){Je.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,s=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Ge.removeClass(document.body,"hijax-loading")};this.queueFrame(s),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let s=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;s||(s="Could not connect to server."),this.options.onError?this.options.onError(e,s):alert("Error loading page: "+s)}},t.send()}processScripts(e){Array.from(e).forEach(e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)})}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach(e=>{e.remove()});const s=e.split(/(<body[^>]*>|<\/body>)/gi),i=dt(s[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],s=t.getAttribute("id"),r=i.getElementById(s);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[s]===r.innerHTML)continue;this.cachedMarkup[s]=r.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&r.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===r.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(r.querySelectorAll("script"));const a=()=>{t.parentNode.replaceChild(r,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(r)};this.queueFrame(a)}}}nt("HijaxLoader",ut);const dt=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),s=document.createElement("div");return s.insertAdjacentHTML("afterBegin",e),t.appendChild(s),t};e.loadPageHandler=void 0;const pt={registerSargassoClass:nt,bootSargasso:(t={})=>{if(t.scrollElement&&Je.setOptions(t),t.breakpoints){new ht(document.body,t.breakpoints).start()}if(t.hijax){const s=new ut(document.body,t.hijax);s.start(),e.loadPageHandler=s.setPage.bind(s)}else e.loadPageHandler=e=>{document.location.href=e};new lt(document.body,t).start(t)},elementTools:Ge},ft={theDOMWatcher:$e,theScrollWatcher:Je,theResizeWatcher:Ye,theOrientationWatcher:_e,theWorkerWatcher:Ke};return e.Sargasso=ot,e.services=ft,e.utils=pt,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=sargasso.iife.min.js.map

@@ -193,3 +193,3 @@ /**

// use a key found in data-hijax-cache-key on a child element with id defined in data-hijax-cache-key-id
// use a key found in data-hijax-cache-key on a child element found by css selector defined in data-hijax-cache-key-selector
const k = container.getAttribute('data-hijax-cache-key-selector')

@@ -196,0 +196,0 @@ if (k) {

@@ -192,2 +192,4 @@ /**

elementTools.offAll(this.element) // remove all dangling event listeners created with on/once
this.started = false

@@ -194,0 +196,0 @@ }

@@ -117,4 +117,3 @@ /**

const on = function (uid, container, events, selector, fn, options, once) {
const k = 'on:' + uid + '-' + events + '-' + selector
// selector is optional
if (typeof selector === 'function') {

@@ -127,2 +126,9 @@ once = options

const k = 'on:' + uid + '-' + events + '-' + selector
if (getMetaData(container, k)) { // duplicate event handler.
console.error('Error: Sargasso utils.on: duplicate event handler specification. %o %s', container, k)
return
}
const handler = (e) => {

@@ -144,3 +150,7 @@ if (once) {

// store handler spec in metadata so we can gracefully remove it later
const data = {
uid: uid,
events: events,
selector: selector,
fn: handler,

@@ -168,2 +178,20 @@ options: options || false

// remove all (on,once) event handlers for element
const offAll = function (container) {
const data = elementMetaData.get(container) || {}
const handlers = []
for (const k in data) {
if (Object.prototype.hasOwnProperty.call(data, k)) {
if (k.match(/^on:/)) {
handlers.push(k)
}
}
}
handlers.forEach((k) => {
off(data[k].uid, container, data[k].events, data[k].selector)
})
}
const once = function (uid, container, events, selector, fn, options) {

@@ -184,3 +212,4 @@ on(uid, container, events, selector, fn, options, true)

off: off,
once: once
once: once,
offAll: offAll
}

@@ -187,0 +216,0 @@

{
"name": "@pelagiccreatures/sargasso",
"version": "1.2.0",
"version": "1.3.0",
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.",

@@ -30,3 +30,3 @@ "keywords": [

"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.1.1",
"@rollup/plugin-node-resolve": "^11.2.0",
"chai": "^4.3.0",

@@ -42,3 +42,3 @@ "core-js": "^3.8.3 ",

"mocha-chrome": "^2.2.0",
"rollup": "^2.39.0",
"rollup": "^2.40.0",
"rollup-plugin-terser": "^7.0.2",

@@ -50,3 +50,3 @@ "setimmediate": "^1.0.5",

"js-cookie": "^2.2.1",
"lodash": "^4.17.20"
"lodash": "^4.17.21"
},

@@ -53,0 +53,0 @@ "directories": {

@@ -98,3 +98,3 @@ # @pelagiccreatures/sargasso

When a Sargasso element appears in the document, the framework supervisor will instantiate an object and call the `start()` method of the object. When removed from the DOM, 'sleep()' will be called allowing you can cleanup any resources or handlers you set up in start. Beyond responding to scrolling, resize and other responsive events, you will probably want to interact with your element in some way. You should use the start hook to set up any element events you need to respond to such as clicking a button, responding to touch events or key presses, etc.
When a Sargasso element appears in the document, the framework supervisor will instantiate an object and call the `start()` method of the object. When removed from the DOM, 'sleep()' will be called allowing you can cleanup any resources or handlers you set up in start (note that event listeners created with 'this.on' and 'this.once' are automatically cleaned up). Beyond responding to scrolling, resize and other responsive events, you will probably want to interact with your element in some way. You should use the start hook to set up any element events you need to respond to such as clicking a button, responding to touch events or key presses, etc.

@@ -152,3 +152,2 @@ ### Example with event handlers

this.debug('MyButtonClass sleep called')
this.off('click') // cleanup click event handler
super.sleep() // important!

@@ -210,3 +209,3 @@ }

| start() | set up any interactions and event handlers |
| sleep() | remove any event handlers defined in start() and cleanup references |
| sleep() | remove any event foreign handlers defined in start() and cleanup references - event handlers created with 'this.on' and 'this.once' are automatically removed by sargasso.|
| DOMChanged() | called when DOM changes if options 'watchDOM: true' was set in constructor |

@@ -283,3 +282,3 @@ | didScroll() | called when scroll occurs if options 'watchScroll: true' was set in constructor |

<div id="some-element" data-hijax>
<div id="some-other-element" data-hijax>
<p>This content also changes from page to page.</p>

@@ -312,6 +311,5 @@ </div>

Note: Hijax pages must be served over http/https. In the example directory of this repository is a python script for a simple server. Run `python localhost.py` then connect using a web browser `http://localhost:8000/example3.html` This example has an instrumented Sargasso class which logs events to illustrate the object lifecycle as pages come and go.
**Note**: Hijax pages must be served over http/https. In the example directory of this repository is a python script for a simple server. Run `python localhost.py` then connect using a web browser `http://localhost:8000/example3.html` This example has an instrumented Sargasso class which logs events to illustrate the object lifecycle as pages come and go.
Note: data-hijax elements must have and ID and contain well formed child html elements.
**Note**: data-hijax elements must have and ID and contain well formed child html elements.
```

@@ -322,7 +320,20 @@ <div id="nope" data-hijax>I'm just text. No child elements. Won't work.</div>

### Programatic page loading
#### Programatic page loading
`loadPageHandler(href)` is the utility function for programmatically loading a new page. EG. instead of `location.href= '/home'`, use `LoadPageHandler('/home')` This can be called to reload the page as well.
#### Finer content merging control
Set the `data-hijax-skip-unchanged` attribute on the hijax container and the content will remain static unless the markup is changed. This is useful if you have a Sargasso element that should remain instantiated and hold state when traversing several pages in a section.
```
<div id="test" data-hijax data-hijax-skip-unchanged>
<p>This content also sometimes changes from page to page, otherwise leave it alone.</p>
</div>
```
Set `data-hijax-cache-key-selector` to a css selector of an element within the hijax container which has defined `data-hijax-cache-key-selector` to leave the content intact across pages until the key changes.
```
<div id="test" data-hijax data-hijax-cache-key-selector="#sub-element">
<p id="sub-element" data-hijax-cache-key="some-key">This content uses a cache key to signal changes, otherwise leave it alone.</p>
</div>
```
### Using Animation Frames

@@ -329,0 +340,0 @@

@@ -52,3 +52,3 @@ const elementTools = SargassoModule.utils.elementTools

})
it('utils.setMetaData', function (done) {
it('utils.setMetaData utils.getMetaData', function (done) {
elementTools.setMetaData(testElement, 'key', 'test')

@@ -60,2 +60,3 @@ expect(elementTools.getMetaData(testElement, 'key')).to.equal('test')

})
it('util.on util.off util.once', function (done) {

@@ -62,0 +63,0 @@ const fn = sinon.spy()

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc