/** * Minified by jsDelivr using Terser v5.3.5. * Original file: /gh/alpine-collective/alpine-magic-helpers@1.2.2/dist/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).AlpineMagicHelpers=e.AlpineMagicHelpers||{},e.AlpineMagicHelpers.index=t())}(this,(function(){"use strict";var e=function(){if(!window.Alpine)throw new Error("[Magic Helpers] Alpine is required for the magic helpers to function correctly.");if(!window.Alpine.version||!function(e,t){for(var n=e.split("."),r=t.split("."),o=0;o>0==+t[r+1]?[]:{}),e[n]}),e)[t[t.length-1]]=n,e},o=function(e,t){var n=e.__x?e.__x.getUnobservedData():function(e,t,n){void 0===n&&(n={});if("function"==typeof e)return e.call(t);return new Function(["$data"].concat(Object.keys(n)),"var __alpine_result; with($data) { __alpine_result = "+e+" }; return __alpine_result").apply(void 0,[t].concat(Object.values(n)))}(e.getAttribute("x-data"),e);return t?(t=Array.isArray(t)?t:[t]).reduce((function(e,t){return e[t]=n[t],e}),{}):n};function i(e,t,n){return e.__x?n():(window.requestAnimationFrame((function(){return t.__x.updateElements(t)})),r={get:function(e,t){return new Proxy((function(){return""}),r)}},new Proxy((function(){return""}),r));var r}var a=/^x-([a-z-]*)\b/i;function s(e){var t=e.name,n=e.value,r=t.match(a),o=t.match(/:([a-z0-9\-:]+)/i),i=t.match(/\.[^.\]]+(?=[^\]]*$)/g)||[];return{type:r?r[1]:null,value:o?o[1]:null,modifiers:i.map((function(e){return e.replace(".","")})),expression:n}}function u(){window.Alpine&&!window.AlpineMagicHelpers.__fatal&&(window.AlpineMagicHelpers.__fatal=setTimeout((function(){console.error("%c*** ALPINE MAGIC HELPER: Fatal Error! ***\n\n\nAlpine magic helpers need to be loaded before Alpine to avoid errors when Alpine initialises its component. \n\nMake sure the helper script is included before Alpine in your page when using the defer attribute","font-size: 14px")}),200))}u();var c={start:function(){e(),Alpine.addMagicProperty("parent",(function(e){if(void 0!==e.$parent)return e.$parent;var a=e.parentNode.closest("[x-data]");if(!a)throw new Error("Parent component not found");return i(a,e,(function(){return e.$parent=t(o(a),a,r),n(a,(function(){e.$parent=t(a.__x.getUnobservedData(),a,r),e.__x.updateElements(e)})),e.$parent}))})),Alpine.addMagicProperty("component",(function(e){return function(a){var s=this;if(void 0!==this[a])return this[a];var u=document.querySelector('[x-data][x-id="'+a+'"], [x-data]#'+a);if(!u)throw new Error("Component not found");return i(u,e,(function(){return s[a]=t(o(u),u,r),n(u,(function(){s[a]=t(u.__x.getUnobservedData(),u,r),e.__x.updateElements(e)})),s[a]}))}}))}},l=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){c.start(),l(e)};var f=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;u[o]="set-cookie"===o?(u[o]?u[o]:[]).concat([a]):u[o]?u[o]+", "+a:a}})),u):u):null,l={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:c,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(P("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,l),i=null}},i.onabort=function(){i&&(n(P("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(P("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(P(t,e,"ECONNABORTED",i)),i=null},w.isStandardBrowserEnv()){var f=(e.withCredentials||M(l))&&e.xsrfCookieName?S.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}if("setRequestHeader"in i&&w.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),w.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),r||(r=null),i.send(r)}))},N={"Content-Type":"application/x-www-form-urlencoded"};function T(e,t){!w.isUndefined(e)&&w.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var k,D={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(k=L),k),transformRequest:[function(e,t){return j(t,"Accept"),j(t,"Content-Type"),w.isFormData(e)||w.isArrayBuffer(e)||w.isBuffer(e)||w.isStream(e)||w.isFile(e)||w.isBlob(e)?e:w.isArrayBufferView(e)?e.buffer:w.isURLSearchParams(e)?(T(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):w.isObject(e)?(T(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};D.headers={common:{Accept:"application/json, text/plain, */*"}},w.forEach(["delete","get","head"],(function(e){D.headers[e]={}})),w.forEach(["post","put","patch"],(function(e){D.headers[e]=w.merge(N)}));var R=D;function B(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var U=function(e){return B(e),e.headers=e.headers||{},e.data=O(e.data,e.headers,e.transformRequest),e.headers=w.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),w.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||R.adapter)(e).then((function(t){return B(e),t.data=O(t.data,t.headers,e.transformResponse),t}),(function(t){return E(t)||(B(e),t&&t.response&&(t.response.data=O(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},I=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return w.isPlainObject(e)&&w.isPlainObject(t)?w.merge(e,t):w.isPlainObject(t)?w.merge({},t):w.isArray(t)?t.slice():t}function u(r){w.isUndefined(t[r])?w.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(e[r],t[r])}w.forEach(r,(function(e){w.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),w.forEach(o,u),w.forEach(i,(function(r){w.isUndefined(t[r])?w.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(void 0,t[r])})),w.forEach(a,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var c=r.concat(o).concat(i).concat(a),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return w.forEach(l,u),n};function q(e){this.defaults=e,this.interceptors={request:new _,response:new _}}q.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=I(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[U,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},q.prototype.getUri=function(e){return e=I(this.defaults,e),A(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},w.forEach(["delete","get","head","options"],(function(e){q.prototype[e]=function(t,n){return this.request(I(n||{},{method:e,url:t,data:(n||{}).data}))}})),w.forEach(["post","put","patch"],(function(e){q.prototype[e]=function(t,n,r){return this.request(I(r||{},{method:e,url:t,data:n}))}}));var H=q;function $(e){this.message=e}$.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},$.prototype.__CANCEL__=!0;var F=$;function X(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new F(e),t(n.reason))}))}X.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},X.source=function(){var e;return{token:new X((function(t){e=t})),cancel:e}};var z=X;function Y(e){var t=new H(e),n=f(H.prototype.request,t);return w.extend(n,H.prototype,t),w.extend(n,t),n}var J=Y(R);J.Axios=H,J.create=function(e){return Y(I(J.defaults,e))},J.Cancel=F,J.CancelToken=z,J.isCancel=E,J.all=function(e){return Promise.all(e)},J.spread=function(e){return function(t){return e.apply(null,t)}},J.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var V=J,W=J;V.default=W;var G=V;u();var K={start:function(){e(),Alpine.addMagicProperty("fetch",this.fetch.bind(null,null)),Alpine.addMagicProperty("get",this.fetch.bind(null,"get")),Alpine.addMagicProperty("post",this.fetch.bind(null,"post"))},fetch:function(e){return async function(t,n){function r(e){return Object.prototype.hasOwnProperty.call(e,"data")?e.data:e}var o;return void 0===n&&(n={}),e?await G((o={url:t,method:e},o["post"===e?"data":"params"]=n,o)).then((function(e){return r(e)})):"string"==typeof t?await G.get(t).then((function(e){return r(e)})):await G(t)}}},Q=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){K.start(),Q(e)},u();var Z={start:function(){e(),Alpine.addMagicProperty("interval",(function(e){return function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;rt;if(r){var o=[t,e];e=o[0],t=o[1]}var i=Array.from({length:(t-e)/n+1},(function(t,r){return e+r*n}));return r?i.reverse():i}}))}},ne=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){te.start(),ne(e)},u();var re={start:function(){e(),Alpine.addMagicProperty("refresh",(function(e){return e.__x?function(t){return void 0===t&&(t=e),t.__x.updateElements(t)}:function(){}}))}},oe=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){re.start(),oe(e)};var ie=new(function(){function e(){var e=this;this.values={breakpoints:{xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536}},document.addEventListener("readystatechange",(function(){if("interactive"===document.readyState&&window.AlpineMagicHelpersConfig)for(var t in window.AlpineMagicHelpersConfig)e.values[t]=window.AlpineMagicHelpersConfig[t]}))}return e.prototype.get=function(e){return this.values[e]?this.values[e]:null},e}());u();var ae=[],se={start:function(){var t;e(),window.addEventListener("resize",(function(){clearTimeout(t),t=setTimeout((function(){ae.forEach((function(e){return e&&e.__x&&e.__x.updateElements(e)}))}),150)})),Alpine.addMagicProperty("screen",(function(e){return ae.includes(e)||ae.push(e),function(e){var t=window.innerWidth;if(Number.isInteger(e))return e<=t;var n=ie.get("breakpoints");if(void 0===n[e])throw Error("Undefined $screen property: "+e);return n[e]<=t}}))}},ue=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){se.start(),ue(e)};var ce="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function le(e){var t={exports:{}};return e(t,t.exports),t.exports}var fe=le((function(e,t){e.exports={polyfill:function(){var e=window,t=document;if(!("scrollBehavior"in t.documentElement.style)||!0===e.__forceSmoothScrollPolyfill__){var n,r=e.HTMLElement||e.Element,o={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||s,scrollIntoView:r.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now,a=(n=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(n)?1:0);e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?h.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):o.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(u(arguments[0])?o.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},r.prototype.scroll=r.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==u(arguments[0])){var e=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");o.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},r.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==u(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):o.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},r.prototype.scrollIntoView=function(){if(!0!==u(arguments[0])){var n=p(this),r=n.getBoundingClientRect(),i=this.getBoundingClientRect();n!==t.body?(h.call(this,n,n.scrollLeft+i.left-r.left,n.scrollTop+i.top-r.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:r.left,top:r.top,behavior:"smooth"})):e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})}else o.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function s(e,t){this.scrollLeft=e,this.scrollTop=t}function u(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+a1?1:s,n=.5*(1-Math.cos(Math.PI*a)),r=t.startX+(t.x-t.startX)*n,o=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,o),r===t.x&&o===t.y||e.requestAnimationFrame(d.bind(e,t))}function h(n,r,a){var u,c,l,f,p=i();n===t.body?(u=e,c=e.scrollX||e.pageXOffset,l=e.scrollY||e.pageYOffset,f=o.scroll):(u=n,c=n.scrollLeft,l=n.scrollTop,f=s),d({scrollable:u,method:f,startTime:p,startX:c,startY:l,x:r,y:a})}}}}));u(),fe.polyfill();var pe={start:function(){e(),Alpine.addMagicProperty("scroll",(function(){return function(e,t){void 0===t&&(t={});var n=e,r=t.offset?parseInt(t.offset,10):0;if(delete t.offset,"string"==typeof e&&/^[0-9]+?/g.test(e)&&(e=parseInt(e,10)),"string"==typeof e&&(e=document.querySelector(e)),e instanceof Element&&(e=Math.floor(e.getBoundingClientRect().top+window.pageYOffset)),Number.isInteger(e)&&(e={top:e-r,behavior:"smooth"}),"object"!=typeof e)throw Error("Unsupported $scroll target: ",n);Object.assign(e,t),window.scroll(e)}}))}},de=window.deferLoadingAlpine||function(e){return e()};window.deferLoadingAlpine=function(e){pe.start(),de(e)},u();var he={start:function(){var t=this;e(),Alpine.addMagicProperty("truncate",(function(){return function(){for(var e=arguments.length,n=new Array(e),r=0;r0&&d[d.length-1].lhs&&Object.getOwnPropertyDescriptor(d[d.length-1].lhs,l),O="undefined"!==x||d&&d.length>0&&d[d.length-1].rhs&&Object.getOwnPropertyDescriptor(d[d.length-1].rhs,l);if(!_&&O)n.push(new i(v,t));else if(!O&&_)n.push(new a(v,e));else if(c(e)!==c(t))n.push(new o(v,e,t));else if("date"===c(e)&&e-t!=0)n.push(new o(v,e,t));else if("object"===A&&null!==e&&null!==t){for(m=d.length-1;m>-1;--m)if(d[m].lhs===e){b=!0;break}if(b)e!==t&&n.push(new o(v,e,t));else{if(d.push({lhs:e,rhs:t}),Array.isArray(e)){for(h&&(e.sort((function(e,t){return f(e)-f(t)})),t.sort((function(e,t){return f(e)-f(t)}))),m=t.length-1,y=e.length-1;m>y;)n.push(new s(v,m,new i(void 0,t[m--])));for(;y>m;)n.push(new s(v,y,new a(void 0,e[y--])));for(;m>=0;--m)p(e[m],t[m],n,r,v,m,d,h)}else{var E=Object.keys(e),j=Object.keys(t);for(m=0;m=0?(p(e[w],t[w],n,r,v,w,d,h),j[b]=null):p(e[w],void 0,n,r,v,w,d,h);for(m=0;m