Socket
Socket
Sign inDemoInstall

@pelagiccreatures/sargasso

Package Overview
Dependencies
2
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.2 to 1.4.3

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:{};function r(e){var t={exports:{}};return e(t,t.exports),t.exports}var s="object"==typeof t&&t&&t.Object===Object&&t,n="object"==typeof self&&self&&self.Object===Object&&self,i=s||n||Function("return this")(),o=i.Symbol;var a=function(e,t){for(var r=-1,s=null==e?0:e.length,n=Array(s);++r<s;)n[r]=t(e[r],r,e);return n},c=Array.isArray,u=Object.prototype,l=u.hasOwnProperty,h=u.toString,d=o?o.toStringTag:void 0;var f=function(e){var t=l.call(e,d),r=e[d];try{e[d]=void 0;var s=!0}catch(e){}var n=h.call(e);return s&&(t?e[d]=r:delete e[d]),n},p=Object.prototype.toString;var b=function(e){return p.call(e)},v=o?o.toStringTag:void 0;var g=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?f(e):b(e)};var m=function(e){return null!=e&&"object"==typeof e};var w=function(e){return"symbol"==typeof e||m(e)&&"[object Symbol]"==g(e)},y=o?o.prototype:void 0,O=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 O?O.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var j=function(e){return null==e?"":x(e)};var _=function(e,t,r){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++s<n;)i[s]=e[s+t];return i};var E=function(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:_(e,t,r)},k=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var A=function(e){return k.test(e)};var S=function(e){return e.split("")},C="[\\ud800-\\udfff]",R="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",M="\\ud83c[\\udffb-\\udfff]",z="[^\\ud800-\\udfff]",F="(?:\\ud83c[\\udde6-\\uddff]){2}",P="[\\ud800-\\udbff][\\udc00-\\udfff]",D="(?:"+R+"|"+M+")"+"?",L="[\\ufe0e\\ufe0f]?",T=L+D+("(?:\\u200d(?:"+[z,F,P].join("|")+")"+L+D+")*"),N="(?:"+[z+R+"?",R,F,P,C].join("|")+")",H=RegExp(M+"(?="+M+")|"+N+T,"g");var V=function(e){return e.match(H)||[]};var I=function(e){return A(e)?V(e):S(e)};var W=function(e){return function(t){t=j(t);var r=A(t)?I(t):void 0,s=r?r[0]:t.charAt(0),n=r?E(r,1).join(""):t.slice(1);return s[e]()+n}}("toUpperCase");var q=function(e){return W(j(e).toLowerCase())};var U=function(e,t,r,s){var n=-1,i=null==e?0:e.length;for(s&&i&&(r=e[++n]);++n<i;)r=t(r,e[n],n,e);return r};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,$=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var G=function(e){return(e=j(e))&&e.replace(Q,B).replace($,"")},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",re="\\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="["+re+"]",ne="\\d+",ie="[\\u2700-\\u27bf]",oe="["+ee+"]",ae="[^\\ud800-\\udfff"+re+ne+X+ee+te+"]",ce="(?:\\ud83c[\\udde6-\\uddff]){2}",ue="[\\ud800-\\udbff][\\udc00-\\udfff]",le="["+te+"]",he="(?:"+oe+"|"+ae+")",de="(?:"+le+"|"+ae+")",fe="(?:['’](?:d|ll|m|re|s|t|ve))?",pe="(?:['’](?:D|LL|M|RE|S|T|VE))?",be="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",ve="[\\ufe0e\\ufe0f]?",ge=ve+be+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",ce,ue].join("|")+")"+ve+be+")*"),me="(?:"+[ie,ce,ue].join("|")+")"+ge,we=RegExp([le+"?"+oe+"+"+fe+"(?="+[se,le,"$"].join("|")+")",de+"+"+pe+"(?="+[se,le+he,"$"].join("|")+")",le+"?"+he+"+"+fe,le+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ne,me].join("|"),"g");var ye=function(e){return e.match(we)||[]};var Oe=function(e,t,r){return e=j(e),void 0===(t=r?void 0:t)?K(e)?ye(e):J(e):e.match(t)||[]},xe=RegExp("['’]","g");var je=function(e){return function(t){return U(Oe(G(t).replace(xe,"")),e,"")}},_e=je((function(e,t,r){return t=t.toLowerCase(),e+(r?q(t):t)}));const Ee=new WeakMap,ke=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),Ae=(e,t,r)=>{const s=Ee.get(e)||{};r?s[t]=r:delete s[t],Ee.set(e,s)},Se=(e,t)=>(Ee.get(e)||{})[t],Ce=function(e,t,r,s,n,i,o){"function"==typeof s&&(o=i,i=n,n=s,s=null);const a="on:"+e+"-"+r+"-"+s;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:r,selector:s,fn:i=>{o&&Re(e,t,r,s),s?Array.from(t.querySelectorAll(s)).forEach(e=>{(i.target===e||e.contains(i.target))&&n(i,e)}):n(i)},options:i||!1};Ae(t,a,c),r.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),c.fn,c.options)})},Re=function(e,t,r,s){const n="on:"+e+"-"+r+"-"+s,i=Se(t,n);i&&(r.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),i.fn,i.options)}),Ae(t,n))},Me={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const r=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===r.indexOf(e)&&r.push(e)}),e.className=r.join(" ")},removeClass:(e,t)=>{const r=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1)}),e.className=r.join(" ")},isVisible:ke,inViewPort:(e,t=window)=>{const r=e.getBoundingClientRect(),s=ke(e),n=r.bottom<0;let i;return i=t.self===window?r.top>(window.innerHeight||document.documentElement.clientHeight):r.top>t.clientHeight,s&&!i&&!n},setCSS:(e,t)=>{for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=_e(r);e.style[s]=t[r]}},setMetaData:Ae,getMetaData:Se,on:Ce,off:Re,once:function(e,t,r,s,n,i){Ce(e,t,r,s,n,i,!0)},offAll:function(e){const t=Ee.get(e)||{},r=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&r.push(e);r.forEach(r=>{Re(t[r].uid,e,t[r].events,t[r].selector)})}};var ze=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Fe=function(){return i.Date.now()},Pe=/\s/;var De=function(e){for(var t=e.length;t--&&Pe.test(e.charAt(t)););return t},Le=/^\s+/;var Te=function(e){return e?e.slice(0,De(e)+1).replace(Le,""):e},Ne=/^[-+]0x[0-9a-f]+$/i,He=/^0b[01]+$/i,Ve=/^0o[0-7]+$/i,Ie=parseInt;var We=function(e){if("number"==typeof e)return e;if(w(e))return NaN;if(ze(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ze(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Te(e);var r=He.test(e);return r||Ve.test(e)?Ie(e.slice(2),r?2:8):Ne.test(e)?NaN:+e},qe=Math.max,Ue=Math.min;var Be=function(e,t,r){var s,n,i,o,a,c,u=0,l=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var r=s,i=n;return s=n=void 0,u=t,o=e.apply(i,r)}function p(e){return u=e,a=setTimeout(v,t),l?f(e):o}function b(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-u>=i}function v(){var e=Fe();if(b(e))return g(e);a=setTimeout(v,function(e){var r=t-(e-c);return h?Ue(r,i-(e-u)):r}(e))}function g(e){return a=void 0,d&&s?f(e):(s=n=void 0,o)}function m(){var e=Fe(),r=b(e);if(s=arguments,n=this,c=e,r){if(void 0===a)return p(c);if(h)return clearTimeout(a),a=setTimeout(v,t),f(c)}return void 0===a&&(a=setTimeout(v,t)),o}return t=We(t)||0,ze(r)&&(l=!!r.leading,i=(h="maxWait"in r)?qe(We(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),m.cancel=function(){void 0!==a&&clearTimeout(a),u=0,s=c=n=a=void 0},m.flush=function(){return void 0===a?o:g(Fe())},m};var Qe=function(){this.__data__=[],this.size=0};var $e=function(e,t){return e===t||e!=e&&t!=t};var Ge=function(e,t){for(var r=e.length;r--;)if($e(e[r][0],t))return r;return-1},Ze=Array.prototype.splice;var Je=function(e){var t=this.__data__,r=Ge(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ze.call(t,r,1),--this.size,!0)};var Ye=function(e){var t=this.__data__,r=Ge(t,e);return r<0?void 0:t[r][1]};var Ke=function(e){return Ge(this.__data__,e)>-1};var Xe=function(e,t){var r=this.__data__,s=Ge(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this};function et(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}et.prototype.clear=Qe,et.prototype.delete=Je,et.prototype.get=Ye,et.prototype.has=Ke,et.prototype.set=Xe;var tt=et;var rt=function(){this.__data__=new tt,this.size=0};var st=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var nt=function(e){return this.__data__.get(e)};var it=function(e){return this.__data__.has(e)};var ot,at=function(e){if(!ze(e))return!1;var t=g(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ct=i["__core-js_shared__"],ut=(ot=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||""))?"Symbol(src)_1."+ot:"";var lt=function(e){return!!ut&&ut 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""},ft=/^\[object .+?Constructor\]$/,pt=Function.prototype,bt=Object.prototype,vt=pt.toString,gt=bt.hasOwnProperty,mt=RegExp("^"+vt.call(gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var wt=function(e){return!(!ze(e)||lt(e))&&(at(e)?mt:ft).test(dt(e))};var yt=function(e,t){return null==e?void 0:e[t]};var Ot=function(e,t){var r=yt(e,t);return wt(r)?r:void 0},xt=Ot(i,"Map"),jt=Ot(Object,"create");var _t=function(){this.__data__=jt?jt(null):{},this.size=0};var Et=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},kt=Object.prototype.hasOwnProperty;var At=function(e){var t=this.__data__;if(jt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return kt.call(t,e)?t[e]:void 0},St=Object.prototype.hasOwnProperty;var Ct=function(e){var t=this.__data__;return jt?void 0!==t[e]:St.call(t,e)};var Rt=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=jt&&void 0===t?"__lodash_hash_undefined__":t,this};function Mt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}Mt.prototype.clear=_t,Mt.prototype.delete=Et,Mt.prototype.get=At,Mt.prototype.has=Ct,Mt.prototype.set=Rt;var zt=Mt;var Ft=function(){this.size=0,this.__data__={hash:new zt,map:new(xt||tt),string:new zt}};var Pt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Dt=function(e,t){var r=e.__data__;return Pt(t)?r["string"==typeof t?"string":"hash"]:r.map};var Lt=function(e){var t=Dt(this,e).delete(e);return this.size-=t?1:0,t};var Tt=function(e){return Dt(this,e).get(e)};var Nt=function(e){return Dt(this,e).has(e)};var Ht=function(e,t){var r=Dt(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this};function Vt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}Vt.prototype.clear=Ft,Vt.prototype.delete=Lt,Vt.prototype.get=Tt,Vt.prototype.has=Nt,Vt.prototype.set=Ht;var It=Vt;var Wt=function(e,t){var r=this.__data__;if(r instanceof tt){var s=r.__data__;if(!xt||s.length<199)return s.push([e,t]),this.size=++r.size,this;r=this.__data__=new It(s)}return r.set(e,t),this.size=r.size,this};function qt(e){var t=this.__data__=new tt(e);this.size=t.size}qt.prototype.clear=rt,qt.prototype.delete=st,qt.prototype.get=nt,qt.prototype.has=it,qt.prototype.set=Wt;var Ut=qt;var Bt=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Qt=function(e){return this.__data__.has(e)};function $t(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new It;++t<r;)this.add(e[t])}$t.prototype.add=$t.prototype.push=Bt,$t.prototype.has=Qt;var Gt=$t;var Zt=function(e,t){for(var r=-1,s=null==e?0:e.length;++r<s;)if(t(e[r],r,e))return!0;return!1};var Jt=function(e,t){return e.has(t)};var Yt=function(e,t,r,s,n,i){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=i.get(e),l=i.get(t);if(u&&l)return u==t&&l==e;var h=-1,d=!0,f=2&r?new Gt:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var p=e[h],b=t[h];if(s)var v=o?s(b,p,h,t,e,i):s(p,b,h,e,t,i);if(void 0!==v){if(v)continue;d=!1;break}if(f){if(!Zt(t,(function(e,t){if(!Jt(f,t)&&(p===e||n(p,e,r,s,i)))return f.push(t)}))){d=!1;break}}else if(p!==b&&!n(p,b,r,s,i)){d=!1;break}}return i.delete(e),i.delete(t),d},Kt=i.Uint8Array;var Xt=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r};var er=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},tr=o?o.prototype:void 0,rr=tr?tr.valueOf:void 0;var sr=function(e,t,r,s,n,i,o){switch(r){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 $e(+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&s;if(a||(a=er),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;s|=2,o.set(e,t);var l=Yt(a(e),a(t),s,n,i,o);return o.delete(e),l;case"[object Symbol]":if(rr)return rr.call(e)==rr.call(t)}return!1};var nr=function(e,t){for(var r=-1,s=t.length,n=e.length;++r<s;)e[n+r]=t[r];return e};var ir=function(e,t,r){var s=t(e);return c(e)?s:nr(s,r(e))};var or=function(e,t){for(var r=-1,s=null==e?0:e.length,n=0,i=[];++r<s;){var o=e[r];t(o,r,e)&&(i[n++]=o)}return i};var ar=function(){return[]},cr=Object.prototype.propertyIsEnumerable,ur=Object.getOwnPropertySymbols,lr=ur?function(e){return null==e?[]:(e=Object(e),or(ur(e),(function(t){return cr.call(e,t)})))}:ar;var hr=function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s};var dr=function(e){return m(e)&&"[object Arguments]"==g(e)},fr=Object.prototype,pr=fr.hasOwnProperty,br=fr.propertyIsEnumerable,vr=dr(function(){return arguments}())?dr:function(e){return m(e)&&pr.call(e,"callee")&&!br.call(e,"callee")};var gr=function(){return!1},mr=r((function(e,t){var r=t&&!t.nodeType&&t,s=r&&e&&!e.nodeType&&e,n=s&&s.exports===r?i.Buffer:void 0,o=(n?n.isBuffer:void 0)||gr;e.exports=o})),wr=/^(?:0|[1-9]\d*)$/;var yr=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&wr.test(e))&&e>-1&&e%1==0&&e<t};var Or=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},xr={};xr["[object Float32Array]"]=xr["[object Float64Array]"]=xr["[object Int8Array]"]=xr["[object Int16Array]"]=xr["[object Int32Array]"]=xr["[object Uint8Array]"]=xr["[object Uint8ClampedArray]"]=xr["[object Uint16Array]"]=xr["[object Uint32Array]"]=!0,xr["[object Arguments]"]=xr["[object Array]"]=xr["[object ArrayBuffer]"]=xr["[object Boolean]"]=xr["[object DataView]"]=xr["[object Date]"]=xr["[object Error]"]=xr["[object Function]"]=xr["[object Map]"]=xr["[object Number]"]=xr["[object Object]"]=xr["[object RegExp]"]=xr["[object Set]"]=xr["[object String]"]=xr["[object WeakMap]"]=!1;var jr=function(e){return m(e)&&Or(e.length)&&!!xr[g(e)]};var _r=function(e){return function(t){return e(t)}},Er=r((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&s.process,o=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o})),kr=Er&&Er.isTypedArray,Ar=kr?_r(kr):jr,Sr=Object.prototype.hasOwnProperty;var Cr=function(e,t){var r=c(e),s=!r&&vr(e),n=!r&&!s&&mr(e),i=!r&&!s&&!n&&Ar(e),o=r||s||n||i,a=o?hr(e.length,String):[],u=a.length;for(var l in e)!t&&!Sr.call(e,l)||o&&("length"==l||n&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||yr(l,u))||a.push(l);return a},Rr=Object.prototype;var Mr=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Rr)};var zr=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Fr=Object.prototype.hasOwnProperty;var Pr=function(e){if(!Mr(e))return zr(e);var t=[];for(var r in Object(e))Fr.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Dr=function(e){return null!=e&&Or(e.length)&&!at(e)};var Lr=function(e){return Dr(e)?Cr(e):Pr(e)};var Tr=function(e){return ir(e,Lr,lr)},Nr=Object.prototype.hasOwnProperty;var Hr=function(e,t,r,s,n,i){var o=1&r,a=Tr(e),c=a.length;if(c!=Tr(t).length&&!o)return!1;for(var u=c;u--;){var l=a[u];if(!(o?l in t:Nr.call(t,l)))return!1}var h=i.get(e),d=i.get(t);if(h&&d)return h==t&&d==e;var f=!0;i.set(e,t),i.set(t,e);for(var p=o;++u<c;){var b=e[l=a[u]],v=t[l];if(s)var g=o?s(v,b,l,t,e,i):s(b,v,l,e,t,i);if(!(void 0===g?b===v||n(b,v,r,s,i):g)){f=!1;break}p||(p="constructor"==l)}if(f&&!p){var m=e.constructor,w=t.constructor;m==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof w&&w instanceof w||(f=!1)}return i.delete(e),i.delete(t),f},Vr=Ot(i,"DataView"),Ir=Ot(i,"Promise"),Wr=Ot(i,"Set"),qr=Ot(i,"WeakMap"),Ur="[object Map]",Br="[object Promise]",Qr="[object Set]",$r="[object WeakMap]",Gr="[object DataView]",Zr=dt(Vr),Jr=dt(xt),Yr=dt(Ir),Kr=dt(Wr),Xr=dt(qr),es=g;(Vr&&es(new Vr(new ArrayBuffer(1)))!=Gr||xt&&es(new xt)!=Ur||Ir&&es(Ir.resolve())!=Br||Wr&&es(new Wr)!=Qr||qr&&es(new qr)!=$r)&&(es=function(e){var t=g(e),r="[object Object]"==t?e.constructor:void 0,s=r?dt(r):"";if(s)switch(s){case Zr:return Gr;case Jr:return Ur;case Yr:return Br;case Kr:return Qr;case Xr:return $r}return t});var ts=es,rs="[object Arguments]",ss="[object Array]",ns="[object Object]",is=Object.prototype.hasOwnProperty;var os=function(e,t,r,s,n,i){var o=c(e),a=c(t),u=o?ss:ts(e),l=a?ss:ts(t),h=(u=u==rs?ns:u)==ns,d=(l=l==rs?ns:l)==ns,f=u==l;if(f&&mr(e)){if(!mr(t))return!1;o=!0,h=!1}if(f&&!h)return i||(i=new Ut),o||Ar(e)?Yt(e,t,r,s,n,i):sr(e,t,u,r,s,n,i);if(!(1&r)){var p=h&&is.call(e,"__wrapped__"),b=d&&is.call(t,"__wrapped__");if(p||b){var v=p?e.value():e,g=b?t.value():t;return i||(i=new Ut),n(v,g,r,s,i)}}return!!f&&(i||(i=new Ut),Hr(e,t,r,s,n,i))};var as=function e(t,r,s,n,i){return t===r||(null==t||null==r||!m(t)&&!m(r)?t!=t&&r!=r:os(t,r,s,n,e,i))};var cs=function(e,t){return as(e,t)};const us={},ls=e=>({get(t,r){const s=Reflect.get(t,r);return s&&"object"==typeof s?new Proxy(s,ls(e)):s},set:(t,r,s)=>(e.sync(r),Reflect.set(t,r,s)),deleteProperty:(t,r)=>(e.sync(r),Reflect.deleteProperty(t,r))});class hs{constructor(e,t={},r={}){if(this.id=e,us[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=new Proxy(t,ls(this)),this.options=r,us[this.id]=this}destroy(){delete us[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){cs(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,r="*"){this.bound[r]||(this.bound[r]={}),this.bound[r][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 ds,fs,ps,bs,vs,gs;class ms{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 r=0;r<this.observers.length;r++)this.observers[r][e]&&this.observers[r][e].apply(this.observers[r],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]()}}ds=new class extends ms{constructor(e){super(e),this.mutationHandler=Be((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")}},fs=new class extends ms{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}}},ps=new class extends ms{constructor(e){super(e),this.debounce=Be(()=>{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")}},bs=new class extends ms{constructor(e){super(e),"onorientationchange"in window?Me.addClass(document.body,"have-orientation"):Me.addClass(document.body,"no-orientation"),this.debounce=Be(()=>{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")}},vs=new class extends ms{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let r=t,s=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});r=URL.createObjectURL(e),s=!0}this.workers[e]={worker:new Worker(r),observers:[]},s&&URL.revokeObjectURL(r),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 r=this.workers[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),r.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach(r=>{r.workerMessage&&r.workerMessage(e,t)})}wakeup(){super.wakeup()}sleep(){super.sleep()}},gs=new class extends ms{constructor(e){super(e),this.registeredObservableObjects={}}getObservable(e){return this.registeredObservableObjects[e]?this.registeredObservableObjects[e].observable:void 0}observableStart(e,t){const r=(e=>us[e])(e);if(r&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=r?{id:e,observable:r,observers:[],managed:!1}:{id:e,observable:new hs(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,r){this.registeredObservableObjects[t]||this.observableStart(t,r),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 r=this.registeredObservableObjects[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),!r.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,r,s){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach(n=>{n.observableChanged&&n.observableChanged(e,t,r,s)})}};var ws=je((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));let ys=0;const Os=[],xs="customElements"in window,js={},_s=(e,t)=>{if(js[e]=t,xs){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-"+ws(e),new Function("registeredClasses",t)(js))}},Es=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class ks{constructor(e,t={}){this.uid=++ys,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=Be(()=>{this._render()},100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),Os.push(this),this.options.watchDOM&&ds.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&fs.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&ps.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&bs.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==Es.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&&ds.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&fs.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&ps.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&bs.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,r){this.render()}setMetaData(e,t){Me.setMetaData(this.element,e,t)}getMetaData(e){return Me.getMetaData(this.element,e)}on(e,t,r,s){Me.on(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}off(e,t){Me.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,r,s){Me.once(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}notifyAll(e,t){if(-1===Es.indexOf(e))throw new Error("invalid event name "+e);for(let r=0;r<Os.length;r++){const s=Os[r];s!==this&&s[e]&&s[e].apply(s,t)}}notifyElement(e,t,r){if(-1===Es.indexOf(t))throw new Error("invalid event name "+t);const s=this.getMetaData("registeredResponsiveControllers");if(s)for(let e=0;e<s.length;e++){const n=s[e];n!==this&&n[t]&&n[t].apply(n,r)}}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]=vs.registerWorker(e,t),vs.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 gs.subscribe(this,e,t),this.observables[e]=gs.getObservable(e),this.observables[e]}observableStop(e){this.observables[e]&&(gs.unSubscribe(this,e),delete this.observables[e])}observableStopAll(){for(const e in this.observables)this.observableStop(e)}setTemplate(e){this.template=e}setRenderer(e){this.renderer=e}setTemplateArgs(e={}){this.templateArgs=e.constructor&&"ObservableObject"===e.constructor.name?e.data:e,this.render()}getTemplateArgs(){return JSON.parse(JSON.stringify(this.templateArgs||{}))}_render(){this.template&&this.renderer&&this.renderer(this.template(this.getTemplateArgs()),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]&&(vs.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!==Os.indexOf(this)&&Os.splice(Os.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(){fs.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()}}_s("Sargasso",ks);class As extends ks{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 r=e[t];if(fs.inViewPort(r)){const s=r.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let r=0;r<s.length;r++){new js[s[r]](e[t]).start()}r.removeAttribute("data-lazy-sargasso-class")}}}}_s("LazyInstantiate",As);class Ss extends ks{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new As(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let r=0;r<t.length;r++)try{new js[t[r]](e).start()}catch(e){console.log("error instantiating "+t[r],e,js)}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<Os.length;e++)Os[e].options.immortal||Os[e].options.isCustomElement||document.body.contains(Os[e].element)||t.push(Os[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}_s("SargassoSupervisor",Ss);var Cs=r((function(e,t){!function(t){if(e.exports=t(),!!0){var r=window.Cookies,s=window.Cookies=t();s.noConflict=function(){return window.Cookies=r,s}}}((function(){function e(){for(var e=0,t={};e<arguments.length;e++){var r=arguments[e];for(var s in r)t[s]=r[s]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function r(s){function n(){}function i(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},n.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(r);/^[\{\[]/.test(o)&&(r=o)}catch(e){}r=s.write?s.write(r,t):encodeURIComponent(String(r)).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+"="+r+a}}function o(e,r){if("undefined"!=typeof document){for(var n={},i=document.cookie?document.cookie.split("; "):[],o=0;o<i.length;o++){var a=i[o].split("="),c=a.slice(1).join("=");r||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(a[0]);if(c=(s.read||s)(c,u)||t(c),r)try{c=JSON.parse(c)}catch(e){}if(n[u]=c,e===u)break}catch(e){}}return e?n[e]:n}}return n.set=i,n.get=function(e){return o(e,!1)},n.getJSON=function(e){return o(e,!0)},n.remove=function(t,r){i(t,"",e(r,{expires:-1}))},n.defaults={},n.withConverter=r,n}((function(){}))}))}));const Rs=[{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 Ms extends ks{constructor(e,t={}){t.watchResize=!0,super(e,t),t.widths?this.options.widths=t.widths:this.options.widths=Rs,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 r=0;r<this.widths.length-1;r++)if(t>=this.widths[r]&&t<this.widths[r+1]){e=this.classes[r];break}}let t=0;if(e!==this.scale){++t;const r=()=>{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(r)}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 Cs.get(e)}setCookie(e,t,r){const s={path:"/",domain:this.options.cookieDomain||null,expires:r};Cs.set(e,t,s)}deleteCookie(e){this.setCookie(e,null)}}_s("Breakpoints",Ms);class zs extends ks{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 r=e[t],s=r.getAttribute("id");this.cachedMarkup[s]=r.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 r=t[e],s=r.getAttribute("href");!s||r.getAttribute("data-hijaxed")||r.getAttribute("target")||r.hasAttribute("data-no-hijax")||this.excludeRegex.exec(s)||(r.setAttribute("data-hijaxed",!0),r.addEventListener("click",e=>{e.preventDefault(),this.setPage(s)},!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,r,s)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),r?this.currentPage=location.pathname+location.search:this.loadPage(s||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){fs.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,r=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Me.removeClass(document.body,"hijax-loading")};this.queueFrame(r),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let r=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;r||(r="Could not connect to server."),this.options.onError?this.options.onError(e,r):alert("Error loading page: "+r)}},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 r=e.split(/(<body[^>]*>|<\/body>)/gi),s=Fs(r[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],r=t.getAttribute("id"),i=s.getElementById(r);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[r]===i.innerHTML)continue;this.cachedMarkup[r]=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)}}}_s("HijaxLoader",zs);const Fs=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),r=document.createElement("div");return r.insertAdjacentHTML("afterBegin",e),t.appendChild(r),t};e.loadPageHandler=void 0;const Ps={registerSargassoClass:_s,bootSargasso:(t={})=>{if(t.scrollElement&&fs.setOptions(t),t.breakpoints){new Ms(document.body,t.breakpoints).start()}if(t.hijax){const r=new zs(document.body,t.hijax);r.start(),e.loadPageHandler=r.setPage.bind(r)}else e.loadPageHandler=e=>{document.location.href=e};new Ss(document.body,t).start(t)},elementTools:Me},Ds={theDOMWatcher:ds,theScrollWatcher:fs,theResizeWatcher:ps,theOrientationWatcher:bs,theWorkerWatcher:vs,theObservableObjectWatcher:gs};return e.ObservableObject=hs,e.Sargasso=ks,e.services=Ds,e.utils=Ps,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 createCommonjsModule(e){var t={exports:{}};return e(t,t.exports),t.exports}var r="object"==typeof t&&t&&t.Object===Object&&t,s="object"==typeof self&&self&&self.Object===Object&&self,n=r||s||Function("return this")(),i=n.Symbol;var o=function arrayMap(e,t){for(var r=-1,s=null==e?0:e.length,n=Array(s);++r<s;)n[r]=t(e[r],r,e);return n},a=Array.isArray,c=Object.prototype,u=c.hasOwnProperty,l=c.toString,h=i?i.toStringTag:void 0;var d=function getRawTag(e){var t=u.call(e,h),r=e[h];try{e[h]=void 0;var s=!0}catch(e){}var n=l.call(e);return s&&(t?e[h]=r:delete e[h]),n},p=Object.prototype.toString;var f=function objectToString(e){return p.call(e)},b=i?i.toStringTag:void 0;var v=function baseGetTag(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":b&&b in Object(e)?d(e):f(e)};var g=function isObjectLike(e){return null!=e&&"object"==typeof e};var m=function isSymbol(e){return"symbol"==typeof e||g(e)&&"[object Symbol]"==v(e)},w=i?i.prototype:void 0,y=w?w.toString:void 0;var O=function baseToString(e){if("string"==typeof e)return e;if(a(e))return o(e,baseToString)+"";if(m(e))return y?y.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var j=function toString(e){return null==e?"":O(e)};var x=function baseSlice(e,t,r){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++s<n;)i[s]=e[s+t];return i};var S=function castSlice(e,t,r){var s=e.length;return r=void 0===r?s:r,!t&&r>=s?e:x(e,t,r)},k=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var C=function hasUnicode(e){return k.test(e)};var _=function asciiToArray(e){return e.split("")},E="[\\ud800-\\udfff]",A="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",M="\\ud83c[\\udffb-\\udfff]",L="[^\\ud800-\\udfff]",R="(?:\\ud83c[\\udde6-\\uddff]){2}",F="[\\ud800-\\udbff][\\udc00-\\udfff]",z="(?:"+A+"|"+M+")"+"?",D="[\\ufe0e\\ufe0f]?",T=D+z+("(?:\\u200d(?:"+[L,R,F].join("|")+")"+D+z+")*"),P="(?:"+[L+A+"?",A,R,F,E].join("|")+")",H=RegExp(M+"(?="+M+")|"+P+T,"g");var I=function unicodeToArray(e){return e.match(H)||[]};var N=function stringToArray(e){return C(e)?I(e):_(e)};var W=function createCaseFirst(e){return function(t){t=j(t);var r=C(t)?N(t):void 0,s=r?r[0]:t.charAt(0),n=r?S(r,1).join(""):t.slice(1);return s[e]()+n}}("toUpperCase");var q=function capitalize(e){return W(j(e).toLowerCase())};var V=function arrayReduce(e,t,r,s){var n=-1,i=null==e?0:e.length;for(s&&i&&(r=e[++n]);++n<i;)r=t(r,e[n],n,e);return r};var U=function basePropertyOf(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"}),B=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,G=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var Q=function deburr(e){return(e=j(e))&&e.replace(B,U).replace(G,"")},$=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Z=function asciiWords(e){return e.match($)||[]},J=/[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 hasUnicodeWord(e){return J.test(e)},Y="\\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",re="["+te+"]",se="\\d+",ne="[\\u2700-\\u27bf]",ie="["+X+"]",oe="[^\\ud800-\\udfff"+te+se+Y+X+ee+"]",ae="(?:\\ud83c[\\udde6-\\uddff]){2}",ce="[\\ud800-\\udbff][\\udc00-\\udfff]",ue="["+ee+"]",le="(?:"+ie+"|"+oe+")",he="(?:"+ue+"|"+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])?",be="[\\ufe0e\\ufe0f]?",ve=be+fe+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",ae,ce].join("|")+")"+be+fe+")*"),ge="(?:"+[ne,ae,ce].join("|")+")"+ve,me=RegExp([ue+"?"+ie+"+"+de+"(?="+[re,ue,"$"].join("|")+")",he+"+"+pe+"(?="+[re,ue+le,"$"].join("|")+")",ue+"?"+le+"+"+de,ue+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",se,ge].join("|"),"g");var we=function unicodeWords(e){return e.match(me)||[]};var ye=function words(e,t,r){return e=j(e),void 0===(t=r?void 0:t)?K(e)?we(e):Z(e):e.match(t)||[]},Oe=RegExp("['’]","g");var je=function createCompounder(e){return function(t){return V(ye(Q(t).replace(Oe,"")),e,"")}},xe=je((function(e,t,r){return t=t.toLowerCase(),e+(r?q(t):t)}));const Se=new WeakMap,isVisible=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),setMetaData=(e,t,r)=>{const s=Se.get(e)||{};r?s[t]=r:delete s[t],Se.set(e,s)},getMetaData=(e,t)=>(Se.get(e)||{})[t],on=function(e,t,r,s,n,i,o){"function"==typeof s&&(o=i,i=n,n=s,s=null);const a="on:"+e+"-"+r+"-"+s;if(getMetaData(t,a))return void console.error("Error: Sargasso utils.on: duplicate event handler specification. %o %s",t,a);const c={uid:e,events:r,selector:s,fn:i=>{o&&off(e,t,r,s),s?Array.from(t.querySelectorAll(s)).forEach(e=>{(i.target===e||e.contains(i.target))&&n(i,e)}):n(i)},options:i||!1};setMetaData(t,a,c),r.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),c.fn,c.options)})},off=function(e,t,r,s){const n="on:"+e+"-"+r+"-"+s,i=getMetaData(t,n);i&&(r.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),i.fn,i.options)}),setMetaData(t,n))},ke={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const r=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===r.indexOf(e)&&r.push(e)}),e.className=r.join(" ")},removeClass:(e,t)=>{const r=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1)}),e.className=r.join(" ")},isVisible:isVisible,inViewPort:(e,t=window)=>{const r=e.getBoundingClientRect(),s=isVisible(e),n=r.bottom<0;let i;return i=t.self===window?r.top>(window.innerHeight||document.documentElement.clientHeight):r.top>t.clientHeight,s&&!i&&!n},setCSS:(e,t)=>{for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const s=xe(r);e.style[s]=t[r]}},setMetaData:setMetaData,getMetaData:getMetaData,on:on,off:off,once:function(e,t,r,s,n,i){on(e,t,r,s,n,i,!0)},offAll:function(e){const t=Se.get(e)||{},r=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&r.push(e);r.forEach(r=>{off(t[r].uid,e,t[r].events,t[r].selector)})}};var Ce=function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},now_1=function(){return n.Date.now()},_e=/\s/;var Ee=function trimmedEndIndex(e){for(var t=e.length;t--&&_e.test(e.charAt(t)););return t},Ae=/^\s+/;var Me=function baseTrim(e){return e?e.slice(0,Ee(e)+1).replace(Ae,""):e},Le=/^[-+]0x[0-9a-f]+$/i,Re=/^0b[01]+$/i,Fe=/^0o[0-7]+$/i,ze=parseInt;var De=function toNumber(e){if("number"==typeof e)return e;if(m(e))return NaN;if(Ce(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ce(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Me(e);var r=Re.test(e);return r||Fe.test(e)?ze(e.slice(2),r?2:8):Le.test(e)?NaN:+e},Te=Math.max,Pe=Math.min;var He=function debounce(e,t,r){var s,n,i,o,a,c,u=0,l=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function invokeFunc(t){var r=s,i=n;return s=n=void 0,u=t,o=e.apply(i,r)}function leadingEdge(e){return u=e,a=setTimeout(timerExpired,t),l?invokeFunc(e):o}function shouldInvoke(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-u>=i}function timerExpired(){var e=now_1();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var r=t-(e-c);return h?Pe(r,i-(e-u)):r}(e))}function trailingEdge(e){return a=void 0,d&&s?invokeFunc(e):(s=n=void 0,o)}function debounced(){var e=now_1(),r=shouldInvoke(e);if(s=arguments,n=this,c=e,r){if(void 0===a)return leadingEdge(c);if(h)return clearTimeout(a),a=setTimeout(timerExpired,t),invokeFunc(c)}return void 0===a&&(a=setTimeout(timerExpired,t)),o}return t=De(t)||0,Ce(r)&&(l=!!r.leading,i=(h="maxWait"in r)?Te(De(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),debounced.cancel=function cancel(){void 0!==a&&clearTimeout(a),u=0,s=c=n=a=void 0},debounced.flush=function flush(){return void 0===a?o:trailingEdge(now_1())},debounced};var Ie=function listCacheClear(){this.__data__=[],this.size=0};var Ne=function eq(e,t){return e===t||e!=e&&t!=t};var We=function assocIndexOf(e,t){for(var r=e.length;r--;)if(Ne(e[r][0],t))return r;return-1},qe=Array.prototype.splice;var Ve=function listCacheDelete(e){var t=this.__data__,r=We(t,e);return!(r<0)&&(r==t.length-1?t.pop():qe.call(t,r,1),--this.size,!0)};var Ue=function listCacheGet(e){var t=this.__data__,r=We(t,e);return r<0?void 0:t[r][1]};var Be=function listCacheHas(e){return We(this.__data__,e)>-1};var Ge=function listCacheSet(e,t){var r=this.__data__,s=We(r,e);return s<0?(++this.size,r.push([e,t])):r[s][1]=t,this};function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}ListCache.prototype.clear=Ie,ListCache.prototype.delete=Ve,ListCache.prototype.get=Ue,ListCache.prototype.has=Be,ListCache.prototype.set=Ge;var Qe=ListCache;var $e=function stackClear(){this.__data__=new Qe,this.size=0};var Ze=function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Je=function stackGet(e){return this.__data__.get(e)};var Ke=function stackHas(e){return this.__data__.has(e)};var Ye,Xe=function isFunction(e){if(!Ce(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},et=n["__core-js_shared__"],tt=(Ye=/[^.]+$/.exec(et&&et.keys&&et.keys.IE_PROTO||""))?"Symbol(src)_1."+Ye:"";var rt=function isMasked(e){return!!tt&&tt in e},st=Function.prototype.toString;var nt=function toSource(e){if(null!=e){try{return st.call(e)}catch(e){}try{return e+""}catch(e){}}return""},it=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,ct=ot.toString,ut=at.hasOwnProperty,lt=RegExp("^"+ct.call(ut).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ht=function baseIsNative(e){return!(!Ce(e)||rt(e))&&(Xe(e)?lt:it).test(nt(e))};var dt=function getValue(e,t){return null==e?void 0:e[t]};var pt=function getNative(e,t){var r=dt(e,t);return ht(r)?r:void 0},ft=pt(n,"Map"),bt=pt(Object,"create");var vt=function hashClear(){this.__data__=bt?bt(null):{},this.size=0};var gt=function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},mt=Object.prototype.hasOwnProperty;var wt=function hashGet(e){var t=this.__data__;if(bt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return mt.call(t,e)?t[e]:void 0},yt=Object.prototype.hasOwnProperty;var Ot=function hashHas(e){var t=this.__data__;return bt?void 0!==t[e]:yt.call(t,e)};var jt=function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=bt&&void 0===t?"__lodash_hash_undefined__":t,this};function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}Hash.prototype.clear=vt,Hash.prototype.delete=gt,Hash.prototype.get=wt,Hash.prototype.has=Ot,Hash.prototype.set=jt;var xt=Hash;var St=function mapCacheClear(){this.size=0,this.__data__={hash:new xt,map:new(ft||Qe),string:new xt}};var kt=function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ct=function getMapData(e,t){var r=e.__data__;return kt(t)?r["string"==typeof t?"string":"hash"]:r.map};var _t=function mapCacheDelete(e){var t=Ct(this,e).delete(e);return this.size-=t?1:0,t};var Et=function mapCacheGet(e){return Ct(this,e).get(e)};var At=function mapCacheHas(e){return Ct(this,e).has(e)};var Mt=function mapCacheSet(e,t){var r=Ct(this,e),s=r.size;return r.set(e,t),this.size+=r.size==s?0:1,this};function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}MapCache.prototype.clear=St,MapCache.prototype.delete=_t,MapCache.prototype.get=Et,MapCache.prototype.has=At,MapCache.prototype.set=Mt;var Lt=MapCache;var Rt=function stackSet(e,t){var r=this.__data__;if(r instanceof Qe){var s=r.__data__;if(!ft||s.length<199)return s.push([e,t]),this.size=++r.size,this;r=this.__data__=new Lt(s)}return r.set(e,t),this.size=r.size,this};function Stack(e){var t=this.__data__=new Qe(e);this.size=t.size}Stack.prototype.clear=$e,Stack.prototype.delete=Ze,Stack.prototype.get=Je,Stack.prototype.has=Ke,Stack.prototype.set=Rt;var Ft=Stack;var zt=function setCacheAdd(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Dt=function setCacheHas(e){return this.__data__.has(e)};function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Lt;++t<r;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=zt,SetCache.prototype.has=Dt;var Tt=SetCache;var Pt=function arraySome(e,t){for(var r=-1,s=null==e?0:e.length;++r<s;)if(t(e[r],r,e))return!0;return!1};var Ht=function cacheHas(e,t){return e.has(t)};var It=function equalArrays(e,t,r,s,n,i){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=i.get(e),l=i.get(t);if(u&&l)return u==t&&l==e;var h=-1,d=!0,p=2&r?new Tt:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var f=e[h],b=t[h];if(s)var v=o?s(b,f,h,t,e,i):s(f,b,h,e,t,i);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!Pt(t,(function(e,t){if(!Ht(p,t)&&(f===e||n(f,e,r,s,i)))return p.push(t)}))){d=!1;break}}else if(f!==b&&!n(f,b,r,s,i)){d=!1;break}}return i.delete(e),i.delete(t),d},Nt=n.Uint8Array;var Wt=function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r};var qt=function setToArray(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Vt=i?i.prototype:void 0,Ut=Vt?Vt.valueOf:void 0;var Bt=function equalByTag(e,t,r,s,n,i,o){switch(r){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 Nt(e),new Nt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ne(+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=Wt;case"[object Set]":var c=1&s;if(a||(a=qt),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;s|=2,o.set(e,t);var l=It(a(e),a(t),s,n,i,o);return o.delete(e),l;case"[object Symbol]":if(Ut)return Ut.call(e)==Ut.call(t)}return!1};var Gt=function arrayPush(e,t){for(var r=-1,s=t.length,n=e.length;++r<s;)e[n+r]=t[r];return e};var Qt=function baseGetAllKeys(e,t,r){var s=t(e);return a(e)?s:Gt(s,r(e))};var $t=function arrayFilter(e,t){for(var r=-1,s=null==e?0:e.length,n=0,i=[];++r<s;){var o=e[r];t(o,r,e)&&(i[n++]=o)}return i};var Zt=function stubArray(){return[]},Jt=Object.prototype.propertyIsEnumerable,Kt=Object.getOwnPropertySymbols,Yt=Kt?function(e){return null==e?[]:(e=Object(e),$t(Kt(e),(function(t){return Jt.call(e,t)})))}:Zt;var Xt=function baseTimes(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s};var er=function baseIsArguments(e){return g(e)&&"[object Arguments]"==v(e)},tr=Object.prototype,rr=tr.hasOwnProperty,sr=tr.propertyIsEnumerable,nr=er(function(){return arguments}())?er:function(e){return g(e)&&rr.call(e,"callee")&&!sr.call(e,"callee")};var ir=function stubFalse(){return!1},or=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,s=r&&e&&!e.nodeType&&e,i=s&&s.exports===r?n.Buffer:void 0,o=(i?i.isBuffer:void 0)||ir;e.exports=o})),ar=/^(?:0|[1-9]\d*)$/;var cr=function isIndex(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&ar.test(e))&&e>-1&&e%1==0&&e<t};var ur=function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},lr={};lr["[object Float32Array]"]=lr["[object Float64Array]"]=lr["[object Int8Array]"]=lr["[object Int16Array]"]=lr["[object Int32Array]"]=lr["[object Uint8Array]"]=lr["[object Uint8ClampedArray]"]=lr["[object Uint16Array]"]=lr["[object Uint32Array]"]=!0,lr["[object Arguments]"]=lr["[object Array]"]=lr["[object ArrayBuffer]"]=lr["[object Boolean]"]=lr["[object DataView]"]=lr["[object Date]"]=lr["[object Error]"]=lr["[object Function]"]=lr["[object Map]"]=lr["[object Number]"]=lr["[object Object]"]=lr["[object RegExp]"]=lr["[object Set]"]=lr["[object String]"]=lr["[object WeakMap]"]=!1;var hr=function baseIsTypedArray(e){return g(e)&&ur(e.length)&&!!lr[v(e)]};var dr=function baseUnary(e){return function(t){return e(t)}},pr=createCommonjsModule((function(e,t){var s=t&&!t.nodeType&&t,n=s&&e&&!e.nodeType&&e,i=n&&n.exports===s&&r.process,o=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o})),fr=pr&&pr.isTypedArray,br=fr?dr(fr):hr,vr=Object.prototype.hasOwnProperty;var gr=function arrayLikeKeys(e,t){var r=a(e),s=!r&&nr(e),n=!r&&!s&&or(e),i=!r&&!s&&!n&&br(e),o=r||s||n||i,c=o?Xt(e.length,String):[],u=c.length;for(var l in e)!t&&!vr.call(e,l)||o&&("length"==l||n&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||cr(l,u))||c.push(l);return c},mr=Object.prototype;var wr=function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||mr)};var yr=function overArg(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Or=Object.prototype.hasOwnProperty;var jr=function baseKeys(e){if(!wr(e))return yr(e);var t=[];for(var r in Object(e))Or.call(e,r)&&"constructor"!=r&&t.push(r);return t};var xr=function isArrayLike(e){return null!=e&&ur(e.length)&&!Xe(e)};var Sr=function keys(e){return xr(e)?gr(e):jr(e)};var kr=function getAllKeys(e){return Qt(e,Sr,Yt)},Cr=Object.prototype.hasOwnProperty;var _r=function equalObjects(e,t,r,s,n,i){var o=1&r,a=kr(e),c=a.length;if(c!=kr(t).length&&!o)return!1;for(var u=c;u--;){var l=a[u];if(!(o?l in t:Cr.call(t,l)))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;++u<c;){var b=e[l=a[u]],v=t[l];if(s)var g=o?s(v,b,l,t,e,i):s(b,v,l,e,t,i);if(!(void 0===g?b===v||n(b,v,r,s,i):g)){p=!1;break}f||(f="constructor"==l)}if(p&&!f){var m=e.constructor,w=t.constructor;m==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof w&&w instanceof w||(p=!1)}return i.delete(e),i.delete(t),p},Er=pt(n,"DataView"),Ar=pt(n,"Promise"),Mr=pt(n,"Set"),Lr=pt(n,"WeakMap"),Rr="[object Map]",Fr="[object Promise]",zr="[object Set]",Dr="[object WeakMap]",Tr="[object DataView]",Pr=nt(Er),Hr=nt(ft),Ir=nt(Ar),Nr=nt(Mr),Wr=nt(Lr),qr=v;(Er&&qr(new Er(new ArrayBuffer(1)))!=Tr||ft&&qr(new ft)!=Rr||Ar&&qr(Ar.resolve())!=Fr||Mr&&qr(new Mr)!=zr||Lr&&qr(new Lr)!=Dr)&&(qr=function(e){var t=v(e),r="[object Object]"==t?e.constructor:void 0,s=r?nt(r):"";if(s)switch(s){case Pr:return Tr;case Hr:return Rr;case Ir:return Fr;case Nr:return zr;case Wr:return Dr}return t});var Vr=qr,Ur="[object Arguments]",Br="[object Array]",Gr="[object Object]",Qr=Object.prototype.hasOwnProperty;var $r=function baseIsEqualDeep(e,t,r,s,n,i){var o=a(e),c=a(t),u=o?Br:Vr(e),l=c?Br:Vr(t),h=(u=u==Ur?Gr:u)==Gr,d=(l=l==Ur?Gr:l)==Gr,p=u==l;if(p&&or(e)){if(!or(t))return!1;o=!0,h=!1}if(p&&!h)return i||(i=new Ft),o||br(e)?It(e,t,r,s,n,i):Bt(e,t,u,r,s,n,i);if(!(1&r)){var f=h&&Qr.call(e,"__wrapped__"),b=d&&Qr.call(t,"__wrapped__");if(f||b){var v=f?e.value():e,g=b?t.value():t;return i||(i=new Ft),n(v,g,r,s,i)}}return!!p&&(i||(i=new Ft),_r(e,t,r,s,n,i))};var Zr=function baseIsEqual(e,t,r,s,n){return e===t||(null==e||null==t||!g(e)&&!g(t)?e!=e&&t!=t:$r(e,t,r,s,baseIsEqual,n))};var Jr=function isEqual(e,t){return Zr(e,t)};const Kr={},buildProxy=e=>({get(t,r){const s=Reflect.get(t,r);return s&&"object"==typeof s?new Proxy(s,buildProxy(e)):s},set:(t,r,s)=>(e.sync(r),Reflect.set(t,r,s)),deleteProperty:(t,r)=>(e.sync(r),Reflect.deleteProperty(t,r))});class ObservableObject{constructor(e,t={},r={}){if(this.id=e,Kr[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=new Proxy(t,buildProxy(this)),this.options=r,Kr[this.id]=this}destroy(){delete Kr[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){Jr(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,r="*"){this.bound[r]||(this.bound[r]={}),this.bound[r][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 Yr,Xr,es,ts,rs,ss;class ObserverSubscriptionManager{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 r=0;r<this.observers.length;r++)this.observers[r][e]&&this.observers[r][e].apply(this.observers[r],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]()}}Yr=new class DOMWatcher extends ObserverSubscriptionManager{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")}},Xr=new class ScrollWatcher extends ObserverSubscriptionManager{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 frame=()=>{this.scrollLoop()};this.queueFrame(frame)}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(),ke.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),ke.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return ke.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}}},es=new class ResizeWatcher extends ObserverSubscriptionManager{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")}},ts=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?ke.addClass(document.body,"have-orientation"):ke.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")}},rs=new class WorkerWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let r=t,s=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});r=URL.createObjectURL(e),s=!0}this.workers[e]={worker:new Worker(r),observers:[]},s&&URL.revokeObjectURL(r),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 r=this.workers[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),r.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach(r=>{r.workerMessage&&r.workerMessage(e,t)})}wakeup(){super.wakeup()}sleep(){super.sleep()}},ss=new class ObservableObjectWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.registeredObservableObjects={}}getObservable(e){return this.registeredObservableObjects[e]?this.registeredObservableObjects[e].observable:void 0}observableStart(e,t){const r=(e=>Kr[e])(e);if(r&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=r?{id:e,observable:r,observers:[],managed:!1}:{id:e,observable:new ObservableObject(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,r){this.registeredObservableObjects[t]||this.observableStart(t,r),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 r=this.registeredObservableObjects[t].observers;-1!==r.indexOf(e)&&r.splice(r.indexOf(e),1),!r.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,r,s){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach(n=>{n.observableChanged&&n.observableChanged(e,t,r,s)})}};var ns=je((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}));let is=0;const os=[],as="customElements"in window,cs={},registerSargassoClass=(e,t)=>{if(cs[e]=t,as){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-"+ns(e),new Function("registeredClasses",t)(cs))}},us=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class Sargasso{constructor(e,t={}){this.uid=++is,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=He(()=>{this._render()},100,{maxWait:250})}start(){const e=this.getMetaData("registeredResponsiveControllers")||[];e.push(this),this.setMetaData("registeredResponsiveControllers",e),this.setMetaData(this.constructor.name,this),os.push(this),this.options.watchDOM&&Yr.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xr.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&es.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&ts.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==us.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&&Yr.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xr.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&es.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&ts.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),ke.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,r){this.render()}setMetaData(e,t){ke.setMetaData(this.element,e,t)}getMetaData(e){return ke.getMetaData(this.element,e)}on(e,t,r,s){ke.on(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}off(e,t){ke.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,r,s){ke.once(this.constructor.name+"-"+this.uid,this.element,e,t,r,s)}notifyAll(e,t){if(-1===us.indexOf(e))throw new Error("invalid event name "+e);for(let r=0;r<os.length;r++){const s=os[r];s!==this&&s[e]&&s[e].apply(s,t)}}notifyElement(e,t,r){if(-1===us.indexOf(t))throw new Error("invalid event name "+t);const s=this.getMetaData("registeredResponsiveControllers");if(s)for(let e=0;e<s.length;e++){const n=s[e];n!==this&&n[t]&&n[t].apply(n,r)}}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 ke.hasClass(this.element,e)}addClass(e){ke.addClass(this.element,e)}removeClass(e){ke.removeClass(this.element,e)}setCSS(e){ke.setCSS(this.element,e)}isVisible(){return ke.isVisible(this.element)}workerStart(e,t){return this.workers[e]=rs.registerWorker(e,t),rs.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 ss.subscribe(this,e,t),this.observables[e]=ss.getObservable(e),this.observables[e]}observableStop(e){this.observables[e]&&(ss.unSubscribe(this,e),delete this.observables[e])}observableStopAll(){for(const e in this.observables)this.observableStop(e)}setTemplate(e){this.template=e}setRenderer(e){this.renderer=e}setTemplateArgs(e={}){this.templateArgs=e.constructor&&"ObservableObject"===e.constructor.name?e.data:e,this.render()}getTemplateArgs(){return JSON.parse(JSON.stringify(this.templateArgs||{}))}_render(){this.template&&this.renderer&&this.renderer(this.template(this.getTemplateArgs()),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]&&(rs.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!==os.indexOf(this)&&os.splice(os.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(){Xr.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()}}registerSargassoClass("Sargasso",Sargasso);class LazyInstantiate extends Sargasso{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 r=e[t];if(Xr.inViewPort(r)){const s=r.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let r=0;r<s.length;r++){new cs[s[r]](e[t]).start()}r.removeAttribute("data-lazy-sargasso-class")}}}}registerSargassoClass("LazyInstantiate",LazyInstantiate);class SargassoSupervisor extends Sargasso{constructor(e,t={}){super(e,{watchDOM:!0,mortal:!1}),this.lazy=new LazyInstantiate(e,t)}start(){this.lazy.start(),super.start()}instantiate(e){const t=e.getAttribute("data-sargasso-class").split(/\s*,\s*/);for(let r=0;r<t.length;r++)try{new cs[t[r]](e).start()}catch(e){console.log("error instantiating "+t[r],e,cs)}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<os.length;e++)os[e].options.immortal||os[e].options.isCustomElement||document.body.contains(os[e].element)||t.push(os[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);var ls=createCommonjsModule((function(e,t){!function(t){if(e.exports=t(),!!0){var r=window.Cookies,s=window.Cookies=t();s.noConflict=function(){return window.Cookies=r,s}}}((function(){function extend(){for(var e=0,t={};e<arguments.length;e++){var r=arguments[e];for(var s in r)t[s]=r[s]}return t}function decode(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function init(e){function api(){}function set(t,r,s){if("undefined"!=typeof document){"number"==typeof(s=extend({path:"/"},api.defaults,s)).expires&&(s.expires=new Date(1*new Date+864e5*s.expires)),s.expires=s.expires?s.expires.toUTCString():"";try{var n=JSON.stringify(r);/^[\{\[]/.test(n)&&(r=n)}catch(e){}r=e.write?e.write(r,t):encodeURIComponent(String(r)).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 i="";for(var o in s)s[o]&&(i+="; "+o,!0!==s[o]&&(i+="="+s[o].split(";")[0]));return document.cookie=t+"="+r+i}}function get(t,r){if("undefined"!=typeof document){for(var s={},n=document.cookie?document.cookie.split("; "):[],i=0;i<n.length;i++){var o=n[i].split("="),a=o.slice(1).join("=");r||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=decode(o[0]);if(a=(e.read||e)(a,c)||decode(a),r)try{a=JSON.parse(a)}catch(e){}if(s[c]=a,t===c)break}catch(e){}}return t?s[t]:s}}return api.set=set,api.get=function(e){return get(e,!1)},api.getJSON=function(e){return get(e,!0)},api.remove=function(e,t){set(e,"",extend(t,{expires:-1}))},api.defaults={},api.withConverter=init,api}((function(){}))}))}));const hs=[{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 Breakpoints extends Sargasso{constructor(e,t={}){t.watchResize=!0,super(e,t),t.widths?this.options.widths=t.widths:this.options.widths=hs,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){ke.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){ke.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 frame=()=>{ke.removeClass(document.body,"landscape"),ke.addClass(document.body,"portrait")};this.queueFrame(frame),this.orientation="portrait"}}else if("landscape"!==this.orientation){const frame=()=>{ke.removeClass(document.body,"portrait"),ke.addClass(document.body,"landscape")};this.queueFrame(frame),this.orientation="landscape"}for(let r=0;r<this.widths.length-1;r++)if(t>=this.widths[r]&&t<this.widths[r+1]){e=this.classes[r];break}}let t=0;if(e!==this.scale){++t;const frame=()=>{for(let t=0;t<this.classes.length;t++)this.classes[t]!==e?(ke.addClass(document.body,"not-"+this.classes[t]),ke.removeClass(document.body,this.classes[t]),ke.removeClass(document.body,"shown-"+this.classes[t]),ke.removeClass(document.body,"hidden-"+this.classes[t])):ke.removeClass(document.body,"not-"+this.classes[t]);ke.addClass(document.body,e),ke.addClass(document.body,"shown-"+e),ke.addClass(document.body,"hidden-"+e),this.notifyAll("didBreakpoint",[e])};this.queueFrame(frame)}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 ls.get(e)}setCookie(e,t,r){const s={path:"/",domain:this.options.cookieDomain||null,expires:r};ls.set(e,t,s)}deleteCookie(e){this.setCookie(e,null)}}registerSargassoClass("Breakpoints",Breakpoints);class HijaxLoader extends Sargasso{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 r=e[t],s=r.getAttribute("id");this.cachedMarkup[s]=r.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 r=t[e],s=r.getAttribute("href");!s||r.getAttribute("data-hijaxed")||r.getAttribute("target")||r.hasAttribute("data-no-hijax")||this.excludeRegex.exec(s)||(r.setAttribute("data-hijaxed",!0),r.addEventListener("click",e=>{e.preventDefault(),this.setPage(s)},!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,r,s)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),r?this.currentPage=location.pathname+location.search:this.loadPage(s||e)})}loadPage(e){this.queueFrame(()=>{ke.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){Xr.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),ke.removeClass(document.body,"hijax-loading")};this.queueFrame(frame),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let r=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;r||(r="Could not connect to server."),this.options.onError?this.options.onError(e,r):alert("Error loading page: "+r)}},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 r=e.split(/(<body[^>]*>|<\/body>)/gi),s=makeFragment(r[2]),n=document.querySelectorAll("[data-hijax]");for(let e=0;e<n.length;e++){const t=n[e],r=t.getAttribute("id"),i=s.getElementById(r);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[r]===i.innerHTML)continue;this.cachedMarkup[r]=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 frame=()=>{t.parentNode.replaceChild(i,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(i)};this.queueFrame(frame)}}}registerSargassoClass("HijaxLoader",HijaxLoader);const makeFragment=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),r=document.createElement("div");return r.insertAdjacentHTML("afterBegin",e),t.appendChild(r),t};e.loadPageHandler=void 0;const ds={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Xr.setOptions(t),t.breakpoints){new Breakpoints(document.body,t.breakpoints).start()}if(t.hijax){const r=new HijaxLoader(document.body,t.hijax);r.start(),e.loadPageHandler=r.setPage.bind(r)}else e.loadPageHandler=e=>{document.location.href=e};new SargassoSupervisor(document.body,t).start(t)},elementTools:ke},ps={theDOMWatcher:Yr,theScrollWatcher:Xr,theResizeWatcher:es,theOrientationWatcher:ts,theWorkerWatcher:rs,theObservableObjectWatcher:ss};return e.ObservableObject=ObservableObject,e.Sargasso=Sargasso,e.services=ps,e.utils=ds,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=sargasso.iife.min.js.map
{
"name": "@pelagiccreatures/sargasso",
"version": "1.4.2",
"version": "1.4.3",
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -30,6 +30,2 @@ # @pelagiccreatures/sargasso

### Why?
Progressive Web Apps and modern websites need a HIJAX scheme to load pages that is integrated with and can manage element behavior. The big name frameworks out there at the moment are not a very good fit for the work I am doing so I decided to roll my own to investigate the current state of browser capabilities.
### Usage Overview (Using CDN iife modules)

@@ -78,3 +74,3 @@

```
[Try It](https://jsfiddle.net/PelagicCreatures/yafdt2h1/10/)
[Try It](https://stackblitz.com/edit/sargasso-example-1)

@@ -84,3 +80,3 @@ Sargasso element controllers are javascript Objects that are subclasses of the framework's Sargasso class. Custom behavior is defined by overriding various methods of the base class.

#### Using data-sargasso-class to specify Sargasso classname
Alternately, Sargasso watches the DOM for any elements tagged with the `data-sargasso-class` attribute which can be one classname or a list of classnames
Alternately, Sargasso watches the DOM for any elements tagged with the `data-sargasso-class` attribute which can be one classname or a list of classnames.

@@ -93,16 +89,20 @@ ```html

Many browsers support custom elements ([current compatibility](https://caniuse.com/#feat=custom-elementsv1) so the preferred (faster and cleaner) syntax for sargasso elements is to use a custom element tag. The class name is the kebab-case of your subclass name so MyClass becomes sargasso-my-class:
Many browsers support custom elements ([current compatibility](https://caniuse.com/#feat=custom-elementsv1) The class name is the kebab-case of your subclass name so MyClass becomes sargasso-my-class:
```html
<sargasso-my-class>This works in <em>most</em> browsers</sargasso-my-class>
<sargasso-my-class>This works in <em>almost all reasonably modern</em> browsers</sargasso-my-class>
```
You can also defer the instantiation using the lazy method by tagging it with `data-lazy-sargasso-class` instead of `data-sargasso-class` which will only start up the class when the element is visible in the viewport.
You can also defer the instantiation using the lazy method by tagging it with `data-lazy-sargasso-class` instead of `data-sargasso-class` which will only start up the controller when the element becomes visible in the viewport.
### Sargasso Object Lifecycle
When a Sargasso element appears in the document, the framework supervisor will instantiate an object and call the `start()` method of the object. When removed from the DOM, 'sleep()' will be called allowing you can cleanup any resources or handlers you set up in start (note that event listeners created with 'this.on' and 'this.once' are automatically cleaned up). Beyond responding to scrolling, resize and other responsive events, you will probably want to interact with your element in some way. You should use the start hook to set up any element events you need to respond to such as clicking a button, responding to touch events or key presses, etc.
**tl;dr** The Sargasso Object life cycle is `constructor` > `start` > do stuff and until element removed from doc > `sleep` > `destroy`
When a Sargasso element appears in the document, the framework supervisor will instantiate an object and call the `start()` method of the object. When removed from the DOM, 'sleep()' will be called allowing cleanup of any resources or handlers set up in start (note that event listeners created with 'this.on' and 'this.once' are automatically cleaned up.)
### Example with event handlers
In this example `MyButtonClass` illustrates this object lifecycle and handling of UI event.
example/example2.html

@@ -112,96 +112,88 @@ ```html

<html>
<head>
<title>Example Sargasso Element</title>
<style>
.container { margin-top: 150vh; margin-bottom: 33vh; }
.container span { border: thin solid #333; border-radius: 1em; padding: 1em; }
.clicked { color: red; }
.float { position: fixed; bottom: 0px; right: 0px; width: 50%; float: right; }
.float>pre { text-align: right; }
</style>
</head>
<body>
<h3>Sargasso Element Example</h3>
<p>Element is aware of when it is scrolled into the viewport, removed from the document and implements a delegated click event which removes the element when triggered.</p>
<head>
<title>Example Sargasso Element</title>
<style>
.container { margin-top: 150vh; margin-bottom: 33vh; }
.clicked { color: red; }
</style>
</head>
<body>
<h3>Sargasso Element Example</h3>
<p>Scroll down to see it in action</p>
<p>
Element is aware of when it is scrolled into the viewport, removed from the document and implements a click event which removes the element when triggered.
</p>
<div class='container'>
<button data-sargasso-class="MyButtonClass">
Hello World! Click me!
</button>
</div>
<p>Scroll down to see it in action</p>
<script src='https://cdn.jsdelivr.net/npm/@pelagiccreatures/sargasso/dist/sargasso.iife.min.js'></script>
<div class="container">
<button data-sargasso-class="MyButtonClass">
Hello World!
</button>
</div>
<script defer>
window.onload = () => {
class MyButtonClass extends SargassoModule.Sargasso {
constructor(element, options = {}) {
options.watchViewport = true // tell me when I am visible
super(element, options) // important!
}
<script src="https://cdn.jsdelivr.net/npm/@pelagiccreatures/sargasso/dist/sargasso.iife.js"></script>
start() {
super.start() // important!
<script defer>
window.onload = () => {
class MyButtonClass extends SargassoModule.Sargasso {
constructor(element, options = {}) {
options.watchViewport = true; // tell me when I am visible
super(element, options); // important!
}
this.on('click', (e) => { // add click event handler
e.preventDefault()
this.clicked()
})
start() {
this.once("click", e => {
// add click event handler
e.preventDefault();
this.clicked();
});
super.start(); // important!
}
this.debug('MyButtonClass starting')
}
sleep() {
this.queueFrame(() => {
document.body.innerHTML = "I'm gone";
})
super.sleep();
}
sleep() {
this.debug('MyButtonClass sleep called')
super.sleep() // important!
}
enterViewport() {
this.queueFrame(() => {
this.element.innerHTML += " In viewport! Click me!";
});
}
enterViewport() {
this.debug('MyButtonClass entered viewport!')
}
// use an animation frame to mutate the DOM
clicked() {
const frame = () => {
// set up a DOM mutation frame
this.addClass("clicked");
this.element.innerHTML += " Clicked!";
};
this.queueFrame(frame); // schedule it
// use an animation frame to mutate the DOM
clicked() {
const frame = () => { // set up a DOM mutation
this.debug('clicked!')
this.addClass('clicked')
// remove it from the document to illustrate Sargasso lifecycle
setTimeout(() => {
this.element.remove();
}, 1000);
}
this.queueFrame(frame) // schedule it
// remove it from the document to illustrate Sargasso lifecycle
setTimeout(() => {
this.debug('removing MyButtonClass element')
this.element.remove()
}, 2000)
}
debug(message) {
document.getElementById('debug').append(message + '\n')
}
}
SargassoModule.utils.registerSargassoClass("MyButtonClass",MyButtonClass);
SargassoModule.utils.registerSargassoClass('MyButtonClass', MyButtonClass)
// Start Sargasso
SargassoModule.utils.bootSargasso()
}
</script>
<div class="float">
<pre id="debug">
Sargasso element event log
------
ready
</pre>
</div>
</body>
// Start Sargasso
SargassoModule.utils.bootSargasso();
};
</script>
</body>
</html>
```
[Try It](https://jsfiddle.net/PelagicCreatures/chfpkvs3/18/)
[Try It](https://stackblitz.com/edit/sargasso-example-2)
### Sargasso Base Class:
### Sargasso Class:
**Properties**
All Sargasso element controllers are sub classes of Sargasso
#### Properties
| property | description |

@@ -213,13 +205,10 @@ | -------- | ----------- |

**Methods to override as needed:**
#### Overridable Methods
| method | description |
| ------ | ----------- |
| 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.|
| constructor(element, options = {}) | subscribe to services by setting appropriate options properties before calling `super(element,options)`. All default to false so only set the ones you need to know about `watchDOM`, `watchScroll`, `watchResize`, `watchOrientation`, `watchViewport` eg. `options.watchScroll = true` |
| start() | set up any interactions and event handlers for the element content such as click handlers, touch events, etc. Generally should call super.start() at head of function |
| sleep() | remove any event **foreign** event handlers defined in start() and cleanup references - event handlers created with 'this.on' and 'this.once' are automatically removed by sargasso. Generally should call super.sleep() at tail of function|
*don't forget to call super.xxx() in your subclass*
**Handlers for sargasso events, override as needed:**
#### Handlers for sargasso managed events, override these as needed to perform any needed behavior:
| method | description |

@@ -234,35 +223,35 @@ | ------ | ----------- |

| didBreakpoint() | new screen width breakpoint |
| 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 |
| 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 |
| workerOnMessage (id, data = {}) | `id` is the id of the worker sending the message (can have as many as you want). Any payload from the worker's `postMessage` call is in data.xxx as defined by the worker. |
| observableChanged(id, property, value) | if watching an observable object this is called on observable data change. `id` is the id of the observable (can have as many as you want) |
| enterFullscreen() | *experimental API in flux* called if options 'watchOrientation: true' when user rotates phone or if setFullscreen is called |
| exitFullscreen() | *experimental API in flux* called on exit fullscreen |
**CSS Methods**
#### CSS Methods
| method | description |
| ------ | ----------- |
| hasClass('classname') | returns true if this.element has cssclass |
| addClass('classname') | add classname or array of classnames to this.element |
| removeClass('classname') | remove classname or array of classnames to this.element |
| setCSS({}) | set css pairs defined in object on this.element |
| hasClass('classname') | returns true if this.element has cssclass. |
| addClass('classname') | add classname or array of classnames to this.element eg: 'class1,class2' |
| removeClass('classname') | remove classname or array of classnames from this.element eg: 'class1,class2' |
| setCSS({}) | set css pairs on this.element {'padding':'1em','margin':'2em'} |
**Register Event Methods**
#### Register Event Methods
| method | description |
| ------ | ----------- |
| on(container,fn) | attach undelegated event handler to container scoped to a css selector |
| 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) |
| off(container) | remove undelegated event handler to container scoped to css selector |
| on(container,selector,fn) | attach delegated event handler to container scoped to a css selector |
| once(container,selector,fn) | attach delegated event handler to container scoped to a css selector that executes only once (automatically removes event handler on first call) |
| off(container,selector) | remove delegated event handler to container scoped to css selector |
| on(container,fn) | attach an undelegated event handler to element |
| once(container,fn) | attach undelegated event handler to this.element that executes only once (automatically removes the event handler on first call) |
| off(container) | remove undelegated event handler from this.element |
| on(container,selector,fn) | attach delegated event handler scoped to a css selector for an element within this.element |
| once(container,selector,fn) | attach delegated event handler scoped to a css selector for an element within this.element that executes only once (automatically removes event handler on first call) |
| off(container,selector) | remove delegated event handler scoped to css selector for an element within this.element |
**Utility Methods:**
#### Utility Methods:
| method | description |
| ------ | ----------- |
| getMetaData(key) | return sargasso metadata associated with element (weak map) |
| setMetaData(key,value) | set a sargasso metadata property |
| isVisible() | true if element is visible |
| getMetaData(key) | return this.element's metadata value for key (implemented as a weak map.) Use this for any key value pairs you like. All data is destroyed when Sargasso object is destroyed. |
| setMetaData(key,value) | set this.element's metadata value for key |
| isVisible() | true if this.element is visible |
### Progressive Web App HIJAX Page Load
### Progressive Web Apps
When HIJAX is enabled, Sargasso automatically captures `<a href="..">` tags and calls the LoadPageHandler instead of allowing the browser load and replace entire pages natively. Usually a web site or app has a boilerplate html wrapper that is the same for every page and well defined content areas that change from page to page. When pages are loaded via HIJAX only the changed content is merged with the current page, replacing containers marked with `data-hijax` leaving heavy weight wrapper elements, persistent javascript, css and sargasso elements intact. You can define as many dynamic elements in the wrapper as needed. Following this scheme allows for deep linking, and search engine discovery while also speeding page load for real browsers.
When HIJAX is enabled, Sargasso automatically captures `<a href="..">` tags and calls the LoadPageHandler instead of allowing the browser load and replace entire pages natively. Usually a web site or app has a boilerplate html wrapper that is the same for every page with well defined content areas that change from page to page. When pages are loaded via HIJAX only the changed content is merged with the current page, replacing content in containers marked with `data-hijax` leaving heavy weight wrapper elements, persistent javascript, css and sargasso elements undisturbed. You can define as many dynamic elements in the wrapper as needed. Following this scheme allows for deep linking and search engine discovery while also speeding page load for an "app" like experience for real browsers.

@@ -283,3 +272,3 @@ The Sargasso supervisor takes care of cleaning up any instantiated Sargasso element controllers in the old content by calling sleep() before the content is removed then sargasso elements in the new content are instantiated and start() is called. That way Sargasso element controllers can be cleanly managed on progressive web app pages without leaving dangling event handlers and memory leaks.

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

@@ -299,5 +288,5 @@ window.onload = () => {

```
[Try It](https://stackblitz.com/edit/web-platform-5g5tqc)
[Try It](https://stackblitz.com/edit/sargasso-hijax)
**Note:** `data-hijax` elements must have and ID and contain well formed child html elements.
**Note:** `data-hijax` elements must have and ID attribute defined and must contain well formed child html elements.

@@ -311,7 +300,7 @@ ```html

`SargassoModule.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.
`SargassoModule.loadPageHandler(href)` is the utility function for programmatically loading a new page. EG. instead of using `location.href= '/home'`, use `loadPageHandler('/home')` This can be called to reload the page as well.
#### 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.
Set the `data-hijax-skip-unchanged` attribute on a 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 but change when you move to a new section of the site.
```html

@@ -323,3 +312,3 @@ <div id="test" data-hijax data-hijax-skip-unchanged>

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.
Set `data-hijax-cache-key-selector` to a css selector of an element within a hijax container which has defined `data-hijax-cache-key-selector` to leave the content intact across pages until the key value changes.
```html

@@ -333,15 +322,16 @@ <div id="test" data-hijax data-hijax-cache-key-selector="#sub-element">

To avoid any chaotic repaints you should only make Content or DOM changes inside animation frames - don't do any long processes in the responsive callbacks or things might bog down the browser UI. Sargasso.queueFrame maintains a list of pending page updates which are executed in order using the animation frame loop.
To avoid chaotic repaints, make Content or DOM changes inside animation frames - don't do any long processes in the responsive callbacks or things might bog down the browser UI. Sargasso.queueFrame maintains a list of pending page updates which are executed in order using the request animation frame loop.
| method | description |
| ------ | ----------- |
| queueFrame(function) | queue a function to execute that changes the DOM |
| queueFrame(function) | queue a function to execute that changes the DOM. To keep pages performant, the function should not be heavy weight or computationally intensive |
Example
```javascript
this.queueFrame(()=>{
const frame = () => {
this.removeClass('css-class,some-other-css-class')
this.addClass('css-class,some-other-css-class')
this.element.innerHTML = 'changed!'
})
}
this.queueFrame(frame)
```

@@ -351,19 +341,16 @@

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.
Observable objects implement a notification scheme for tracking data changes. (the implementation is using javascript Proxy and Reflect) These objects can be shared across elements for real-time display of information.
| method | description |
| ------ | ----------- |
| observableStart (id, data) | start watching for changes in observable data. `data` is an optional JS data object |
| observableStart (id, data) | start watching for changes in observable object. `id` is an application unique identifier for the shared data. `data` is an optional JS data object to initialize the values |
| observableStop (id) | stop watching for changes in observable data |
| getObservable (id) | get underlying ObservableObject instance for id |
| getObservable (id) | get underlying ObservableObject instance for `id` |
```javascript
let args = {
name: 'World!',
cssClass: 'red'
}
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:
Then bind a function to the observable instance which is called when the data changes:
```javascript

@@ -374,11 +361,10 @@ let watch = (id, property, 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
// any changes to the data will trigger the watch function
observable.data.name = 'New Name'
observable.set('name','New Name') // same thing different syntax
```
Sargasso Elements can subscribe to notifications from ObservableObjects that are defined externally or owned by the element.
Sargasso Elements can subscribe to ObservableObjects that are owned by the element or were defined externally.
```javascript

@@ -392,3 +378,4 @@ class MyClass extends SargassoModule.Sargasso {

observableChanged(id, property, value) {
// do something with the change
// Do something with the change like re-display the element with new values or something.
// DON'T make a change to the data here tho or you will have an endless loop on your hands.
}

@@ -399,3 +386,3 @@ }

### Templates and Rendering
Complete example of an element that renders on data updates using an ObservableObject and li-html templates.
Complete example of an element that renders on data updates using an ObservableObject and `li-html` templates.

@@ -426,3 +413,3 @@ | method | description |

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

@@ -488,3 +475,3 @@ import {

```
[Try It](https://jsfiddle.net/PelagicCreatures/gbL5y7xq/11/)
[Try It](https://stackblitz.com/edit/sargasso-example-5)

@@ -519,3 +506,3 @@ ### Using managed Web Workers

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

@@ -522,0 +509,0 @@ window.onload = () => {

@@ -23,3 +23,5 @@ import commonjs from '@rollup/plugin-commonjs'

comments: false
}
},
keep_classnames: true,
keep_fnames: true
})]

@@ -26,0 +28,0 @@ }],

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc