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.3.0 to 1.4.0

example/example4.html

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 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}({});
var SargassoModule=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(e){var t={exports:{}};return e(t,t.exports),t.exports}var n="object"==typeof t&&t&&t.Object===Object&&t,r="object"==typeof self&&self&&self.Object===Object&&self,i=n||r||Function("return this")(),o=i.Symbol;var a=function(e,t){for(var s=-1,n=null==e?0:e.length,r=Array(n);++s<n;)r[s]=t(e[s],s,e);return r},c=Array.isArray,l=Object.prototype,u=l.hasOwnProperty,h=l.toString,d=o?o.toStringTag:void 0;var p=function(e){var t=u.call(e,d),s=e[d];try{e[d]=void 0;var n=!0}catch(e){}var r=h.call(e);return n&&(t?e[d]=s:delete e[d]),r},f=Object.prototype.toString;var b=function(e){return f.call(e)},m=o?o.toStringTag:void 0;var v=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":m&&m in Object(e)?p(e):b(e)};var g=function(e){return null!=e&&"object"==typeof e};var w=function(e){return"symbol"==typeof e||g(e)&&"[object Symbol]"==v(e)},y=o?o.prototype:void 0,_=y?y.toString:void 0;var x=function e(t){if("string"==typeof t)return t;if(c(t))return a(t,e)+"";if(w(t))return _?_.call(t):"";var s=t+"";return"0"==s&&1/t==-Infinity?"-0":s};var O=function(e){return null==e?"":x(e)};var j=function(e,t,s){var n=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(s=s>r?r:s)<0&&(s+=r),r=t>s?0:s-t>>>0,t>>>=0;for(var i=Array(r);++n<r;)i[n]=e[n+t];return i};var E=function(e,t,s){var n=e.length;return s=void 0===s?n:s,!t&&s>=n?e:j(e,t,s)},A=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var k=function(e){return A.test(e)};var S=function(e){return e.split("")},N="[\\ud800-\\udfff]",C="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",M="\\ud83c[\\udffb-\\udfff]",T="[^\\ud800-\\udfff]",V="(?:\\ud83c[\\udde6-\\uddff]){2}",R="[\\ud800-\\udbff][\\udc00-\\udfff]",F="(?:"+C+"|"+M+")"+"?",L="[\\ufe0e\\ufe0f]?",P=L+F+("(?:\\u200d(?:"+[T,V,R].join("|")+")"+L+F+")*"),z="(?:"+[T+C+"?",C,V,R,N].join("|")+")",D=RegExp(M+"(?="+M+")|"+z+P,"g");var W=function(e){return e.match(D)||[]};var H=function(e){return k(e)?W(e):S(e)};var I=function(e){return function(t){t=O(t);var s=k(t)?H(t):void 0,n=s?s[0]:t.charAt(0),r=s?E(s,1).join(""):t.slice(1);return n[e]()+r}}("toUpperCase");var B=function(e){return I(O(e).toLowerCase())};var q=function(e,t,s,n){var r=-1,i=null==e?0:e.length;for(n&&i&&(s=e[++r]);++r<i;)s=t(s,e[r],r,e);return s};var U=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"}),$=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Q=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var G=function(e){return(e=O(e))&&e.replace($,U).replace(Q,"")},Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var J=function(e){return e.match(Z)||[]},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 K=function(e){return Y.test(e)},X="\\u2700-\\u27bf",ee="a-z\\xdf-\\xf6\\xf8-\\xff",te="A-Z\\xc0-\\xd6\\xd8-\\xde",se="\\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",ne="["+se+"]",re="\\d+",ie="[\\u2700-\\u27bf]",oe="["+ee+"]",ae="[^\\ud800-\\udfff"+se+re+X+ee+te+"]",ce="(?:\\ud83c[\\udde6-\\uddff]){2}",le="[\\ud800-\\udbff][\\udc00-\\udfff]",ue="["+te+"]",he="(?:"+oe+"|"+ae+")",de="(?:"+ue+"|"+ae+")",pe="(?:['’](?:d|ll|m|re|s|t|ve))?",fe="(?:['’](?:D|LL|M|RE|S|T|VE))?",be="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",me="[\\ufe0e\\ufe0f]?",ve=me+be+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",ce,le].join("|")+")"+me+be+")*"),ge="(?:"+[ie,ce,le].join("|")+")"+ve,we=RegExp([ue+"?"+oe+"+"+pe+"(?="+[ne,ue,"$"].join("|")+")",de+"+"+fe+"(?="+[ne,ue+he,"$"].join("|")+")",ue+"?"+he+"+"+pe,ue+"+"+fe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",re,ge].join("|"),"g");var ye=function(e){return e.match(we)||[]};var _e=function(e,t,s){return e=O(e),void 0===(t=s?void 0:t)?K(e)?ye(e):J(e):e.match(t)||[]},xe=RegExp("['’]","g");var Oe=function(e){return function(t){return q(_e(G(t).replace(xe,"")),e,"")}},je=Oe((function(e,t,s){return t=t.toLowerCase(),e+(s?B(t):t)}));const Ee=new WeakMap,Ae=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),ke=(e,t,s)=>{const n=Ee.get(e)||{};s?n[t]=s:delete n[t],Ee.set(e,n)},Se=(e,t)=>(Ee.get(e)||{})[t],Ne=function(e,t,s,n,r,i,o){"function"==typeof n&&(o=i,i=r,r=n,n=null);const a="on:"+e+"-"+s+"-"+n;if(Se(t,a))return void console.error("Error: Sargasso utils.on: duplicate event handler specification. %o %s",t,a);const c={uid:e,events:s,selector:n,fn:i=>{o&&Ce(e,t,s,n),n?Array.from(t.querySelectorAll(n)).forEach(e=>{(i.target===e||e.contains(i.target))&&r(i,e)}):r(i)},options:i||!1};ke(t,a,c),s.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),c.fn,c.options)})},Ce=function(e,t,s,n){const r="on:"+e+"-"+s+"-"+n,i=Se(t,r);i&&(s.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),i.fn,i.options)}),ke(t,r))},Me={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:Ae,inViewPort:(e,t=window)=>{const s=e.getBoundingClientRect(),n=Ae(e),r=s.bottom<0;let i;return i=t.self===window?s.top>(window.innerHeight||document.documentElement.clientHeight):s.top>t.clientHeight,n&&!i&&!r},setCSS:(e,t)=>{for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const n=je(s);e.style[n]=t[s]}},setMetaData:ke,getMetaData:Se,on:Ne,off:Ce,once:function(e,t,s,n,r,i){Ne(e,t,s,n,r,i,!0)},offAll:function(e){const t=Ee.get(e)||{},s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&s.push(e);s.forEach(s=>{Ce(t[s].uid,e,t[s].events,t[s].selector)})}};var Te=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ve=function(){return i.Date.now()},Re=/\s/;var Fe=function(e){for(var t=e.length;t--&&Re.test(e.charAt(t)););return t},Le=/^\s+/;var Pe=function(e){return e?e.slice(0,Fe(e)+1).replace(Le,""):e},ze=/^[-+]0x[0-9a-f]+$/i,De=/^0b[01]+$/i,We=/^0o[0-7]+$/i,He=parseInt;var Ie=function(e){if("number"==typeof e)return e;if(w(e))return NaN;if(Te(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Te(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Pe(e);var s=De.test(e);return s||We.test(e)?He(e.slice(2),s?2:8):ze.test(e)?NaN:+e},Be=Math.max,qe=Math.min;var Ue=function(e,t,s){var n,r,i,o,a,c,l=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var s=n,i=r;return n=r=void 0,l=t,o=e.apply(i,s)}function f(e){return l=e,a=setTimeout(m,t),u?p(e):o}function b(e){var s=e-c;return void 0===c||s>=t||s<0||h&&e-l>=i}function m(){var e=Ve();if(b(e))return v(e);a=setTimeout(m,function(e){var s=t-(e-c);return h?qe(s,i-(e-l)):s}(e))}function v(e){return a=void 0,d&&n?p(e):(n=r=void 0,o)}function g(){var e=Ve(),s=b(e);if(n=arguments,r=this,c=e,s){if(void 0===a)return f(c);if(h)return clearTimeout(a),a=setTimeout(m,t),p(c)}return void 0===a&&(a=setTimeout(m,t)),o}return t=Ie(t)||0,Te(s)&&(u=!!s.leading,i=(h="maxWait"in s)?Be(Ie(s.maxWait)||0,t):i,d="trailing"in s?!!s.trailing:d),g.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=r=a=void 0},g.flush=function(){return void 0===a?o:v(Ve())},g};var $e=function(){this.__data__=[],this.size=0};var Qe=function(e,t){return e===t||e!=e&&t!=t};var Ge=function(e,t){for(var s=e.length;s--;)if(Qe(e[s][0],t))return s;return-1},Ze=Array.prototype.splice;var Je=function(e){var t=this.__data__,s=Ge(t,e);return!(s<0)&&(s==t.length-1?t.pop():Ze.call(t,s,1),--this.size,!0)};var Ye=function(e){var t=this.__data__,s=Ge(t,e);return s<0?void 0:t[s][1]};var Ke=function(e){return Ge(this.__data__,e)>-1};var Xe=function(e,t){var s=this.__data__,n=Ge(s,e);return n<0?(++this.size,s.push([e,t])):s[n][1]=t,this};function et(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var n=e[t];this.set(n[0],n[1])}}et.prototype.clear=$e,et.prototype.delete=Je,et.prototype.get=Ye,et.prototype.has=Ke,et.prototype.set=Xe;var tt=et;var st=function(){this.__data__=new tt,this.size=0};var nt=function(e){var t=this.__data__,s=t.delete(e);return this.size=t.size,s};var rt=function(e){return this.__data__.get(e)};var it=function(e){return this.__data__.has(e)};var ot,at=function(e){if(!Te(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ct=i["__core-js_shared__"],lt=(ot=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||""))?"Symbol(src)_1."+ot:"";var ut=function(e){return!!lt&&lt in e},ht=Function.prototype.toString;var dt=function(e){if(null!=e){try{return ht.call(e)}catch(e){}try{return e+""}catch(e){}}return""},pt=/^\[object .+?Constructor\]$/,ft=Function.prototype,bt=Object.prototype,mt=ft.toString,vt=bt.hasOwnProperty,gt=RegExp("^"+mt.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var wt=function(e){return!(!Te(e)||ut(e))&&(at(e)?gt:pt).test(dt(e))};var yt=function(e,t){return null==e?void 0:e[t]};var _t=function(e,t){var s=yt(e,t);return wt(s)?s:void 0},xt=_t(i,"Map"),Ot=_t(Object,"create");var jt=function(){this.__data__=Ot?Ot(null):{},this.size=0};var Et=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},At=Object.prototype.hasOwnProperty;var kt=function(e){var t=this.__data__;if(Ot){var s=t[e];return"__lodash_hash_undefined__"===s?void 0:s}return At.call(t,e)?t[e]:void 0},St=Object.prototype.hasOwnProperty;var Nt=function(e){var t=this.__data__;return Ot?void 0!==t[e]:St.call(t,e)};var Ct=function(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=Ot&&void 0===t?"__lodash_hash_undefined__":t,this};function Mt(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var n=e[t];this.set(n[0],n[1])}}Mt.prototype.clear=jt,Mt.prototype.delete=Et,Mt.prototype.get=kt,Mt.prototype.has=Nt,Mt.prototype.set=Ct;var Tt=Mt;var Vt=function(){this.size=0,this.__data__={hash:new Tt,map:new(xt||tt),string:new Tt}};var Rt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ft=function(e,t){var s=e.__data__;return Rt(t)?s["string"==typeof t?"string":"hash"]:s.map};var Lt=function(e){var t=Ft(this,e).delete(e);return this.size-=t?1:0,t};var Pt=function(e){return Ft(this,e).get(e)};var zt=function(e){return Ft(this,e).has(e)};var Dt=function(e,t){var s=Ft(this,e),n=s.size;return s.set(e,t),this.size+=s.size==n?0:1,this};function Wt(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var n=e[t];this.set(n[0],n[1])}}Wt.prototype.clear=Vt,Wt.prototype.delete=Lt,Wt.prototype.get=Pt,Wt.prototype.has=zt,Wt.prototype.set=Dt;var Ht=Wt;var It=function(e,t){var s=this.__data__;if(s instanceof tt){var n=s.__data__;if(!xt||n.length<199)return n.push([e,t]),this.size=++s.size,this;s=this.__data__=new Ht(n)}return s.set(e,t),this.size=s.size,this};function Bt(e){var t=this.__data__=new tt(e);this.size=t.size}Bt.prototype.clear=st,Bt.prototype.delete=nt,Bt.prototype.get=rt,Bt.prototype.has=it,Bt.prototype.set=It;var qt=Bt;var Ut=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var $t=function(e){return this.__data__.has(e)};function Qt(e){var t=-1,s=null==e?0:e.length;for(this.__data__=new Ht;++t<s;)this.add(e[t])}Qt.prototype.add=Qt.prototype.push=Ut,Qt.prototype.has=$t;var Gt=Qt;var Zt=function(e,t){for(var s=-1,n=null==e?0:e.length;++s<n;)if(t(e[s],s,e))return!0;return!1};var Jt=function(e,t){return e.has(t)};var Yt=function(e,t,s,n,r,i){var o=1&s,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var h=-1,d=!0,p=2&s?new Gt:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var f=e[h],b=t[h];if(n)var m=o?n(b,f,h,t,e,i):n(f,b,h,e,t,i);if(void 0!==m){if(m)continue;d=!1;break}if(p){if(!Zt(t,(function(e,t){if(!Jt(p,t)&&(f===e||r(f,e,s,n,i)))return p.push(t)}))){d=!1;break}}else if(f!==b&&!r(f,b,s,n,i)){d=!1;break}}return i.delete(e),i.delete(t),d},Kt=i.Uint8Array;var Xt=function(e){var t=-1,s=Array(e.size);return e.forEach((function(e,n){s[++t]=[n,e]})),s};var es=function(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s},ts=o?o.prototype:void 0,ss=ts?ts.valueOf:void 0;var ns=function(e,t,s,n,r,i,o){switch(s){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new Kt(e),new Kt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Qe(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Xt;case"[object Set]":var c=1&n;if(a||(a=es),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;n|=2,o.set(e,t);var u=Yt(a(e),a(t),n,r,i,o);return o.delete(e),u;case"[object Symbol]":if(ss)return ss.call(e)==ss.call(t)}return!1};var rs=function(e,t){for(var s=-1,n=t.length,r=e.length;++s<n;)e[r+s]=t[s];return e};var is=function(e,t,s){var n=t(e);return c(e)?n:rs(n,s(e))};var os=function(e,t){for(var s=-1,n=null==e?0:e.length,r=0,i=[];++s<n;){var o=e[s];t(o,s,e)&&(i[r++]=o)}return i};var as=function(){return[]},cs=Object.prototype.propertyIsEnumerable,ls=Object.getOwnPropertySymbols,us=ls?function(e){return null==e?[]:(e=Object(e),os(ls(e),(function(t){return cs.call(e,t)})))}:as;var hs=function(e,t){for(var s=-1,n=Array(e);++s<e;)n[s]=t(s);return n};var ds=function(e){return g(e)&&"[object Arguments]"==v(e)},ps=Object.prototype,fs=ps.hasOwnProperty,bs=ps.propertyIsEnumerable,ms=ds(function(){return arguments}())?ds:function(e){return g(e)&&fs.call(e,"callee")&&!bs.call(e,"callee")};var vs=function(){return!1},gs=s((function(e,t){var s=t&&!t.nodeType&&t,n=s&&e&&!e.nodeType&&e,r=n&&n.exports===s?i.Buffer:void 0,o=(r?r.isBuffer:void 0)||vs;e.exports=o})),ws=/^(?:0|[1-9]\d*)$/;var ys=function(e,t){var s=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==s||"symbol"!=s&&ws.test(e))&&e>-1&&e%1==0&&e<t};var _s=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},xs={};xs["[object Float32Array]"]=xs["[object Float64Array]"]=xs["[object Int8Array]"]=xs["[object Int16Array]"]=xs["[object Int32Array]"]=xs["[object Uint8Array]"]=xs["[object Uint8ClampedArray]"]=xs["[object Uint16Array]"]=xs["[object Uint32Array]"]=!0,xs["[object Arguments]"]=xs["[object Array]"]=xs["[object ArrayBuffer]"]=xs["[object Boolean]"]=xs["[object DataView]"]=xs["[object Date]"]=xs["[object Error]"]=xs["[object Function]"]=xs["[object Map]"]=xs["[object Number]"]=xs["[object Object]"]=xs["[object RegExp]"]=xs["[object Set]"]=xs["[object String]"]=xs["[object WeakMap]"]=!1;var Os=function(e){return g(e)&&_s(e.length)&&!!xs[v(e)]};var js=function(e){return function(t){return e(t)}},Es=s((function(e,t){var s=t&&!t.nodeType&&t,r=s&&e&&!e.nodeType&&e,i=r&&r.exports===s&&n.process,o=function(){try{var e=r&&r.require&&r.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o})),As=Es&&Es.isTypedArray,ks=As?js(As):Os,Ss=Object.prototype.hasOwnProperty;var Ns=function(e,t){var s=c(e),n=!s&&ms(e),r=!s&&!n&&gs(e),i=!s&&!n&&!r&&ks(e),o=s||n||r||i,a=o?hs(e.length,String):[],l=a.length;for(var u in e)!t&&!Ss.call(e,u)||o&&("length"==u||r&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ys(u,l))||a.push(u);return a},Cs=Object.prototype;var Ms=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Cs)};var Ts=function(e,t){return function(s){return e(t(s))}}(Object.keys,Object),Vs=Object.prototype.hasOwnProperty;var Rs=function(e){if(!Ms(e))return Ts(e);var t=[];for(var s in Object(e))Vs.call(e,s)&&"constructor"!=s&&t.push(s);return t};var Fs=function(e){return null!=e&&_s(e.length)&&!at(e)};var Ls=function(e){return Fs(e)?Ns(e):Rs(e)};var Ps=function(e){return is(e,Ls,us)},zs=Object.prototype.hasOwnProperty;var Ds=function(e,t,s,n,r,i){var o=1&s,a=Ps(e),c=a.length;if(c!=Ps(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:zs.call(t,u)))return!1}var h=i.get(e),d=i.get(t);if(h&&d)return h==t&&d==e;var p=!0;i.set(e,t),i.set(t,e);for(var f=o;++l<c;){var b=e[u=a[l]],m=t[u];if(n)var v=o?n(m,b,u,t,e,i):n(b,m,u,e,t,i);if(!(void 0===v?b===m||r(b,m,s,n,i):v)){p=!1;break}f||(f="constructor"==u)}if(p&&!f){var g=e.constructor,w=t.constructor;g==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof w&&w instanceof w||(p=!1)}return i.delete(e),i.delete(t),p},Ws=_t(i,"DataView"),Hs=_t(i,"Promise"),Is=_t(i,"Set"),Bs=_t(i,"WeakMap"),qs="[object Map]",Us="[object Promise]",$s="[object Set]",Qs="[object WeakMap]",Gs="[object DataView]",Zs=dt(Ws),Js=dt(xt),Ys=dt(Hs),Ks=dt(Is),Xs=dt(Bs),en=v;(Ws&&en(new Ws(new ArrayBuffer(1)))!=Gs||xt&&en(new xt)!=qs||Hs&&en(Hs.resolve())!=Us||Is&&en(new Is)!=$s||Bs&&en(new Bs)!=Qs)&&(en=function(e){var t=v(e),s="[object Object]"==t?e.constructor:void 0,n=s?dt(s):"";if(n)switch(n){case Zs:return Gs;case Js:return qs;case Ys:return Us;case Ks:return $s;case Xs:return Qs}return t});var tn=en,sn="[object Arguments]",nn="[object Array]",rn="[object Object]",on=Object.prototype.hasOwnProperty;var an=function(e,t,s,n,r,i){var o=c(e),a=c(t),l=o?nn:tn(e),u=a?nn:tn(t),h=(l=l==sn?rn:l)==rn,d=(u=u==sn?rn:u)==rn,p=l==u;if(p&&gs(e)){if(!gs(t))return!1;o=!0,h=!1}if(p&&!h)return i||(i=new qt),o||ks(e)?Yt(e,t,s,n,r,i):ns(e,t,l,s,n,r,i);if(!(1&s)){var f=h&&on.call(e,"__wrapped__"),b=d&&on.call(t,"__wrapped__");if(f||b){var m=f?e.value():e,v=b?t.value():t;return i||(i=new qt),r(m,v,s,n,i)}}return!!p&&(i||(i=new qt),Ds(e,t,s,n,r,i))};var cn=function e(t,s,n,r,i){return t===s||(null==t||null==s||!g(t)&&!g(s)?t!=t&&s!=s:an(t,s,n,r,e,i))};var ln=function(e,t){return cn(e,t)};const un={},hn=e=>({get(t,s){const n=Reflect.get(t,s);return n&&"object"==typeof n?new Proxy(n,hn(e)):n},set:(t,s,n)=>(e.sync(s),Reflect.set(t,s,n)),deleteProperty:(t,s)=>(e.sync(s),Reflect.deleteProperty(t,s))});class dn{constructor(e,t={},s={}){if(this.id=e,un[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=new Proxy(t,hn(this)),this.options=s,un[this.id]=this}destroy(){delete un[this.id],delete this.data,Object.keys(this.bound).forEach(e=>{Object.keys(this.bound[e]).forEach(t=>{this.unbind(e,t)})})}getBoundData(){return this.data}set(e,t){ln(this.get(e),t)||(this.data[e]=t)}get(e){return this.data[e]}delete(e){delete this.data[e]}syncAll(){Object.keys(this.data||{}).forEach(e=>{this.sync(e)})}bind(e,t,s="*"){this.bound[s]||(this.bound[s]={}),this.bound[s][e]=t,Object.keys(this.data).forEach(e=>{t(this.id,e,this.get(e))})}unbind(e,t="*"){this.bound[t][e]&&delete this.bound[t][e]}observers(){let e=0;for(const t in this.bound)this.bound.hasOwnProperty(t)&&e++;return e}sync(e){Object.keys(this.bound["*"]||{}).forEach(t=>{this.bound["*"][t](this.id,e,this.get(e))}),Object.keys(this.bound[e]||{}).forEach(t=>{this.bound[e][t](this.id,e,this.get(e))})}}let pn,fn,bn,mn,vn,gn;class wn{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]()}}pn=new class extends wn{constructor(e){super(e),this.mutationHandler=Ue((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")}},fn=new class extends wn{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(),Me.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),Me.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Me.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}}},bn=new class extends wn{constructor(e){super(e),this.debounce=Ue(()=>{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")}},mn=new class extends wn{constructor(e){super(e),"onorientationchange"in window?Me.addClass(document.body,"have-orientation"):Me.addClass(document.body,"no-orientation"),this.debounce=Ue(()=>{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")}},vn=new class extends wn{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let s=t,n=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});s=URL.createObjectURL(e),n=!0}this.workers[e]={worker:new Worker(s),observers:[]},n&&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.workers[e].observers.forEach(s=>{s.workerMessage&&s.workerMessage(e,t)})}wakeup(){super.wakeup()}sleep(){super.sleep()}},gn=new class extends wn{constructor(e){super(e),this.registeredObservableObjects={}}getObservable(e){return this.registeredObservableObjects[e]?this.registeredObservableObjects[e].observable:void 0}observableStart(e,t){const s=(e=>un[e])(e);if(s&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=s?{id:e,observable:s,observers:[],managed:!1}:{id:e,observable:new dn(e,t),observers:[],managed:!0},this.registeredObservableObjects[e].observable.bind(this.constructor.name,this.notify.bind(this))),this.registeredObservableObjects[e].observable}observableDestroy(e){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject observableDestroy "+e+" does not exist");this.registeredObservableObjects[e].observable.unbind(this.constructor.name),this.registeredObservableObjects[e].observable.destroy(),delete this.registeredObservableObjects[e]}subscribe(e,t,s){this.registeredObservableObjects[t]||this.observableStart(t,s),this.registeredObservableObjects[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.registeredObservableObjects[t])throw new Error("ObservableObject unSubscribe "+t+" does not exist");const s=this.registeredObservableObjects[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),!s.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,s,n){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach(r=>{r.observableChanged&&r.observableChanged(e,t,s,n)})}};var yn=Oe((function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}));const _n=new WeakMap,xn=e=>(...t)=>{const s=e(...t);return _n.set(s,!0),s},On=e=>"function"==typeof e&&_n.has(e),jn="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,En=(e,t,s=null,n=null)=>{for(;t!==s;){const s=t.nextSibling;e.insertBefore(t,n),t=s}},An=(e,t,s=null)=>{for(;t!==s;){const s=t.nextSibling;e.removeChild(t),t=s}},kn={},Sn={},Nn=`{{lit-${String(Math.random()).slice(2)}}}`,Cn=`\x3c!--${Nn}--\x3e`,Mn=new RegExp(`${Nn}|${Cn}`),Tn="$lit$";class Vn{constructor(e,t){this.parts=[],this.element=t;const s=[],n=[],r=document.createTreeWalker(t.content,133,null,!1);let i=0,o=-1,a=0;const{strings:c,values:{length:l}}=e;for(;a<l;){const e=r.nextNode();if(null!==e){if(o++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:s}=t;let n=0;for(let e=0;e<s;e++)Rn(t[e].name,Tn)&&n++;for(;n-- >0;){const t=c[a],s=Pn.exec(t)[2],n=s.toLowerCase()+Tn,r=e.getAttribute(n);e.removeAttribute(n);const i=r.split(Mn);this.parts.push({type:"attribute",index:o,name:s,strings:i}),a+=i.length-1}}"TEMPLATE"===e.tagName&&(n.push(e),r.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(Nn)>=0){const n=e.parentNode,r=t.split(Mn),i=r.length-1;for(let t=0;t<i;t++){let s,i=r[t];if(""===i)s=Ln();else{const e=Pn.exec(i);null!==e&&Rn(e[2],Tn)&&(i=i.slice(0,e.index)+e[1]+e[2].slice(0,-Tn.length)+e[3]),s=document.createTextNode(i)}n.insertBefore(s,e),this.parts.push({type:"node",index:++o})}""===r[i]?(n.insertBefore(Ln(),e),s.push(e)):e.data=r[i],a+=i}}else if(8===e.nodeType)if(e.data===Nn){const t=e.parentNode;null!==e.previousSibling&&o!==i||(o++,t.insertBefore(Ln(),e)),i=o,this.parts.push({type:"node",index:o}),null===e.nextSibling?e.data="":(s.push(e),o--),a++}else{let t=-1;for(;-1!==(t=e.data.indexOf(Nn,t+1));)this.parts.push({type:"node",index:-1}),a++}}else r.currentNode=n.pop()}for(const e of s)e.parentNode.removeChild(e)}}const Rn=(e,t)=>{const s=e.length-t.length;return s>=0&&e.slice(s)===t},Fn=e=>-1!==e.index,Ln=()=>document.createComment(""),Pn=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class zn{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)void 0!==s&&s.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=jn?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],s=this.template.parts,n=document.createTreeWalker(e,133,null,!1);let r,i=0,o=0,a=n.nextNode();for(;i<s.length;)if(r=s[i],Fn(r)){for(;o<r.index;)o++,"TEMPLATE"===a.nodeName&&(t.push(a),n.currentNode=a.content),null===(a=n.nextNode())&&(n.currentNode=t.pop(),a=n.nextNode());if("node"===r.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(a.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,r.name,r.strings,this.options));i++}else this.__parts.push(void 0),i++;return jn&&(document.adoptNode(e),customElements.upgrade(e)),e}}const Dn=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),Wn=` ${Nn} `;class Hn{constructor(e,t,s,n){this.strings=e,this.values=t,this.type=s,this.processor=n}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let n=0;n<e;n++){const e=this.strings[n],r=e.lastIndexOf("\x3c!--");s=(r>-1||s)&&-1===e.indexOf("--\x3e",r+1);const i=Pn.exec(e);t+=null===i?e+(s?Wn:Cn):e.substr(0,i.index)+i[1]+i[2]+Tn+i[3]+Nn}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==Dn&&(t=Dn.createHTML(t)),e.innerHTML=t,e}}const In=e=>null===e||!("object"==typeof e||"function"==typeof e),Bn=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class qn{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let e=0;e<s.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new Un(this)}_getValue(){const e=this.strings,t=e.length-1,s=this.parts;if(1===t&&""===e[0]&&""===e[1]){const e=s[0].value;if("symbol"==typeof e)return String(e);if("string"==typeof e||!Bn(e))return e}let n="";for(let r=0;r<t;r++){n+=e[r];const t=s[r];if(void 0!==t){const e=t.value;if(In(e)||!Bn(e))n+="string"==typeof e?e:String(e);else for(const t of e)n+="string"==typeof t?t:String(t)}}return n+=e[t],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class Un{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===kn||In(e)&&e===this.value||(this.value=e,On(e)||(this.committer.dirty=!0))}commit(){for(;On(this.value);){const e=this.value;this.value=kn,e(this)}this.value!==kn&&this.committer.commit()}}class $n{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Ln()),this.endNode=e.appendChild(Ln())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Ln()),e.__insert(this.endNode=Ln())}insertAfterPart(e){e.__insert(this.startNode=Ln()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;On(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=kn,e(this)}const e=this.__pendingValue;e!==kn&&(In(e)?e!==this.value&&this.__commitText(e):e instanceof Hn?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Bn(e)?this.__commitIterable(e):e===Sn?(this.value=Sn,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,s="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=s:this.__commitNode(document.createTextNode(s)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof zn&&this.value.template===t)this.value.update(e.values);else{const s=new zn(t,e.processor,this.options),n=s._clone();s.update(e.values),this.__commitNode(n),this.value=s}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let s,n=0;for(const r of e)s=t[n],void 0===s&&(s=new $n(this.options),t.push(s),0===n?s.appendIntoPart(this):s.insertAfterPart(t[n-1])),s.setValue(r),s.commit(),n++;n<t.length&&(t.length=n,this.clear(s&&s.endNode))}clear(e=this.startNode){An(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Qn{constructor(e,t,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=s}setValue(e){this.__pendingValue=e}commit(){for(;On(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=kn,e(this)}if(this.__pendingValue===kn)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=kn}}class Gn extends qn{constructor(e,t,s){super(e,t,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new Zn(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Zn extends Un{}let Jn=!1;(()=>{try{const e={get capture(){return Jn=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class Yn{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;On(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=kn,e(this)}if(this.__pendingValue===kn)return;const e=this.__pendingValue,t=this.value,s=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),n=null!=e&&(null==t||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),n&&(this.__options=Kn(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=kn}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Kn=e=>e&&(Jn?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);const Xn=new class{handleAttributeExpressions(e,t,s,n){const r=t[0];if("."===r){return new Gn(e,t.slice(1),s).parts}if("@"===r)return[new Yn(e,t.slice(1),n.eventContext)];if("?"===r)return[new Qn(e,t.slice(1),s)];return new qn(e,t,s).parts}handleTextExpression(e){return new $n(e)}};function er(e){let t=tr.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},tr.set(e.type,t));let s=t.stringsArray.get(e.strings);if(void 0!==s)return s;const n=e.strings.join(Nn);return s=t.keyString.get(n),void 0===s&&(s=new Vn(e,e.getTemplateElement()),t.keyString.set(n,s)),t.stringsArray.set(e.strings,s),s}const tr=new Map,sr=new WeakMap,nr=(e,t,s)=>{let n=sr.get(t);void 0===n&&(An(t,t.firstChild),sr.set(t,n=new $n(Object.assign({templateFactory:er},s))),n.appendInto(t)),n.setValue(e),n.commit()};"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");let rr=0;const ir=[],or="customElements"in window,ar={},cr=(e,t)=>{if(ar[e]=t,or){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-"+yn(e),new Function("registeredClasses",t)(ar))}},lr=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class ur{constructor(e,t={}){this.uid=++rr,this.element=e,this.options=t,this.pendingAnimationFrame=void 0,this.frameQueue=[],this.isInViewport=!1,this.workers={},this.observables={},this.template=void 0,this.templateArgs={},this.started=!1,this.render=Ue(()=>{this._render()},100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),ir.push(this),this.options.watchDOM&&pn.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&fn.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&bn.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&mn.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==lr.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&&pn.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&fn.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&bn.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&mn.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),Me.offAll(this.element),this.started=!1}DOMChanged(){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}observableChanged(e,t,s){this.render()}setMetaData(e,t){Me.setMetaData(this.element,e,t)}getMetaData(e){return Me.getMetaData(this.element,e)}on(e,t,s,n){Me.on(this.constructor.name+"-"+this.uid,this.element,e,t,s,n)}off(e,t){Me.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,s,n){Me.once(this.constructor.name+"-"+this.uid,this.element,e,t,s,n)}notifyAll(e,t){if(-1===lr.indexOf(e))throw new Error("invalid event name "+e);for(let s=0;s<ir.length;s++){const n=ir[s];n!==this&&n[e]&&n[e].apply(n,t)}}notifyElement(e,t,s){if(-1===lr.indexOf(t))throw new Error("invalid event name "+t);const n=this.getMetaData("registeredResponsiveControllers");if(n)for(let e=0;e<n.length;e++){const r=n[e];r!==this&&r[t]&&r[t].apply(r,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 Me.hasClass(this.element,e)}addClass(e){Me.addClass(this.element,e)}removeClass(e){Me.removeClass(this.element,e)}setCSS(e){Me.setCSS(this.element,e)}isVisible(){return Me.isVisible(this.element)}workerStart(e,t){return this.workers[e]=vn.registerWorker(e,t),vn.subscribe(this,e),this.workers[e]}workerPostMessage(e,t){t.uid||(t.uid=this.uid),this.workers[e]&&this.workers[e].postMessage(t)}getObservable(e){return this.observables[e]}observableStart(e,t){return gn.subscribe(this,e,t),this.observables[e]=gn.getObservable(e),this.observables[e]}observableStop(e){this.observables[e]&&(gn.unSubscribe(this,e),delete this.observables[e])}observableStopAll(){for(const e in this.observables)this.observableStop(e)}setTemplate(e){this.template=e}setTemplateArgs(e={}){this.templateArgs=e.constructor&&"ObservableObject"===e.constructor.name?e.data:e,this.render()}_render(){this.template&&nr(this.template(JSON.parse(JSON.stringify(this.templateArgs||{}))),this.element)}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]&&(vn.unSubscribe(this,e),delete this.workers[e])}stopAllWorkers(){for(const e in this.workers)this.stopWorker(e)}destroy(){this.stopAllWorkers(),this.observableStopAll(),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!==ir.indexOf(this)&&ir.splice(ir.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(){fn.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()}}cr("Sargasso",ur);class hr extends ur{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(fn.inViewPort(s)){const n=s.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let s=0;s<n.length;s++){new ar[n[s]](e[t]).start()}s.removeAttribute("data-lazy-sargasso-class")}}}}cr("LazyInstantiate",hr);class dr extends ur{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new hr(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 ar[t[s]](e).start()}catch(e){console.log("error instantiating "+t[s],e,ar)}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<ir.length;e++)ir[e].options.immortal||ir[e].options.isCustomElement||document.body.contains(ir[e].element)||t.push(ir[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}cr("SargassoSupervisor",dr);var pr=s((function(e,t){!function(t){if(e.exports=t(),!!0){var s=window.Cookies,n=window.Cookies=t();n.noConflict=function(){return window.Cookies=s,n}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var s=arguments[e];for(var n in s)t[n]=s[n]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function s(n){function r(){}function i(t,s,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},r.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var o=JSON.stringify(s);/^[\{\[]/.test(o)&&(s=o)}catch(e){}s=n.write?n.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 c in i)i[c]&&(a+="; "+c,!0!==i[c]&&(a+="="+i[c].split(";")[0]));return document.cookie=t+"="+s+a}}function o(e,s){if("undefined"!=typeof document){for(var r={},i=document.cookie?document.cookie.split("; "):[],o=0;o<i.length;o++){var a=i[o].split("="),c=a.slice(1).join("=");s||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var l=t(a[0]);if(c=(n.read||n)(c,l)||t(c),s)try{c=JSON.parse(c)}catch(e){}if(r[l]=c,e===l)break}catch(e){}}return e?r[e]:r}}return r.set=i,r.get=function(e){return o(e,!1)},r.getJSON=function(e){return o(e,!0)},r.remove=function(t,s){i(t,"",e(s,{expires:-1}))},r.defaults={},r.withConverter=s,r}((function(){}))}))}));const fr=[{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 br extends ur{constructor(e,t={}){t.watchResize=!0,super(e,t),t.widths?this.options.widths=t.widths:this.options.widths=fr,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){Me.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){Me.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=()=>{Me.removeClass(document.body,"landscape"),Me.addClass(document.body,"portrait")};this.queueFrame(e),this.orientation="portrait"}}else if("landscape"!==this.orientation){const e=()=>{Me.removeClass(document.body,"portrait"),Me.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?(Me.addClass(document.body,"not-"+this.classes[t]),Me.removeClass(document.body,this.classes[t]),Me.removeClass(document.body,"shown-"+this.classes[t]),Me.removeClass(document.body,"hidden-"+this.classes[t])):Me.removeClass(document.body,"not-"+this.classes[t]);Me.addClass(document.body,e),Me.addClass(document.body,"shown-"+e),Me.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 pr.get(e)}setCookie(e,t,s){const n={path:"/",domain:this.options.cookieDomain||null,expires:s};pr.set(e,t,n)}deleteCookie(e){this.setCookie(e,null)}}cr("Breakpoints",br);class mr extends ur{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],n=s.getAttribute("id");this.cachedMarkup[n]=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],n=s.getAttribute("href");!n||s.getAttribute("data-hijaxed")||s.getAttribute("target")||s.hasAttribute("data-no-hijax")||this.excludeRegex.exec(n)||(s.setAttribute("data-hijaxed",!0),s.addEventListener("click",e=>{e.preventDefault(),this.setPage(n)},!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,n)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),s?this.currentPage=location.pathname+location.search:this.loadPage(n||e)})}loadPage(e){this.queueFrame(()=>{Me.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){fn.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,s=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Me.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),n=vr(s[2]),r=document.querySelectorAll("[data-hijax]");for(let e=0;e<r.length;e++){const t=r[e],s=t.getAttribute("id"),i=n.getElementById(s);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[s]===i.innerHTML)continue;this.cachedMarkup[s]=i.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&i.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===i.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(i.querySelectorAll("script"));const a=()=>{t.parentNode.replaceChild(i,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(i)};this.queueFrame(a)}}}cr("HijaxLoader",mr);const vr=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 gr=(e,t)=>{const s=e.startNode.parentNode,n=void 0===t?e.endNode:t.startNode,r=s.insertBefore(Ln(),n);s.insertBefore(Ln(),n);const i=new $n(e.options);return i.insertAfterNode(r),i},wr=(e,t)=>(e.setValue(t),e.commit(),e),yr=(e,t,s)=>{const n=e.startNode.parentNode,r=s?s.startNode:e.endNode,i=t.endNode.nextSibling;i!==r&&En(n,t.startNode,i,r)},_r=e=>{An(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},xr=(e,t,s)=>{const n=new Map;for(let r=t;r<=s;r++)n.set(e[r],r);return n},Or=new WeakMap,jr=new WeakMap,Er=xn((e,t,s)=>{let n;return void 0===s?s=t:void 0!==t&&(n=t),t=>{if(!(t instanceof $n))throw new Error("repeat can only be used in text bindings");const r=Or.get(t)||[],i=jr.get(t)||[],o=[],a=[],c=[];let l,u,h=0;for(const t of e)c[h]=n?n(t,h):h,a[h]=s(t,h),h++;let d=0,p=r.length-1,f=0,b=a.length-1;for(;d<=p&&f<=b;)if(null===r[d])d++;else if(null===r[p])p--;else if(i[d]===c[f])o[f]=wr(r[d],a[f]),d++,f++;else if(i[p]===c[b])o[b]=wr(r[p],a[b]),p--,b--;else if(i[d]===c[b])o[b]=wr(r[d],a[b]),yr(t,r[d],o[b+1]),d++,b--;else if(i[p]===c[f])o[f]=wr(r[p],a[f]),yr(t,r[p],r[d]),p--,f++;else if(void 0===l&&(l=xr(c,f,b),u=xr(i,d,p)),l.has(i[d]))if(l.has(i[p])){const e=u.get(c[f]),s=void 0!==e?r[e]:null;if(null===s){const e=gr(t,r[d]);wr(e,a[f]),o[f]=e}else o[f]=wr(s,a[f]),yr(t,s,r[d]),r[e]=null;f++}else _r(r[p]),p--;else _r(r[d]),d++;for(;f<=b;){const e=gr(t,o[b+1]);wr(e,a[f]),o[f++]=e}for(;d<=p;){const e=r[d++];null!==e&&_r(e)}Or.set(t,o),jr.set(t,c)}}),Ar=new WeakMap,kr=xn(e=>t=>{if(!(t instanceof $n))throw new Error("cache can only be used in text bindings");let s=Ar.get(t);void 0===s&&(s=new WeakMap,Ar.set(t,s));const n=t.value;if(n instanceof zn){if(e instanceof Hn&&n.template===t.options.templateFactory(e))return void t.setValue(e);{let e=s.get(n.template);void 0===e&&(e={instance:n,nodes:document.createDocumentFragment()},s.set(n.template,e)),En(e.nodes,t.startNode.nextSibling,t.endNode)}}if(e instanceof Hn){const n=t.options.templateFactory(e),r=s.get(n);void 0!==r&&(t.setValue(r.nodes),t.commit(),t.value=r.instance)}t.setValue(e)});class Sr{constructor(e){this.classes=new Set,this.changed=!1,this.element=e;const t=(e.getAttribute("class")||"").split(/\s+/);for(const e of t)this.classes.add(e)}add(e){this.classes.add(e),this.changed=!0}remove(e){this.classes.delete(e),this.changed=!0}commit(){if(this.changed){let e="";this.classes.forEach(t=>e+=t+" "),this.element.setAttribute("class",e)}}}const Nr=new WeakMap,Cr=xn(e=>t=>{if(!(t instanceof Un)||t instanceof Zn||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");const{committer:s}=t,{element:n}=s;let r=Nr.get(t);void 0===r&&(n.setAttribute("class",s.strings.join(" ")),Nr.set(t,r=new Set));const i=n.classList||new Sr(n);r.forEach(t=>{t in e||(i.remove(t),r.delete(t))});for(const t in e){const s=e[t];s!=r.has(t)&&(s?(i.add(t),r.add(t)):(i.remove(t),r.delete(t)))}"function"==typeof i.commit&&i.commit()}),Mr=new WeakMap,Tr=xn(e=>t=>{const s=Mr.get(t);if(void 0===e&&t instanceof Un){if(void 0!==s||!Mr.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==s&&t.setValue(e);Mr.set(t,e)}),Vr=new WeakMap,Rr=xn((e,t)=>s=>{const n=Vr.get(s);if(Array.isArray(e)){if(Array.isArray(n)&&n.length===e.length&&e.every((e,t)=>e===n[t]))return}else if(n===e&&(void 0!==e||Vr.has(s)))return;s.setValue(t()),Vr.set(s,Array.isArray(e)?Array.from(e):e)}),Fr=new WeakMap,Lr=xn(e=>t=>{if(!(t instanceof Un)||t instanceof Zn||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:s}=t,{style:n}=s.element;let r=Fr.get(t);void 0===r&&(n.cssText=s.strings.join(" "),Fr.set(t,r=new Set)),r.forEach(t=>{t in e||(r.delete(t),-1===t.indexOf("-")?n[t]=null:n.removeProperty(t))});for(const t in e)r.add(t),-1===t.indexOf("-")?n[t]=e[t]:n.setProperty(t,e[t])}),Pr=new WeakMap,zr=xn(e=>t=>{if(!(t instanceof $n))throw new Error("templateContent can only be used in text bindings");const s=Pr.get(t);if(void 0!==s&&e===s.template&&t.value===s.fragment)return;const n=document.importNode(e.content,!0);t.setValue(n),Pr.set(t,{template:e,fragment:n})}),Dr=new WeakMap,Wr=xn(e=>t=>{if(!(t instanceof $n))throw new Error("unsafeHTML can only be used in text bindings");const s=Dr.get(t);if(void 0!==s&&In(e)&&e===s.value&&t.value===s.fragment)return;const n=document.createElement("template");n.innerHTML=e;const r=document.importNode(n.content,!0);t.setValue(r),Dr.set(t,{value:e,fragment:r})}),Hr=new WeakMap,Ir=2147483647,Br=xn((...e)=>t=>{let s=Hr.get(t);void 0===s&&(s={lastRenderedIndex:Ir,values:[]},Hr.set(t,s));const n=s.values;let r=n.length;s.values=e;for(let i=0;i<e.length&&!(i>s.lastRenderedIndex);i++){const o=e[i];if(In(o)||"function"!=typeof o.then){t.setValue(o),s.lastRenderedIndex=i;break}i<r&&o===n[i]||(s.lastRenderedIndex=Ir,r=0,Promise.resolve(o).then(e=>{const n=s.values.indexOf(o);n>-1&&n<s.lastRenderedIndex&&(s.lastRenderedIndex=n,t.setValue(e),t.commit())}))}}),qr={registerSargassoClass:cr,bootSargasso:(t={})=>{if(t.scrollElement&&fn.setOptions(t),t.breakpoints){new br(document.body,t.breakpoints).start()}if(t.hijax){const s=new mr(document.body,t.hijax);s.start(),e.loadPageHandler=s.setPage.bind(s)}else e.loadPageHandler=e=>{document.location.href=e};new dr(document.body,t).start(t)},elementTools:Me},Ur={theDOMWatcher:pn,theScrollWatcher:fn,theResizeWatcher:bn,theOrientationWatcher:mn,theWorkerWatcher:vn,theObservableObjectWatcher:gn},$r={html:(e,...t)=>new Hn(e,t,"html",Xn),render:nr,repeat:Er,cache:kr,classMap:Cr,ifDefined:Tr,guard:Rr,styleMap:Lr,templateContent:zr,unsafeHTML:Wr,until:Br};return e.ObservableObject=dn,e.Sargasso=ur,e.lit=$r,e.services=Ur,e.utils=qr,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=sargasso.iife.min.js.map

@@ -28,6 +28,53 @@ /*

import {
theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
}
from './lib/Services.js'
import {
ObservableObject
}
from './lib/ObservableObject'
import {
html, render
}
from 'lit-html/lit-html.js'
import {
repeat
}
from 'lit-html/directives/repeat.js'
import {
cache
}
from 'lit-html/directives/cache.js'
import {
classMap
}
from 'lit-html/directives/class-map.js'
import {
ifDefined
}
from 'lit-html/directives/if-defined'
import {
guard
}
from 'lit-html/directives/guard'
import {
styleMap
}
from 'lit-html/directives/style-map.js'
import {
templateContent
}
from 'lit-html/directives/template-content'
import {
unsafeHTML
}
from 'lit-html/directives/unsafe-html.js'
import {
until
}
from 'lit-html/directives/until.js'
const utils = {

@@ -44,7 +91,22 @@ registerSargassoClass: registerSargassoClass,

theOrientationWatcher: theOrientationWatcher,
theWorkerWatcher: theWorkerWatcher
theWorkerWatcher: theWorkerWatcher,
theObservableObjectWatcher: theObservableObjectWatcher
}
const lit = {
html: html,
render: render,
repeat: repeat,
cache: cache,
classMap: classMap,
ifDefined: ifDefined,
guard: guard,
styleMap: styleMap,
templateContent: templateContent,
unsafeHTML: unsafeHTML,
until: until
}
export {
Sargasso, utils, loadPageHandler, services
Sargasso, utils, loadPageHandler, services, ObservableObject, lit
}

@@ -23,6 +23,3 @@ /**

import {
Cookies
}
from './dependencies'
import Cookies from 'js-cookie'

@@ -29,0 +26,0 @@ const materialBreakpoints = [{

@@ -19,10 +19,14 @@ /**

import {
theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
}
from './Services.js'
import debounce from 'lodash/debounce'
import kebabCase from 'lodash/kebabCase'
import {
kebabCase
render
}
from './dependencies'
from 'lit-html/lit-html.js'

@@ -113,3 +117,12 @@ let unique = 0 // unique IDs for controllers

this.workers = {}
this.observables = {}
this.template = undefined
this.templateArgs = {}
this.started = false
this.render = debounce(() => {
this._render()
}, 100, {
maxWait: 250
})
}

@@ -268,2 +281,12 @@

/*
@function observableChange - listen for changes to observable object
@param { String } id - id of observable
@param { String } property - property that changed
@param { String } value - new value
*/
observableChanged (id, property, value) {
this.render()
}
/****************************************************

@@ -470,2 +493,47 @@ UTILITY METHODS - callable but normally not overriden

/************************************************
observe observable objects
get or set observable object by unique id
obj optional external object
*************************************************/
getObservable (id) {
return this.observables[id]
}
observableStart (id, data) {
theObservableObjectWatcher.subscribe(this, id, data)
this.observables[id] = theObservableObjectWatcher.getObservable(id)
return this.observables[id]
}
observableStop (id) {
if (this.observables[id]) {
theObservableObjectWatcher.unSubscribe(this, id)
delete this.observables[id]
}
}
observableStopAll () {
for (const id in this.observables) {
this.observableStop(id)
}
}
setTemplate (template) {
this.template = template
}
setTemplateArgs (args = {}) {
this.templateArgs = args.constructor && args.constructor.name === 'ObservableObject' ? args.data : args
this.render()
}
// this.render is a debounced call to this
_render () {
if (this.template) {
render(this.template(JSON.parse(JSON.stringify(this.templateArgs || {}))), this.element)
}
}
/************************************************
PRIVATE METHODS: normally not called or overriden

@@ -521,2 +589,3 @@ *************************************************/

this.stopAllWorkers()
this.observableStopAll()

@@ -523,0 +592,0 @@ this.flushQueue()

@@ -21,6 +21,8 @@ /**

import debounce from 'lodash/debounce'
import {
debounce
ObservableObject, getObservable
}
from './dependencies'
from './ObservableObject'

@@ -32,2 +34,3 @@ let theDOMWatcher

let theWorkerWatcher
let theObservableObjectWatcher

@@ -349,3 +352,8 @@ class ObserverSubscriptionManager {

workerMessage (id, e) {
this.notifyObservers('workerMessage', [id, e])
const workerObservers = this.workers[id].observers
workerObservers.forEach((observer) => {
if (observer.workerMessage) {
observer.workerMessage(id, e)
}
})
}

@@ -362,2 +370,90 @@

class ObservableObjectWatcher extends ObserverSubscriptionManager {
constructor (options) {
super(options)
this.registeredObservableObjects = {}
}
getObservable (id) {
return this.registeredObservableObjects[id] ? this.registeredObservableObjects[id].observable : undefined
}
observableStart (id, data) {
const foundObservable = getObservable(id)
// trying to define with data but already exists
if (foundObservable && data !== undefined) {
throw (new Error('ObservableObject ' + id + ' already exists, can\'t build.'))
}
if (!this.registeredObservableObjects[id]) { // not already managing observable
if (foundObservable) { // add to service
this.registeredObservableObjects[id] = {
id: id,
observable: foundObservable,
observers: [],
managed: false
}
} else { // make it
this.registeredObservableObjects[id] = {
id: id,
observable: new ObservableObject(id, data),
observers: [],
managed: true
}
}
this.registeredObservableObjects[id].observable.bind(this.constructor.name, this.notify.bind(this))
}
return this.registeredObservableObjects[id].observable
}
// delete an observable
observableDestroy (id) {
if (!this.registeredObservableObjects[id]) {
throw (new Error('ObservableObject observableDestroy ' + id + ' does not exist'))
}
this.registeredObservableObjects[id].observable.unbind(this.constructor.name)
this.registeredObservableObjects[id].observable.destroy()
delete this.registeredObservableObjects[id]
}
subscribe (observer, id, data) {
if (!this.registeredObservableObjects[id]) {
this.observableStart(id, data)
}
this.registeredObservableObjects[id].observers.push(observer)
super.subscribe(observer)
}
unSubscribe (observer, id) {
if (!this.registeredObservableObjects[id]) {
throw (new Error('ObservableObject unSubscribe ' + id + ' does not exist'))
}
const observers = this.registeredObservableObjects[id].observers
if (observers.indexOf(observer) !== -1) {
observers.splice(observers.indexOf(observer), 1)
}
if (!observers.length && this.registeredObservableObjects[id].managed) {
this.observableDestroy(id)
}
super.unSubscribe(observer)
}
notify (id, property, value, source) {
if (!this.registeredObservableObjects[id]) {
throw (new Error('ObservableObject notify ' + id + ' does not exist'))
}
const observers = this.registeredObservableObjects[id].observers
observers.forEach((observer) => {
if (observer.observableChanged) {
observer.observableChanged(id, property, value, source)
}
})
}
}
// build subscription services

@@ -370,5 +466,6 @@

theWorkerWatcher = new WorkerWatcher()
theObservableObjectWatcher = new ObservableObjectWatcher()
export {
theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
}

@@ -9,6 +9,3 @@ /**

import {
camelCase
}
from './dependencies'
import camelCase from 'lodash/camelCase'

@@ -15,0 +12,0 @@ const elementMetaData = new WeakMap()

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

@@ -48,2 +48,3 @@ "keywords": [

"js-cookie": "^2.2.1",
"lit-html": "^1.3.0",
"lodash": "^4.17.21"

@@ -50,0 +51,0 @@ },

@@ -13,4 +13,6 @@ # @pelagiccreatures/sargasso

One of the core features of this framework is to implement an asynchronous page loading scheme which supports deep linking and lightning fast page loads where only dynamic content areas are merged between page loads leaving css, js, web workers and wrapper elements intact. Sargasso controller instances are automatically created as needed when their element appears in the DOM and destroyed when their element is removed so everything is cleanly destroyed and all the trash is collected. Performance is further enhanced with shared event listening services which are fully debounced during large updates. Services are also provided to schedule content changes using the browser's **animation frame** event loop and managed **web workers** for simplified offloading of computation heavy tasks to a dedicated thread resulting in highly performant pages.
One of the core features of this framework is to implement an asynchronous page loading scheme which supports deep linking and lightning fast page loads where only dynamic content areas are merged between page loads leaving css, js, web workers and wrapper elements intact. Sargasso controller instances are automatically created as needed when their element appears in the DOM and destroyed when their element is removed so everything is cleanly destroyed and all the trash is collected. Performance is further enhanced with shared event listening services which are fully debounced during updates. Services are also provided to schedule content changes using the browser's **animation frame** event loop and managed **web workers** for simplified offloading of computation heavy tasks to a dedicated thread resulting in highly performant pages.
Sargasso elements can also track changes to underlying data and re-render as needed using [lit-html](https://lit-html.polymer-project.org/) templates.
This is a very lightweight (27kb), pure ES6 framework (with only few dependencies) which aims to use the most advanced stable features of modern browsers to maximum effect leaving the historical cruft, kludges and code barnacles infesting older web frameworks behind. The result is lean, highly performant and clean library that simplifies the complex technologies behind modern progressive web apps and web sites.

@@ -129,3 +131,3 @@

<script src='https://cdn.jsdelivr.net/npm/@pelagiccreatures/sargasso/dist/sargasso.iife.js'></script>
<script src='https://cdn.jsdelivr.net/npm/@pelagiccreatures/sargasso/dist/sargasso.iife.min.js'></script>

@@ -201,11 +203,22 @@ <script defer>

**Properties**
| property | description |
| -------- | ----------- |
| this.element | the element we are controlling |
Your Sargasso subclasses can subscribe to event feeds in order to be notified of events.
**Methods to override as needed:** *don't forget to call super.xxx() in your subclass*
**Methods to override as needed:**
| method | description |
| ------ | ----------- |
| constructor(element, options = {}) | subscribe to services by setting options properties. All default to false so only set the ones you need `watchDOM`, `watchScroll`, `watchResize`, `watchOrientation`, `watchViewport` eg. {watchScroll:true} |
| constructor(element, options = {}) | subscribe to services by setting appropriate options properties. All default to false so only set the ones you need to know about `watchDOM`, `watchScroll`, `watchResize`, `watchOrientation`, `watchViewport` eg. { watchScroll: true } |
| start() | set up any interactions and event handlers |
| 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.|
*don't forget to call super.xxx() in your subclass*
**Handlers for sargasso events, override as needed:**
| method | description |
| ------ | ----------- |
| DOMChanged() | called when DOM changes if options 'watchDOM: true' was set in constructor |

@@ -219,14 +232,7 @@ | didScroll() | called when scroll occurs if options 'watchScroll: true' was set in constructor |

| workerOnMessage (id, data = {}) | id is the worker sending the message. Any payload from the worker `postMessage` is in data.xxx as defined by the worker |
| enterFullscreen() | called if options 'watchOrientation: true' when user rotates phone or if setFullscreen is called |
| exitFullscreen() | called on exit fullscreen |
| observableChanged(id, property, value) | called on data change if watching an observable object |
| enterFullscreen() | *experimental* called if options 'watchOrientation: true' when user rotates phone or if setFullscreen is called |
| exitFullscreen() | *experimental* called on exit fullscreen |
**Properties**
| property | description |
| ------ | ----------- |
| this.element | the element we are controlling |
**Utility Methods:**
| method | description |

@@ -236,2 +242,8 @@ | ------ | ----------- |

| setMetaData(key,value) | set a sargasso metadata property |
| isVisible() | true if element is visible |
| queueFrame(function) | queue a function to execute that changes the DOM |
**CSS Methods**
| method | description |
| ------ | ----------- |
| hasClass('classname') | returns true if this.element has cssclass |

@@ -241,6 +253,26 @@ | addClass('classname') | add classname or array of classnames to this.element |

| setCSS({}) | set css pairs defined in object on this.element |
| isVisible() | true if element is visible |
| queueFrame(function) | queue a function to execute that changes the DOM |
| workerStart(id, codeOrURL) | start a web worker with id. Ignored if worker id already installed (see https://github.com/PelagicCreatures/flyingfish for a shared worker example)|
**Web Worker Methods**
| method | description |
| ------ | ----------- |
| workerStart(id, codeOrURL) | start a web worker with id. Ignored if worker id already installed. |
| workerPostMessage(id, data {}) | send the worker tagged with `id` a message. the message must be an object which can have any structure you want to pass to the worker |
**Observable Data Methods**
| method | description |
| ------ | ----------- |
| observableStart (id, data) | start watching for changes in observable data. `data` is an optional JS data object |
| observableStop (id) | stop watching for changes in observable data |
| getObservable (id) | get underlying ObservableObject instance for id |
**Templates & Rendering Methods**
| method | description |
| ------ | ----------- |
| setTemplate (template) | set a lit-html template function for rendering |
| setTemplateArgs (args) | set template arguments |
| render () | render template into element |
**Register Event Methods**
| method | description |
| ------ | ----------- |
| on(container,fn) | attach undelegated event handler to container scoped to a css selector |

@@ -315,4 +347,4 @@ | once(container,fn) | attach undelegated event handler to container scoped to a css selector that executes only once (automatically removes event handler on first call) |

**Note**: data-hijax elements must have and ID and contain well formed child html elements.
```
`data-hijax` elements must have and ID and contain well formed child html elements.
```html
<div id="nope" data-hijax>I'm just text. No child elements. Won't work.</div>

@@ -322,8 +354,8 @@ <div id="yup" data-hijax><p>I'm html. This works.</p></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
#### Content Merging Fine 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.
```
```html
<div id="test" data-hijax data-hijax-skip-unchanged>

@@ -335,3 +367,3 @@ <p>This content also sometimes changes from page to page, otherwise leave it alone.</p>

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.
```
```html
<div id="test" data-hijax data-hijax-cache-key-selector="#sub-element">

@@ -354,2 +386,96 @@ <p id="sub-element" data-hijax-cache-key="some-key">This content uses a cache key to signal changes, otherwise leave it alone.</p>

### ObservableObjects
Observable objects implement a notification scheme for data changes. (implementation is javascript Proxy and reflect) These objects can be shared across elements for real-time sharing and display of information.
```javascript
let args = {
name: 'World!',
cssClass: 'red'
}
let observable = new SargassoModule.ObservableObject('shared-data', args)
```
You can bind a function to the observable instance which is called on change:
```javascript
let watch = (id, property, value) => {
console.log('id:' + id + ' property:' + property + ' is now:' + value)
}
// you can optionally provide a property as a third parameter if you only want to be notified if 'cssClass' changes, for instance. In this case we want all changes.
observable.bind('uniqueID', watch)
// now changes to the data will trigger the watch function
observable.set('name','New Name')
observable.data.name = 'New Name' // same thing different syntax
```
Sargasso Elements can subscribe to notifications from ObservableObjects that are defined externally or owned by the element.
```javascript
class MyClass extends SargassoModule.Sargasso {
start() {
super.start()
this.observableStart('shared-data'); // find or create an observable with id 'shared-data'
}
observableChanged(id, property, value) {
// do something with the change
}
}
```
### Observables, Templates and Rendering
Complete example of an element that renders on data update using an ObservableObject and li-html templates.
examples/example5.html
window.onload = () => {
let args = {
name: 'World!',
cssClass: 'red',
list: [{id:1,name:'one'},{id:2,name:'two'},{id:3,name:'three'}]
}
let observed = new SargassoModule.ObservableObject('shared-data',args)
// define MyClass as a subclass of Sargasso
// sargasso will render the template when data in
// observed ObservableObject is changed
class MyClass extends SargassoModule.Sargasso {
start() {
super.start()
// define a template
this.setTemplate((args) => SargassoModule.lit.html`
<p class=${args.cssClass}>Hello ${args.name} (${args.cssClass})</p>
<strong>List</strong>
<ul>
${SargassoModule.lit.repeat(args.list, (item) => item.id, (item, index) => SargassoModule.lit.html`
<li>${index}: ${item.name}</li>
`)}
</ul>
`)
// hook up observable data
this.setTemplateArgs(this.observableStart('shared-data'))
}
}
// Register MyClass to the Sargasso framework
SargassoModule.utils.registerSargassoClass('MyClass', MyClass)
// Start Sargasso
SargassoModule.utils.bootSargasso()
// repeatedly and randomly change the observed data
let classes = ['red','green','blue']
let named = ['Bob','Carol','Ted','Alice']
setInterval(()=>{
observed.data.cssClass = classes[Math.floor(Math.random() * classes.length)]
observed.data.name = named[Math.floor(Math.random() * named.length)]
},1000)
}
```
[Try It](https://jsfiddle.net/PelagicCreatures/gbL5y7xq/3/)
### Using managed Web Workers

@@ -364,31 +490,68 @@ You should offload compute heavy tasks to a new thread when possible.

example/example4.html
```javascript
startTask () {
// this worker increments a counter every 3 seconds and posts a message back us
const task = `let counters= {}
onmessage = async (e) => {
if(!counters[e.data.uid]) { counters[e.data.uid] = e.data.count }
setInterval(()=>{
self.postMessage({ uid: e.data.uid, count: ++counters[e.data.uid] })
},30000)
}`
<!DOCTYPE html>
<html>
<head>
<title>Example Sargasso Element</title>
</head>
<body>
<h3>First Sargasso Element</h3>
// register the worker
this.workerStart('mytask', task)
<sargasso-my-class data-name="custom" data-count-to="10">Will count to 10</sargasso-my-class>
// start the worker working
this.workerPostMessage('mytask', {
count: 0
})
}
<div data-sargasso-class="MyClass" data-name="div" data-count-to="20">Will count to 20</div>
workerOnMessage (id, data) {
if(id === 'mytask') {
this.queueFrame(()=>{
this.element.innerHTML = data.count
})
}
super.workerOnMessage(id, data)
}
<script src="https://cdn.jsdelivr.net/npm/@pelagiccreatures/sargasso/dist/sargasso.iife.min.js"></script>
<script defer>
window.onload = () => {
// define MyClass as a subclass of Sargasso
class MyClass extends SargassoModule.Sargasso {
start() {
super.start()
// this worker increments a counter every second and posts a message back us
const task = `let counters= {}
onmessage = async (e) => {
if(!counters[e.data.uid]) { counters[e.data.uid] = e.data.count }
setInterval(()=>{
self.postMessage({ uid: e.data.uid, me:e.data.me, count: ++counters[e.data.uid] })
},1000)
}`
// register the worker
this.workerStart('mytask', task)
// start the worker working
this.workerPostMessage('mytask', {
me: this.element.getAttribute('data-name'),
count: 0
})
}
workerOnMessage (id, data) {
if(id === 'mytask') { // only neeed to test this is running multiple workers
if(data.count == this.element.getAttribute('data-count-to')) {
this.stopWorker('mytask')
}
this.queueFrame(()=>{
this.element.innerHTML = data.me + ' says ' + data.count
})
}
}
}
// Register MyClass to the Sargasso framework
SargassoModule.utils.registerSargassoClass('MyClass', MyClass)
// Start Sargasso
SargassoModule.utils.bootSargasso()
}
</script>
</body>
</html>
```
[Try It](https://jsfiddle.net/PelagicCreatures/exnjtvqb/1/)

@@ -395,0 +558,0 @@ ### Serving modules from your project

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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