diff --git a/modules/system/.eslintrc.json b/modules/system/.eslintrc.json index 96bf04b4ef..e06ae01240 100644 --- a/modules/system/.eslintrc.json +++ b/modules/system/.eslintrc.json @@ -32,5 +32,9 @@ "math": "always" }], "vue/multi-word-component-names": ["off"] - } + }, + "ignorePatterns": [ + "tests/js", + "**/build/*.js" + ] } diff --git a/modules/system/assets/js/build/manifest.js b/modules/system/assets/js/build/manifest.js index 15c3878c30..6bb0026d28 100644 --- a/modules/system/assets/js/build/manifest.js +++ b/modules/system/assets/js/build/manifest.js @@ -1 +1 @@ -!function(){"use strict";var n,r={},t={};function e(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return r[n](u,u.exports,e),u.exports}e.m=r,n=[],e.O=function(r,t,o,u){if(!t){var i=1/0;for(a=0;a=u)&&Object.keys(e.O).every((function(n){return e.O[n](t[c])}))?t.splice(c--,1):(f=!1,u0&&n[a-1][2]>u;a--)n[a]=n[a-1];n[a]=[t,o,u]},e.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(r,{a:r}),r},e.d=function(n,r){for(var t in r)e.o(r,t)&&!e.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:r[t]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),e.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},function(){var n={911:0};e.O.j=function(r){return 0===n[r]};var r=function(r,t){var o,u,i=t[0],f=t[1],c=t[2],s=0;if(i.some((function(r){return 0!==n[r]}))){for(o in f)e.o(f,o)&&(e.m[o]=f[o]);if(c)var a=c(e)}for(r&&r(t);s=i)&&Object.keys(t.O).every((function(r){return t.O[r](e[c])}))?e.splice(c--,1):(f=!1,i0&&r[a-1][2]>i;a--)r[a]=r[a-1];r[a]=[e,o,i]},t.d=function(r,n){for(var e in n)t.o(n,e)&&!t.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:n[e]})},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},function(){var r={911:0};t.O.j=function(n){return 0===r[n]};var n=function(n,e){var o,i,u=e[0],f=e[1],c=e[2],s=0;if(u.some((function(n){return 0!==r[n]}))){for(o in f)t.o(f,o)&&(t.m[o]=f[o]);if(c)var a=c(t)}for(n&&n(e);s{t&&this.doAjax().then((t=>{if(t.cancelled)return this.cancelled=!0,void this.complete();this.responseData=t,this.processUpdate(t).then((()=>{!1===t.X_WINTER_SUCCESS?this.processError(t):this.processResponse(t)}))}),(t=>{this.responseError=t,this.processError(t)}))})):this.doAjax().then((t=>{if(t.cancelled)return this.cancelled=!0,void this.complete();this.responseData=t,this.processUpdate(t).then((()=>{!1===t.X_WINTER_SUCCESS?this.processError(t):this.processResponse(t)}))}),(t=>{this.responseError=t,this.processError(t)})):this.cancelled=!0}else this.cancelled=!0}dependencies(){return["cookie","jsonParser"]}checkRequest(){if(this.element&&this.element instanceof Element==!1)throw new Error("The element provided must be an Element instance");if(void 0===this.handler)throw new Error("The AJAX handler name is not specified.");if(!this.handler.match(/^(?:\w+:{2})?on*/))throw new Error('Invalid AJAX handler name. The correct handler name format is: "onEvent".')}getFetch(){return this.fetchOptions=void 0!==this.options.fetchOptions&&"object"==typeof this.options.fetchOptions?this.options.fetchOptions:{method:"POST",headers:this.headers,body:this.data,redirect:"follow",mode:"same-origin"},this.snowboard.globalEvent("ajaxFetchOptions",this.fetchOptions,this),fetch(this.url,this.fetchOptions)}doClientValidation(){return!0!==this.options.browserValidate||!this.form||!1!==this.form.checkValidity()||(this.form.reportValidity(),!1)}doAjax(){if(!1===this.snowboard.globalEvent("ajaxBeforeSend",this))return Promise.resolve({cancelled:!0});const t=new Promise(((t,e)=>{this.getFetch().then((n=>{n.ok||406===n.status?n.headers.has("Content-Type")&&n.headers.get("Content-Type").includes("/json")?n.json().then((e=>{t(o(o({},e),{},{X_WINTER_SUCCESS:406!==n.status,X_WINTER_RESPONSE_CODE:n.status}))}),(t=>{e(this.renderError("Unable to parse JSON response: ".concat(t)))})):n.text().then((e=>{t(e)}),(t=>{e(this.renderError("Unable to process response: ".concat(t)))})):n.headers.has("Content-Type")&&n.headers.get("Content-Type").includes("/json")?n.json().then((t=>{e(this.renderError(t.message,t.exception,t.file,t.line,t.trace))}),(t=>{e(this.renderError("Unable to parse JSON response: ".concat(t)))})):n.text().then((t=>{e(this.renderError(t))}),(t=>{e(this.renderError("Unable to process response: ".concat(t)))}))}),(t=>{e(this.renderError("Unable to retrieve a response from the server: ".concat(t)))}))}));if(this.snowboard.globalEvent("ajaxStart",t,this),this.element){const e=new Event("ajaxPromise");e.promise=t,this.element.dispatchEvent(e)}return t}processUpdate(t){return new Promise(((e,n)=>{if("function"==typeof this.options.beforeUpdate&&!1===this.options.beforeUpdate.apply(this,[t]))return void n();const r={};if(Object.entries(t).forEach((t=>{const[e,n]=t;"X_WINTER"!==e.substr(0,8)&&(r[e]=n)})),0===Object.keys(r).length)return void(t.X_WINTER_ASSETS?this.processAssets(t.X_WINTER_ASSETS).then((()=>{e()}),(()=>{n()})):e());this.snowboard.globalPromiseEvent("ajaxBeforeUpdate",t,this).then((async()=>{t.X_WINTER_ASSETS&&await this.processAssets(t.X_WINTER_ASSETS),this.doUpdate(r).then((()=>{window.requestAnimationFrame((()=>e()))}),(()=>{n()}))}),(()=>{n()}))}))}doUpdate(t){return new Promise((e=>{const n=[];Object.entries(t).forEach((t=>{const[e,r]=t;let o=this.options.update&&this.options.update[e]?this.options.update[e]:e,i="replace";"@"===o.substr(0,1)?(i="append",o=o.substr(1)):"^"===o.substr(0,1)&&(i="prepend",o=o.substr(1));const s=document.querySelectorAll(o);s.length>0&&s.forEach((t=>{switch(i){case"append":t.innerHTML+=r;break;case"prepend":t.innerHTML=r+t.innerHTML;break;default:t.innerHTML=r}n.push(t),this.snowboard.globalEvent("ajaxUpdate",t,r,this);const e=new Event("ajaxUpdate");e.content=r,t.dispatchEvent(e)}))})),this.snowboard.globalEvent("ajaxUpdateComplete",n,this),e()}))}processResponse(t){if((!this.options.success||"function"!=typeof this.options.success||!1!==this.options.success(this.responseData,this))&&!1!==this.snowboard.globalEvent("ajaxSuccess",this.responseData,this)){if(this.element){const t=new Event("ajaxDone",{cancelable:!0});if(t.responseData=this.responseData,t.request=this,this.element.dispatchEvent(t),t.defaultPrevented)return}this.flash&&t.X_WINTER_FLASH_MESSAGES&&this.processFlashMessages(t.X_WINTER_FLASH_MESSAGES),this.redirect||t.X_WINTER_REDIRECT?this.processRedirect(this.redirect||t.X_WINTER_REDIRECT):this.complete()}}processError(t){if((!this.options.error||"function"!=typeof this.options.error||!1!==this.options.error(this.responseError,this))&&!1!==this.snowboard.globalEvent("ajaxError",this.responseError,this)){if(this.element){const t=new Event("ajaxFail",{cancelable:!0});if(t.responseError=this.responseError,t.request=this,this.element.dispatchEvent(t),t.defaultPrevented)return}t instanceof Error?this.processErrorMessage(t.message):(t.X_WINTER_ERROR_FIELDS&&this.processValidationErrors(t.X_WINTER_ERROR_FIELDS),t.X_WINTER_ERROR_MESSAGE&&this.processErrorMessage(t.X_WINTER_ERROR_MESSAGE)),this.complete()}}processRedirect(t){"function"==typeof this.options.handleRedirectResponse&&!1===this.options.handleRedirectResponse.apply(this,[t])||!1!==this.snowboard.globalEvent("ajaxRedirect",t,this)&&(window.addEventListener("popstate",(()=>{if(this.element){const t=document.createEvent("CustomEvent");t.eventName="ajaxRedirected",this.element.dispatchEvent(t)}}),{once:!0}),window.location.assign(t))}processErrorMessage(t){"function"==typeof this.options.handleErrorMessage&&!1===this.options.handleErrorMessage.apply(this,[t])||!1!==this.snowboard.globalEvent("ajaxErrorMessage",t,this)&&window.alert(t)}processFlashMessages(t){"function"==typeof this.options.handleFlashMessages&&!1===this.options.handleFlashMessages.apply(this,[t])||this.snowboard.globalEvent("ajaxFlashMessages",t,this)}processValidationErrors(t){"function"==typeof this.options.handleValidationErrors&&!1===this.options.handleValidationErrors.apply(this,[this.form,t])||this.snowboard.globalEvent("ajaxValidationErrors",this.form,t,this)}processAssets(t){return this.snowboard.globalPromiseEvent("ajaxLoadAssets",t)}async doConfirm(){if("function"==typeof this.options.handleConfirmMessage)return!1!==this.options.handleConfirmMessage.apply(this,[this.confirm]);if(0===this.snowboard.listensToEvent("ajaxConfirmMessage").length)return window.confirm(this.confirm);const t=this.snowboard.globalPromiseEvent("ajaxConfirmMessage",this.confirm,this);try{if(await t)return!0}catch(t){return!1}return!1}complete(){if(this.options.complete&&"function"==typeof this.options.complete&&this.options.complete(this.responseData,this),this.snowboard.globalEvent("ajaxDone",this.responseData,this),this.element){const t=new Event("ajaxAlways");t.request=this,t.responseData=this.responseData,t.responseError=this.responseError,this.element.dispatchEvent(t)}this.destruct()}get form(){return this.options.form?"string"==typeof this.options.form?document.querySelector(this.options.form):this.options.form:this.element?"FORM"===this.element.tagName?this.element:this.element.closest("form"):null}get context(){return{handler:this.handler,options:this.options}}get headers(){const t={"X-Requested-With":"XMLHttpRequest","X-WINTER-REQUEST-HANDLER":this.handler,"X-WINTER-REQUEST-PARTIALS":this.extractPartials(this.options.update||[])};return this.flash&&(t["X-WINTER-REQUEST-FLASH"]=1),this.xsrfToken&&(t["X-XSRF-TOKEN"]=this.xsrfToken),t}get loading(){return this.options.loading||!1}get url(){return this.options.url||window.location.href}get redirect(){return this.options.redirect&&this.options.redirect.length?this.options.redirect:null}get flash(){return this.options.flash||!1}get files(){return!0===this.options.files&&(void 0!==FormData||(this.snowboard.debug("This browser does not support file uploads"),!1))}get xsrfToken(){return this.snowboard.cookie().get("XSRF-TOKEN")}get data(){const t="object"==typeof this.options.data?this.options.data:{},e=new FormData(this.form||void 0);return Object.keys(t).length>0&&Object.entries(t).forEach((t=>{const[n,r]=t;e.append(n,r)})),e}get confirm(){return this.options.confirm||!1}extractPartials(t){return Object.keys(t).join("&")}renderError(t,e,n,r,o){const i=new Error(t);return i.exception=e||null,i.file=n||null,i.line=r||null,i.trace=o||[],i}}Snowboard.addPlugin("request",s)},8809:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});n(6886);class r extends window.Snowboard.Singleton{listens(){return{ajaxLoadAssets:"load"}}async load(t){if(t.js&&t.js.length>0)for(const e of t.js)try{await this.loadScript(e)}catch(t){return Promise.reject(t)}if(t.css&&t.css.length>0)for(const e of t.css)try{await this.loadStyle(e)}catch(t){return Promise.reject(t)}if(t.img&&t.img.length>0)for(const e of t.img)try{await this.loadImage(e)}catch(t){return Promise.reject(t)}return Promise.resolve()}loadScript(t){return new Promise(((e,n)=>{if(document.querySelector('script[src="'.concat(t,'"]')))return void e();const r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("src",t),r.addEventListener("load",(()=>{this.snowboard.globalEvent("assetLoader.loaded","script",t,r),e()})),r.addEventListener("error",(()=>{this.snowboard.globalEvent("assetLoader.error","script",t,r),n(new Error('Unable to load script file: "'.concat(t,'"')))})),document.body.append(r)}))}loadStyle(t){return new Promise(((e,n)=>{if(document.querySelector('link[rel="stylesheet"][href="'.concat(t,'"]')))return void e();const r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href",t),r.addEventListener("load",(()=>{this.snowboard.globalEvent("assetLoader.loaded","style",t,r),e()})),r.addEventListener("error",(()=>{this.snowboard.globalEvent("assetLoader.error","style",t,r),n(new Error('Unable to load stylesheet file: "'.concat(t,'"')))})),document.head.append(r)}))}loadImage(t){return new Promise(((e,n)=>{const r=new Image;r.addEventListener("load",(()=>{this.snowboard.globalEvent("assetLoader.loaded","image",t,r),e()})),r.addEventListener("error",(()=>{this.snowboard.globalEvent("assetLoader.error","image",t,r),n(new Error('Unable to load image file: "'.concat(t,'"')))})),r.src=t}))}}},9553:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});class r extends Snowboard.Singleton{dependencies(){return["request"]}listens(){return{ajaxStart:"ajaxStart",ajaxDone:"ajaxDone"}}ajaxStart(t,e){if(e.element)if("FORM"===e.element.tagName){const t=e.element.querySelectorAll("[data-attach-loading]");t.length>0&&t.forEach((t=>{t.classList.add(this.getLoadingClass(t))}))}else void 0!==e.element.dataset.attachLoading&&e.element.classList.add(this.getLoadingClass(e.element))}ajaxDone(t,e){if(e.element)if("FORM"===e.element.tagName){const t=e.element.querySelectorAll("[data-attach-loading]");t.length>0&&t.forEach((t=>{t.classList.remove(this.getLoadingClass(t))}))}else void 0!==e.element.dataset.attachLoading&&e.element.classList.remove(this.getLoadingClass(e.element))}getLoadingClass(t){return void 0!==t.dataset.attachLoading&&""!==t.dataset.attachLoading?t.dataset.attachLoading:"wn-loading"}}},5763:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});n(9529),n(5940);class r extends Snowboard.PluginBase{construct(t,e){if(t instanceof Snowboard.PluginBase==!1)throw new Error("You must provide a Snowboard plugin to enable data configuration");if(e instanceof HTMLElement==!1)throw new Error("Data configuration can only be extracted from HTML elements");this.instance=t,this.element=e,this.refresh()}get(t){return void 0===t?this.instanceConfig:void 0!==this.instanceConfig[t]?this.instanceConfig[t]:void 0}set(t,e,n){if(void 0===t)throw new Error("You must provide a configuration key to set");this.instanceConfig[t]=e,!0===n&&(this.element.dataset[t]=e)}refresh(){this.acceptedConfigs=this.getAcceptedConfigs(),this.instanceConfig=this.processConfig()}getAcceptedConfigs(){return void 0!==this.instance.acceptAllDataConfigs&&!0===this.instance.acceptAllDataConfigs||void 0!==this.instance.defaults&&"function"==typeof this.instance.defaults&&"object"==typeof this.instance.defaults()&&Object.keys(this.instance.defaults())}getDefaults(){return void 0!==this.instance.defaults&&"function"==typeof this.instance.defaults&&"object"==typeof this.instance.defaults()?this.instance.defaults():{}}processConfig(){const t=this.getDefaults();if(!1===this.acceptedConfigs)return t;for(const e in this.element.dataset)(!0===this.acceptedConfigs||this.acceptedConfigs.includes(e))&&(t[e]=this.coerceValue(this.element.dataset[e]));return t}coerceValue(t){const e=String(t);if("null"===e)return null;if("undefined"!==e){if(e.startsWith("base64:")){const t=e.replace(/^base64:/,""),n=atob(t);return this.coerceValue(n)}if(["true","yes"].includes(e.toLowerCase()))return!0;if(["false","no"].includes(e.toLowerCase()))return!1;if(/^[-+]?[0-9]+(\.[0-9]+)?$/.test(e))return Number(e);try{return this.snowboard.jsonParser().parse(e)}catch(t){return""===e||e}}}}},2270:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});class r extends Snowboard.PluginBase{construct(t,e,n){if(this.message=t,this.type=e||"default",this.duration=Number(n||7),this.duration<0)throw new Error("Flash duration must be a positive number, or zero");this.clear(),this.timer=null,this.flashTimer=null,this.create()}dependencies(){return["transition"]}destruct(){null!==this.timer&&window.clearTimeout(this.timer),this.flashTimer&&this.flashTimer.remove(),this.flash&&(this.flash.remove(),this.flash=null,this.flashTimer=null),super.destruct()}create(){this.snowboard.globalEvent("flash.create",this),this.flash=document.createElement("DIV"),this.flash.innerHTML=this.message,this.flash.classList.add("flash-message",this.type),this.flash.removeAttribute("data-control"),this.flash.addEventListener("click",(()=>this.remove())),this.flash.addEventListener("mouseover",(()=>this.stopTimer())),this.flash.addEventListener("mouseout",(()=>this.startTimer())),this.duration>0?(this.flashTimer=document.createElement("DIV"),this.flashTimer.classList.add("flash-timer"),this.flash.appendChild(this.flashTimer)):this.flash.classList.add("no-timer"),document.body.appendChild(this.flash),this.snowboard.transition(this.flash,"show",(()=>{this.startTimer()}))}remove(){this.snowboard.globalEvent("flash.remove",this),this.stopTimer(),this.snowboard.transition(this.flash,"hide",(()=>{this.flash.remove(),this.flash=null,this.destruct()}))}clear(){document.querySelectorAll("body > div.flash-message").forEach((t=>t.remove()))}startTimer(){0!==this.duration&&(this.timerTrans=this.snowboard.transition(this.flashTimer,"timeout",null,"".concat(this.duration,".0s"),!0),this.timer=window.setTimeout((()=>this.remove()),1e3*this.duration))}stopTimer(){this.timerTrans&&this.timerTrans.cancel(),this.timer&&window.clearTimeout(this.timer)}}},6277:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});n(1515);class r extends Snowboard.Singleton{dependencies(){return["request"]}listens(){return{ready:"ready",ajaxStart:"ajaxStart"}}ready(){this.counter=0,this.createStripe()}ajaxStart(t){this.show(),t.catch((()=>{this.hide()})).finally((()=>{this.hide()}))}createStripe(){this.indicator=document.createElement("DIV"),this.stripe=document.createElement("DIV"),this.stripeLoaded=document.createElement("DIV"),this.indicator.classList.add("stripe-loading-indicator","loaded"),this.stripe.classList.add("stripe"),this.stripeLoaded.classList.add("stripe-loaded"),this.indicator.appendChild(this.stripe),this.indicator.appendChild(this.stripeLoaded),document.body.appendChild(this.indicator)}show(){this.counter+=1;const t=this.stripe.cloneNode(!0);this.indicator.appendChild(t),this.stripe.remove(),this.stripe=t,this.counter>1||(this.indicator.classList.remove("loaded"),document.body.classList.add("wn-loading"))}hide(t){this.counter-=1,!0===t&&(this.counter=0),this.counter<=0&&(this.indicator.classList.add("loaded"),document.body.classList.remove("wn-loading"))}}},8032:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});class r extends Snowboard.Singleton{listens(){return{ready:"ready"}}ready(){let t=!1;if(document.querySelectorAll('link[rel="stylesheet"]').forEach((e=>{e.href.endsWith("/modules/system/assets/css/snowboard.extras.css")&&(t=!0)})),!t){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",this.snowboard.url().to("/modules/system/assets/css/snowboard.extras.css")),document.head.appendChild(t)}}}},8269:function(t,e,n){"use strict";n.d(e,{Z:function(){return r}});n(6886);class r extends Snowboard.PluginBase{construct(t,e,n,r,o){if(t instanceof HTMLElement==!1)throw new Error("A HTMLElement must be provided for transitioning");if(this.element=t,"string"!=typeof e)throw new Error("Transition name must be specified as a string");if(this.transition=e,n&&"function"!=typeof n)throw new Error("Callback must be a valid function");this.callback=n,this.duration=r?this.parseDuration(r):null,this.trailTo=!0===o,this.doTransition()}eventClasses(){for(var t=arguments.length,e=new Array(t),n=0;n{const[n,r]=t;-1!==e.indexOf(n)&&o.push(r)})),o}doTransition(){null!==this.duration&&(this.element.style.transitionDuration=this.duration),this.resetClasses(),this.eventClasses("in","active").forEach((t=>{this.element.classList.add(t)})),window.requestAnimationFrame((()=>{"0s"!==window.getComputedStyle(this.element)["transition-duration"]?(this.element.addEventListener("transitionend",(()=>this.onTransitionEnd()),{once:!0}),window.requestAnimationFrame((()=>{this.element.classList.remove(this.eventClasses("in")[0]),this.element.classList.add(this.eventClasses("out")[0])}))):(this.resetClasses(),this.callback&&this.callback.apply(this.element),this.destruct())}))}onTransitionEnd(){this.eventClasses("active",this.trailTo?"":"out").forEach((t=>{this.element.classList.remove(t)})),this.callback&&this.callback.apply(this.element),null!==this.duration&&(this.element.style.transitionDuration=null),this.destruct()}cancel(){this.element.removeEventListener("transitionend",(()=>this.onTransitionEnd),{once:!0}),this.resetClasses(),null!==this.duration&&(this.element.style.transitionDuration=null),this.destruct()}resetClasses(){this.eventClasses().forEach((t=>{this.element.classList.remove(t)}))}parseDuration(t){const e=/^([0-9]+(\.[0-9]+)?)(m?s)?$/.exec(t),n=Number(e[1]),r="s"===e[3]?"sec":"msec";return"".concat("sec"===r?1e3*n:Math.floor(n),"ms")}}},1705:function(t,e,n){"use strict";n.d(e,{Z:function(){return p}});n(6886),n(9529);class r{constructor(t){this.snowboard=t}construct(){}dependencies(){return[]}listens(){return{}}destruct(){this.detach(),delete this.snowboard}destructor(){this.destruct()}}class o extends r{}class i{constructor(t,e,n){this.name=t,this.snowboard=e,this.instance=n,this.instances=[],this.singleton=n.prototype instanceof o,this.initialised=n.prototype instanceof r,this.mocks={},this.originalFunctions={}}hasMethod(t){return!this.isFunction()&&"function"==typeof this.instance.prototype[t]}callMethod(){if(this.isFunction())return null;for(var t=arguments.length,e=new Array(t),n=0;n!this.snowboard.getPluginNames().includes(t)));throw new Error('The "'.concat(this.name,'" plugin requires the following plugins: ').concat(t.join(", ")))}if(this.isSingleton())return 0===this.instances.length&&this.initialiseSingleton(...n),Object.keys(this.mocks).length>0&&(Object.entries(this.originalFunctions).forEach((t=>{const[e,n]=t;this.instances[0][e]=n})),Object.entries(this.mocks).forEach((e=>{const[n,r]=e;this.instances[0][n]=function(){for(var e=arguments.length,n=new Array(e),o=0;o0&&(Object.entries(this.originalFunctions).forEach((t=>{const[e,n]=t;this.instance.prototype[e]=n})),Object.entries(this.mocks).forEach((e=>{const[n,r]=e;this.instance.prototype[n]=function(){for(var e=arguments.length,n=new Array(e),o=0;othis.instances.splice(this.instances.indexOf(o),1),o.construct(...n),this.instances.push(o),o}getInstances(){return this.isFunction()?[]:this.instances}isFunction(){return"function"==typeof this.instance&&this.instance.prototype instanceof r==!1}isSingleton(){return this.instance.prototype instanceof o==!0}isInitialised(){return this.initialised}initialiseSingleton(){if(!this.isSingleton())return;for(var t=arguments.length,e=new Array(t),n=0;nthis.instances.splice(this.instances.indexOf(r),1),r.construct(...e),this.instances.push(r),this.initialised=!0}getDependencies(){return this.isFunction()||"function"!=typeof this.instance.prototype.dependencies?[]:this.instance.prototype.dependencies().map((t=>t.toLowerCase()))}dependenciesFulfilled(){const t=this.getDependencies();let e=!0;return t.forEach((t=>{this.snowboard.hasPlugin(t)||(e=!1)})),e}mock(t,e){var n=this;if(!this.isFunction()){if(!this.instance.prototype[t])throw new Error('Function "'.concat(t,'" does not exist and cannot be mocked'));this.mocks[t]=e,this.originalFunctions[t]=this.instance.prototype[t],this.isSingleton()&&0===this.instances.length&&(this.initialiseSingleton(),this.instances[0][t]=function(){for(var t=arguments.length,r=new Array(t),o=0;o{const[e,n]=t;void 0!==this.defaults[e]&&(this.defaults[e]=n)}))}getDefaults(){const t={};return Object.entries(this.defaults).forEach((e=>{const[n,r]=e;null!==this.defaults[n]&&(t[n]=r)})),t}get(t){if(void 0===t){const t=s.Z.get();return Object.entries(t).forEach((e=>{const[n,r]=e;this.snowboard.globalEvent("cookie.get",n,r,(e=>{t[n]=e}))})),t}let e=s.Z.get(t);return this.snowboard.globalEvent("cookie.get",t,e,(t=>{e=t})),e}set(t,e,n){let r=e;return this.snowboard.globalEvent("cookie.set",t,e,(t=>{r=t})),s.Z.set(t,r,c(c({},this.getDefaults()),n))}remove(t,e){s.Z.remove(t,c(c({},this.getDefaults()),e))}}class h extends o{construct(){window.wnJSON=t=>this.parse(t),window.ocJSON=window.wnJSON}parse(t){const e=this.parseString(t);return JSON.parse(e)}parseString(t){let e=t.trim();if(!e.length)throw new Error("Broken JSON object.");let n="",r=null,o=null,i="";for(;e&&","===e[0];)e=e.substr(1);if('"'===e[0]||"'"===e[0]){if(e[e.length-1]!==e[0])throw new Error("Invalid string JSON object.");i='"';for(let t=1;t="0"&&t[e]<="9"){n="";for(let r=e;r="0"&&t[r]<="9"))return{originLength:n.length,body:n};n+=t[r]}throw new Error("Broken JSON number body near ".concat(n))}if("{"===t[e]||"["===t[e]){const r=[t[e]];n=t[e];for(let o=e+1;o=0?e-5:0,50)))}parseKey(t,e,n){let r="";for(let o=e;o="a"&&t[0]<="z"||t[0]>="A"&&t[0]<="Z"||"_"===t[0]||(t[0]>="0"&&t[0]<="9"||("$"===t[0]||t.charCodeAt(0)>255)))}isBlankChar(t){return" "===t||"\n"===t||"\t"===t}}class f extends o{construct(){window.wnSanitize=t=>this.sanitize(t),window.ocSanitize=window.wnSanitize}sanitize(t,e){const n=(new DOMParser).parseFromString(t,"text/html"),r=void 0===e||"boolean"!=typeof e||e;return this.sanitizeNode(n.getRootNode()),r?n.body.innerHTML:n.innerHTML}sanitizeNode(t){if("SCRIPT"===t.tagName)return void t.remove();this.trimAttributes(t);Array.from(t.children).forEach((t=>{this.sanitizeNode(t)}))}trimAttributes(t){if(t.attributes)for(let e=0;e{this.autoInitSingletons&&this.initialiseSingletons(),this.globalEvent("ready"),this.domReady=!0}))}initialiseSingletons(){Object.values(this.plugins).forEach((t=>{t.isSingleton()&&t.dependenciesFulfilled()&&t.initialiseSingleton()}))}addPlugin(t,e){var n=this;const o=t.toLowerCase();if(this.hasPlugin(o))throw new Error('A plugin called "'.concat(t,'" is already registered.'));if("function"!=typeof e&&e instanceof r==!1)throw new Error("The provided plugin must extend the PluginBase class, or must be a callback function.");if(void 0!==this[t]||void 0!==this[o])throw new Error("The given name is already in use for a property or method of the Snowboard class.");this.plugins[o]=new i(o,this,e);const s=function(){return n.plugins[o].getInstance(...arguments)};this[t]=s,this[o]=s,this.debug('Plugin "'.concat(t,'" registered')),Object.values(this.getPlugins()).forEach((t=>{if(t.isSingleton()&&!t.isInitialised()&&t.dependenciesFulfilled()&&t.hasMethod("listens")&&Object.keys(t.callMethod("listens")).includes("ready")&&this.domReady){const e=t.callMethod("listens").ready;t.callMethod(e)}}))}removePlugin(t){const e=t.toLowerCase();this.hasPlugin(e)?(this.plugins[e].getInstances().forEach((t=>{t.destruct()})),delete this.plugins[e],delete this[e],delete this[t],this.debug('Plugin "'.concat(t,'" removed'))):this.debug('Plugin "'.concat(t,'" already removed'))}hasPlugin(t){const e=t.toLowerCase();return void 0!==this.plugins[e]}getPlugins(){return this.plugins}getPluginNames(){return Object.keys(this.plugins)}getPlugin(t){if(!this.hasPlugin(t))throw new Error('No plugin called "'.concat(t,'" has been registered.'));return this.plugins[t]}listensToEvent(t){const e=[];return Object.entries(this.plugins).forEach((n=>{const[r,o]=n;if(o.isFunction())return;if(!o.dependenciesFulfilled())return;if(!o.hasMethod("listens"))return;"string"==typeof o.callMethod("listens")[t]&&e.push(r)})),e}ready(t){this.domReady&&t(),this.on("ready",t)}on(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].includes(e)||this.listeners[t].push(e)}off(t,e){if(!this.listeners[t])return;const n=this.listeners[t].indexOf(e);-1!==n&&this.listeners[t].splice(n,1)}globalEvent(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{const r=this.getPlugin(e);if(r.isFunction())return;r.isSingleton()&&0===r.getInstances().length&&r.initialiseSingleton();const o=r.callMethod("listens")[t];r.getInstances().forEach((r=>{if(!i){if(!r[o])throw new Error('Missing "'.concat(o,'" method in "').concat(e,'" plugin'));try{!1===r[o](...n)&&(i=!0,this.debug('Global event "'.concat(t,'" cancelled by "').concat(e,'" plugin')))}catch(n){this.error('Error thrown in "'.concat(t,'" event by "').concat(e,'" plugin.'),n)}}}))})),!i&&this.listeners[t]&&this.listeners[t].length>0&&(this.debug("Found ".concat(this.listeners[t].length,' ad-hoc listener(s) for global event "').concat(t,'"')),this.listeners[t].forEach((e=>{if(!i)try{!1===e(...n)&&(i=!0,this.debug('Global event "'.concat(t," cancelled by an ad-hoc listener.")))}catch(e){this.error('Error thrown in "'.concat(t,'" event by an ad-hoc listener.'),e)}}))),!i}globalPromiseEvent(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{const r=this.getPlugin(e);if(r.isFunction())return;r.isSingleton()&&0===r.getInstances().length&&r.initialiseSingleton();const o=r.callMethod("listens")[t];r.getInstances().forEach((r=>{if(!r[o])throw new Error('Missing "'.concat(o,'" method in "').concat(e,'" plugin'));try{const t=r[o](...n);if(t instanceof Promise==!1)return;i.push(t)}catch(n){this.error('Error thrown in "'.concat(t,'" promise event by "').concat(e,'" plugin.'),n)}}))})),this.listeners[t]&&this.listeners[t].length>0&&(this.debug("Found ".concat(this.listeners[t].length,' ad-hoc listener(s) for global promise event "').concat(t,'"')),this.listeners[t].forEach((e=>{try{const t=e(...n);if(t instanceof Promise==!1)return;i.push(t)}catch(e){this.error('Error thrown in "'.concat(t,'" promise event by an ad-hoc listener.'),e)}}))),0===i.length?Promise.resolve():Promise.all(i)}logMessage(t,e,n){console.groupCollapsed("%c[Snowboard]","color: ".concat(t,"; font-weight: ").concat(e?"bold":"normal",";"),n);for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i{t+=1,console.log("%c".concat(t,":"),"color: rgb(88, 88, 88); font-weight: normal;",e)})),console.groupEnd(),console.groupCollapsed("%cTrace","color: rgb(45, 167, 199); font-weight: bold;"),console.trace(),console.groupEnd()}else console.trace();console.groupEnd()}log(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r{t.addPlugin("assetLoader",c.Z),t.addPlugin("dataConfig",l.Z),t.addPlugin("extrasStyles",a.Z),t.addPlugin("transition",o.Z),t.addPlugin("flash",r.Z),t.addPlugin("attachLoading",i.Z),t.addPlugin("stripeLoader",s.Z)})(window.Snowboard)},2165:function(t,e,n){"use strict";var r=n(1705);(t=>{const e=new r.Z(!0,!0);t.snowboard=e,t.Snowboard=e,t.SnowBoard=e})(window)},7111:function(t,e,n){var r=n(6733),o=n(9821),i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not a function")}},7988:function(t,e,n){var r=n(2359),o=n(9821),i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not a constructor")}},8505:function(t,e,n){var r=n(6733),o=String,i=TypeError;t.exports=function(t){if("object"==typeof t||r(t))return t;throw i("Can't set "+o(t)+" as a prototype")}},9736:function(t,e,n){var r=n(95),o=n(2391),i=n(1787).f,s=r("unscopables"),a=Array.prototype;null==a[s]&&i(a,s,{configurable:!0,value:o(null)}),t.exports=function(t){a[s][t]=!0}},6637:function(t,e,n){"use strict";var r=n(966).charAt;t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},1176:function(t,e,n){var r=n(5052),o=String,i=TypeError;t.exports=function(t){if(r(t))return t;throw i(o(t)+" is not an object")}},9540:function(t,e,n){var r=n(905),o=n(3231),i=n(9646),s=function(t){return function(e,n,s){var a,c=r(e),l=i(c),u=o(s,l);if(t&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((t||u in c)&&c[u]===n)return t||u||0;return!t&&-1}};t.exports={includes:s(!0),indexOf:s(!1)}},7079:function(t,e,n){var r=n(5968),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},1589:function(t,e,n){var r=n(1601),o=n(6733),i=n(7079),s=n(95)("toStringTag"),a=Object,c="Arguments"==i(function(){return arguments}());t.exports=r?i:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=a(t),s))?n:c?i(e):"Object"==(r=i(e))&&o(e.callee)?"Arguments":r}},7081:function(t,e,n){var r=n(8270),o=n(4826),i=n(7933),s=n(1787);t.exports=function(t,e,n){for(var a=o(e),c=s.f,l=i.f,u=0;u0&&r[0]<4?1:+(r[0]+r[1])),!o&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(o=+r[1]),t.exports=o},3837:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3103:function(t,e,n){var r=n(9859),o=n(7933).f,i=n(5762),s=n(4768),a=n(8400),c=n(7081),l=n(6541);t.exports=function(t,e){var n,u,h,f,d,p=t.target,g=t.global,v=t.stat;if(n=g?r:v?r[p]||a(p,{}):(r[p]||{}).prototype)for(u in e){if(f=e[u],h=t.dontCallGetSet?(d=o(n,u))&&d.value:n[u],!l(g?u:p+(v?".":"#")+u,t.forced)&&void 0!==h){if(typeof f==typeof h)continue;c(f,h)}(t.sham||h&&h.sham)&&i(f,"sham",!0),s(n,u,f,t)}}},4229:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},4954:function(t,e,n){"use strict";n(7950);var r=n(5968),o=n(4768),i=n(3466),s=n(4229),a=n(95),c=n(5762),l=a("species"),u=RegExp.prototype;t.exports=function(t,e,n,h){var f=a(t),d=!s((function(){var e={};return e[f]=function(){return 7},7!=""[t](e)})),p=d&&!s((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[l]=function(){return n},n.flags="",n[f]=/./[f]),n.exec=function(){return e=!0,null},n[f](""),!e}));if(!d||!p||n){var g=r(/./[f]),v=e(f,""[t],(function(t,e,n,o,s){var a=r(t),c=e.exec;return c===i||c===u.exec?d&&!s?{done:!0,value:g(e,n,o)}:{done:!0,value:a(n,e,o)}:{done:!1}}));o(String.prototype,t,v[0]),o(u,f,v[1])}h&&c(u[f],"sham",!0)}},3171:function(t,e,n){var r=n(7188),o=Function.prototype,i=o.apply,s=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?s.bind(i):function(){return s.apply(i,arguments)})},7188:function(t,e,n){var r=n(4229);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},266:function(t,e,n){var r=n(7188),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},1805:function(t,e,n){var r=n(7400),o=n(8270),i=Function.prototype,s=r&&Object.getOwnPropertyDescriptor,a=o(i,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&s(i,"name").configurable);t.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},5968:function(t,e,n){var r=n(7188),o=Function.prototype,i=o.bind,s=o.call,a=r&&i.bind(s,s);t.exports=r?function(t){return t&&a(t)}:function(t){return t&&function(){return s.apply(t,arguments)}}},1333:function(t,e,n){var r=n(9859),o=n(6733),i=function(t){return o(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?i(r[t]):r[t]&&r[t][e]}},5300:function(t,e,n){var r=n(7111);t.exports=function(t,e){var n=t[e];return null==n?void 0:r(n)}},17:function(t,e,n){var r=n(5968),o=n(2991),i=Math.floor,s=r("".charAt),a=r("".replace),c=r("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;t.exports=function(t,e,n,r,h,f){var d=n+t.length,p=r.length,g=u;return void 0!==h&&(h=o(h),g=l),a(f,g,(function(o,a){var l;switch(s(a,0)){case"$":return"$";case"&":return t;case"`":return c(e,0,n);case"'":return c(e,d);case"<":l=h[c(a,1,-1)];break;default:var u=+a;if(0===u)return o;if(u>p){var f=i(u/10);return 0===f?o:f<=p?void 0===r[f-1]?s(a,1):r[f-1]+s(a,1):o}l=r[u-1]}return void 0===l?"":l}))}},9859:function(t,e,n){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},8270:function(t,e,n){var r=n(5968),o=n(2991),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},5977:function(t){t.exports={}},3777:function(t,e,n){var r=n(1333);t.exports=r("document","documentElement")},4394:function(t,e,n){var r=n(7400),o=n(4229),i=n(2635);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},9337:function(t,e,n){var r=n(5968),o=n(4229),i=n(7079),s=Object,a=r("".split);t.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?a(t,""):s(t)}:s},8511:function(t,e,n){var r=n(5968),o=n(6733),i=n(5353),s=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return s(t)}),t.exports=i.inspectSource},6407:function(t,e,n){var r,o,i,s=n(8694),a=n(9859),c=n(5968),l=n(5052),u=n(5762),h=n(8270),f=n(5353),d=n(4399),p=n(5977),g="Object already initialized",v=a.TypeError,b=a.WeakMap;if(s||f.state){var m=f.state||(f.state=new b),y=c(m.get),w=c(m.has),E=c(m.set);r=function(t,e){if(w(m,t))throw new v(g);return e.facade=t,E(m,t,e),e},o=function(t){return y(m,t)||{}},i=function(t){return w(m,t)}}else{var x=d("state");p[x]=!0,r=function(t,e){if(h(t,x))throw new v(g);return e.facade=t,u(t,x,e),e},o=function(t){return h(t,x)?t[x]:{}},i=function(t){return h(t,x)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!l(e)||(n=o(e)).type!==t)throw v("Incompatible receiver, "+t+" required");return n}}}},6733:function(t){t.exports=function(t){return"function"==typeof t}},2359:function(t,e,n){var r=n(5968),o=n(4229),i=n(6733),s=n(1589),a=n(1333),c=n(8511),l=function(){},u=[],h=a("Reflect","construct"),f=/^\s*(?:class|function)\b/,d=r(f.exec),p=!f.exec(l),g=function(t){if(!i(t))return!1;try{return h(l,u,t),!0}catch(t){return!1}},v=function(t){if(!i(t))return!1;switch(s(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!d(f,c(t))}catch(t){return!0}};v.sham=!0,t.exports=!h||o((function(){var t;return g(g.call)||!g(Object)||!g((function(){t=!0}))||t}))?v:g},6541:function(t,e,n){var r=n(4229),o=n(6733),i=/#|\.prototype\./,s=function(t,e){var n=c[a(t)];return n==u||n!=l&&(o(e)?r(e):!!e)},a=s.normalize=function(t){return String(t).replace(i,".").toLowerCase()},c=s.data={},l=s.NATIVE="N",u=s.POLYFILL="P";t.exports=s},5052:function(t,e,n){var r=n(6733);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},4231:function(t){t.exports=!1},9395:function(t,e,n){var r=n(1333),o=n(6733),i=n(1321),s=n(6969),a=Object;t.exports=s?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,a(t))}},693:function(t,e,n){"use strict";var r,o,i,s=n(4229),a=n(6733),c=n(2391),l=n(7567),u=n(4768),h=n(95),f=n(4231),d=h("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=l(l(i)))!==Object.prototype&&(r=o):p=!0),null==r||s((function(){var t={};return r[d].call(t)!==t}))?r={}:f&&(r=c(r)),a(r[d])||u(r,d,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},5495:function(t){t.exports={}},9646:function(t,e,n){var r=n(4237);t.exports=function(t){return r(t.length)}},6039:function(t,e,n){var r=n(4229),o=n(6733),i=n(8270),s=n(7400),a=n(1805).CONFIGURABLE,c=n(8511),l=n(6407),u=l.enforce,h=l.get,f=Object.defineProperty,d=s&&!r((function(){return 8!==f((function(){}),"length",{value:8}).length})),p=String(String).split("String"),g=t.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!i(t,"name")||a&&t.name!==e)&&f(t,"name",{value:e,configurable:!0}),d&&n&&i(n,"arity")&&t.length!==n.arity&&f(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?s&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=u(t);return i(r,"source")||(r.source=p.join("string"==typeof e?e:"")),t};Function.prototype.toString=g((function(){return o(this)&&h(this).source||c(this)}),"toString")},917:function(t){var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},3839:function(t,e,n){var r=n(6358),o=n(4229);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},8694:function(t,e,n){var r=n(9859),o=n(6733),i=n(8511),s=r.WeakMap;t.exports=o(s)&&/native code/.test(i(s))},6485:function(t,e,n){"use strict";var r=n(7111),o=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},2391:function(t,e,n){var r,o=n(1176),i=n(219),s=n(3837),a=n(5977),c=n(3777),l=n(2635),u=n(4399),h=u("IE_PROTO"),f=function(){},d=function(t){return"