@htmlguyllc/jpack
Advanced tools
Comparing version 6.1.2 to 6.1.3
@@ -1,2 +0,2 @@ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={getElement:function(t,e,n){const r=this.getElements(t,e);if(r.length>1&&n)throw`More than 1 result found for "${t}"`;return r?r[0]:null},getElements:function(t,e){e=void 0!==e&&e;let n=[];if(void 0!==t&&t)if(t instanceof Element||t instanceof HTMLDocument)n.push(t);else if("string"==typeof t)n=(n=document.querySelectorAll(t))?Array.from(n):n;else if(t instanceof jQuery)t.length&&(n=t.toArray());else if(t instanceof NodeList||t instanceof HTMLCollection)n=Array.from(t);else{if(!Array.isArray(t))throw`Invalid value: "${t}"`;t.forEach(function(t){(t=r.getElement(t))&&n.push(t)})}else;if(!n.length&&e)throw`Failed to find "${t}"`;return n},remove:function(t,e){let n=this.getElements(t);if(!n.length){if(e)throw`Could not find "${t}"`;return this}return n.forEach(function(t){t.parentNode.removeChild(t)}),this},replaceElWithHTML:function(t,e,n){if("string"!=typeof e)throw`${e} is not a string`;const r=this.getElement(t);if(!t){if(n)throw`Could not find "${t}"`;return null}let o=(new DOMParser).parseFromString(e,"text/html");return o=r.parentNode.insertBefore(o.documentElement.querySelector("body").childNodes[0],r),r.remove(),o},isVisible(t,e){if(!(t=this.getElement(t,!0,!0))){if(e)throw`Could not find "${t}"`;return!1}const n=getComputedStyle(t);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(0===n.opacity)return!1;if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width===0)return!1;const r=t.getBoundingClientRect(),o={"top-left":{x:r.left,y:r.top},"top-right":{x:r.right,y:r.top},"bottom-left":{x:r.left,y:r.bottom},"bottom-right":{x:r.right,y:r.bottom},center:{x:r.left+t.offsetWidth/2,y:r.top+t.offsetHeight/2}};let i=!0;return Object.keys(o).forEach(function(t){var e=o[t];return e.x<0&&(i=!1),!1}),i},exists:function(t){return this.getElements(t).length},multipleExist:function(t){return this.getElements(t).length>1}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=n(0);const o={setGlobal:function(t){for(var e in t="string"==typeof t?t:null,this)this.hasOwnProperty(e)&&"setGlobal"!==e&&(t?(void 0===window[t]&&(window[t]={}),window[t][e]=this[e]):window[e]=this[e])},onClick:function(t,e){return o.onEventPreventDefault(t,"click",e)},onSubmit:function(t,e){return o.onEventPreventDefault(t,"submit",e)},onEventPreventDefault:function(t,e,n){const o=r.a.getElements(t);if(!o.length)return t;const i=function(t){return Array.isArray(t)&&(t=t[0]),t.preventDefault(),n.call(this,t),!1};return o.forEach(function(t){t.addEventListener(e,i)}),i},on:function(t,e,n){const o=r.a.getElements(t);return o.length?(o.forEach(function(t){t.addEventListener(e,n)}),o):t},off:function(t,e,n){const o=r.a.getElements(t);return o.length?(o.forEach(function(t){t.removeEventListener(e,n)}),o):t},trigger:function(t,e,n){const o=r.a.getElements(t);return o.length?(n=void 0===n?null:n,e=new CustomEvent(e,{detail:n}),o.forEach(function(t){t.dispatchEvent(e)}),o):t}}},function(t,e,n){"use strict";var r=n(11),o=n(24),i=Object.prototype.toString;function s(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:s,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return a(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){"use strict";n.d(e,"a",function(){return u});var r=n(5),o=n.n(r),i=n(0),s=n(6),a=n(1);const u={_passthroughData:null,setPassthroughData:function(t){return this._passthroughData=t,this},clearPassthroughData:function(){return this.setPassthroughData(null),this},getPassThroughData:function(t){return this._passthroughData},_incomingElementSelector:"body",setIncomingElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._incomingElementSelector=t},getIncomingElement:function(){return this._incomingElementSelector},_replaceElementSelector:"body",setReplaceElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._replaceElementSelector=t},getReplaceElement:function(){return this._replaceElementSelector},load:function(t,e,n,r,s){if("string"!=typeof t)throw`Provided URL (${t}) is not a string`;if(n=void 0!==n&&n?n:this.getIncomingElement(),r=void 0!==r&&r?r:this.getReplaceElement(),s=void 0===s||s,"string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof r)throw`Provided replace_el (${r}) is not a string`;u.showLoader(),o.a.get(t).then(function(o){u.hideLoader(),u.replacePageContent(o.data,t,n,r,s),"function"==typeof e&&window.setTimeout(function(){e(i.a.getElement(r),n,u.getPassThroughData())},105)}).catch(function(t){throw u.hideLoader(),u.triggerNavigationFailure(t),t})},loaderEnabled:!0,_loaderDelay:300,setLoaderDelay:function(t){if("number"!=typeof t)throw`${t} is not an integer`;return this._loaderDelay=t,this},getLoaderDelay:function(){return this._loaderDelay},_loaderClasses:"progress page-navigation-loader",_loaderInnerDivClasses:"progress-bar progress-bar-striped progress-bar-animated",getLoaderEl:function(){if(!this.loaderEnabled)return;if(u.navLoaderCached)return u.navLoaderCached;let t=document.createElement("div");t.classList=this._loaderClasses;let e=document.createElement("div");return e.classList=this._loaderInnerDivClasses,t.append(e),document.body.prepend(t),u.navLoaderCached=i.a.getElement(".page-navigation-loader"),u.navLoaderCached},showLoader:function(){if(this.loaderEnabled)return u.loader_timeout=window.setTimeout(function(){u.getLoaderEl().classList.add("active")},this.getLoaderDelay()),this},hideLoader:function(){if(this.loaderEnabled)return window.clearTimeout(u.loader_timeout),u.getLoaderEl().classList.remove("active"),this},parseHTML(t,e){if("string"!=typeof(e=void 0===e?null:e)&&null!==e)throw`Provided parent_el (${e}) is not a string or null`;var n=new DOMParser,r=n.parseFromString(t,"text/html"),o=r.querySelector("title");o=o?o.innerText:null;var i=r.head.getElementsByTagName("meta"),s=r.querySelectorAll('link[rel="canonical"]'),a=r.body.classList,c=t;if(e){var l=r.querySelector(e);if(!l)throw`Could not find parent selector ${e}`;c=l.outerHTML}var f=u.getRouteFromMeta(r);return n=r=null,{title:o,route:f,metas:i,links:s,body_classes:a,html:c}},getRouteFromMeta:function(t){var e=(t=void 0===t?document.head:t).querySelector('[name="current_route"]');return e=e?e.content:null},replacePageContent(t,e,n,r,o){var s=this;if(o=void 0===o||o,n=void 0!==n&&n?n:this.getIncomingElement(),r=void 0!==r&&r?r:this.getReplaceElement(),"string"!=typeof e)throw`Provided url (${e}) is not a string`;if("string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof r)throw`Provided replace_el (${r}) is not a string`;return u.triggerUnload(i.a.getElement(r),r,this.getRouteFromMeta()),window.setTimeout(function(){var a=u.parseHTML(t,n);if(a.html.length){i.a.remove("meta"),document.head.append(a.metas),i.a.remove('[rel="canonical"]'),Array.from(a.links).forEach(function(t){document.head.append(t)}),document.body.classList=a.body_classes,o&&history.pushState({url:e},a.title,e),u.setTitle(a.title);const t=i.a.replaceElWithHTML(r,a.html);u.triggerOnLoad(t,n,r,a.route),s.getReplaceElement()!==r&&s.setReplaceElement(n)}},100),this},reload:function(t){return t="function"!=typeof t?null:t,u.load(s.a.getFullURL(),t),this},fullReload:function(){u.showLoader(),window.location.reload()},redirect:function(t){u.showLoader(),window.location.href=t},setTitle:function(t){return document.title=t,this},onLoad:function(t){return a.a.on("body","navigation.complete",t),this},onUnload:function(t){return a.a.on("body","navigation.started",t),this},onNavigationFailure:function(t){return a.a.on("body","navigation.failed",t),this},triggerOnLoad:function(t,e,n,r){return r=void 0!==r?r:u.getRouteFromMeta(),a.a.trigger("body","navigation.complete",{el:t,el_selector:e,replaced_selector:n,route:r,data:this.getPassThroughData()}),this},triggerUnload:function(t,e,n){return a.a.trigger("body","navigation.started",{el:t,el_selector:e,route:n}),this},triggerNavigationFailure:function(t){return a.a.trigger("body","navigation.failed",{error:t}),this},initHistoryHandlers:function(){return window.onpushstate=function(t){u.load(s.a.getURIWithQueryString())},window.onpopstate=function(t){u.load(s.a.getURIWithQueryString(),null,null,null,!1)},this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={isDataObject:function(t,e,n,r,o){o=void 0!==o&&o,n=void 0!==n&&n;var i=JSON.stringify(t);const s=`${i} is not an object`;if(void 0===t){if(o)throw s;return!1}if(!("object"==typeof t)||null===t||Array.isArray(t)){if(o)throw s;return!1}if(Array.isArray(e)){let s=!1,a=[];const u=Object.keys(t);if(e.forEach(function(t){u.includes(t)?s=!0:a.push(t)}),!s){if(o)throw`${i} does not contain at least one of the following: `+e.join(", ");return!1}if(n&&a.length){if(o)throw`${i} is missing data: `+a.join(", ");return!1}if(r){let t=[];if(u.forEach(function(n){e.includes(n)||t.push(n)}),t.length){if(o)throw`${i} contains invalid data: `+t.join(", ");return!1}}}return!0}}},function(t,e,n){t.exports=n(23)},function(t,e,n){"use strict";n.d(e,"a",function(){return r}),n(40);const r={query:new URLSearchParams(window.location.search),isHttps:function(){return"https:"===window.location.protocol},getDomain:function(){return window.location.hostname||window.location.host},getDomainWithProtocol:function(){return window.location.origin},getURI:function(){return window.location.pathname},getURIWithQueryString:function(){return window.location.pathname+window.location.search},getFullURL:function(){return window.location.href},appendSlash:function(t){return"/"!==t[t.length-1]?t+"/":t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(4),o=n(8);class i{constructor(){}populate(t){const e=this;if(void 0===this._keys)throw"Cannot populate object if _keys property is not set";return r.a.isDataObject(t,this._keys,!1,!0,!0),this._keys.forEach(function(n){void 0!==t[n]&&e[o.a.setter(n)](t[n])}),this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={getter:function(t){return"get"+this.ucfirst(t)},setter:function(t){return"set"+this.ucfirst(t)},ucfirst:function(t){return t&&t[0].toUpperCase()+t.slice(1)}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(5),s=n.n(i);n(41);const a={xhrSubmit:!0,submitURL:null,submitMethod:null,onError:function(t,e,n){alert(t)},onSuccess:function(t,e){"string"==typeof t.success?alert(t.success):alert("Your submission has been received")},validateForm:function(t){t.classList.add("was-validated");const e=!t.querySelector(":invalid");return e&&t.classList.remove("was-validated"),e}};class u{constructor(t,e){if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...a,...e},this.setForm(t),this.setValidateCallback(e.validateForm),this.setXHRSubmit(e.xhrSubmit),this.setSubmitMethod(e.submitMethod),this.setSubmitURL(e.submitURL),this.onSuccess(e.onSuccess),this.onError(e.onError)}setValidateCallback(t){if("function"!=typeof t)throw`${t} is not a function`;return this._validateCallback=t,this}validate(t){return void 0===t&&(t=this.getForm()),this._validateCallback(t)}setForm(t){if(!t||void 0===t)throw"Form element is required";if(!(t=r.a.getElement(t,!0,!0)))throw"Invalid form element received";return this._form=t,this}getForm(){return this._form}setXHRSubmit(t){return this._xhrSubmit=!!t,this}setSubmitMethod(t){if("string"!=typeof t&&null!==t)throw`${t} is not a string or null`;return this._submitMethod=t,this}getSubmitMethod(){return this._submitMethod}setSubmitURL(t){if("string"!=typeof t&&"function"!=typeof t&&null!==t)throw`${t} is not a string, function, or null`;return this._submitURL=t,this}getSubmitURL(){return this._submitURL}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):null===e?t.action:e}attachSubmitHandler(t){if(!this._xhrSubmit)return;if(!(t=void 0===t?this.getForm():r.a.getElement(t)))throw"Form element not received, cannot attach submit handler";const e=this;return t.addEventListener("submit",function(n){return!e._xhrSubmit||(n.preventDefault(),e.submitForm(t),!1)}),this}onSuccess(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onSuccess&&(this._onSuccess=[]),this._onSuccess.push(t),this}clearOnSuccessCallbacks(){return this._onSuccess=[],this}triggerOnSuccess(t,e){return void 0!==this._onSuccess&&(this._onSuccess.forEach(function(n){n(t,e)}),this)}onError(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onError&&(this._onError=[]),this._onError.push(t),this}clearOnErrorCallbacks(){return this._onError=[],this}triggerOnError(t,e,n){return void 0!==this._onError&&(this._onError.forEach(function(r){r(t,e,n)}),this)}submitForm(t){if(void 0===this._processing&&(this._processing=!1),this._processing)return!1;this._processing=!0;const e=this;let n=this.getFinalSubmitURL(t),r=this.getSubmitMethod();if(null===r&&void 0!==t.attributes.method&&(r=t.method),r=r?r.toLowerCase():"post",!this.validate(t))return this._processing=!1,!1;o.a.showLoader();const i=Array.from(this.getFormValues(t),t=>t.map(encodeURIComponent).join("=")).join("&");return s()({url:n,method:r,data:i}).then(function(n){o.a.hideLoader(),e._processing=!1;let r=n.data;try{r="string"==typeof r?JSON.parse(r):r}catch(t){}if("string"==typeof r){if("string"==typeof e.getIncomingElementSelector()){const n=o.a.parseHTML(r,e.getIncomingElementSelector());return n.html.length?e.insertForm(n,r,t):e.triggerOnError(`${e.getIncomingElementSelector()} could not be found in response from the server`,r,t)}return e.insertForm({html:r},r,t)}if("object"==typeof r)return r.html?e.insertForm({html:r.html},r,t):r.error?e.triggerOnError(r.error,r,t):e.triggerOnSuccess(r,t)}).catch(function(t){throw o.a.hideLoader(),e._processing=!1,t}),this}getFormValues(t){return new FormData(t)}}const c={incomingElementSelector:null,insertIntoElement:null,onload:function(t){return this}};class l extends u{constructor(t,e){if(super(null,e),"string"!=typeof t)throw`${t} is not a string`;if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...c,...e},this.setURL(t),this.setIncomingElementSelector(e.incomingElementSelector),this.setInsertIntoElement(e.insertIntoElement),this.onload(e.onload)}setForm(t){return this._form=t,this}setURL(t){if("string"!=typeof t)throw`${t} is not a string`;return this._url=t,this}getURL(){return this._url}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):(null===e&&t.attributes.action&&(e=t.action),null===(e=e||this.getURL())&&(e=t.action),e)}setIncomingElementSelector(t){if(null!==t&&"string"!=typeof t)throw`${t} is not a string or null value`;return this._incomingElementSelector=t,this}getIncomingElementSelector(){return this._incomingElementSelector}setInsertIntoElement(t){this._insertIntoElement=t}getInsertIntoElement(){return this._insertIntoElement}getForm(){const t=this;o.a.showLoader(),s.a.get(this.getURL()).then(function(e){o.a.hideLoader();let n=e.data;try{n="string"==typeof n?JSON.parse(n):n}catch(t){}if("string"==typeof n){if("string"==typeof t.getIncomingElementSelector()){const e=o.a.parseHTML(n,t.getIncomingElementSelector());return t.insertForm(e,n)}return t.insertForm({html:n})}if("object"==typeof n&&void 0!==n.html)return t.insertForm({html:n.html},n);throw`Unexpected server response ${n}`}).catch(function(t){throw o.a.hideLoader(),t})}insertForm(t,e,n){let o=this.getInsertIntoElement();if(null===o)throw"Cannot determine where to insert form. Overwrite insertForm() or provide insertIntoElement";return(o=r.a.getElement(o,!0)).innerHTML=t.html,n=o.querySelector("form"),this.attachSubmitHandler(n),this.triggerOnload(n),o}onload(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onload&&(this._onload=[]),this._onload.push(t),this}clearOnloadCallbacks(){return this._onload=[],this}triggerOnload(t){return void 0!==this._onload&&(this._onload.forEach(function(e){e(t)}),this)}}n.d(e,"b",function(){return u}),n.d(e,"a",function(){return l})},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";var r=n(2);function o(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(r.isURLSearchParams(e))i=e.toString();else{var s=[];r.forEach(e,function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(o(e)+"="+o(t))}))}),i=s.join("&")}if(i){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";(function(e){var r=n(2),o=n(30),i={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:(void 0!==e&&"[object process]"===Object.prototype.toString.call(e)?a=n(15):"undefined"!=typeof XMLHttpRequest&&(a=n(15)),a),transformRequest:[function(t,e){return o(e,"Accept"),o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){u.headers[t]={}}),r.forEach(["post","put","patch"],function(t){u.headers[t]=r.merge(i)}),t.exports=u}).call(this,n(29))},function(t,e,n){"use strict";var r=n(2),o=n(31),i=n(12),s=n(33),a=n(34),u=n(16);t.exports=function(t){return new Promise(function(e,c){var l=t.data,f=t.headers;r.isFormData(l)&&delete f["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",p=t.auth.password||"";f.Authorization="Basic "+btoa(d+":"+p)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:t,request:h};o(e,c,r),h=null}},h.onabort=function(){h&&(c(u("Request aborted",t,"ECONNABORTED",h)),h=null)},h.onerror=function(){c(u("Network Error",t,null,h)),h=null},h.ontimeout=function(){c(u("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var m=n(35),g=(t.withCredentials||a(t.url))&&t.xsrfCookieName?m.read(t.xsrfCookieName):void 0;g&&(f[t.xsrfHeaderName]=g)}if("setRequestHeader"in h&&r.forEach(f,function(t,e){void 0===l&&"content-type"===e.toLowerCase()?delete f[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),c(t),h=null)}),void 0===l&&(l=null),h.send(l)})}},function(t,e,n){"use strict";var r=n(32);t.exports=function(t,e,n,o,i){var s=new Error(t);return r(s,e,n,o,i)}},function(t,e,n){"use strict";var r=n(2);t.exports=function(t,e){e=e||{};var n={};return r.forEach(["url","method","params","data"],function(t){void 0!==e[t]&&(n[t]=e[t])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(e[o])?n[o]=r.deepMerge(t[o],e[o]):void 0!==e[o]?n[o]=e[o]:r.isObject(t[o])?n[o]=r.deepMerge(t[o]):void 0!==t[o]&&(n[o]=t[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])}),n}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var r=n(4),o=n(7);const i={id:null,name:null,config:{}};class s extends o.a{constructor(t){if(super(),this._keys=["id","name","config"],void 0===t)return this;t={...i,...t},this.populate(t)}getId(){return this._id}setId(t){return this._id=t,this}getName(){return this._name}setName(t){return this._name=t,this}getConfig(){return this._config}setConfig(t){return r.a.isDataObject(t,null,!1,!1,!0),this._config=t,this}getConfigItem(t){return void 0===this._config[t]?null:this._config[t]}setConfigItem(t,e){return this._config[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var r=n(4),o=n(7);const i={id:null,isGuest:!1,isAdmin:!1,username:null,fname:null,lname:null,email:null,phone:null,permissions:[],additionalData:{}};class s extends o.a{constructor(t){if(super(),this._keys=["id","isGuest","isAdmin","username","fname","lname","email","phone","permissions","additionalData"],void 0===t)return this;t={...i,...t},this.populate(t)}setId(t){return this._id=t,this}getId(){return this._id}setIsGuest(t){return this._isGuest=t,this}getIsGuest(){return this._isGuest}setIsAdmin(t){return this._isAdmin=t,this}getIsAdmin(){return this._isAdmin}setUsername(t){return this._username=t,this}getUsername(){return this._username}getFname(){return this._fname}setFname(t){return this._fname=t,this}getLname(){return this._lname}setLname(t){return this._lname=t,this}getName(){return`${user.getFname()} ${user.getLname()}`}getEmail(){return this._email}setEmail(t){return this._email=t,this}getPhone(){return this._phone}setPhone(t){return this._phone=t,this}getPermissions(){return this._permissions}setPermissions(t){if(!Array.isArray(t))throw"setPermissions requires an array";return this._permissions=t,this}addPermission(t){return this._permissions.push(t),this}removePermission(t){return this.setPermissions(this._permissions.filter(function(e){return e!==t})),this}hasPermission(t){return this.getPermissions().includes(t)}getAdditionalData(){return this._additionalData}setAdditionalData(t){return r.a.isDataObject(t,null,!1,!1,!0),this._additionalData=t,this}getDataItem(t){return void 0===this._additionalData[t]?null:this._additionalData[t]}setDataItem(t,e){return this._additionalData[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(1),o=n(0);class i{constructor(t,e,n,r){this.btn=o.a.getElement(t,!0,!0),this.toggle_el=o.a.getElement(e,!0,!0),this.hide_on_outside_click="boolean"!=typeof r||r,this.toggle_class="string"!=typeof n?"visible":n}init(){const t=this;return this.onWindowResize=function(){window.clearTimeout(void 0),window.setTimeout(function(){o.a.isVisible(t.btn)?t.toggle_el.classList.remove(t.toggle_class):t.toggle_el.classList.add(t.toggle_class)},200)},this.hide_on_outside_click&&(this.onClickOutside=function(e){let n=e.target;if(n===t.btn)return!1;do{if(t.btn===n)return!1}while(n=n.parentNode);if((n=e.target)===t.toggle_el)return!1;do{if(t.toggle_el===n)return!1}while(n=n.parentNode);t.toggle_el.classList.remove(t.toggle_class)},r.a.on("body","click",this.onClickOutside)),this.onClickToggleBtn=r.a.onClick(this.btn,function(){t.toggle_el.classList.toggle(t.toggle_class)}),window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this}destroy(){this.hide_on_outside_click&&r.a.off("body","click",this.onClickOutside),r.a.off(this.btn,"click",this.onClickToggleBtn),window.removeEventListener("resize",this.onWindowResize)}}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"jpack",function(){return p});var r=n(0),o=n(1),i=n(10),s=n(3),a=n(6),u=n(19),c=n(8),l=n(4),f=n(20),h=n(21);const d={dom:r.a,events:o.a,XHRForm:i.b,FormFromURL:i.a,navigation:s.a,request:a.a,Site:u.a,strings:c.a,type_checks:l.a,User:f.a,ToggleOnMobile:h.a},p={...d,setGlobal:function(t){t="string"==typeof t?t:null;for(const e in d)t?(void 0===window[t]&&(window[t]={}),window[t][e]=d[e]):window[e]=d[e]}};t.jpack=p}.call(this,n(9))},function(t,e,n){"use strict";var r=n(2),o=n(11),i=n(25),s=n(17);function a(t){var e=new i(t),n=o(i.prototype.request,e);return r.extend(n,i.prototype,e),r.extend(n,e),n}var u=a(n(14));u.Axios=i,u.create=function(t){return a(s(u.defaults,t))},u.Cancel=n(18),u.CancelToken=n(38),u.isCancel=n(13),u.all=function(t){return Promise.all(t)},u.spread=n(39),t.exports=u,t.exports.default=u},function(t,e){ | ||
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={getElement:function(t,e,n){const r=this.getElements(t,e);if(r.length>1&&n)throw`More than 1 result found for "${t}"`;return r?r[0]:null},getElements:function(t,e){e=void 0!==e&&e;let n=[];if(void 0!==t&&t)if(t instanceof Element||t instanceof HTMLDocument)n.push(t);else if("string"==typeof t)n=(n=document.querySelectorAll(t))?Array.from(n):n;else if(t instanceof jQuery)t.length&&(n=t.toArray());else if(t instanceof NodeList||t instanceof HTMLCollection)n=Array.from(t);else{if(!Array.isArray(t))throw`Invalid value: "${t}"`;t.forEach(function(t){(t=r.getElement(t))&&n.push(t)})}else;if(!n.length&&e)throw`Failed to find "${t}"`;return n},remove:function(t,e){let n=this.getElements(t);if(!n.length){if(e)throw`Could not find "${t}"`;return this}return n.forEach(function(t){t.parentNode.removeChild(t)}),this},replaceElWithHTML:function(t,e,n){if("string"!=typeof e)throw`${e} is not a string`;const r=this.getElement(t);if(!t){if(n)throw`Could not find "${t}"`;return null}let o=(new DOMParser).parseFromString(e,"text/html");return o=r.parentNode.insertBefore(o.documentElement.querySelector("body").childNodes[0],r),r.remove(),o},isVisible(t,e){if(!(t=this.getElement(t,!0,!0))){if(e)throw`Could not find "${t}"`;return!1}const n=getComputedStyle(t);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(0===n.opacity)return!1;if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width===0)return!1;const r=t.getBoundingClientRect(),o={"top-left":{x:r.left,y:r.top},"top-right":{x:r.right,y:r.top},"bottom-left":{x:r.left,y:r.bottom},"bottom-right":{x:r.right,y:r.bottom},center:{x:r.left+t.offsetWidth/2,y:r.top+t.offsetHeight/2}};let i=!0;return Object.keys(o).forEach(function(t){var e=o[t];return e.x<0&&(i=!1),!1}),i},exists:function(t){return this.getElements(t).length},multipleExist:function(t){return this.getElements(t).length>1}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var r=n(0);const o={setGlobal:function(t){for(var e in t="string"==typeof t?t:null,this)this.hasOwnProperty(e)&&"setGlobal"!==e&&(t?(void 0===window[t]&&(window[t]={}),window[t][e]=this[e]):window[e]=this[e])},onClick:function(t,e){return o.onEventPreventDefault(t,"click",e)},onSubmit:function(t,e){return o.onEventPreventDefault(t,"submit",e)},onEventPreventDefault:function(t,e,n){const o=r.a.getElements(t);if(!o.length)return t;const i=function(t){return Array.isArray(t)&&(t=t[0]),t.preventDefault(),n.call(this,t),!1};return o.forEach(function(t){t.addEventListener(e,i)}),i},on:function(t,e,n){const o=r.a.getElements(t);return o.length?(o.forEach(function(t){t.addEventListener(e,n)}),o):t},off:function(t,e,n){const o=r.a.getElements(t);return o.length?(o.forEach(function(t){t.removeEventListener(e,n)}),o):t},trigger:function(t,e,n){const o=r.a.getElements(t);return o.length?(n=void 0===n?null:n,e=new CustomEvent(e,{detail:n}),o.forEach(function(t){t.dispatchEvent(e)}),o):t}}},function(t,e,n){"use strict";var r=n(11),o=n(24),i=Object.prototype.toString;function s(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function u(t){return"[object Function]"===i.call(t)}function c(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),s(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}t.exports={isArray:s,isArrayBuffer:function(t){return"[object ArrayBuffer]"===i.call(t)},isBuffer:o,isFormData:function(t){return"undefined"!=typeof FormData&&t instanceof FormData},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:a,isUndefined:function(t){return void 0===t},isDate:function(t){return"[object Date]"===i.call(t)},isFile:function(t){return"[object File]"===i.call(t)},isBlob:function(t){return"[object Blob]"===i.call(t)},isFunction:u,isStream:function(t){return a(t)&&u(t.pipe)},isURLSearchParams:function(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]=n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},deepMerge:function t(){var e={};function n(n,r){"object"==typeof e[r]&&"object"==typeof n?e[r]=t(e[r],n):e[r]="object"==typeof n?t({},n):n}for(var r=0,o=arguments.length;r<o;r++)c(arguments[r],n);return e},extend:function(t,e,n){return c(e,function(e,o){t[o]=n&&"function"==typeof e?r(e,n):e}),t},trim:function(t){return t.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(t,e,n){"use strict";n.d(e,"a",function(){return u});var r=n(5),o=n.n(r),i=n(0),s=n(6),a=n(1);const u={_passthroughData:null,setPassthroughData:function(t){return this._passthroughData=t,this},clearPassthroughData:function(){return this.setPassthroughData(null),this},getPassThroughData:function(t){return this._passthroughData},_incomingElementSelector:"body",setIncomingElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._incomingElementSelector=t},getIncomingElement:function(){return this._incomingElementSelector},_replaceElementSelector:"body",setReplaceElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._replaceElementSelector=t},getReplaceElement:function(){return this._replaceElementSelector},load:function(t,e,n,r,s){if("string"!=typeof t)throw`Provided URL (${t}) is not a string`;if(n=void 0!==n&&n?n:this.getIncomingElement(),r=void 0!==r&&r?r:this.getReplaceElement(),s=void 0===s||s,"string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof r)throw`Provided replace_el (${r}) is not a string`;u.showLoader(),o.a.get(t).then(function(o){u.hideLoader(),u.replacePageContent(o.data,t,n,r,s),"function"==typeof e&&window.setTimeout(function(){e(i.a.getElement(r),n,u.getPassThroughData())},105)}).catch(function(t){throw u.hideLoader(),u.triggerNavigationFailure(t),t})},loaderEnabled:!0,_loaderDelay:300,setLoaderDelay:function(t){if("number"!=typeof t)throw`${t} is not an integer`;return this._loaderDelay=t,this},getLoaderDelay:function(){return this._loaderDelay},_loaderClasses:"progress page-navigation-loader",_loaderInnerDivClasses:"progress-bar progress-bar-striped progress-bar-animated",getLoaderEl:function(){if(!this.loaderEnabled)return;if(u.navLoaderCached)return u.navLoaderCached;let t=document.createElement("div");t.classList=this._loaderClasses;let e=document.createElement("div");return e.classList=this._loaderInnerDivClasses,t.append(e),document.body.prepend(t),u.navLoaderCached=i.a.getElement(".page-navigation-loader"),u.navLoaderCached},showLoader:function(){if(this.loaderEnabled)return u.loader_timeout=window.setTimeout(function(){u.getLoaderEl().classList.add("active")},this.getLoaderDelay()),this},hideLoader:function(){if(this.loaderEnabled)return window.clearTimeout(u.loader_timeout),u.getLoaderEl().classList.remove("active"),this},parseHTML(t,e){if("string"!=typeof(e=void 0===e?null:e)&&null!==e)throw`Provided parent_el (${e}) is not a string or null`;var n=new DOMParser,r=n.parseFromString(t,"text/html"),o=r.querySelector("title");o=o?o.innerText:null;var i=r.head.getElementsByTagName("meta"),s=r.querySelectorAll('link[rel="canonical"]'),a=r.body.classList,c=t;if(e){var l=r.querySelector(e);if(!l)throw`Could not find parent selector ${e}`;c=l.outerHTML}var f=u.getRouteFromMeta(r);return n=r=null,{title:o,route:f,metas:i,links:s,body_classes:a,html:c}},getRouteFromMeta:function(t){var e=(t=void 0===t?document.head:t).querySelector('[name="current_route"]');return e=e?e.content:null},replacePageContent(t,e,n,r,o){var s=this;if(o=void 0===o||o,n=void 0!==n&&n?n:this.getIncomingElement(),r=void 0!==r&&r?r:this.getReplaceElement(),"string"!=typeof e)throw`Provided url (${e}) is not a string`;if("string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof r)throw`Provided replace_el (${r}) is not a string`;return u.triggerUnload(i.a.getElement(r),r,this.getRouteFromMeta()),window.setTimeout(function(){var a=u.parseHTML(t,n);if(a.html.length){i.a.remove("meta"),document.head.append(a.metas),i.a.remove('[rel="canonical"]'),Array.from(a.links).forEach(function(t){document.head.append(t)}),document.body.classList=a.body_classes,o&&history.pushState({url:e},a.title,e),u.setTitle(a.title);const t=i.a.replaceElWithHTML(r,a.html);u.triggerOnLoad(t,n,r,a.route),s.getReplaceElement()!==r&&s.setReplaceElement(n)}},100),this},reload:function(t){return t="function"!=typeof t?null:t,u.load(s.a.getFullURL(),t),this},fullReload:function(){u.showLoader(),window.location.reload()},redirect:function(t){u.showLoader(),window.location.href=t},setTitle:function(t){return document.title=t,this},onLoad:function(t){return a.a.on("body","navigation.complete",t),this},onUnload:function(t){return a.a.on("body","navigation.started",t),this},onNavigationFailure:function(t){return a.a.on("body","navigation.failed",t),this},triggerOnLoad:function(t,e,n,r){return r=void 0!==r?r:u.getRouteFromMeta(),a.a.trigger("body","navigation.complete",{el:t,el_selector:e,replaced_selector:n,route:r,data:this.getPassThroughData()}),this},triggerUnload:function(t,e,n){return a.a.trigger("body","navigation.started",{el:t,el_selector:e,route:n}),this},triggerNavigationFailure:function(t){return a.a.trigger("body","navigation.failed",{error:t}),this},initHistoryHandlers:function(){return window.onpushstate=function(t){u.load(s.a.getURIWithQueryString())},window.onpopstate=function(t){u.load(s.a.getURIWithQueryString(),null,null,null,!1)},this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={isDataObject:function(t,e,n,r,o){o=void 0!==o&&o,n=void 0!==n&&n;var i=JSON.stringify(t);const s=`${i} is not an object`;if(void 0===t){if(o)throw s;return!1}if(!("object"==typeof t)||null===t||Array.isArray(t)){if(o)throw s;return!1}if(Array.isArray(e)){let s=!1,a=[];const u=Object.keys(t);if(e.forEach(function(t){u.includes(t)?s=!0:a.push(t)}),!s){if(o)throw`${i} does not contain at least one of the following: `+e.join(", ");return!1}if(n&&a.length){if(o)throw`${i} is missing data: `+a.join(", ");return!1}if(r){let t=[];if(u.forEach(function(n){e.includes(n)||t.push(n)}),t.length){if(o)throw`${i} contains invalid data: `+t.join(", ");return!1}}}return!0}}},function(t,e,n){t.exports=n(23)},function(t,e,n){"use strict";n.d(e,"a",function(){return r}),n(40);const r={query:new URLSearchParams(window.location.search),isHttps:function(){return"https:"===window.location.protocol},getDomain:function(){return window.location.hostname||window.location.host},getDomainWithProtocol:function(){return window.location.origin},getURI:function(){return window.location.pathname},getURIWithQueryString:function(){return window.location.pathname+window.location.search},getFullURL:function(){return window.location.href},appendSlash:function(t){return"/"!==t[t.length-1]?t+"/":t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(4),o=n(8);class i{constructor(){}populate(t){const e=this;if(void 0===this._keys)throw"Cannot populate object if _keys property is not set";return r.a.isDataObject(t,this._keys,!1,!0,!0),this._keys.forEach(function(n){void 0!==t[n]&&e[o.a.setter(n)](t[n])}),this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});const r={getter:function(t){return"get"+this.ucfirst(t)},setter:function(t){return"set"+this.ucfirst(t)},ucfirst:function(t){return t&&t[0].toUpperCase()+t.slice(1)}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";var r=n(0),o=n(3),i=n(5),s=n.n(i);n(41);const a={xhrSubmit:!0,submitURL:null,submitMethod:null,onError:function(t,e,n){alert(t)},onSuccess:function(t,e){"string"==typeof t.success?alert(t.success):alert("Your submission has been received")},validateForm:function(t){t.classList.add("was-validated");const e=!t.querySelector(":invalid");return e&&t.classList.remove("was-validated"),e}};class u{constructor(t,e){if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...a,...e},this.setForm(t),this.setValidateCallback(e.validateForm),this.setXHRSubmit(e.xhrSubmit),this.setSubmitMethod(e.submitMethod),this.setSubmitURL(e.submitURL),this.onSuccess(e.onSuccess),this.onError(e.onError)}setValidateCallback(t){if("function"!=typeof t)throw`${t} is not a function`;return this._validateCallback=t,this}validate(t){return void 0===t&&(t=this.getForm()),this._validateCallback(t)}setForm(t){if(!t||void 0===t)throw"Form element is required";if(!(t=r.a.getElement(t,!0,!0)))throw"Invalid form element received";return this._form=t,this}getForm(){return this._form}setXHRSubmit(t){return this._xhrSubmit=!!t,this}setSubmitMethod(t){if("string"!=typeof t&&null!==t)throw`${t} is not a string or null`;return this._submitMethod=t,this}getSubmitMethod(){return this._submitMethod}setSubmitURL(t){if("string"!=typeof t&&"function"!=typeof t&&null!==t)throw`${t} is not a string, function, or null`;return this._submitURL=t,this}getSubmitURL(){return this._submitURL}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):null===e?t.action:e}attachSubmitHandler(t){if(!this._xhrSubmit)return;if(!(t=void 0===t?this.getForm():r.a.getElement(t)))throw"Form element not received, cannot attach submit handler";const e=this;return t.addEventListener("submit",function(n){return!e._xhrSubmit||(n.preventDefault(),e.submitForm(t),!1)}),this}onSuccess(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onSuccess&&(this._onSuccess=[]),this._onSuccess.push(t),this}clearOnSuccessCallbacks(){return this._onSuccess=[],this}triggerOnSuccess(t,e){return void 0!==this._onSuccess&&(this._onSuccess.forEach(function(n){n(t,e)}),this)}onError(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onError&&(this._onError=[]),this._onError.push(t),this}clearOnErrorCallbacks(){return this._onError=[],this}triggerOnError(t,e,n){return void 0!==this._onError&&(this._onError.forEach(function(r){r(t,e,n)}),this)}submitForm(t){if(void 0===this._processing&&(this._processing=!1),this._processing)return!1;this._processing=!0;const e=this;let n=this.getFinalSubmitURL(t),r=this.getSubmitMethod();if(null===r&&void 0!==t.attributes.method&&(r=t.method),r=r?r.toLowerCase():"post",!this.validate(t))return this._processing=!1,!1;o.a.showLoader();const i=Array.from(this.getFormValues(t),t=>t.map(encodeURIComponent).join("=")).join("&");return s()({url:n,method:r,data:i}).then(function(n){o.a.hideLoader(),e._processing=!1;let r=n.data;try{r="string"==typeof r?JSON.parse(r):r}catch(t){}if("string"==typeof r){if("string"==typeof e.getIncomingElementSelector()){const n=o.a.parseHTML(r,e.getIncomingElementSelector());return n.html.length?e.insertForm(n,r,t):e.triggerOnError(`${e.getIncomingElementSelector()} could not be found in response from the server`,r,t)}return e.insertForm({html:r},r,t)}if("object"==typeof r)return r.html?e.insertForm({html:r.html},r,t):r.error?e.triggerOnError(r.error,r,t):e.triggerOnSuccess(r,t)}).catch(function(t){throw o.a.hideLoader(),e._processing=!1,t}),this}getFormValues(t){return new FormData(t)}}const c={incomingElementSelector:null,insertIntoElement:null,onload:function(t){return this}};class l extends u{constructor(t,e){if(super(null,e),"string"!=typeof t)throw`${t} is not a string`;if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...c,...e},this.setURL(t),this.setIncomingElementSelector(e.incomingElementSelector),this.setInsertIntoElement(e.insertIntoElement),this.onload(e.onload)}setForm(t){return this._form=t,this}setURL(t){if("string"!=typeof t)throw`${t} is not a string`;return this._url=t,this}getURL(){return this._url}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):(null===e&&t.attributes.action&&(e=t.action),null===(e=e||this.getURL())&&(e=t.action),e)}setIncomingElementSelector(t){if(null!==t&&"string"!=typeof t)throw`${t} is not a string or null value`;return this._incomingElementSelector=t,this}getIncomingElementSelector(){return this._incomingElementSelector}setInsertIntoElement(t){this._insertIntoElement=t}getInsertIntoElement(){return this._insertIntoElement}getForm(){const t=this;o.a.showLoader(),s.a.get(this.getURL()).then(function(e){o.a.hideLoader();let n=e.data;try{n="string"==typeof n?JSON.parse(n):n}catch(t){}if("string"==typeof n){if("string"==typeof t.getIncomingElementSelector()){const e=o.a.parseHTML(n,t.getIncomingElementSelector());return t.insertForm(e,n)}return t.insertForm({html:n})}if("object"==typeof n&&void 0!==n.html)return t.insertForm({html:n.html},n);throw`Unexpected server response ${n}`}).catch(function(t){throw o.a.hideLoader(),t})}insertForm(t,e,n){let o=this.getInsertIntoElement();if(null===o)throw"Cannot determine where to insert form. Overwrite insertForm() or provide insertIntoElement";return(o=r.a.getElement(o,!0)).innerHTML=t.html,n=o.querySelector("form"),this.attachSubmitHandler(n),this.triggerOnload(n),o}onload(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onload&&(this._onload=[]),this._onload.push(t),this}clearOnloadCallbacks(){return this._onload=[],this}triggerOnload(t){return void 0!==this._onload&&(this._onload.forEach(function(e){e(t)}),this)}}n.d(e,"b",function(){return u}),n.d(e,"a",function(){return l})},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},function(t,e,n){"use strict";var r=n(2);function o(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(r.isURLSearchParams(e))i=e.toString();else{var s=[];r.forEach(e,function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),s.push(o(e)+"="+o(t))}))}),i=s.join("&")}if(i){var a=t.indexOf("#");-1!==a&&(t=t.slice(0,a)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t}},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";(function(e){var r=n(2),o=n(30),i={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:(void 0!==e&&"[object process]"===Object.prototype.toString.call(e)?a=n(15):"undefined"!=typeof XMLHttpRequest&&(a=n(15)),a),transformRequest:[function(t,e){return o(e,"Accept"),o(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){u.headers[t]={}}),r.forEach(["post","put","patch"],function(t){u.headers[t]=r.merge(i)}),t.exports=u}).call(this,n(29))},function(t,e,n){"use strict";var r=n(2),o=n(31),i=n(12),s=n(33),a=n(34),u=n(16);t.exports=function(t){return new Promise(function(e,c){var l=t.data,f=t.headers;r.isFormData(l)&&delete f["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var d=t.auth.username||"",p=t.auth.password||"";f.Authorization="Basic "+btoa(d+":"+p)}if(h.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,r={data:t.responseType&&"text"!==t.responseType?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:n,config:t,request:h};o(e,c,r),h=null}},h.onabort=function(){h&&(c(u("Request aborted",t,"ECONNABORTED",h)),h=null)},h.onerror=function(){c(u("Network Error",t,null,h)),h=null},h.ontimeout=function(){c(u("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var m=n(35),g=(t.withCredentials||a(t.url))&&t.xsrfCookieName?m.read(t.xsrfCookieName):void 0;g&&(f[t.xsrfHeaderName]=g)}if("setRequestHeader"in h&&r.forEach(f,function(t,e){void 0===l&&"content-type"===e.toLowerCase()?delete f[e]:h.setRequestHeader(e,t)}),t.withCredentials&&(h.withCredentials=!0),t.responseType)try{h.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){h&&(h.abort(),c(t),h=null)}),void 0===l&&(l=null),h.send(l)})}},function(t,e,n){"use strict";var r=n(32);t.exports=function(t,e,n,o,i){var s=new Error(t);return r(s,e,n,o,i)}},function(t,e,n){"use strict";var r=n(2);t.exports=function(t,e){e=e||{};var n={};return r.forEach(["url","method","params","data"],function(t){void 0!==e[t]&&(n[t]=e[t])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(e[o])?n[o]=r.deepMerge(t[o],e[o]):void 0!==e[o]?n[o]=e[o]:r.isObject(t[o])?n[o]=r.deepMerge(t[o]):void 0!==t[o]&&(n[o]=t[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){void 0!==e[r]?n[r]=e[r]:void 0!==t[r]&&(n[r]=t[r])}),n}},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var r=n(4),o=n(7);const i={id:null,name:null,config:{}};class s extends o.a{constructor(t){if(super(),this._keys=["id","name","config"],void 0===t)return this;t={...i,...t},this.populate(t)}getId(){return this._id}setId(t){return this._id=t,this}getName(){return this._name}setName(t){return this._name=t,this}getConfig(){return this._config}setConfig(t){return r.a.isDataObject(t,null,!1,!1,!0),this._config=t,this}getConfigItem(t){return void 0===this._config[t]?null:this._config[t]}setConfigItem(t,e){return this._config[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var r=n(4),o=n(7);const i={id:null,isGuest:!1,isAdmin:!1,username:null,fname:null,lname:null,email:null,phone:null,permissions:[],additionalData:{}};class s extends o.a{constructor(t){if(super(),this._keys=["id","isGuest","isAdmin","username","fname","lname","email","phone","permissions","additionalData"],void 0===t)return this;t={...i,...t},this.populate(t)}setId(t){return this._id=t,this}getId(){return this._id}setIsGuest(t){return this._isGuest=t,this}getIsGuest(){return this._isGuest}setIsAdmin(t){return this._isAdmin=t,this}getIsAdmin(){return this._isAdmin}setUsername(t){return this._username=t,this}getUsername(){return this._username}getFname(){return this._fname}setFname(t){return this._fname=t,this}getLname(){return this._lname}setLname(t){return this._lname=t,this}getName(){return`${s.getFname()} ${s.getLname()}`}getEmail(){return this._email}setEmail(t){return this._email=t,this}getPhone(){return this._phone}setPhone(t){return this._phone=t,this}getPermissions(){return this._permissions}setPermissions(t){if(!Array.isArray(t))throw"setPermissions requires an array";return this._permissions=t,this}addPermission(t){return this._permissions.push(t),this}removePermission(t){return this.setPermissions(this._permissions.filter(function(e){return e!==t})),this}hasPermission(t){return this.getPermissions().includes(t)}getAdditionalData(){return this._additionalData}setAdditionalData(t){return r.a.isDataObject(t,null,!1,!1,!0),this._additionalData=t,this}getDataItem(t){return void 0===this._additionalData[t]?null:this._additionalData[t]}setDataItem(t,e){return this._additionalData[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(1),o=n(0);class i{constructor(t,e,n,r){this.btn=o.a.getElement(t,!0,!0),this.toggle_el=o.a.getElement(e,!0,!0),this.hide_on_outside_click="boolean"!=typeof r||r,this.toggle_class="string"!=typeof n?"visible":n}init(){const t=this;return this.onWindowResize=function(){window.clearTimeout(void 0),window.setTimeout(function(){o.a.isVisible(t.btn)?t.toggle_el.classList.remove(t.toggle_class):t.toggle_el.classList.add(t.toggle_class)},200)},this.hide_on_outside_click&&(this.onClickOutside=function(e){let n=e.target;if(n===t.btn)return!1;do{if(t.btn===n)return!1}while(n=n.parentNode);if((n=e.target)===t.toggle_el)return!1;do{if(t.toggle_el===n)return!1}while(n=n.parentNode);t.toggle_el.classList.remove(t.toggle_class)},r.a.on("body","click",this.onClickOutside)),this.onClickToggleBtn=r.a.onClick(this.btn,function(){t.toggle_el.classList.toggle(t.toggle_class)}),window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this}destroy(){this.hide_on_outside_click&&r.a.off("body","click",this.onClickOutside),r.a.off(this.btn,"click",this.onClickToggleBtn),window.removeEventListener("resize",this.onWindowResize)}}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"jpack",function(){return p});var r=n(0),o=n(1),i=n(10),s=n(3),a=n(6),u=n(19),c=n(8),l=n(4),f=n(20),h=n(21);const d={dom:r.a,events:o.a,XHRForm:i.b,FormFromURL:i.a,navigation:s.a,request:a.a,Site:u.a,strings:c.a,type_checks:l.a,User:f.a,ToggleOnMobile:h.a},p={...d,setGlobal:function(t){t="string"==typeof t?t:null;for(const e in d)t?(void 0===window[t]&&(window[t]={}),window[t][e]=d[e]):window[e]=d[e]}};t.jpack=p}.call(this,n(9))},function(t,e,n){"use strict";var r=n(2),o=n(11),i=n(25),s=n(17);function a(t){var e=new i(t),n=o(i.prototype.request,e);return r.extend(n,i.prototype,e),r.extend(n,e),n}var u=a(n(14));u.Axios=i,u.create=function(t){return a(s(u.defaults,t))},u.Cancel=n(18),u.CancelToken=n(38),u.isCancel=n(13),u.all=function(t){return Promise.all(t)},u.spread=n(39),t.exports=u,t.exports.default=u},function(t,e){ | ||
/*! | ||
@@ -3,0 +3,0 @@ * Determine if an object is a Buffer |
@@ -1,1 +0,1 @@ | ||
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={getElement:function(t,e,n){const i=this.getElements(t,e);if(i.length>1&&n)throw`More than 1 result found for "${t}"`;return i?i[0]:null},getElements:function(t,e){e=void 0!==e&&e;let n=[];if(void 0!==t&&t)if(t instanceof Element||t instanceof HTMLDocument)n.push(t);else if("string"==typeof t)n=(n=document.querySelectorAll(t))?Array.from(n):n;else if(t instanceof jQuery)t.length&&(n=t.toArray());else if(t instanceof NodeList||t instanceof HTMLCollection)n=Array.from(t);else{if(!Array.isArray(t))throw`Invalid value: "${t}"`;t.forEach(function(t){(t=i.getElement(t))&&n.push(t)})}else;if(!n.length&&e)throw`Failed to find "${t}"`;return n},remove:function(t,e){let n=this.getElements(t);if(!n.length){if(e)throw`Could not find "${t}"`;return this}return n.forEach(function(t){t.parentNode.removeChild(t)}),this},replaceElWithHTML:function(t,e,n){if("string"!=typeof e)throw`${e} is not a string`;const i=this.getElement(t);if(!t){if(n)throw`Could not find "${t}"`;return null}let r=(new DOMParser).parseFromString(e,"text/html");return r=i.parentNode.insertBefore(r.documentElement.querySelector("body").childNodes[0],i),i.remove(),r},isVisible(t,e){if(!(t=this.getElement(t,!0,!0))){if(e)throw`Could not find "${t}"`;return!1}const n=getComputedStyle(t);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(0===n.opacity)return!1;if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width===0)return!1;const i=t.getBoundingClientRect(),r={"top-left":{x:i.left,y:i.top},"top-right":{x:i.right,y:i.top},"bottom-left":{x:i.left,y:i.bottom},"bottom-right":{x:i.right,y:i.bottom},center:{x:i.left+t.offsetWidth/2,y:i.top+t.offsetHeight/2}};let o=!0;return Object.keys(r).forEach(function(t){var e=r[t];return e.x<0&&(o=!1),!1}),o},exists:function(t){return this.getElements(t).length},multipleExist:function(t){return this.getElements(t).length>1}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);const r={setGlobal:function(t){for(var e in t="string"==typeof t?t:null,this)this.hasOwnProperty(e)&&"setGlobal"!==e&&(t?(void 0===window[t]&&(window[t]={}),window[t][e]=this[e]):window[e]=this[e])},onClick:function(t,e){return r.onEventPreventDefault(t,"click",e)},onSubmit:function(t,e){return r.onEventPreventDefault(t,"submit",e)},onEventPreventDefault:function(t,e,n){const r=i.a.getElements(t);if(!r.length)return t;const o=function(t){return Array.isArray(t)&&(t=t[0]),t.preventDefault(),n.call(this,t),!1};return r.forEach(function(t){t.addEventListener(e,o)}),o},on:function(t,e,n){const r=i.a.getElements(t);return r.length?(r.forEach(function(t){t.addEventListener(e,n)}),r):t},off:function(t,e,n){const r=i.a.getElements(t);return r.length?(r.forEach(function(t){t.removeEventListener(e,n)}),r):t},trigger:function(t,e,n){const r=i.a.getElements(t);return r.length?(n=void 0===n?null:n,e=new CustomEvent(e,{detail:n}),r.forEach(function(t){t.dispatchEvent(e)}),r):t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(4),r=n.n(i),o=n(0),s=n(5),a=n(1);const l={_passthroughData:null,setPassthroughData:function(t){return this._passthroughData=t,this},clearPassthroughData:function(){return this.setPassthroughData(null),this},getPassThroughData:function(t){return this._passthroughData},_incomingElementSelector:"body",setIncomingElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._incomingElementSelector=t},getIncomingElement:function(){return this._incomingElementSelector},_replaceElementSelector:"body",setReplaceElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._replaceElementSelector=t},getReplaceElement:function(){return this._replaceElementSelector},load:function(t,e,n,i,s){if("string"!=typeof t)throw`Provided URL (${t}) is not a string`;if(n=void 0!==n&&n?n:this.getIncomingElement(),i=void 0!==i&&i?i:this.getReplaceElement(),s=void 0===s||s,"string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof i)throw`Provided replace_el (${i}) is not a string`;l.showLoader(),r.a.get(t).then(function(r){l.hideLoader(),l.replacePageContent(r.data,t,n,i,s),"function"==typeof e&&window.setTimeout(function(){e(o.a.getElement(i),n,l.getPassThroughData())},105)}).catch(function(t){throw l.hideLoader(),l.triggerNavigationFailure(t),t})},loaderEnabled:!0,_loaderDelay:300,setLoaderDelay:function(t){if("number"!=typeof t)throw`${t} is not an integer`;return this._loaderDelay=t,this},getLoaderDelay:function(){return this._loaderDelay},_loaderClasses:"progress page-navigation-loader",_loaderInnerDivClasses:"progress-bar progress-bar-striped progress-bar-animated",getLoaderEl:function(){if(!this.loaderEnabled)return;if(l.navLoaderCached)return l.navLoaderCached;let t=document.createElement("div");t.classList=this._loaderClasses;let e=document.createElement("div");return e.classList=this._loaderInnerDivClasses,t.append(e),document.body.prepend(t),l.navLoaderCached=o.a.getElement(".page-navigation-loader"),l.navLoaderCached},showLoader:function(){if(this.loaderEnabled)return l.loader_timeout=window.setTimeout(function(){l.getLoaderEl().classList.add("active")},this.getLoaderDelay()),this},hideLoader:function(){if(this.loaderEnabled)return window.clearTimeout(l.loader_timeout),l.getLoaderEl().classList.remove("active"),this},parseHTML(t,e){if("string"!=typeof(e=void 0===e?null:e)&&null!==e)throw`Provided parent_el (${e}) is not a string or null`;var n=new DOMParser,i=n.parseFromString(t,"text/html"),r=i.querySelector("title");r=r?r.innerText:null;var o=i.head.getElementsByTagName("meta"),s=i.querySelectorAll('link[rel="canonical"]'),a=i.body.classList,u=t;if(e){var c=i.querySelector(e);if(!c)throw`Could not find parent selector ${e}`;u=c.outerHTML}var h=l.getRouteFromMeta(i);return n=i=null,{title:r,route:h,metas:o,links:s,body_classes:a,html:u}},getRouteFromMeta:function(t){var e=(t=void 0===t?document.head:t).querySelector('[name="current_route"]');return e=e?e.content:null},replacePageContent(t,e,n,i,r){var s=this;if(r=void 0===r||r,n=void 0!==n&&n?n:this.getIncomingElement(),i=void 0!==i&&i?i:this.getReplaceElement(),"string"!=typeof e)throw`Provided url (${e}) is not a string`;if("string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof i)throw`Provided replace_el (${i}) is not a string`;return l.triggerUnload(o.a.getElement(i),i,this.getRouteFromMeta()),window.setTimeout(function(){var a=l.parseHTML(t,n);if(a.html.length){o.a.remove("meta"),document.head.append(a.metas),o.a.remove('[rel="canonical"]'),Array.from(a.links).forEach(function(t){document.head.append(t)}),document.body.classList=a.body_classes,r&&history.pushState({url:e},a.title,e),l.setTitle(a.title);const t=o.a.replaceElWithHTML(i,a.html);l.triggerOnLoad(t,n,i,a.route),s.getReplaceElement()!==i&&s.setReplaceElement(n)}},100),this},reload:function(t){return t="function"!=typeof t?null:t,l.load(s.a.getFullURL(),t),this},fullReload:function(){l.showLoader(),window.location.reload()},redirect:function(t){l.showLoader(),window.location.href=t},setTitle:function(t){return document.title=t,this},onLoad:function(t){return a.a.on("body","navigation.complete",t),this},onUnload:function(t){return a.a.on("body","navigation.started",t),this},onNavigationFailure:function(t){return a.a.on("body","navigation.failed",t),this},triggerOnLoad:function(t,e,n,i){return i=void 0!==i?i:l.getRouteFromMeta(),a.a.trigger("body","navigation.complete",{el:t,el_selector:e,replaced_selector:n,route:i,data:this.getPassThroughData()}),this},triggerUnload:function(t,e,n){return a.a.trigger("body","navigation.started",{el:t,el_selector:e,route:n}),this},triggerNavigationFailure:function(t){return a.a.trigger("body","navigation.failed",{error:t}),this},initHistoryHandlers:function(){return window.onpushstate=function(t){l.load(s.a.getURIWithQueryString())},window.onpopstate=function(t){l.load(s.a.getURIWithQueryString(),null,null,null,!1)},this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={isDataObject:function(t,e,n,i,r){r=void 0!==r&&r,n=void 0!==n&&n;var o=JSON.stringify(t);const s=`${o} is not an object`;if(void 0===t){if(r)throw s;return!1}if(!("object"==typeof t)||null===t||Array.isArray(t)){if(r)throw s;return!1}if(Array.isArray(e)){let s=!1,a=[];const l=Object.keys(t);if(e.forEach(function(t){l.includes(t)?s=!0:a.push(t)}),!s){if(r)throw`${o} does not contain at least one of the following: `+e.join(", ");return!1}if(n&&a.length){if(r)throw`${o} is missing data: `+a.join(", ");return!1}if(i){let t=[];if(l.forEach(function(n){e.includes(n)||t.push(n)}),t.length){if(r)throw`${o} contains invalid data: `+t.join(", ");return!1}}}return!0}}},function(t,e){t.exports=axios},function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n(14);const i={query:new URLSearchParams(window.location.search),isHttps:function(){return"https:"===window.location.protocol},getDomain:function(){return window.location.hostname||window.location.host},getDomainWithProtocol:function(){return window.location.origin},getURI:function(){return window.location.pathname},getURIWithQueryString:function(){return window.location.pathname+window.location.search},getFullURL:function(){return window.location.href},appendSlash:function(t){return"/"!==t[t.length-1]?t+"/":t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(3),r=n(7);class o{constructor(){}populate(t){const e=this;if(void 0===this._keys)throw"Cannot populate object if _keys property is not set";return i.a.isDataObject(t,this._keys,!1,!0,!0),this._keys.forEach(function(n){void 0!==t[n]&&e[r.a.setter(n)](t[n])}),this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={getter:function(t){return"get"+this.ucfirst(t)},setter:function(t){return"set"+this.ucfirst(t)},ucfirst:function(t){return t&&t[0].toUpperCase()+t.slice(1)}}},function(t,e,n){"use strict";var i=n(0),r=n(2),o=n(4),s=n.n(o);n(15);const a={xhrSubmit:!0,submitURL:null,submitMethod:null,onError:function(t,e,n){alert(t)},onSuccess:function(t,e){"string"==typeof t.success?alert(t.success):alert("Your submission has been received")},validateForm:function(t){t.classList.add("was-validated");const e=!t.querySelector(":invalid");return e&&t.classList.remove("was-validated"),e}};class l{constructor(t,e){if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...a,...e},this.setForm(t),this.setValidateCallback(e.validateForm),this.setXHRSubmit(e.xhrSubmit),this.setSubmitMethod(e.submitMethod),this.setSubmitURL(e.submitURL),this.onSuccess(e.onSuccess),this.onError(e.onError)}setValidateCallback(t){if("function"!=typeof t)throw`${t} is not a function`;return this._validateCallback=t,this}validate(t){return void 0===t&&(t=this.getForm()),this._validateCallback(t)}setForm(t){if(!t||void 0===t)throw"Form element is required";if(!(t=i.a.getElement(t,!0,!0)))throw"Invalid form element received";return this._form=t,this}getForm(){return this._form}setXHRSubmit(t){return this._xhrSubmit=!!t,this}setSubmitMethod(t){if("string"!=typeof t&&null!==t)throw`${t} is not a string or null`;return this._submitMethod=t,this}getSubmitMethod(){return this._submitMethod}setSubmitURL(t){if("string"!=typeof t&&"function"!=typeof t&&null!==t)throw`${t} is not a string, function, or null`;return this._submitURL=t,this}getSubmitURL(){return this._submitURL}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):null===e?t.action:e}attachSubmitHandler(t){if(!this._xhrSubmit)return;if(!(t=void 0===t?this.getForm():i.a.getElement(t)))throw"Form element not received, cannot attach submit handler";const e=this;return t.addEventListener("submit",function(n){return!e._xhrSubmit||(n.preventDefault(),e.submitForm(t),!1)}),this}onSuccess(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onSuccess&&(this._onSuccess=[]),this._onSuccess.push(t),this}clearOnSuccessCallbacks(){return this._onSuccess=[],this}triggerOnSuccess(t,e){return void 0!==this._onSuccess&&(this._onSuccess.forEach(function(n){n(t,e)}),this)}onError(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onError&&(this._onError=[]),this._onError.push(t),this}clearOnErrorCallbacks(){return this._onError=[],this}triggerOnError(t,e,n){return void 0!==this._onError&&(this._onError.forEach(function(i){i(t,e,n)}),this)}submitForm(t){if(void 0===this._processing&&(this._processing=!1),this._processing)return!1;this._processing=!0;const e=this;let n=this.getFinalSubmitURL(t),i=this.getSubmitMethod();if(null===i&&void 0!==t.attributes.method&&(i=t.method),i=i?i.toLowerCase():"post",!this.validate(t))return this._processing=!1,!1;r.a.showLoader();const o=Array.from(this.getFormValues(t),t=>t.map(encodeURIComponent).join("=")).join("&");return s()({url:n,method:i,data:o}).then(function(n){r.a.hideLoader(),e._processing=!1;let i=n.data;try{i="string"==typeof i?JSON.parse(i):i}catch(t){}if("string"==typeof i){if("string"==typeof e.getIncomingElementSelector()){const n=r.a.parseHTML(i,e.getIncomingElementSelector());return n.html.length?e.insertForm(n,i,t):e.triggerOnError(`${e.getIncomingElementSelector()} could not be found in response from the server`,i,t)}return e.insertForm({html:i},i,t)}if("object"==typeof i)return i.html?e.insertForm({html:i.html},i,t):i.error?e.triggerOnError(i.error,i,t):e.triggerOnSuccess(i,t)}).catch(function(t){throw r.a.hideLoader(),e._processing=!1,t}),this}getFormValues(t){return new FormData(t)}}const u={incomingElementSelector:null,insertIntoElement:null,onload:function(t){return this}};class c extends l{constructor(t,e){if(super(null,e),"string"!=typeof t)throw`${t} is not a string`;if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...u,...e},this.setURL(t),this.setIncomingElementSelector(e.incomingElementSelector),this.setInsertIntoElement(e.insertIntoElement),this.onload(e.onload)}setForm(t){return this._form=t,this}setURL(t){if("string"!=typeof t)throw`${t} is not a string`;return this._url=t,this}getURL(){return this._url}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):(null===e&&t.attributes.action&&(e=t.action),null===(e=e||this.getURL())&&(e=t.action),e)}setIncomingElementSelector(t){if(null!==t&&"string"!=typeof t)throw`${t} is not a string or null value`;return this._incomingElementSelector=t,this}getIncomingElementSelector(){return this._incomingElementSelector}setInsertIntoElement(t){this._insertIntoElement=t}getInsertIntoElement(){return this._insertIntoElement}getForm(){const t=this;r.a.showLoader(),s.a.get(this.getURL()).then(function(e){r.a.hideLoader();let n=e.data;try{n="string"==typeof n?JSON.parse(n):n}catch(t){}if("string"==typeof n){if("string"==typeof t.getIncomingElementSelector()){const e=r.a.parseHTML(n,t.getIncomingElementSelector());return t.insertForm(e,n)}return t.insertForm({html:n})}if("object"==typeof n&&void 0!==n.html)return t.insertForm({html:n.html},n);throw`Unexpected server response ${n}`}).catch(function(t){throw r.a.hideLoader(),t})}insertForm(t,e,n){let r=this.getInsertIntoElement();if(null===r)throw"Cannot determine where to insert form. Overwrite insertForm() or provide insertIntoElement";return(r=i.a.getElement(r,!0)).innerHTML=t.html,n=r.querySelector("form"),this.attachSubmitHandler(n),this.triggerOnload(n),r}onload(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onload&&(this._onload=[]),this._onload.push(t),this}clearOnloadCallbacks(){return this._onload=[],this}triggerOnload(t){return void 0!==this._onload&&(this._onload.forEach(function(e){e(t)}),this)}}n.d(e,"b",function(){return l}),n.d(e,"a",function(){return c})},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(3),r=n(6);const o={id:null,name:null,config:{}};class s extends r.a{constructor(t){if(super(),this._keys=["id","name","config"],void 0===t)return this;t={...o,...t},this.populate(t)}getId(){return this._id}setId(t){return this._id=t,this}getName(){return this._name}setName(t){return this._name=t,this}getConfig(){return this._config}setConfig(t){return i.a.isDataObject(t,null,!1,!1,!0),this._config=t,this}getConfigItem(t){return void 0===this._config[t]?null:this._config[t]}setConfigItem(t,e){return this._config[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(3),r=n(6);const o={id:null,isGuest:!1,isAdmin:!1,username:null,fname:null,lname:null,email:null,phone:null,permissions:[],additionalData:{}};class s extends r.a{constructor(t){if(super(),this._keys=["id","isGuest","isAdmin","username","fname","lname","email","phone","permissions","additionalData"],void 0===t)return this;t={...o,...t},this.populate(t)}setId(t){return this._id=t,this}getId(){return this._id}setIsGuest(t){return this._isGuest=t,this}getIsGuest(){return this._isGuest}setIsAdmin(t){return this._isAdmin=t,this}getIsAdmin(){return this._isAdmin}setUsername(t){return this._username=t,this}getUsername(){return this._username}getFname(){return this._fname}setFname(t){return this._fname=t,this}getLname(){return this._lname}setLname(t){return this._lname=t,this}getName(){return`${user.getFname()} ${user.getLname()}`}getEmail(){return this._email}setEmail(t){return this._email=t,this}getPhone(){return this._phone}setPhone(t){return this._phone=t,this}getPermissions(){return this._permissions}setPermissions(t){if(!Array.isArray(t))throw"setPermissions requires an array";return this._permissions=t,this}addPermission(t){return this._permissions.push(t),this}removePermission(t){return this.setPermissions(this._permissions.filter(function(e){return e!==t})),this}hasPermission(t){return this.getPermissions().includes(t)}getAdditionalData(){return this._additionalData}setAdditionalData(t){return i.a.isDataObject(t,null,!1,!1,!0),this._additionalData=t,this}getDataItem(t){return void 0===this._additionalData[t]?null:this._additionalData[t]}setDataItem(t,e){return this._additionalData[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(1),r=n(0);class o{constructor(t,e,n,i){this.btn=r.a.getElement(t,!0,!0),this.toggle_el=r.a.getElement(e,!0,!0),this.hide_on_outside_click="boolean"!=typeof i||i,this.toggle_class="string"!=typeof n?"visible":n}init(){const t=this;return this.onWindowResize=function(){window.clearTimeout(void 0),window.setTimeout(function(){r.a.isVisible(t.btn)?t.toggle_el.classList.remove(t.toggle_class):t.toggle_el.classList.add(t.toggle_class)},200)},this.hide_on_outside_click&&(this.onClickOutside=function(e){let n=e.target;if(n===t.btn)return!1;do{if(t.btn===n)return!1}while(n=n.parentNode);if((n=e.target)===t.toggle_el)return!1;do{if(t.toggle_el===n)return!1}while(n=n.parentNode);t.toggle_el.classList.remove(t.toggle_class)},i.a.on("body","click",this.onClickOutside)),this.onClickToggleBtn=i.a.onClick(this.btn,function(){t.toggle_el.classList.toggle(t.toggle_class)}),window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this}destroy(){this.hide_on_outside_click&&i.a.off("body","click",this.onClickOutside),i.a.off(this.btn,"click",this.onClickToggleBtn),window.removeEventListener("resize",this.onWindowResize)}}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"jpack",function(){return g});var i=n(0),r=n(1),o=n(8),s=n(2),a=n(5),l=n(9),u=n(7),c=n(3),h=n(10),d=n(11);const f={dom:i.a,events:r.a,XHRForm:o.b,FormFromURL:o.a,navigation:s.a,request:a.a,Site:l.a,strings:u.a,type_checks:c.a,User:h.a,ToggleOnMobile:d.a},g={...f,setGlobal:function(t){t="string"==typeof t?t:null;for(const e in f)t?(void 0===window[t]&&(window[t]={}),window[t][e]=f[e]):window[e]=f[e]}};t.jpack=g}.call(this,n(13))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=url-search-params-polyfill},function(t,e){t.exports=formdata-polyfill}]); | ||
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}([function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={getElement:function(t,e,n){const i=this.getElements(t,e);if(i.length>1&&n)throw`More than 1 result found for "${t}"`;return i?i[0]:null},getElements:function(t,e){e=void 0!==e&&e;let n=[];if(void 0!==t&&t)if(t instanceof Element||t instanceof HTMLDocument)n.push(t);else if("string"==typeof t)n=(n=document.querySelectorAll(t))?Array.from(n):n;else if(t instanceof jQuery)t.length&&(n=t.toArray());else if(t instanceof NodeList||t instanceof HTMLCollection)n=Array.from(t);else{if(!Array.isArray(t))throw`Invalid value: "${t}"`;t.forEach(function(t){(t=i.getElement(t))&&n.push(t)})}else;if(!n.length&&e)throw`Failed to find "${t}"`;return n},remove:function(t,e){let n=this.getElements(t);if(!n.length){if(e)throw`Could not find "${t}"`;return this}return n.forEach(function(t){t.parentNode.removeChild(t)}),this},replaceElWithHTML:function(t,e,n){if("string"!=typeof e)throw`${e} is not a string`;const i=this.getElement(t);if(!t){if(n)throw`Could not find "${t}"`;return null}let r=(new DOMParser).parseFromString(e,"text/html");return r=i.parentNode.insertBefore(r.documentElement.querySelector("body").childNodes[0],i),i.remove(),r},isVisible(t,e){if(!(t=this.getElement(t,!0,!0))){if(e)throw`Could not find "${t}"`;return!1}const n=getComputedStyle(t);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(0===n.opacity)return!1;if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width===0)return!1;const i=t.getBoundingClientRect(),r={"top-left":{x:i.left,y:i.top},"top-right":{x:i.right,y:i.top},"bottom-left":{x:i.left,y:i.bottom},"bottom-right":{x:i.right,y:i.bottom},center:{x:i.left+t.offsetWidth/2,y:i.top+t.offsetHeight/2}};let o=!0;return Object.keys(r).forEach(function(t){var e=r[t];return e.x<0&&(o=!1),!1}),o},exists:function(t){return this.getElements(t).length},multipleExist:function(t){return this.getElements(t).length>1}}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);const r={setGlobal:function(t){for(var e in t="string"==typeof t?t:null,this)this.hasOwnProperty(e)&&"setGlobal"!==e&&(t?(void 0===window[t]&&(window[t]={}),window[t][e]=this[e]):window[e]=this[e])},onClick:function(t,e){return r.onEventPreventDefault(t,"click",e)},onSubmit:function(t,e){return r.onEventPreventDefault(t,"submit",e)},onEventPreventDefault:function(t,e,n){const r=i.a.getElements(t);if(!r.length)return t;const o=function(t){return Array.isArray(t)&&(t=t[0]),t.preventDefault(),n.call(this,t),!1};return r.forEach(function(t){t.addEventListener(e,o)}),o},on:function(t,e,n){const r=i.a.getElements(t);return r.length?(r.forEach(function(t){t.addEventListener(e,n)}),r):t},off:function(t,e,n){const r=i.a.getElements(t);return r.length?(r.forEach(function(t){t.removeEventListener(e,n)}),r):t},trigger:function(t,e,n){const r=i.a.getElements(t);return r.length?(n=void 0===n?null:n,e=new CustomEvent(e,{detail:n}),r.forEach(function(t){t.dispatchEvent(e)}),r):t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(4),r=n.n(i),o=n(0),s=n(5),a=n(1);const l={_passthroughData:null,setPassthroughData:function(t){return this._passthroughData=t,this},clearPassthroughData:function(){return this.setPassthroughData(null),this},getPassThroughData:function(t){return this._passthroughData},_incomingElementSelector:"body",setIncomingElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._incomingElementSelector=t},getIncomingElement:function(){return this._incomingElementSelector},_replaceElementSelector:"body",setReplaceElement:function(t){if("string"!=typeof t)throw`${t} is not a string`;this._replaceElementSelector=t},getReplaceElement:function(){return this._replaceElementSelector},load:function(t,e,n,i,s){if("string"!=typeof t)throw`Provided URL (${t}) is not a string`;if(n=void 0!==n&&n?n:this.getIncomingElement(),i=void 0!==i&&i?i:this.getReplaceElement(),s=void 0===s||s,"string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof i)throw`Provided replace_el (${i}) is not a string`;l.showLoader(),r.a.get(t).then(function(r){l.hideLoader(),l.replacePageContent(r.data,t,n,i,s),"function"==typeof e&&window.setTimeout(function(){e(o.a.getElement(i),n,l.getPassThroughData())},105)}).catch(function(t){throw l.hideLoader(),l.triggerNavigationFailure(t),t})},loaderEnabled:!0,_loaderDelay:300,setLoaderDelay:function(t){if("number"!=typeof t)throw`${t} is not an integer`;return this._loaderDelay=t,this},getLoaderDelay:function(){return this._loaderDelay},_loaderClasses:"progress page-navigation-loader",_loaderInnerDivClasses:"progress-bar progress-bar-striped progress-bar-animated",getLoaderEl:function(){if(!this.loaderEnabled)return;if(l.navLoaderCached)return l.navLoaderCached;let t=document.createElement("div");t.classList=this._loaderClasses;let e=document.createElement("div");return e.classList=this._loaderInnerDivClasses,t.append(e),document.body.prepend(t),l.navLoaderCached=o.a.getElement(".page-navigation-loader"),l.navLoaderCached},showLoader:function(){if(this.loaderEnabled)return l.loader_timeout=window.setTimeout(function(){l.getLoaderEl().classList.add("active")},this.getLoaderDelay()),this},hideLoader:function(){if(this.loaderEnabled)return window.clearTimeout(l.loader_timeout),l.getLoaderEl().classList.remove("active"),this},parseHTML(t,e){if("string"!=typeof(e=void 0===e?null:e)&&null!==e)throw`Provided parent_el (${e}) is not a string or null`;var n=new DOMParser,i=n.parseFromString(t,"text/html"),r=i.querySelector("title");r=r?r.innerText:null;var o=i.head.getElementsByTagName("meta"),s=i.querySelectorAll('link[rel="canonical"]'),a=i.body.classList,u=t;if(e){var c=i.querySelector(e);if(!c)throw`Could not find parent selector ${e}`;u=c.outerHTML}var h=l.getRouteFromMeta(i);return n=i=null,{title:r,route:h,metas:o,links:s,body_classes:a,html:u}},getRouteFromMeta:function(t){var e=(t=void 0===t?document.head:t).querySelector('[name="current_route"]');return e=e?e.content:null},replacePageContent(t,e,n,i,r){var s=this;if(r=void 0===r||r,n=void 0!==n&&n?n:this.getIncomingElement(),i=void 0!==i&&i?i:this.getReplaceElement(),"string"!=typeof e)throw`Provided url (${e}) is not a string`;if("string"!=typeof n)throw`Provided incoming_el (${n}) is not a string`;if("string"!=typeof i)throw`Provided replace_el (${i}) is not a string`;return l.triggerUnload(o.a.getElement(i),i,this.getRouteFromMeta()),window.setTimeout(function(){var a=l.parseHTML(t,n);if(a.html.length){o.a.remove("meta"),document.head.append(a.metas),o.a.remove('[rel="canonical"]'),Array.from(a.links).forEach(function(t){document.head.append(t)}),document.body.classList=a.body_classes,r&&history.pushState({url:e},a.title,e),l.setTitle(a.title);const t=o.a.replaceElWithHTML(i,a.html);l.triggerOnLoad(t,n,i,a.route),s.getReplaceElement()!==i&&s.setReplaceElement(n)}},100),this},reload:function(t){return t="function"!=typeof t?null:t,l.load(s.a.getFullURL(),t),this},fullReload:function(){l.showLoader(),window.location.reload()},redirect:function(t){l.showLoader(),window.location.href=t},setTitle:function(t){return document.title=t,this},onLoad:function(t){return a.a.on("body","navigation.complete",t),this},onUnload:function(t){return a.a.on("body","navigation.started",t),this},onNavigationFailure:function(t){return a.a.on("body","navigation.failed",t),this},triggerOnLoad:function(t,e,n,i){return i=void 0!==i?i:l.getRouteFromMeta(),a.a.trigger("body","navigation.complete",{el:t,el_selector:e,replaced_selector:n,route:i,data:this.getPassThroughData()}),this},triggerUnload:function(t,e,n){return a.a.trigger("body","navigation.started",{el:t,el_selector:e,route:n}),this},triggerNavigationFailure:function(t){return a.a.trigger("body","navigation.failed",{error:t}),this},initHistoryHandlers:function(){return window.onpushstate=function(t){l.load(s.a.getURIWithQueryString())},window.onpopstate=function(t){l.load(s.a.getURIWithQueryString(),null,null,null,!1)},this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={isDataObject:function(t,e,n,i,r){r=void 0!==r&&r,n=void 0!==n&&n;var o=JSON.stringify(t);const s=`${o} is not an object`;if(void 0===t){if(r)throw s;return!1}if(!("object"==typeof t)||null===t||Array.isArray(t)){if(r)throw s;return!1}if(Array.isArray(e)){let s=!1,a=[];const l=Object.keys(t);if(e.forEach(function(t){l.includes(t)?s=!0:a.push(t)}),!s){if(r)throw`${o} does not contain at least one of the following: `+e.join(", ");return!1}if(n&&a.length){if(r)throw`${o} is missing data: `+a.join(", ");return!1}if(i){let t=[];if(l.forEach(function(n){e.includes(n)||t.push(n)}),t.length){if(r)throw`${o} contains invalid data: `+t.join(", ");return!1}}}return!0}}},function(t,e){t.exports=axios},function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n(14);const i={query:new URLSearchParams(window.location.search),isHttps:function(){return"https:"===window.location.protocol},getDomain:function(){return window.location.hostname||window.location.host},getDomainWithProtocol:function(){return window.location.origin},getURI:function(){return window.location.pathname},getURIWithQueryString:function(){return window.location.pathname+window.location.search},getFullURL:function(){return window.location.href},appendSlash:function(t){return"/"!==t[t.length-1]?t+"/":t}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(3),r=n(7);class o{constructor(){}populate(t){const e=this;if(void 0===this._keys)throw"Cannot populate object if _keys property is not set";return i.a.isDataObject(t,this._keys,!1,!0,!0),this._keys.forEach(function(n){void 0!==t[n]&&e[r.a.setter(n)](t[n])}),this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});const i={getter:function(t){return"get"+this.ucfirst(t)},setter:function(t){return"set"+this.ucfirst(t)},ucfirst:function(t){return t&&t[0].toUpperCase()+t.slice(1)}}},function(t,e,n){"use strict";var i=n(0),r=n(2),o=n(4),s=n.n(o);n(15);const a={xhrSubmit:!0,submitURL:null,submitMethod:null,onError:function(t,e,n){alert(t)},onSuccess:function(t,e){"string"==typeof t.success?alert(t.success):alert("Your submission has been received")},validateForm:function(t){t.classList.add("was-validated");const e=!t.querySelector(":invalid");return e&&t.classList.remove("was-validated"),e}};class l{constructor(t,e){if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...a,...e},this.setForm(t),this.setValidateCallback(e.validateForm),this.setXHRSubmit(e.xhrSubmit),this.setSubmitMethod(e.submitMethod),this.setSubmitURL(e.submitURL),this.onSuccess(e.onSuccess),this.onError(e.onError)}setValidateCallback(t){if("function"!=typeof t)throw`${t} is not a function`;return this._validateCallback=t,this}validate(t){return void 0===t&&(t=this.getForm()),this._validateCallback(t)}setForm(t){if(!t||void 0===t)throw"Form element is required";if(!(t=i.a.getElement(t,!0,!0)))throw"Invalid form element received";return this._form=t,this}getForm(){return this._form}setXHRSubmit(t){return this._xhrSubmit=!!t,this}setSubmitMethod(t){if("string"!=typeof t&&null!==t)throw`${t} is not a string or null`;return this._submitMethod=t,this}getSubmitMethod(){return this._submitMethod}setSubmitURL(t){if("string"!=typeof t&&"function"!=typeof t&&null!==t)throw`${t} is not a string, function, or null`;return this._submitURL=t,this}getSubmitURL(){return this._submitURL}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):null===e?t.action:e}attachSubmitHandler(t){if(!this._xhrSubmit)return;if(!(t=void 0===t?this.getForm():i.a.getElement(t)))throw"Form element not received, cannot attach submit handler";const e=this;return t.addEventListener("submit",function(n){return!e._xhrSubmit||(n.preventDefault(),e.submitForm(t),!1)}),this}onSuccess(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onSuccess&&(this._onSuccess=[]),this._onSuccess.push(t),this}clearOnSuccessCallbacks(){return this._onSuccess=[],this}triggerOnSuccess(t,e){return void 0!==this._onSuccess&&(this._onSuccess.forEach(function(n){n(t,e)}),this)}onError(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onError&&(this._onError=[]),this._onError.push(t),this}clearOnErrorCallbacks(){return this._onError=[],this}triggerOnError(t,e,n){return void 0!==this._onError&&(this._onError.forEach(function(i){i(t,e,n)}),this)}submitForm(t){if(void 0===this._processing&&(this._processing=!1),this._processing)return!1;this._processing=!0;const e=this;let n=this.getFinalSubmitURL(t),i=this.getSubmitMethod();if(null===i&&void 0!==t.attributes.method&&(i=t.method),i=i?i.toLowerCase():"post",!this.validate(t))return this._processing=!1,!1;r.a.showLoader();const o=Array.from(this.getFormValues(t),t=>t.map(encodeURIComponent).join("=")).join("&");return s()({url:n,method:i,data:o}).then(function(n){r.a.hideLoader(),e._processing=!1;let i=n.data;try{i="string"==typeof i?JSON.parse(i):i}catch(t){}if("string"==typeof i){if("string"==typeof e.getIncomingElementSelector()){const n=r.a.parseHTML(i,e.getIncomingElementSelector());return n.html.length?e.insertForm(n,i,t):e.triggerOnError(`${e.getIncomingElementSelector()} could not be found in response from the server`,i,t)}return e.insertForm({html:i},i,t)}if("object"==typeof i)return i.html?e.insertForm({html:i.html},i,t):i.error?e.triggerOnError(i.error,i,t):e.triggerOnSuccess(i,t)}).catch(function(t){throw r.a.hideLoader(),e._processing=!1,t}),this}getFormValues(t){return new FormData(t)}}const u={incomingElementSelector:null,insertIntoElement:null,onload:function(t){return this}};class c extends l{constructor(t,e){if(super(null,e),"string"!=typeof t)throw`${t} is not a string`;if("object"!=typeof(e=void 0===e?{}:e))throw`${e} is not an object`;e={...u,...e},this.setURL(t),this.setIncomingElementSelector(e.incomingElementSelector),this.setInsertIntoElement(e.insertIntoElement),this.onload(e.onload)}setForm(t){return this._form=t,this}setURL(t){if("string"!=typeof t)throw`${t} is not a string`;return this._url=t,this}getURL(){return this._url}getFinalSubmitURL(t){let e=this.getSubmitURL(t);return"function"==typeof this._submitURL?this._submitURL(t):(null===e&&t.attributes.action&&(e=t.action),null===(e=e||this.getURL())&&(e=t.action),e)}setIncomingElementSelector(t){if(null!==t&&"string"!=typeof t)throw`${t} is not a string or null value`;return this._incomingElementSelector=t,this}getIncomingElementSelector(){return this._incomingElementSelector}setInsertIntoElement(t){this._insertIntoElement=t}getInsertIntoElement(){return this._insertIntoElement}getForm(){const t=this;r.a.showLoader(),s.a.get(this.getURL()).then(function(e){r.a.hideLoader();let n=e.data;try{n="string"==typeof n?JSON.parse(n):n}catch(t){}if("string"==typeof n){if("string"==typeof t.getIncomingElementSelector()){const e=r.a.parseHTML(n,t.getIncomingElementSelector());return t.insertForm(e,n)}return t.insertForm({html:n})}if("object"==typeof n&&void 0!==n.html)return t.insertForm({html:n.html},n);throw`Unexpected server response ${n}`}).catch(function(t){throw r.a.hideLoader(),t})}insertForm(t,e,n){let r=this.getInsertIntoElement();if(null===r)throw"Cannot determine where to insert form. Overwrite insertForm() or provide insertIntoElement";return(r=i.a.getElement(r,!0)).innerHTML=t.html,n=r.querySelector("form"),this.attachSubmitHandler(n),this.triggerOnload(n),r}onload(t){if("function"!=typeof t)throw`${t} is not a function`;return void 0===this._onload&&(this._onload=[]),this._onload.push(t),this}clearOnloadCallbacks(){return this._onload=[],this}triggerOnload(t){return void 0!==this._onload&&(this._onload.forEach(function(e){e(t)}),this)}}n.d(e,"b",function(){return l}),n.d(e,"a",function(){return c})},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(3),r=n(6);const o={id:null,name:null,config:{}};class s extends r.a{constructor(t){if(super(),this._keys=["id","name","config"],void 0===t)return this;t={...o,...t},this.populate(t)}getId(){return this._id}setId(t){return this._id=t,this}getName(){return this._name}setName(t){return this._name=t,this}getConfig(){return this._config}setConfig(t){return i.a.isDataObject(t,null,!1,!1,!0),this._config=t,this}getConfigItem(t){return void 0===this._config[t]?null:this._config[t]}setConfigItem(t,e){return this._config[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(3),r=n(6);const o={id:null,isGuest:!1,isAdmin:!1,username:null,fname:null,lname:null,email:null,phone:null,permissions:[],additionalData:{}};class s extends r.a{constructor(t){if(super(),this._keys=["id","isGuest","isAdmin","username","fname","lname","email","phone","permissions","additionalData"],void 0===t)return this;t={...o,...t},this.populate(t)}setId(t){return this._id=t,this}getId(){return this._id}setIsGuest(t){return this._isGuest=t,this}getIsGuest(){return this._isGuest}setIsAdmin(t){return this._isAdmin=t,this}getIsAdmin(){return this._isAdmin}setUsername(t){return this._username=t,this}getUsername(){return this._username}getFname(){return this._fname}setFname(t){return this._fname=t,this}getLname(){return this._lname}setLname(t){return this._lname=t,this}getName(){return`${s.getFname()} ${s.getLname()}`}getEmail(){return this._email}setEmail(t){return this._email=t,this}getPhone(){return this._phone}setPhone(t){return this._phone=t,this}getPermissions(){return this._permissions}setPermissions(t){if(!Array.isArray(t))throw"setPermissions requires an array";return this._permissions=t,this}addPermission(t){return this._permissions.push(t),this}removePermission(t){return this.setPermissions(this._permissions.filter(function(e){return e!==t})),this}hasPermission(t){return this.getPermissions().includes(t)}getAdditionalData(){return this._additionalData}setAdditionalData(t){return i.a.isDataObject(t,null,!1,!1,!0),this._additionalData=t,this}getDataItem(t){return void 0===this._additionalData[t]?null:this._additionalData[t]}setDataItem(t,e){return this._additionalData[t]=e,this}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(1),r=n(0);class o{constructor(t,e,n,i){this.btn=r.a.getElement(t,!0,!0),this.toggle_el=r.a.getElement(e,!0,!0),this.hide_on_outside_click="boolean"!=typeof i||i,this.toggle_class="string"!=typeof n?"visible":n}init(){const t=this;return this.onWindowResize=function(){window.clearTimeout(void 0),window.setTimeout(function(){r.a.isVisible(t.btn)?t.toggle_el.classList.remove(t.toggle_class):t.toggle_el.classList.add(t.toggle_class)},200)},this.hide_on_outside_click&&(this.onClickOutside=function(e){let n=e.target;if(n===t.btn)return!1;do{if(t.btn===n)return!1}while(n=n.parentNode);if((n=e.target)===t.toggle_el)return!1;do{if(t.toggle_el===n)return!1}while(n=n.parentNode);t.toggle_el.classList.remove(t.toggle_class)},i.a.on("body","click",this.onClickOutside)),this.onClickToggleBtn=i.a.onClick(this.btn,function(){t.toggle_el.classList.toggle(t.toggle_class)}),window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this}destroy(){this.hide_on_outside_click&&i.a.off("body","click",this.onClickOutside),i.a.off(this.btn,"click",this.onClickToggleBtn),window.removeEventListener("resize",this.onWindowResize)}}},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"jpack",function(){return g});var i=n(0),r=n(1),o=n(8),s=n(2),a=n(5),l=n(9),u=n(7),c=n(3),h=n(10),d=n(11);const f={dom:i.a,events:r.a,XHRForm:o.b,FormFromURL:o.a,navigation:s.a,request:a.a,Site:l.a,strings:u.a,type_checks:c.a,User:h.a,ToggleOnMobile:d.a},g={...f,setGlobal:function(t){t="string"==typeof t?t:null;for(const e in f)t?(void 0===window[t]&&(window[t]={}),window[t][e]=f[e]):window[e]=f[e]}};t.jpack=g}.call(this,n(13))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=url-search-params-polyfill},function(t,e){t.exports=formdata-polyfill}]); |
@@ -89,3 +89,3 @@ import {type_checks} from "../type_checks"; | ||
getName(){ | ||
return `${user.getFname()} ${user.getLname()}`; | ||
return `${User.getFname()} ${User.getLname()}`; | ||
} | ||
@@ -92,0 +92,0 @@ |
{ | ||
"name": "@htmlguyllc/jpack", | ||
"version": "6.1.2", | ||
"version": "6.1.3", | ||
"description": "Core Javascript Library of Everyday Objects, Events, and Utilities", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -486,3 +486,3 @@ # jPack | ||
<h2 id="user">User</h2> | ||
[back to top](#whatsincluded) <br><br> | ||
[demo](https://jsfiddle.net/HTMLGuyLLC/Lzp5w3rg) | [back to top](#whatsincluded) <br><br> | ||
<i>A generic user class with properties for id, name, email, phone, etc - also allows for front-end permission checks</i><br><br> | ||
@@ -489,0 +489,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
386980