/* # ----------------------------------------------------------------------------- # ~/assets/themes/j1/modules/fam/js/cash.min.js # MODIFIED old Cash version v1.3.5 from Materialize used by J1 Module FAMs # # Product/Info: # https://jekyll.one * https://github.com/fabiospampinato/cash/tree/1.3.5 # # Copyright (c) 2014 Ken Wheeler # Copyright (C) 2023 Juergen Adams # # Cash is licensed under the MIT License. # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md # J1 Template is licensed under the MIT License. # See: https://github.com/fabiospampinato/cash/blob/1.3.5/LICENSE.md # ----------------------------------------------------------------------------- */ window.cash=function(){var t,e=document,n=window,r=Array.prototype,i=r.slice,u=r.filter,o=r.push,s=function(){},c=function(t){return"function"==typeof t&&t.call},a=function(t){return"string"==typeof t},f=/^#[\w-]*$/,h=/^\.[\w-]*$/,l=/<.+>/,d=/^\w+$/;function v(t,n){n=n||e;var r=h.test(t)?n.getElementsByClassName(t.slice(1)):d.test(t)?n.getElementsByTagName(t):n.querySelectorAll(t);return r}function p(n){if(!t){var r=(t=e.implementation.createHTMLDocument(null)).createElement("base");r.href=e.location.href,t.head.appendChild(r)}return t.body.innerHTML=n,t.body.childNodes}function m(t){"loading"!==e.readyState?t():e.addEventListener("DOMContentLoaded",t)}function g(t,r){if(!t)return this;if(t.cash&&t!==n)return t;var i,u=t,o=0;if(a(t))u=f.test(t)?e.getElementById(t.slice(1)):l.test(t)?p(t):v(t,r);else if(c(t))return m(t),this;if(!u)return this;if(u.nodeType||u===n)this[0]=u,this.length=1;else for(i=this.length=u.length;o=0&&u.splice(r,1)):(x(u,function(n){t.removeEventListener(e,n)}),u=[]))}function _(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function F(t){var e=t.type;if(!e)return null;switch(e.toLowerCase()){case"select-one":return function(t){var e=t.selectedIndex;return e>=0?t.options[e].value:null}(t);case"select-multiple":return function(t){var e=[];return x(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null}(t);case"radio":case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function U(t,e,n){var r=a(e);r||!e.length?x(t,r?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,r){return function(t,e,n){if(n){var r=t.childNodes[0];t.insertBefore(e,r)}else t.appendChild(e)}(t,0===r?e:e.cloneNode(!0),n)}):x(e,function(e){return U(t,e,n)})}y.prefixedProp=R,y.camelCase=P,b.extend({css:function(t,e){if(a(t))return t=R(t),arguments.length>1?this.each(function(n){return n.style[t]=e}):n.getComputedStyle(this[0])[t];for(var r in t)this.css(r,t[r]);return this}}),x(["Width","Height"],function(t){var e=t.toLowerCase();b[e]=function(){return this[0].getBoundingClientRect()[e]},b["inner"+t]=function(){return this[0]["client"+t]},b["outer"+t]=function(e){return this[0]["offset"+t]+(e?q(this,"margin"+("Width"===t?"Left":"Top"))+q(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),b.extend({off:function(t,e){return this.each(function(n){return D(n,t,e)})},on:function(t,e,n,r){var i;if(!a(t)){for(var u in t)this.on(u,e,t[u]);return this}return c(e)&&(n=e,e=null),"ready"===t?(m(n),this):(e&&(i=n,n=function(t){for(var n=t.target;!N(n,e);){if(n===this||null===n)return n=!1;n=n.parentNode}n&&i.call(n,t)}),this.each(function(e){var i=n;r&&(i=function(){n.apply(this,arguments),D(e,t,i)}),function(t,e,n){var r=T(t,"_cashEvents")||A(t,"_cashEvents",{});r[e]=r[e]||[],r[e].push(n),t.addEventListener(e,n)}(e,t,i)}))},one:function(t,e,n){return this.on(t,e,n,!0)},ready:m,trigger:function(t,e){if(document.createEvent){var n=document.createEvent("HTMLEvents");return n.initEvent(t,!0,!1),n=this.extend(n,e),this.each(function(t){return t.dispatchEvent(n)})}}}),b.extend({serialize:function(){var t="";return x(this[0].elements||this,function(e){if(!e.disabled&&"FIELDSET"!==e.tagName){var n=e.name;switch(e.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var r=F(e);null!==r&&x(r,function(e){t+=_(n,e)});break;default:var i=F(e);null!==i&&(t+=_(n,i))}}}),t.substr(1)},val:function(t){return void 0===t?F(this[0]):this.each(function(e){return e.value=t})}}),b.extend({after:function(t){return y(t).insertAfter(this),this},append:function(t){return U(this,t),this},appendTo:function(t){return U(y(t),this),this},before:function(t){return y(t).insertBefore(this),this},clone:function(){return y(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var e=this;return y(t).each(function(t,n){var r=t.parentNode,i=t.nextSibling;e.each(function(t){r.insertBefore(0===n?t:t.cloneNode(!0),i)})}),this},insertBefore:function(t){var e=this;return y(t).each(function(t,n){var r=t.parentNode;e.each(function(e){r.insertBefore(0===n?e:e.cloneNode(!0),t)})}),this},prepend:function(t){return U(this,t,!0),this},prependTo:function(t){return U(y(t),this,!0),this},remove:function(){return this.each(function(t){if(t.parentNode)return t.parentNode.removeChild(t)})},text:function(t){return void 0===t?this[0].textContent:this.each(function(e){return e.textContent=t})}});var $=e.documentElement;return b.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+n.pageYOffset-$.clientTop,left:t.left+n.pageXOffset-$.clientLeft}},offsetParent:function(){return y(this[0].offsetParent)}}),b.extend({children:function(t){var e=[];return this.each(function(t){o.apply(e,t.children)}),e=C(e),t?e.filter(function(e){return N(e,t)}):e},closest:function(t){return!t||this.length<1?y():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(t){if(!t)return!1;var e=!1,n=L(t);return this.each(function(r){return!(e=n(r,t))}),e},find:function(t){if(!t||t.nodeType)return y(t&&this.has(t).length?t:null);var e=[];return this.each(function(n){o.apply(e,v(t,n))}),C(e)},has:function(t){var e=a(t)?function(e){return 0!==v(t,e).length}:function(e){return e.contains(t)};return this.filter(e)},next:function(){return y(this[0].nextElementSibling)},not:function(t){if(!t)return this;var e=L(t);return this.filter(function(n){return!e(n,t)})},parent:function(){var t=[];return this.each(function(e){e&&e.parentNode&&t.push(e.parentNode)}),C(t)},parents:function(t){var n,r=[];return this.each(function(i){for(n=i;n&&n.parentNode&&n!==e.body.parentNode;)n=n.parentNode,(!t||t&&N(n,t))&&r.push(n)}),C(r)},prev:function(){return y(this[0].previousElementSibling)},siblings:function(t){var e=this.parent().children(t),n=this[0];return e.filter(function(t){return t!==n})}}),y}();