Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
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.8 to 1.5.0-beta.1

example/Noisy.js

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 createCommonjsModule(e){var t={exports:{}};return e(t,t.exports),t.exports}var s="object"==typeof t&&t&&t.Object===Object&&t,r="object"==typeof self&&self&&self.Object===Object&&self,i=s||r||Function("return this")(),n=i.Symbol;var o=function arrayMap(e,t){for(var s=-1,r=null==e?0:e.length,i=Array(r);++s<r;)i[s]=t(e[s],s,e);return i},a=Array.isArray,c=Object.prototype,l=c.hasOwnProperty,u=c.toString,h=n?n.toStringTag:void 0;var d=function getRawTag(e){var t=l.call(e,h),s=e[h];try{e[h]=void 0;var r=!0}catch(e){}var i=u.call(e);return r&&(t?e[h]=s:delete e[h]),i},p=Object.prototype.toString;var f=function objectToString(e){return p.call(e)},b=n?n.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)},y=n?n.prototype:void 0,w=y?y.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 w?w.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,s){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(s=s>i?i:s)<0&&(s+=i),i=t>s?0:s-t>>>0,t>>>=0;for(var n=Array(i);++r<i;)n[r]=e[r+t];return n};var S=function castSlice(e,t,s){var r=e.length;return s=void 0===s?r:s,!t&&s>=r?e:x(e,t,s)},A=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var _=function hasUnicode(e){return A.test(e)};var k=function asciiToArray(e){return e.split("")},E="[\\ud800-\\udfff]",C="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",M="\\ud83c[\\udffb-\\udfff]",L="[^\\ud800-\\udfff]",R="(?:\\ud83c[\\udde6-\\uddff]){2}",F="[\\ud800-\\udbff][\\udc00-\\udfff]",z="(?:"+C+"|"+M+")"+"?",D="[\\ufe0e\\ufe0f]?",P=D+z+("(?:\\u200d(?:"+[L,R,F].join("|")+")"+D+z+")*"),T="(?:"+[L+C+"?",C,R,F,E].join("|")+")",H=RegExp(M+"(?="+M+")|"+T+P,"g");var I=function unicodeToArray(e){return e.match(H)||[]};var W=function stringToArray(e){return _(e)?I(e):k(e)};var N=function createCaseFirst(e){return function(t){t=j(t);var s=_(t)?W(t):void 0,r=s?s[0]:t.charAt(0),i=s?S(s,1).join(""):t.slice(1);return r[e]()+i}}("toUpperCase");var q=function capitalize(e){return N(j(e).toLowerCase())};var V=function arrayReduce(e,t,s,r){var i=-1,n=null==e?0:e.length;for(r&&n&&(s=e[++i]);++i<n;)s=t(s,e[i],i,e);return s};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($)||[]},K=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var J=function hasUnicodeWord(e){return K.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",se="["+te+"]",re="\\d+",ie="[\\u2700-\\u27bf]",ne="["+X+"]",oe="[^\\ud800-\\udfff"+te+re+Y+X+ee+"]",ae="(?:\\ud83c[\\udde6-\\uddff]){2}",ce="[\\ud800-\\udbff][\\udc00-\\udfff]",le="["+ee+"]",ue="(?:"+ne+"|"+oe+")",he="(?:"+le+"|"+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="(?:"+[ie,ae,ce].join("|")+")"+ve,me=RegExp([le+"?"+ne+"+"+de+"(?="+[se,le,"$"].join("|")+")",he+"+"+pe+"(?="+[se,le+ue,"$"].join("|")+")",le+"?"+ue+"+"+de,le+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",re,ge].join("|"),"g");var ye=function unicodeWords(e){return e.match(me)||[]};var we=function words(e,t,s){return e=j(e),void 0===(t=s?void 0:t)?J(e)?ye(e):Z(e):e.match(t)||[]},Oe=RegExp("['’]","g");var je=function createCompounder(e){return function(t){return V(we(Q(t).replace(Oe,"")),e,"")}},xe=je((function(e,t,s){return t=t.toLowerCase(),e+(s?q(t):t)}));const Se=new WeakMap,isVisible=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),setMetaData=(e,t,s)=>{const r=Se.get(e)||{};s?r[t]=s:delete r[t],Se.set(e,r)},getMetaData=(e,t)=>{const s=Se.get(e)||{};return t?s[t]:s},on=function(e,t,s,r,i,n,o){"function"==typeof r&&(o=n,n=i,i=r,r=void 0);const a="on:"+e+"-"+s+"-"+r;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:s,selector:r||void 0,fn:n=>{o&&off(e,t,s,r),r?Array.from(t.querySelectorAll(r)).forEach(e=>{(n.target===e||e.contains(n.target))&&i(n,e)}):i(n)},options:n||!1};setMetaData(t,a,c),s.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),c.fn,c.options)})},off=function(e,t,s,r){const i="on:"+e+"-"+s+"-"+r,n=getMetaData(t,i);n&&(s.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),n.fn,n.options)}),setMetaData(t,i))},Ae={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===s.indexOf(e)&&s.push(e)}),e.className=s.join(" ")},removeClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1)}),e.className=s.join(" ")},isVisible:isVisible,inViewPort:(e,t=window)=>{const s=e.getBoundingClientRect(),r=isVisible(e),i=s.bottom<0;let n;return n=t.self===window?s.top>(window.innerHeight||document.documentElement.clientHeight):s.top>t.clientHeight,r&&!n&&!i},setCSS:(e,t)=>{for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const r=xe(s);e.style[r]=t[s]||null}},setMetaData:setMetaData,getMetaData:getMetaData,on:on,off:off,once:function(e,t,s,r,i,n){"function"==typeof r&&(n=i,i=r,r=void 0),on(e,t,s,r,i,n,!0)},offAll:function(e){const t=Se.get(e)||{},s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&s.push(e);s.forEach(s=>{off(t[s].uid,e,t[s].events,t[s].selector)})}};var _e=function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},now_1=function(){return i.Date.now()},ke=/\s/;var Ee=function trimmedEndIndex(e){for(var t=e.length;t--&&ke.test(e.charAt(t)););return t},Ce=/^\s+/;var Me=function baseTrim(e){return e?e.slice(0,Ee(e)+1).replace(Ce,""):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(_e(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_e(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Me(e);var s=Re.test(e);return s||Fe.test(e)?ze(e.slice(2),s?2:8):Le.test(e)?NaN:+e},Pe=Math.max,Te=Math.min;var He=function debounce(e,t,s){var r,i,n,o,a,c,l=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function invokeFunc(t){var s=r,n=i;return r=i=void 0,l=t,o=e.apply(n,s)}function leadingEdge(e){return l=e,a=setTimeout(timerExpired,t),u?invokeFunc(e):o}function shouldInvoke(e){var s=e-c;return void 0===c||s>=t||s<0||h&&e-l>=n}function timerExpired(){var e=now_1();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var s=t-(e-c);return h?Te(s,n-(e-l)):s}(e))}function trailingEdge(e){return a=void 0,d&&r?invokeFunc(e):(r=i=void 0,o)}function debounced(){var e=now_1(),s=shouldInvoke(e);if(r=arguments,i=this,c=e,s){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,_e(s)&&(u=!!s.leading,n=(h="maxWait"in s)?Pe(De(s.maxWait)||0,t):n,d="trailing"in s?!!s.trailing:d),debounced.cancel=function cancel(){void 0!==a&&clearTimeout(a),l=0,r=c=i=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 We=function eq(e,t){return e===t||e!=e&&t!=t};var Ne=function assocIndexOf(e,t){for(var s=e.length;s--;)if(We(e[s][0],t))return s;return-1},qe=Array.prototype.splice;var Ve=function listCacheDelete(e){var t=this.__data__,s=Ne(t,e);return!(s<0)&&(s==t.length-1?t.pop():qe.call(t,s,1),--this.size,!0)};var Ue=function listCacheGet(e){var t=this.__data__,s=Ne(t,e);return s<0?void 0:t[s][1]};var Be=function listCacheHas(e){return Ne(this.__data__,e)>-1};var Ge=function listCacheSet(e,t){var s=this.__data__,r=Ne(s,e);return r<0?(++this.size,s.push([e,t])):s[r][1]=t,this};function ListCache(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[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__,s=t.delete(e);return this.size=t.size,s};var Ke=function stackGet(e){return this.__data__.get(e)};var Je=function stackHas(e){return this.__data__.has(e)};var Ye,Xe=function isFunction(e){if(!_e(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},et=i["__core-js_shared__"],tt=(Ye=/[^.]+$/.exec(et&&et.keys&&et.keys.IE_PROTO||""))?"Symbol(src)_1."+Ye:"";var st=function isMasked(e){return!!tt&&tt in e},rt=Function.prototype.toString;var it=function toSource(e){if(null!=e){try{return rt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},nt=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,ct=ot.toString,lt=at.hasOwnProperty,ut=RegExp("^"+ct.call(lt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ht=function baseIsNative(e){return!(!_e(e)||st(e))&&(Xe(e)?ut:nt).test(it(e))};var dt=function getValue(e,t){return null==e?void 0:e[t]};var pt=function getNative(e,t){var s=dt(e,t);return ht(s)?s:void 0},ft=pt(i,"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 yt=function hashGet(e){var t=this.__data__;if(bt){var s=t[e];return"__lodash_hash_undefined__"===s?void 0:s}return mt.call(t,e)?t[e]:void 0},wt=Object.prototype.hasOwnProperty;var Ot=function hashHas(e){var t=this.__data__;return bt?void 0!==t[e]:wt.call(t,e)};var jt=function hashSet(e,t){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=bt&&void 0===t?"__lodash_hash_undefined__":t,this};function Hash(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}Hash.prototype.clear=vt,Hash.prototype.delete=gt,Hash.prototype.get=yt,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 At=function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var _t=function getMapData(e,t){var s=e.__data__;return At(t)?s["string"==typeof t?"string":"hash"]:s.map};var kt=function mapCacheDelete(e){var t=_t(this,e).delete(e);return this.size-=t?1:0,t};var Et=function mapCacheGet(e){return _t(this,e).get(e)};var Ct=function mapCacheHas(e){return _t(this,e).has(e)};var Mt=function mapCacheSet(e,t){var s=_t(this,e),r=s.size;return s.set(e,t),this.size+=s.size==r?0:1,this};function MapCache(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}MapCache.prototype.clear=St,MapCache.prototype.delete=kt,MapCache.prototype.get=Et,MapCache.prototype.has=Ct,MapCache.prototype.set=Mt;var Lt=MapCache;var Rt=function stackSet(e,t){var s=this.__data__;if(s instanceof Qe){var r=s.__data__;if(!ft||r.length<199)return r.push([e,t]),this.size=++s.size,this;s=this.__data__=new Lt(r)}return s.set(e,t),this.size=s.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=Ke,Stack.prototype.has=Je,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,s=null==e?0:e.length;for(this.__data__=new Lt;++t<s;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=zt,SetCache.prototype.has=Dt;var Pt=SetCache;var Tt=function arraySome(e,t){for(var s=-1,r=null==e?0:e.length;++s<r;)if(t(e[s],s,e))return!0;return!1};var Ht=function cacheHas(e,t){return e.has(t)};var It=function equalArrays(e,t,s,r,i,n){var o=1&s,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=n.get(e),u=n.get(t);if(l&&u)return l==t&&u==e;var h=-1,d=!0,p=2&s?new Pt:void 0;for(n.set(e,t),n.set(t,e);++h<a;){var f=e[h],b=t[h];if(r)var v=o?r(b,f,h,t,e,n):r(f,b,h,e,t,n);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!Tt(t,(function(e,t){if(!Ht(p,t)&&(f===e||i(f,e,s,r,n)))return p.push(t)}))){d=!1;break}}else if(f!==b&&!i(f,b,s,r,n)){d=!1;break}}return n.delete(e),n.delete(t),d},Wt=i.Uint8Array;var Nt=function mapToArray(e){var t=-1,s=Array(e.size);return e.forEach((function(e,r){s[++t]=[r,e]})),s};var qt=function setToArray(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s},Vt=n?n.prototype:void 0,Ut=Vt?Vt.valueOf:void 0;var Bt=function equalByTag(e,t,s,r,i,n,o){switch(s){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!n(new Wt(e),new Wt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return We(+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=Nt;case"[object Set]":var c=1&r;if(a||(a=qt),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=It(a(e),a(t),r,i,n,o);return o.delete(e),u;case"[object Symbol]":if(Ut)return Ut.call(e)==Ut.call(t)}return!1};var Gt=function arrayPush(e,t){for(var s=-1,r=t.length,i=e.length;++s<r;)e[i+s]=t[s];return e};var Qt=function baseGetAllKeys(e,t,s){var r=t(e);return a(e)?r:Gt(r,s(e))};var $t=function arrayFilter(e,t){for(var s=-1,r=null==e?0:e.length,i=0,n=[];++s<r;){var o=e[s];t(o,s,e)&&(n[i++]=o)}return n};var Zt=function stubArray(){return[]},Kt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Yt=Jt?function(e){return null==e?[]:(e=Object(e),$t(Jt(e),(function(t){return Kt.call(e,t)})))}:Zt;var Xt=function baseTimes(e,t){for(var s=-1,r=Array(e);++s<e;)r[s]=t(s);return r};var es=function baseIsArguments(e){return g(e)&&"[object Arguments]"==v(e)},ts=Object.prototype,ss=ts.hasOwnProperty,rs=ts.propertyIsEnumerable,is=es(function(){return arguments}())?es:function(e){return g(e)&&ss.call(e,"callee")&&!rs.call(e,"callee")};var ns=function stubFalse(){return!1},os=createCommonjsModule((function(e,t){var s=t&&!t.nodeType&&t,r=s&&e&&!e.nodeType&&e,n=r&&r.exports===s?i.Buffer:void 0,o=(n?n.isBuffer:void 0)||ns;e.exports=o})),as=/^(?:0|[1-9]\d*)$/;var cs=function isIndex(e,t){var s=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==s||"symbol"!=s&&as.test(e))&&e>-1&&e%1==0&&e<t};var ls=function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},us={};us["[object Float32Array]"]=us["[object Float64Array]"]=us["[object Int8Array]"]=us["[object Int16Array]"]=us["[object Int32Array]"]=us["[object Uint8Array]"]=us["[object Uint8ClampedArray]"]=us["[object Uint16Array]"]=us["[object Uint32Array]"]=!0,us["[object Arguments]"]=us["[object Array]"]=us["[object ArrayBuffer]"]=us["[object Boolean]"]=us["[object DataView]"]=us["[object Date]"]=us["[object Error]"]=us["[object Function]"]=us["[object Map]"]=us["[object Number]"]=us["[object Object]"]=us["[object RegExp]"]=us["[object Set]"]=us["[object String]"]=us["[object WeakMap]"]=!1;var hs=function baseIsTypedArray(e){return g(e)&&ls(e.length)&&!!us[v(e)]};var ds=function baseUnary(e){return function(t){return e(t)}},ps=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,n=i&&i.exports===r&&s.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=o})),fs=ps&&ps.isTypedArray,bs=fs?ds(fs):hs,vs=Object.prototype.hasOwnProperty;var gs=function arrayLikeKeys(e,t){var s=a(e),r=!s&&is(e),i=!s&&!r&&os(e),n=!s&&!r&&!i&&bs(e),o=s||r||i||n,c=o?Xt(e.length,String):[],l=c.length;for(var u in e)!t&&!vs.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||n&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||cs(u,l))||c.push(u);return c},ms=Object.prototype;var ys=function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ms)};var ws=function overArg(e,t){return function(s){return e(t(s))}}(Object.keys,Object),Os=Object.prototype.hasOwnProperty;var js=function baseKeys(e){if(!ys(e))return ws(e);var t=[];for(var s in Object(e))Os.call(e,s)&&"constructor"!=s&&t.push(s);return t};var xs=function isArrayLike(e){return null!=e&&ls(e.length)&&!Xe(e)};var Ss=function keys(e){return xs(e)?gs(e):js(e)};var As=function getAllKeys(e){return Qt(e,Ss,Yt)},_s=Object.prototype.hasOwnProperty;var ks=function equalObjects(e,t,s,r,i,n){var o=1&s,a=As(e),c=a.length;if(c!=As(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:_s.call(t,u)))return!1}var h=n.get(e),d=n.get(t);if(h&&d)return h==t&&d==e;var p=!0;n.set(e,t),n.set(t,e);for(var f=o;++l<c;){var b=e[u=a[l]],v=t[u];if(r)var g=o?r(v,b,u,t,e,n):r(b,v,u,e,t,n);if(!(void 0===g?b===v||i(b,v,s,r,n):g)){p=!1;break}f||(f="constructor"==u)}if(p&&!f){var m=e.constructor,y=t.constructor;m==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof y&&y instanceof y||(p=!1)}return n.delete(e),n.delete(t),p},Es=pt(i,"DataView"),Cs=pt(i,"Promise"),Ms=pt(i,"Set"),Ls=pt(i,"WeakMap"),Rs="[object Map]",Fs="[object Promise]",zs="[object Set]",Ds="[object WeakMap]",Ps="[object DataView]",Ts=it(Es),Hs=it(ft),Is=it(Cs),Ws=it(Ms),Ns=it(Ls),qs=v;(Es&&qs(new Es(new ArrayBuffer(1)))!=Ps||ft&&qs(new ft)!=Rs||Cs&&qs(Cs.resolve())!=Fs||Ms&&qs(new Ms)!=zs||Ls&&qs(new Ls)!=Ds)&&(qs=function(e){var t=v(e),s="[object Object]"==t?e.constructor:void 0,r=s?it(s):"";if(r)switch(r){case Ts:return Ps;case Hs:return Rs;case Is:return Fs;case Ws:return zs;case Ns:return Ds}return t});var Vs=qs,Us="[object Arguments]",Bs="[object Array]",Gs="[object Object]",Qs=Object.prototype.hasOwnProperty;var $s=function baseIsEqualDeep(e,t,s,r,i,n){var o=a(e),c=a(t),l=o?Bs:Vs(e),u=c?Bs:Vs(t),h=(l=l==Us?Gs:l)==Gs,d=(u=u==Us?Gs:u)==Gs,p=l==u;if(p&&os(e)){if(!os(t))return!1;o=!0,h=!1}if(p&&!h)return n||(n=new Ft),o||bs(e)?It(e,t,s,r,i,n):Bt(e,t,l,s,r,i,n);if(!(1&s)){var f=h&&Qs.call(e,"__wrapped__"),b=d&&Qs.call(t,"__wrapped__");if(f||b){var v=f?e.value():e,g=b?t.value():t;return n||(n=new Ft),i(v,g,s,r,n)}}return!!p&&(n||(n=new Ft),ks(e,t,s,r,i,n))};var Zs=function baseIsEqual(e,t,s,r,i){return e===t||(null==e||null==t||!g(e)&&!g(t)?e!=e&&t!=t:$s(e,t,s,r,baseIsEqual,i))};var Ks=function isEqual(e,t){return Zs(e,t)};const Js={},buildProxy=e=>({get(t,s){const r=Reflect.get(t,s);return r&&"object"==typeof r?new Proxy(r,buildProxy(e)):r},set:(t,s,r)=>(e.sync(s),Reflect.set(t,s,r)),deleteProperty:(t,s)=>(e.sync(s),Reflect.deleteProperty(t,s))});class ObservableObject{constructor(e,t={},s={}){if(this.id=e,Js[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=new Proxy(t,buildProxy(this)),this.options=s,Js[this.id]=this}destroy(){delete Js[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){Ks(this.get(e),t)||(this.data[e]=t)}get(e){return this.data[e]}delete(e){delete this.data[e]}syncAll(){Object.keys(this.data||{}).forEach(e=>{this.sync(e)})}bind(e,t,s="*"){this.bound[s]||(this.bound[s]={}),this.bound[s][e]=t,Object.keys(this.data).forEach(e=>{t(this.id,e,this.get(e))})}unbind(e,t="*"){this.bound[t][e]&&delete this.bound[t][e]}observers(){let e=0;for(const t in this.bound)this.bound.hasOwnProperty(t)&&e++;return e}sync(e){Object.keys(this.bound["*"]||{}).forEach(t=>{this.bound["*"][t](this.id,e,this.get(e))}),Object.keys(this.bound[e]||{}).forEach(t=>{this.bound[e][t](this.id,e,this.get(e))})}}let Ys,Xs,er,tr,sr,rr;class ObserverSubscriptionManager{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[],this.sleeping=!0}subscribe(e){!this.observers.length&&this.sleeping&&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(){this.sleeping=!0}wakeup(){this.sleeping=!1}notifyObservers(e,t){for(let s=0;s<this.observers.length;s++)this.observers[s][e]&&this.observers[s][e].apply(this.observers[s],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}Ys=new class DOMWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.mutationHandler=He((e,t)=>{this.observeDOM(e,t)},25,{maxWait:100}),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")}},Xs=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(),Ae.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),Ae.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Ae.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}}},er=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")}},tr=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?Ae.addClass(document.body,"have-orientation"):Ae.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")}},sr=new class WorkerWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let s=t,r=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});s=URL.createObjectURL(e),r=!0}this.workers[e]={worker:new Worker(s),observers:[]},r&&URL.revokeObjectURL(s),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const s=this.workers[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),s.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach(s=>{s.workerMessage&&s.workerMessage(e,t)})}wakeup(){super.wakeup()}sleep(){super.sleep()}},rr=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 s=(e=>Js[e])(e);if(s&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=s?{id:e,observable:s,observers:[],managed:!1}:{id:e,observable:new 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,s){this.registeredObservableObjects[t]||this.observableStart(t,s),this.registeredObservableObjects[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.registeredObservableObjects[t])throw new Error("ObservableObject unSubscribe "+t+" does not exist");const s=this.registeredObservableObjects[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),!s.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,s,r){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach(i=>{i.observableChanged&&i.observableChanged(e,t,s,r)})}};var ir=je((function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}));let nr=0;const or=[],ar="customElements"in window,cr={},registerSargassoClass=(e,t)=>{if(cr[e]=t,ar){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-"+ir(e),new Function("registeredClasses",t)(cr))}},lr=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent"];class Sargasso{constructor(e,t={}){this.uid=++nr,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),or.push(this),this.options.watchDOM&&Ys.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xs.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&er.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&tr.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==lr.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this.started=!0}sleep(){this.options.watchDOM&&Ys.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xs.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&er.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&tr.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),Ae.offAll(this.element),this.started=!1}DOMChanged(){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}observableChanged(e,t,s){this.render()}setMetaData(e,t){Ae.setMetaData(this.element,e,t)}getMetaData(e){return Ae.getMetaData(this.element,e)}on(e,t,s,r){Ae.on(this.constructor.name+"-"+this.uid,this.element,e,t,s,r)}off(e,t){Ae.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,s,r){Ae.once(this.constructor.name+"-"+this.uid,this.element,e,t,s,r)}notifyAll(e,t){if(-1===lr.indexOf(e))throw new Error("invalid event name "+e);for(let s=0;s<or.length;s++){const r=or[s];r!==this&&r[e]&&r[e].apply(r,t)}}notifyElement(e,t,s){if(-1===lr.indexOf(t))throw new Error("invalid event name "+t);const r=this.getMetaData("registeredResponsiveControllers");if(r)for(let e=0;e<r.length;e++){const i=r[e];i!==this&&i[t]&&i[t].apply(i,s)}}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Ae.hasClass(this.element,e)}addClass(e){Ae.addClass(this.element,e)}removeClass(e){Ae.removeClass(this.element,e)}setCSS(e){Ae.setCSS(this.element,e)}isVisible(){return Ae.isVisible(this.element)}workerStart(e,t){return this.workers[e]=sr.registerWorker(e,t),sr.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 rr.subscribe(this,e,t),this.observables[e]=rr.getObservable(e),this.observables[e]}observableStop(e){this.observables[e]&&(rr.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]&&(sr.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!==or.indexOf(this)&&or.splice(or.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(){Xs.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 s=e[t];if(Xs.inViewPort(s)){const r=s.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let s=0;s<r.length;s++){new cr[r[s]](e[t]).start()}s.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 s=0;s<t.length;s++)try{new cr[t[s]](e).start()}catch(e){console.log("error instantiating "+t[s],e,cr)}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<or.length;e++)or[e].options.immortal||or[e].options.isCustomElement||document.body.contains(or[e].element)||t.push(or[e]);for(let e=0;e<t.length;e++)t[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);var ur=t&&t.__assign||function(){return(ur=Object.assign||function(e){for(var t,s=1,r=arguments.length;s<r;s++)for(var i in t=arguments[s])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function stringifyAttribute(e,t){if(!t)return"";var s="; "+e;return!0===t?s:s+"="+t}function encode(e,t,s){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function stringifyAttributes(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return stringifyAttribute("Expires",e.expires?e.expires.toUTCString():"")+stringifyAttribute("Domain",e.domain)+stringifyAttribute("Path",e.path)+stringifyAttribute("Secure",e.secure)+stringifyAttribute("SameSite",e.sameSite)}(s)}var hr=encode;function parse(e){for(var t={},s=e?e.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<s.length;i++){var n=s[i].split("="),o=n.slice(1).join("=");'"'===o.charAt(0)&&(o=o.slice(1,-1));try{t[n[0].replace(r,decodeURIComponent)]=o.replace(r,decodeURIComponent)}catch(e){}}return t}var dr=parse;function getAll(){return parse(document.cookie)}var pr=getAll;var fr=function get(e){return getAll()[e]};function set(e,t,s){document.cookie=encode(e,t,ur({path:"/"},s))}var br=set;var vr=function remove(e,t){set(e,"",ur(ur({},t),{expires:-1}))},gr=Object.defineProperty({encode:hr,parse:dr,getAll:pr,get:fr,set:br,remove:vr},"__esModule",{value:!0});const mr=[{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=mr,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){Ae.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){Ae.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=()=>{Ae.removeClass(document.body,"landscape"),Ae.addClass(document.body,"portrait")};this.queueFrame(frame),this.orientation="portrait"}}else if("landscape"!==this.orientation){const frame=()=>{Ae.removeClass(document.body,"portrait"),Ae.addClass(document.body,"landscape")};this.queueFrame(frame),this.orientation="landscape"}for(let s=0;s<this.widths.length-1;s++)if(t>=this.widths[s]&&t<this.widths[s+1]){e=this.classes[s];break}}let t=0;if(e!==this.scale){++t;const frame=()=>{for(let t=0;t<this.classes.length;t++)this.classes[t]!==e?(Ae.addClass(document.body,"not-"+this.classes[t]),Ae.removeClass(document.body,this.classes[t]),Ae.removeClass(document.body,"shown-"+this.classes[t]),Ae.removeClass(document.body,"hidden-"+this.classes[t])):Ae.removeClass(document.body,"not-"+this.classes[t]);Ae.addClass(document.body,e),Ae.addClass(document.body,"shown-"+e),Ae.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 gr.get(e)}setCookie(e,t,s){const r={path:"/",domain:this.options.cookieDomain||null,expires:s};gr.set(e,t,r)}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 s=e[t],r=s.getAttribute("id");this.cachedMarkup[r]=s.innerHTML}super.start(),window.addEventListener("popstate",e=>{this.watchPopState(e)},!1)}DOMChanged(){super.DOMChanged(),this.hijaxLinks()}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const s=t[e],r=s.getAttribute("href");!r||s.getAttribute("data-hijaxed")||s.getAttribute("target")||s.hasAttribute("data-no-hijax")||this.excludeRegex.exec(r)||(s.setAttribute("data-hijaxed",!0),s.addEventListener("click",e=>{e.preventDefault(),this.setPage(r)},!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,(t,s,r)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),s?this.currentPage=location.pathname+location.search:this.loadPage(r||e)})}loadPage(e){this.queueFrame(()=>{Ae.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){Xs.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Ae.removeClass(document.body,"hijax-loading")};this.queueFrame(frame),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let s=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;s||(s="Could not connect to server."),this.options.onError?this.options.onError(e,s):alert("Error loading page: "+s)}},t.send()}processScripts(e){Array.from(e).forEach(e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)})}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach(e=>{e.remove()});const s=e.split(/(<body[^>]*>|<\/body>)/gi),r=makeFragment(s[2]),i=document.querySelectorAll("[data-hijax]");for(let e=0;e<i.length;e++){const t=i[e],s=t.getAttribute("id"),n=r.getElementById(s);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[s]===n.innerHTML)continue;this.cachedMarkup[s]=n.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&n.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===n.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(n.querySelectorAll("script"));const frame=()=>{t.parentNode.replaceChild(n,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(n)};this.queueFrame(frame)}}}registerSargassoClass("HijaxLoader",HijaxLoader);const makeFragment=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),s=document.createElement("div");return s.insertAdjacentHTML("afterBegin",e),t.appendChild(s),t};e.loadPageHandler=void 0;const yr={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Xs.setOptions(t),t.breakpoints){new Breakpoints(document.body,t.breakpoints).start()}if(t.hijax){const s=new HijaxLoader(document.body,t.hijax);s.start(),e.loadPageHandler=s.setPage.bind(s)}else e.loadPageHandler=e=>{document.location.href=e};new SargassoSupervisor(document.body,t).start(t)},elementTools:Ae},wr={theDOMWatcher:Ys,theScrollWatcher:Xs,theResizeWatcher:er,theOrientationWatcher:tr,theWorkerWatcher:sr,theObservableObjectWatcher:rr};return e.ObservableObject=ObservableObject,e.Sargasso=Sargasso,e.services=wr,e.utils=yr,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 s="object"==typeof t&&t&&t.Object===Object&&t,r="object"==typeof self&&self&&self.Object===Object&&self,i=s||r||Function("return this")(),n=i.Symbol;var o=function arrayMap(e,t){for(var s=-1,r=null==e?0:e.length,i=Array(r);++s<r;)i[s]=t(e[s],s,e);return i},a=Array.isArray,c=Object.prototype,l=c.hasOwnProperty,h=c.toString,u=n?n.toStringTag:void 0;var d=function getRawTag(e){var t=l.call(e,u),s=e[u];try{e[u]=void 0;var r=!0}catch(e){}var i=h.call(e);return r&&(t?e[u]=s:delete e[u]),i},p=Object.prototype.toString;var f=function objectToString(e){return p.call(e)},b=n?n.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=n?n.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,s){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(s=s>i?i:s)<0&&(s+=i),i=t>s?0:s-t>>>0,t>>>=0;for(var n=Array(i);++r<i;)n[r]=e[r+t];return n};var S=function castSlice(e,t,s){var r=e.length;return s=void 0===s?r:s,!t&&s>=r?e:x(e,t,s)},A=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var k=function hasUnicode(e){return A.test(e)};var _=function asciiToArray(e){return e.split("")},E="[\\ud800-\\udfff]",C="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",M="\\ud83c[\\udffb-\\udfff]",D="[^\\ud800-\\udfff]",R="(?:\\ud83c[\\udde6-\\uddff]){2}",L="[\\ud800-\\udbff][\\udc00-\\udfff]",F="(?:"+C+"|"+M+")"+"?",z="[\\ufe0e\\ufe0f]?",T=z+F+("(?:\\u200d(?:"+[D,R,L].join("|")+")"+z+F+")*"),P="(?:"+[D+C+"?",C,R,L,E].join("|")+")",H=RegExp(M+"(?="+M+")|"+P+T,"g");var W=function unicodeToArray(e){return e.match(H)||[]};var I=function stringToArray(e){return k(e)?W(e):_(e)};var N=function createCaseFirst(e){return function(t){t=j(t);var s=k(t)?I(t):void 0,r=s?s[0]:t.charAt(0),i=s?S(s,1).join(""):t.slice(1);return r[e]()+i}}("toUpperCase");var q=function capitalize(e){return N(j(e).toLowerCase())};var V=function arrayReduce(e,t,s,r){var i=-1,n=null==e?0:e.length;for(r&&n&&(s=e[++i]);++i<n;)s=t(s,e[i],i,e);return s};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($)||[]},K=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var J=function hasUnicodeWord(e){return K.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",se="["+te+"]",re="\\d+",ie="[\\u2700-\\u27bf]",ne="["+X+"]",oe="[^\\ud800-\\udfff"+te+re+Y+X+ee+"]",ae="(?:\\ud83c[\\udde6-\\uddff]){2}",ce="[\\ud800-\\udbff][\\udc00-\\udfff]",le="["+ee+"]",he="(?:"+ne+"|"+oe+")",ue="(?:"+le+"|"+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="(?:"+[ie,ae,ce].join("|")+")"+ve,me=RegExp([le+"?"+ne+"+"+de+"(?="+[se,le,"$"].join("|")+")",ue+"+"+pe+"(?="+[se,le+he,"$"].join("|")+")",le+"?"+he+"+"+de,le+"+"+pe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",re,ge].join("|"),"g");var we=function unicodeWords(e){return e.match(me)||[]};var ye=function words(e,t,s){return e=j(e),void 0===(t=s?void 0:t)?J(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,s){return t=t.toLowerCase(),e+(s?q(t):t)}));const Se=new WeakMap,isVisible=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),setMetaData=(e,t,s)=>{const r=Se.get(e)||{};s?r[t]=s:delete r[t],Se.set(e,r)},getMetaData=(e,t)=>{const s=Se.get(e)||{};return t?s[t]:s},on=function(e,t,s,r,i,n,o){"function"==typeof r&&(o=n,n=i,i=r,r=void 0);const a="on:"+e+"-"+s+"-"+r;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:s,selector:r||void 0,fn:n=>{o&&off(e,t,s,r),r?Array.from(t.querySelectorAll(r)).forEach(e=>{(n.target===e||e.contains(n.target))&&i(n,e)}):i(n)},options:n||!1};setMetaData(t,a,c),s.split(/[\s,]+/).forEach(e=>{t.addEventListener(e.trim(),c.fn,c.options)})},off=function(e,t,s,r){const i="on:"+e+"-"+s+"-"+r,n=getMetaData(t,i);n&&(s.split(/[\s,]+/).forEach(e=>{t.removeEventListener(e.trim(),n.fn,n.options)}),setMetaData(t,i))},Ae={hasClass:(e,t)=>-1!==(e.className||"").split(/\s+/).indexOf(t),addClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1===s.indexOf(e)&&s.push(e)}),e.className=s.join(" ")},removeClass:(e,t)=>{const s=(e.className||"").split(/\s+/);Array.isArray(t)||(t=t.split(/[\s,]/)),t.forEach(e=>{e=e.trim(),-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1)}),e.className=s.join(" ")},isVisible:isVisible,inViewPort:(e,t=window)=>{const s=e.getBoundingClientRect(),r=isVisible(e),i=s.bottom<0;let n;return n=t.self===window?s.top>(window.innerHeight||document.documentElement.clientHeight):s.top>t.clientHeight,r&&!n&&!i},setCSS:(e,t)=>{for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const r=xe(s);e.style[r]=t[s]||null}},setMetaData:setMetaData,getMetaData:getMetaData,on:on,off:off,once:function(e,t,s,r,i,n){"function"==typeof r&&(n=i,i=r,r=void 0),on(e,t,s,r,i,n,!0)},offAll:function(e){const t=Se.get(e)||{},s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e.match(/^on:/)&&s.push(e);s.forEach(s=>{off(t[s].uid,e,t[s].events,t[s].selector)})}};var ke=function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},now_1=function(){return i.Date.now()},_e=/\s/;var Ee=function trimmedEndIndex(e){for(var t=e.length;t--&&_e.test(e.charAt(t)););return t},Ce=/^\s+/;var Me=function baseTrim(e){return e?e.slice(0,Ee(e)+1).replace(Ce,""):e},De=/^[-+]0x[0-9a-f]+$/i,Re=/^0b[01]+$/i,Le=/^0o[0-7]+$/i,Fe=parseInt;var ze=function toNumber(e){if("number"==typeof e)return e;if(m(e))return NaN;if(ke(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ke(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Me(e);var s=Re.test(e);return s||Le.test(e)?Fe(e.slice(2),s?2:8):De.test(e)?NaN:+e},Te=Math.max,Pe=Math.min;var He=function debounce(e,t,s){var r,i,n,o,a,c,l=0,h=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function invokeFunc(t){var s=r,n=i;return r=i=void 0,l=t,o=e.apply(n,s)}function leadingEdge(e){return l=e,a=setTimeout(timerExpired,t),h?invokeFunc(e):o}function shouldInvoke(e){var s=e-c;return void 0===c||s>=t||s<0||u&&e-l>=n}function timerExpired(){var e=now_1();if(shouldInvoke(e))return trailingEdge(e);a=setTimeout(timerExpired,function remainingWait(e){var s=t-(e-c);return u?Pe(s,n-(e-l)):s}(e))}function trailingEdge(e){return a=void 0,d&&r?invokeFunc(e):(r=i=void 0,o)}function debounced(){var e=now_1(),s=shouldInvoke(e);if(r=arguments,i=this,c=e,s){if(void 0===a)return leadingEdge(c);if(u)return clearTimeout(a),a=setTimeout(timerExpired,t),invokeFunc(c)}return void 0===a&&(a=setTimeout(timerExpired,t)),o}return t=ze(t)||0,ke(s)&&(h=!!s.leading,n=(u="maxWait"in s)?Te(ze(s.maxWait)||0,t):n,d="trailing"in s?!!s.trailing:d),debounced.cancel=function cancel(){void 0!==a&&clearTimeout(a),l=0,r=c=i=a=void 0},debounced.flush=function flush(){return void 0===a?o:trailingEdge(now_1())},debounced};var We=function listCacheClear(){this.__data__=[],this.size=0};var Ie=function eq(e,t){return e===t||e!=e&&t!=t};var Ne=function assocIndexOf(e,t){for(var s=e.length;s--;)if(Ie(e[s][0],t))return s;return-1},qe=Array.prototype.splice;var Ve=function listCacheDelete(e){var t=this.__data__,s=Ne(t,e);return!(s<0)&&(s==t.length-1?t.pop():qe.call(t,s,1),--this.size,!0)};var Ue=function listCacheGet(e){var t=this.__data__,s=Ne(t,e);return s<0?void 0:t[s][1]};var Be=function listCacheHas(e){return Ne(this.__data__,e)>-1};var Ge=function listCacheSet(e,t){var s=this.__data__,r=Ne(s,e);return r<0?(++this.size,s.push([e,t])):s[r][1]=t,this};function ListCache(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}ListCache.prototype.clear=We,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__,s=t.delete(e);return this.size=t.size,s};var Ke=function stackGet(e){return this.__data__.get(e)};var Je=function stackHas(e){return this.__data__.has(e)};var Ye,Xe=function isFunction(e){if(!ke(e))return!1;var t=v(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},et=i["__core-js_shared__"],tt=(Ye=/[^.]+$/.exec(et&&et.keys&&et.keys.IE_PROTO||""))?"Symbol(src)_1."+Ye:"";var st=function isMasked(e){return!!tt&&tt in e},rt=Function.prototype.toString;var it=function toSource(e){if(null!=e){try{return rt.call(e)}catch(e){}try{return e+""}catch(e){}}return""},nt=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,ct=ot.toString,lt=at.hasOwnProperty,ht=RegExp("^"+ct.call(lt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ut=function baseIsNative(e){return!(!ke(e)||st(e))&&(Xe(e)?ht:nt).test(it(e))};var dt=function getValue(e,t){return null==e?void 0:e[t]};var pt=function getNative(e,t){var s=dt(e,t);return ut(s)?s:void 0},ft=pt(i,"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 s=t[e];return"__lodash_hash_undefined__"===s?void 0:s}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 s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=bt&&void 0===t?"__lodash_hash_undefined__":t,this};function Hash(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[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 At=function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var kt=function getMapData(e,t){var s=e.__data__;return At(t)?s["string"==typeof t?"string":"hash"]:s.map};var _t=function mapCacheDelete(e){var t=kt(this,e).delete(e);return this.size-=t?1:0,t};var Et=function mapCacheGet(e){return kt(this,e).get(e)};var Ct=function mapCacheHas(e){return kt(this,e).has(e)};var Mt=function mapCacheSet(e,t){var s=kt(this,e),r=s.size;return s.set(e,t),this.size+=s.size==r?0:1,this};function MapCache(e){var t=-1,s=null==e?0:e.length;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}MapCache.prototype.clear=St,MapCache.prototype.delete=_t,MapCache.prototype.get=Et,MapCache.prototype.has=Ct,MapCache.prototype.set=Mt;var Dt=MapCache;var Rt=function stackSet(e,t){var s=this.__data__;if(s instanceof Qe){var r=s.__data__;if(!ft||r.length<199)return r.push([e,t]),this.size=++s.size,this;s=this.__data__=new Dt(r)}return s.set(e,t),this.size=s.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=Ke,Stack.prototype.has=Je,Stack.prototype.set=Rt;var Lt=Stack;var Ft=function setCacheAdd(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var zt=function setCacheHas(e){return this.__data__.has(e)};function SetCache(e){var t=-1,s=null==e?0:e.length;for(this.__data__=new Dt;++t<s;)this.add(e[t])}SetCache.prototype.add=SetCache.prototype.push=Ft,SetCache.prototype.has=zt;var Tt=SetCache;var Pt=function arraySome(e,t){for(var s=-1,r=null==e?0:e.length;++s<r;)if(t(e[s],s,e))return!0;return!1};var Ht=function cacheHas(e,t){return e.has(t)};var Wt=function equalArrays(e,t,s,r,i,n){var o=1&s,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=n.get(e),h=n.get(t);if(l&&h)return l==t&&h==e;var u=-1,d=!0,p=2&s?new Tt:void 0;for(n.set(e,t),n.set(t,e);++u<a;){var f=e[u],b=t[u];if(r)var v=o?r(b,f,u,t,e,n):r(f,b,u,e,t,n);if(void 0!==v){if(v)continue;d=!1;break}if(p){if(!Pt(t,(function(e,t){if(!Ht(p,t)&&(f===e||i(f,e,s,r,n)))return p.push(t)}))){d=!1;break}}else if(f!==b&&!i(f,b,s,r,n)){d=!1;break}}return n.delete(e),n.delete(t),d},It=i.Uint8Array;var Nt=function mapToArray(e){var t=-1,s=Array(e.size);return e.forEach((function(e,r){s[++t]=[r,e]})),s};var qt=function setToArray(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s},Vt=n?n.prototype:void 0,Ut=Vt?Vt.valueOf:void 0;var Bt=function equalByTag(e,t,s,r,i,n,o){switch(s){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!n(new It(e),new It(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ie(+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=Nt;case"[object Set]":var c=1&r;if(a||(a=qt),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var h=Wt(a(e),a(t),r,i,n,o);return o.delete(e),h;case"[object Symbol]":if(Ut)return Ut.call(e)==Ut.call(t)}return!1};var Gt=function arrayPush(e,t){for(var s=-1,r=t.length,i=e.length;++s<r;)e[i+s]=t[s];return e};var Qt=function baseGetAllKeys(e,t,s){var r=t(e);return a(e)?r:Gt(r,s(e))};var $t=function arrayFilter(e,t){for(var s=-1,r=null==e?0:e.length,i=0,n=[];++s<r;){var o=e[s];t(o,s,e)&&(n[i++]=o)}return n};var Zt=function stubArray(){return[]},Kt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Yt=Jt?function(e){return null==e?[]:(e=Object(e),$t(Jt(e),(function(t){return Kt.call(e,t)})))}:Zt;var Xt=function baseTimes(e,t){for(var s=-1,r=Array(e);++s<e;)r[s]=t(s);return r};var es=function baseIsArguments(e){return g(e)&&"[object Arguments]"==v(e)},ts=Object.prototype,ss=ts.hasOwnProperty,rs=ts.propertyIsEnumerable,is=es(function(){return arguments}())?es:function(e){return g(e)&&ss.call(e,"callee")&&!rs.call(e,"callee")};var ns=function stubFalse(){return!1},os=createCommonjsModule((function(e,t){var s=t&&!t.nodeType&&t,r=s&&e&&!e.nodeType&&e,n=r&&r.exports===s?i.Buffer:void 0,o=(n?n.isBuffer:void 0)||ns;e.exports=o})),as=/^(?:0|[1-9]\d*)$/;var cs=function isIndex(e,t){var s=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==s||"symbol"!=s&&as.test(e))&&e>-1&&e%1==0&&e<t};var ls=function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},hs={};hs["[object Float32Array]"]=hs["[object Float64Array]"]=hs["[object Int8Array]"]=hs["[object Int16Array]"]=hs["[object Int32Array]"]=hs["[object Uint8Array]"]=hs["[object Uint8ClampedArray]"]=hs["[object Uint16Array]"]=hs["[object Uint32Array]"]=!0,hs["[object Arguments]"]=hs["[object Array]"]=hs["[object ArrayBuffer]"]=hs["[object Boolean]"]=hs["[object DataView]"]=hs["[object Date]"]=hs["[object Error]"]=hs["[object Function]"]=hs["[object Map]"]=hs["[object Number]"]=hs["[object Object]"]=hs["[object RegExp]"]=hs["[object Set]"]=hs["[object String]"]=hs["[object WeakMap]"]=!1;var us=function baseIsTypedArray(e){return g(e)&&ls(e.length)&&!!hs[v(e)]};var ds=function baseUnary(e){return function(t){return e(t)}},ps=createCommonjsModule((function(e,t){var r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,n=i&&i.exports===r&&s.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=o})),fs=ps&&ps.isTypedArray,bs=fs?ds(fs):us,vs=Object.prototype.hasOwnProperty;var gs=function arrayLikeKeys(e,t){var s=a(e),r=!s&&is(e),i=!s&&!r&&os(e),n=!s&&!r&&!i&&bs(e),o=s||r||i||n,c=o?Xt(e.length,String):[],l=c.length;for(var h in e)!t&&!vs.call(e,h)||o&&("length"==h||i&&("offset"==h||"parent"==h)||n&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||cs(h,l))||c.push(h);return c},ms=Object.prototype;var ws=function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ms)};var ys=function overArg(e,t){return function(s){return e(t(s))}}(Object.keys,Object),Os=Object.prototype.hasOwnProperty;var js=function baseKeys(e){if(!ws(e))return ys(e);var t=[];for(var s in Object(e))Os.call(e,s)&&"constructor"!=s&&t.push(s);return t};var xs=function isArrayLike(e){return null!=e&&ls(e.length)&&!Xe(e)};var Ss=function keys(e){return xs(e)?gs(e):js(e)};var As=function getAllKeys(e){return Qt(e,Ss,Yt)},ks=Object.prototype.hasOwnProperty;var _s=function equalObjects(e,t,s,r,i,n){var o=1&s,a=As(e),c=a.length;if(c!=As(t).length&&!o)return!1;for(var l=c;l--;){var h=a[l];if(!(o?h in t:ks.call(t,h)))return!1}var u=n.get(e),d=n.get(t);if(u&&d)return u==t&&d==e;var p=!0;n.set(e,t),n.set(t,e);for(var f=o;++l<c;){var b=e[h=a[l]],v=t[h];if(r)var g=o?r(v,b,h,t,e,n):r(b,v,h,e,t,n);if(!(void 0===g?b===v||i(b,v,s,r,n):g)){p=!1;break}f||(f="constructor"==h)}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 n.delete(e),n.delete(t),p},Es=pt(i,"DataView"),Cs=pt(i,"Promise"),Ms=pt(i,"Set"),Ds=pt(i,"WeakMap"),Rs="[object Map]",Ls="[object Promise]",Fs="[object Set]",zs="[object WeakMap]",Ts="[object DataView]",Ps=it(Es),Hs=it(ft),Ws=it(Cs),Is=it(Ms),Ns=it(Ds),qs=v;(Es&&qs(new Es(new ArrayBuffer(1)))!=Ts||ft&&qs(new ft)!=Rs||Cs&&qs(Cs.resolve())!=Ls||Ms&&qs(new Ms)!=Fs||Ds&&qs(new Ds)!=zs)&&(qs=function(e){var t=v(e),s="[object Object]"==t?e.constructor:void 0,r=s?it(s):"";if(r)switch(r){case Ps:return Ts;case Hs:return Rs;case Ws:return Ls;case Is:return Fs;case Ns:return zs}return t});var Vs=qs,Us="[object Arguments]",Bs="[object Array]",Gs="[object Object]",Qs=Object.prototype.hasOwnProperty;var $s=function baseIsEqualDeep(e,t,s,r,i,n){var o=a(e),c=a(t),l=o?Bs:Vs(e),h=c?Bs:Vs(t),u=(l=l==Us?Gs:l)==Gs,d=(h=h==Us?Gs:h)==Gs,p=l==h;if(p&&os(e)){if(!os(t))return!1;o=!0,u=!1}if(p&&!u)return n||(n=new Lt),o||bs(e)?Wt(e,t,s,r,i,n):Bt(e,t,l,s,r,i,n);if(!(1&s)){var f=u&&Qs.call(e,"__wrapped__"),b=d&&Qs.call(t,"__wrapped__");if(f||b){var v=f?e.value():e,g=b?t.value():t;return n||(n=new Lt),i(v,g,s,r,n)}}return!!p&&(n||(n=new Lt),_s(e,t,s,r,i,n))};var Zs=function baseIsEqual(e,t,s,r,i){return e===t||(null==e||null==t||!g(e)&&!g(t)?e!=e&&t!=t:$s(e,t,s,r,baseIsEqual,i))};var Ks=function isEqual(e,t){return Zs(e,t)};const Js={},buildProxy=e=>({get(t,s){const r=Reflect.get(t,s);return r&&"object"==typeof r?new Proxy(r,buildProxy(e)):r},set:(t,s,r)=>(e.sync(s),Reflect.set(t,s,r)),deleteProperty:(t,s)=>(e.sync(s),Reflect.deleteProperty(t,s))});class ObservableObject{constructor(e,t={},s={}){if(this.id=e,Js[this.id])throw new Error("ObservableObject "+e+" already exists.");this.bound={},this.data=new Proxy(t,buildProxy(this)),this.options=s,Js[this.id]=this}destroy(){delete Js[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){Ks(this.get(e),t)||(this.data[e]=t)}get(e){return this.data[e]}delete(e){delete this.data[e]}syncAll(){Object.keys(this.data||{}).forEach(e=>{this.sync(e)})}bind(e,t,s="*"){this.bound[s]||(this.bound[s]={}),this.bound[s][e]=t,Object.keys(this.data).forEach(e=>{t(this.id,e,this.get(e))})}unbind(e,t="*"){this.bound[t][e]&&delete this.bound[t][e]}observers(){let e=0;for(const t in this.bound)this.bound.hasOwnProperty(t)&&e++;return e}sync(e){Object.keys(this.bound["*"]||{}).forEach(t=>{this.bound["*"][t](this.id,e,this.get(e))}),Object.keys(this.bound[e]||{}).forEach(t=>{this.bound[e][t](this.id,e,this.get(e))})}}let Ys,Xs,er,tr,sr,rr;class ObserverSubscriptionManager{constructor(e){this.options=e,this.observers=[],this.pendingAnimationFrame=void 0,this.frameQueue=[],this.sleeping=!0}subscribe(e){!this.observers.length&&this.sleeping&&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(){this.sleeping=!0}wakeup(){this.sleeping=!1}notifyObservers(e,t){for(let s=0;s<this.observers.length;s++)this.observers[s][e]&&this.observers[s][e].apply(this.observers[s],t||[])}flushQueue(){this.pendingAnimationFrame&&(cancelAnimationFrame(this.pendingAnimationFrame),this.pendingAnimationFrame=void 0),this.frameQueue=[]}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}processQueue(){this.pendingAnimationFrame=void 0;const e=this.frameQueue.slice(0);this.frameQueue=[];for(let t=0;t<e.length;t++)e[t]()}}class DOMWatcher extends ObserverSubscriptionManager{constructor(e={}){super(e),this.mutationHandler=He((e,t)=>{this.observeDOM(this.options.shadowDOM||document.body)},25,{maxWait:100}),this.mutationObserver=new MutationObserver(this.mutationHandler,!1)}subscribe(e){super.subscribe(e),e.watchDOM(this.options.shadowDOM||document.body)}wakeup(){super.wakeup(),this.mutationObserver.observe(this.options.shadowDOM||document.body,{childList:!0,subtree:!0})}sleep(){super.sleep(),this.mutationObserver.disconnect()}observeDOM(e){this.notifyObservers("watchDOM",[e||this.options.shadowDOM||document.body])}}Ys=new DOMWatcher,Xs=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(),Ae.on("theScrollWatcher",this.scrollElement,"scroll",()=>{this.trigger()})}sleep(){super.sleep(),Ae.off("theScrollWatcher",this.scrollElement,"scroll")}inViewPort(e){return Ae.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}}},er=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")}},tr=new class OrientationWatcher extends ObserverSubscriptionManager{constructor(e){super(e),"onorientationchange"in window?Ae.addClass(document.body,"have-orientation"):Ae.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")}},sr=new class WorkerWatcher extends ObserverSubscriptionManager{constructor(e){super(e),this.workers={}}registerWorker(e,t){if(!this.workers[e]){let s=t,r=!1;if(!t.match(/^(http|\/)/i)){const e=new Blob([t],{type:"text/javascript"});s=URL.createObjectURL(e),r=!0}this.workers[e]={worker:new Worker(s),observers:[]},r&&URL.revokeObjectURL(s),this.workers[e].worker.onmessage=t=>{this.workerMessage(e,t)}}return this.workers[e].worker}subscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");this.workers[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.workers[t])throw new Error("worker "+t+" does not exist");const s=this.workers[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),s.length||(this.workers[t].worker.terminate(),delete this.workers[t]),super.unSubscribe(e)}workerMessage(e,t){this.workers[e].observers.forEach(s=>{s.workerMessage&&s.workerMessage(e,t)})}wakeup(){super.wakeup()}sleep(){super.sleep()}},rr=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 s=(e=>Js[e])(e);if(s&&void 0!==t)throw new Error("ObservableObject "+e+" already exists, can't build.");return this.registeredObservableObjects[e]||(this.registeredObservableObjects[e]=s?{id:e,observable:s,observers:[],managed:!1}:{id:e,observable:new 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,s){this.registeredObservableObjects[t]||this.observableStart(t,s),this.registeredObservableObjects[t].observers.push(e),super.subscribe(e)}unSubscribe(e,t){if(!this.registeredObservableObjects[t])throw new Error("ObservableObject unSubscribe "+t+" does not exist");const s=this.registeredObservableObjects[t].observers;-1!==s.indexOf(e)&&s.splice(s.indexOf(e),1),!s.length&&this.registeredObservableObjects[t].managed&&this.observableDestroy(t),super.unSubscribe(e)}notify(e,t,s,r){if(!this.registeredObservableObjects[e])throw new Error("ObservableObject notify "+e+" does not exist");this.registeredObservableObjects[e].observers.forEach(i=>{i.observableChanged&&i.observableChanged(e,t,s,r)})}};var ir=je((function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}));let nr=0;const or=[],ar="customElements"in window,cr={},registerSargassoClass=(e,t)=>{if(cr[e]=t,ar){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-"+ir(e),new Function("registeredClasses",t)(cr))}},lr=["DOMChanged","didScroll","didResize","didBreakpoint","enterViewport","exitViewport","enterFullscreen","exitFullscreen","newPage","elementEvent","workerOnMessage","observableChanged"];class Sargasso{constructor(e,t={}){if(this.uid=++nr,this.element=e,t.shadowDOM){this.shadowDOM=e.attachShadow({mode:"open"}),this.shadowRoot=document.createElement("div"),this.shadowDOM.append(this.shadowRoot),this.hostElement=this.element,this.element=this.shadowRoot,this.hostTemplates={};const t=this.hostElement.querySelectorAll("template");t.length&&t.forEach(e=>{e.getAttribute("id")&&(this.hostTemplates[e.getAttribute("id")]=e.content.cloneNode(!0))})}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),or.push(this),this.shadowDOM&&(this.shadowDOMWatcher||(this.shadowDOMWatcher=new DOMWatcher({shadowDOM:this.shadowRoot})),this.shadowDOMWatcher.subscribe(this)),this.options.watchDOM&&Ys.subscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xs.subscribe(this),(this.options.watchResize||this.options.watchViewport)&&er.subscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&tr.subscribe(this),this.elementListener=e=>{e.detail&&e.detail.sargassoEvent&&-1!==lr.indexOf(e.detail.sargassoEvent)?this[e.detail.sargassoEvent].apply(this,e.detail.sargassoEventOptions||[]):this.elementEvent(e)},this.element.addEventListener("sargasso",this.elementListener),this.started=!0}sleep(){this.shadowDOM&&this.shadowDOMWatcher.unSubscribe(this),this.options.watchDOM&&Ys.unSubscribe(this),(this.options.watchScroll||this.options.watchViewport)&&Xs.unSubscribe(this),(this.options.watchResize||this.options.watchViewport)&&er.unSubscribe(this),(this.options.watchOrientation||this.options.watchViewport)&&tr.unSubscribe(this),this.element.removeEventListener("sargasso",this.elementListener),Ae.offAll(this.element),this.started=!1}DOMChanged(e){}didScroll(){}didResize(){}didBreakpoint(){}enterViewport(){}exitViewport(){}enterFullscreen(){}exitFullscreen(){}newPage(e,t){}elementEvent(e){}workerOnMessage(e,t){}observableChanged(e,t,s){this.render()}setMetaData(e,t){Ae.setMetaData(this.element,e,t)}getMetaData(e){return Ae.getMetaData(this.element,e)}on(e,t,s,r){Ae.on(this.constructor.name+"-"+this.uid,this.element,e,t,s,r)}off(e,t){Ae.off(this.constructor.name+"-"+this.uid,this.element,e,t)}once(e,t,s,r){Ae.once(this.constructor.name+"-"+this.uid,this.element,e,t,s,r)}notifyAll(e,t){if(-1===lr.indexOf(e))throw new Error("invalid event name "+e);for(let s=0;s<or.length;s++){const r=or[s];r!==this&&r[e]&&r[e].apply(r,t)}}notifyElement(e,t,s){if(-1===lr.indexOf(t))throw new Error("invalid event name "+t);const r=this.getMetaData("registeredResponsiveControllers");if(r)for(let e=0;e<r.length;e++){const i=r[e];i!==this&&i[t]&&i[t].apply(i,s)}}queueFrame(e){this.frameQueue.push(e.bind(this)),this.pendingAnimationFrame||(this.pendingAnimationFrame=requestAnimationFrame(()=>{this.processQueue()}))}wantFullscreen(e){e?this.enterFullscreen():this.exitFullscreen()}hasClass(e){return Ae.hasClass(this.element,e)}addClass(e){Ae.addClass(this.element,e)}removeClass(e){Ae.removeClass(this.element,e)}setCSS(e){Ae.setCSS(this.element,e)}isVisible(){return Ae.isVisible(this.element)}workerStart(e,t){return this.workers[e]=sr.registerWorker(e,t),sr.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 rr.subscribe(this,e,t),this.observables[e]=rr.getObservable(e),this.observables[e]}observableStop(e){this.observables[e]&&(rr.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]&&(sr.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!==or.indexOf(this)&&or.splice(or.indexOf(this),1)}watchDOM(e){e===this.shadowRoot?Ys.observeDOM(this.shadowRoot):this.DOMChanged(e)}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(){Xs.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(e){super.DOMChanged(e),this.lazyHandler(e)}lazyHandler(e=document){const t=e.querySelectorAll("[data-lazy-sargasso-class]");for(let e=0;e<t.length;e++){const s=t[e];if(Xs.inViewPort(s)){const r=s.getAttribute("data-lazy-sargasso-class").split(/\s*,\s*/);for(let s=0;s<r.length;s++){new cr[r[s]](t[e]).start()}s.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 s=0;s<t.length;s++)try{new cr[t[s]](e).start()}catch(e){console.log("error instantiating "+t[s],e,cr)}e.removeAttribute("data-sargasso-class")}newPage(){this.doIt()}DOMChanged(e){this.doIt(e)}doIt(e=document){const t=e.querySelectorAll("[data-sargasso-class]");for(const e of t)this.instantiate(e);const s=[];for(let e=0;e<or.length;e++)or[e].options.immortal||or[e].options.isCustomElement||document.body.contains(or[e].element)||s.push(or[e]);for(let e=0;e<s.length;e++)s[e].destroy()}}registerSargassoClass("SargassoSupervisor",SargassoSupervisor);var hr=t&&t.__assign||function(){return(hr=Object.assign||function(e){for(var t,s=1,r=arguments.length;s<r;s++)for(var i in t=arguments[s])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function stringifyAttribute(e,t){if(!t)return"";var s="; "+e;return!0===t?s:s+"="+t}function encode(e,t,s){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,"%28").replace(/\)/g,"%29")+"="+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function stringifyAttributes(e){if("number"==typeof e.expires){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return stringifyAttribute("Expires",e.expires?e.expires.toUTCString():"")+stringifyAttribute("Domain",e.domain)+stringifyAttribute("Path",e.path)+stringifyAttribute("Secure",e.secure)+stringifyAttribute("SameSite",e.sameSite)}(s)}var ur=encode;function parse(e){for(var t={},s=e?e.split("; "):[],r=/(%[\dA-F]{2})+/gi,i=0;i<s.length;i++){var n=s[i].split("="),o=n.slice(1).join("=");'"'===o.charAt(0)&&(o=o.slice(1,-1));try{t[n[0].replace(r,decodeURIComponent)]=o.replace(r,decodeURIComponent)}catch(e){}}return t}var dr=parse;function getAll(){return parse(document.cookie)}var pr=getAll;var fr=function get(e){return getAll()[e]};function set(e,t,s){document.cookie=encode(e,t,hr({path:"/"},s))}var br=set;var vr=function remove(e,t){set(e,"",hr(hr({},t),{expires:-1}))},gr=Object.defineProperty({encode:ur,parse:dr,getAll:pr,get:fr,set:br,remove:vr},"__esModule",{value:!0});const mr=[{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=mr,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){Ae.addClass(document.body,"disable-responsive"),this.disabled=!0,this.forceScale=e,this.detectGeometry()}enableResponsive(){Ae.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=()=>{Ae.removeClass(document.body,"landscape"),Ae.addClass(document.body,"portrait")};this.queueFrame(frame),this.orientation="portrait"}}else if("landscape"!==this.orientation){const frame=()=>{Ae.removeClass(document.body,"portrait"),Ae.addClass(document.body,"landscape")};this.queueFrame(frame),this.orientation="landscape"}for(let s=0;s<this.widths.length-1;s++)if(t>=this.widths[s]&&t<this.widths[s+1]){e=this.classes[s];break}}let t=0;if(e!==this.scale){++t;const frame=()=>{for(let t=0;t<this.classes.length;t++)this.classes[t]!==e?(Ae.addClass(document.body,"not-"+this.classes[t]),Ae.removeClass(document.body,this.classes[t]),Ae.removeClass(document.body,"shown-"+this.classes[t]),Ae.removeClass(document.body,"hidden-"+this.classes[t])):Ae.removeClass(document.body,"not-"+this.classes[t]);Ae.addClass(document.body,e),Ae.addClass(document.body,"shown-"+e),Ae.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 gr.get(e)}setCookie(e,t,s){const r={path:"/",domain:this.options.cookieDomain||null,expires:s};gr.set(e,t,r)}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 s=e[t],r=s.getAttribute("id");this.cachedMarkup[r]=s.innerHTML}super.start(),window.addEventListener("popstate",e=>{this.watchPopState(e)},!1)}DOMChanged(e){super.DOMChanged(e),this.hijaxLinks(e)}watchPopState(e){location.pathname+location.search!==this.currentPage&&this.preFlight(location.pathname+location.search)}hijaxLinks(e){const t=e?e.getElementsByTagName("a"):this.element.getElementsByTagName("a");for(let e=0;e<t.length;e++){const s=t[e],r=s.getAttribute("href");!r||s.getAttribute("data-hijaxed")||s.getAttribute("target")||s.hasAttribute("data-no-hijax")||this.excludeRegex.exec(r)||(s.setAttribute("data-hijaxed",!0),s.addEventListener("click",e=>{e.preventDefault(),this.setPage(r)},!1))}}setPage(e,t){e===this.currentPage||t?this.preFlight(e):(history.pushState(null,null,e),this.watchPopState())}preFlight(e){if(!this.options.preFlight)return this.loadPage(e);this.options.preFlight(e,(t,s,r)=>{t&&(this.options.onError?this.options.onError("danger",t):alert("Error loading page: "+t)),s?this.currentPage=location.pathname+location.search:this.loadPage(r||e)})}loadPage(e){this.queueFrame(()=>{Ae.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){Xs.scrollTop(0),this.mergePage(t.responseText);const e=this.currentPage,frame=()=>{this.notifyAll("newPage",[e,location.pathname+location.search]),Ae.removeClass(document.body,"hijax-loading")};this.queueFrame(frame),this.currentPage=location.pathname+location.search}else{const e=t.getResponseHeader("Sargasso-Flash-Level")||"danger";let s=t.getResponseHeader("Sargasso-Flash-Message")||t.statusText;s||(s="Could not connect to server."),this.options.onError?this.options.onError(e,s):alert("Error loading page: "+s)}},t.send()}processScripts(e){Array.from(e).forEach(e=>{e.remove();const t=e.getAttribute("id");document.getElementById(t)||document.getElementsByTagName("head")[0].appendChild(e)})}mergePage(e){const t=document.querySelectorAll("[data-ephemeral]");Array.from(t).forEach(e=>{e.remove()});const s=e.split(/(<body[^>]*>|<\/body>)/gi),r=makeFragment(s[2]),i=document.querySelectorAll("[data-hijax]");for(let e=0;e<i.length;e++){const t=i[e],s=t.getAttribute("id"),n=r.getElementById(s);if(t.hasAttribute("data-hijax-skip-unchanged")){if(this.cachedMarkup[s]===n.innerHTML)continue;this.cachedMarkup[s]=n.innerHTML}const o=t.getAttribute("data-hijax-cache-key-selector");if(o&&n.querySelector(o)&&t.querySelector(o)&&t.querySelector(o).getAttribute("data-hijax-cache-key")===n.querySelector(o).getAttribute("data-hijax-cache-key"))continue;this.processScripts(n.querySelectorAll("script"));const frame=()=>{t.parentNode.replaceChild(n,t),this.options.onEnterPage&&this.options.onEnterPage(),this.hijaxLinks(n)};this.queueFrame(frame)}}}registerSargassoClass("HijaxLoader",HijaxLoader);const makeFragment=e=>{if(document.createRange&&document.createRange().createContextualFragment)return document.createRange().createContextualFragment(e);const t=document.createDocumentFragment(),s=document.createElement("div");return s.insertAdjacentHTML("afterBegin",e),t.appendChild(s),t};e.loadPageHandler=void 0;const wr={registerSargassoClass:registerSargassoClass,bootSargasso:(t={})=>{if(t.scrollElement&&Xs.setOptions(t),t.breakpoints){new Breakpoints(document.body,t.breakpoints).start()}if(t.hijax){const s=new HijaxLoader(document.body,t.hijax);s.start(),e.loadPageHandler=s.setPage.bind(s)}else e.loadPageHandler=e=>{document.location.href=e};new SargassoSupervisor(document.body,t).start(t)},elementTools:Ae},yr={theDOMWatcher:Ys,theScrollWatcher:Xs,theResizeWatcher:er,theOrientationWatcher:tr,theWorkerWatcher:sr,theObservableObjectWatcher:rr};return e.ObservableObject=ObservableObject,e.Sargasso=Sargasso,e.services=yr,e.utils=wr,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=sargasso.iife.min.js.map

@@ -13,3 +13,3 @@ /*

}
from '../lib/Noisy.js'
from './Noisy.js'

@@ -16,0 +16,0 @@ export {

@@ -53,5 +53,5 @@ /**

DOMChanged () {
super.DOMChanged()
this.hijaxLinks()
DOMChanged (root) {
super.DOMChanged(root)
this.hijaxLinks(root)
}

@@ -58,0 +58,0 @@

@@ -47,10 +47,10 @@ /**

DOMChanged () {
super.DOMChanged()
this.lazyHandler()
DOMChanged (root) {
super.DOMChanged(root)
this.lazyHandler(root)
}
// watch viewport and instantiate lazy-instantiate-responsive things when visible
lazyHandler () {
const els = document.querySelectorAll('[data-lazy-sargasso-class]')
lazyHandler (root = document) {
const els = root.querySelectorAll('[data-lazy-sargasso-class]')
for (let i = 0; i < els.length; i++) {

@@ -57,0 +57,0 @@ const element = els[i]

@@ -19,3 +19,3 @@ /**

import {
theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
DOMWatcher, theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
}

@@ -97,3 +97,14 @@ from './Services.js'

const eventNames = [
'DOMChanged', 'didScroll', 'didResize', 'didBreakpoint', 'enterViewport', 'exitViewport', 'enterFullscreen', 'exitFullscreen', 'newPage', 'elementEvent'
'DOMChanged',
'didScroll',
'didResize',
'didBreakpoint',
'enterViewport',
'exitViewport',
'enterFullscreen',
'exitFullscreen',
'newPage',
'elementEvent',
'workerOnMessage',
'observableChanged'
]

@@ -108,2 +119,20 @@

this.element = element
if (options.shadowDOM) {
this.shadowDOM = element.attachShadow({
mode: 'open'
})
this.shadowRoot = document.createElement('div')
this.shadowDOM.append(this.shadowRoot)
this.hostElement = this.element
this.element = this.shadowRoot
this.hostTemplates = {} // <template id="xxx"></template>
const templates = this.hostElement.querySelectorAll('template')
if (templates.length) {
templates.forEach((t) => {
if (t.getAttribute('id')) {
this.hostTemplates[t.getAttribute('id')] = t.content.cloneNode(true)
}
})
}
}
this.options = options

@@ -141,2 +170,12 @@ this.pendingAnimationFrame = undefined

// if using shadow DOM, build a DOMWatcher to observe changes
if (this.shadowDOM) {
if (!this.shadowDOMWatcher) {
this.shadowDOMWatcher = new DOMWatcher({
shadowDOM: this.shadowRoot
})
}
this.shadowDOMWatcher.subscribe(this)
}
// subscribe to desired event services

@@ -186,2 +225,6 @@

sleep () {
if (this.shadowDOM) {
this.shadowDOMWatcher.unSubscribe(this)
}
if (this.options.watchDOM) {

@@ -218,3 +261,3 @@ theDOMWatcher.unSubscribe(this)

*/
DOMChanged () {}
DOMChanged (root) {}

@@ -626,4 +669,11 @@ /*

*/
watchDOM () {
this.DOMChanged()
watchDOM (root) {
if (root === this.shadowRoot) {
// something happend this element's my shadow DOM, tell in the DOM about it
// so dom observers can take actions such as instantiating new sargasso
// controllers, etc.
theDOMWatcher.observeDOM(this.shadowRoot)
} else {
this.DOMChanged(root)
}
}

@@ -630,0 +680,0 @@

@@ -56,8 +56,8 @@ /**

DOMChanged () {
this.doIt()
DOMChanged (root) {
this.doIt(root)
}
doIt () {
const elements = document.querySelectorAll('[data-sargasso-class]')
doIt (root = document) {
const elements = root.querySelectorAll('[data-sargasso-class]')
for (const element of elements) {

@@ -64,0 +64,0 @@ this.instantiate(element)

@@ -105,3 +105,3 @@ /**

class DOMWatcher extends ObserverSubscriptionManager {
constructor (options) {
constructor (options = {}) {
super(options)

@@ -111,3 +111,3 @@

this.mutationHandler = debounce((mutations, observer) => {
this.observeDOM(mutations, observer)
this.observeDOM(this.options.shadowDOM || document.body)
}, 25, {

@@ -122,3 +122,3 @@ maxWait: 100

super.subscribe(observer)
observer.watchDOM()
observer.watchDOM(this.options.shadowDOM || document.body)
}

@@ -128,3 +128,3 @@

super.wakeup()
this.mutationObserver.observe(document.body, {
this.mutationObserver.observe(this.options.shadowDOM || document.body, {
childList: true,

@@ -140,4 +140,4 @@ subtree: true

observeDOM () {
this.notifyObservers('watchDOM')
observeDOM (root) {
this.notifyObservers('watchDOM', [root || this.options.shadowDOM || document.body])
}

@@ -475,3 +475,3 @@ }

export {
theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
DOMWatcher, theObservableObjectWatcher, theDOMWatcher, theScrollWatcher, theResizeWatcher, theOrientationWatcher, theWorkerWatcher
}
{
"name": "@pelagiccreatures/sargasso",
"version": "1.4.8",
"version": "1.5.0-beta.1",
"description": "Simple, Fast, Reactive, Supervised Javascript controllers for custom html elements.",

@@ -21,3 +21,2 @@ "type": "module",

],
"main": "index.js",
"scripts": {

@@ -24,0 +23,0 @@ "test": "npx mocha-chrome http://localhost:8000/tests/index.html --ignore-exceptions",

@@ -31,2 +31,3 @@ # [@pelagiccreatures/sargasso](https://www.npmjs.com/package/@pelagiccreatures/sargasso)

* Template literals and rendering tools such as [lit-html](https://lit-html.polymer-project.org/)
* Shadow DOM

@@ -229,3 +230,3 @@ The result is lean (<50k), highly performant and clean library that simplifies the implementation of the complex technologies behind modern progressive web apps and web sites.

| ------ | ----------- |
| DOMChanged() | called when DOM changes if options 'watchDOM: true' was set in constructor |
| DOMChanged(root) | called when DOM changes if options 'watchDOM: true' was set in constructor. `root` is root element where change occurred such as body or root element of a shadow dom |
| didScroll() | called when scroll occurs if options 'watchScroll: true' was set in constructor |

@@ -347,2 +348,21 @@ | didResize() | called when resize changes if options 'watchResize: true' was set in constructor |

### Web Components
[Using Shadow Dom](https://developers.google.com/web/fundamentals/web-components/shadowdom)
Sargasso controllers are web components. If you want to further encapsulate the element from the rest of the page, pass `options.shadowDOM = true` when calling `super(element,options)` in your Sargasso subclass constructor and Sargasso will create a shadow DOM for scoping styles and child elements to the element. Sargasso elements within the shadow DOM are under supervision (new elements are instantiated and destroyed as needed).
```
class MyClass extends SargassoModule.Sargasso {
constructor(element, options = {}) {
options.shadowDOM = true
super(element, options)
}
start() {
super.start()
}
}
```
### ObservableObjects

@@ -562,2 +582,3 @@

### Serving modules from your project

@@ -564,0 +585,0 @@ ```

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc