1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,50107,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},53306,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},51933,(e,t,r)=>{"use strict";var n,i,s,o,a,c=e.e&&e.e.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r},h=e.e&&e.e.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};Object.defineProperty(r,"__esModule",{value:!0}),r.RequestError=r.TooManyRequestsError=r.SystemError=r.UserCredentialsError=r.ChildError=r.ErrorTypes=void 0,(n=a||(r.ErrorTypes=a={})).CHILD_ERROR="ChildError",n.USER_CREDENTIALS_ERROR="UserCredentialsError",n.SYSTEM_ERROR="SystemError",n.REQUEST_ERROR="RequestError",n.TOO_MANY_REQUESTS_ERROR="TooManyRequestsError";class u extends Error{get childError(){return h(this,i,"f")}get body(){return h(this,s,"f")}constructor(e,t=null,r={}){super(e),i.set(this,void 0),s.set(this,void 0),this.name=a.CHILD_ERROR,c(this,i,t,"f"),c(this,s,r,"f")}}r.ChildError=u,i=new WeakMap,s=new WeakMap,r.UserCredentialsError=class extends u{constructor(e,t=null,r={}){super(e,t,r),this.name=a.USER_CREDENTIALS_ERROR}},r.SystemError=class extends u{constructor(e,t,r={}){super(e,t,r),this.name=a.SYSTEM_ERROR}},r.TooManyRequestsError=class extends u{constructor(e,t,r={}){super(e,t,r),this.name=a.TOO_MANY_REQUESTS_ERROR}},r.RequestError=class extends u{get responseCode(){return h(this,o,"f")}constructor(e,t,r={},n){super(e,t,r),o.set(this,void 0),this.name=a.REQUEST_ERROR,c(this,o,n,"f")}},o=new WeakMap},97570,(e,t,r)=>{"use strict";r.byteLength=function(e){var t=h(e),r=t[0],n=t[1];return(r+n)*3/4-n},r.toByteArray=function(e){var t,r,n=h(e),o=n[0],a=n[1],c=new s((o+a)*3/4-a),u=0,l=a>0?o-4:o;for(r=0;r<l;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(function(e,t,r){for(var i,s=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&s.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),s.join("")};for(var n=[],i=[],s="u">typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=o.length;a<c;++a)n[a]=o[a],i[o.charCodeAt(a)]=a;function h(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}i[45]=62,i[95]=63},31164,(e,t,r)=>{r.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,c=(1<<a)-1,h=c>>1,u=-7,l=r?i-1:0,f=r?-1:1,d=e[t+l];for(l+=f,s=d&(1<<-u)-1,d>>=-u,u+=a;u>0;s=256*s+e[t+l],l+=f,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+e[t+l],l+=f,u-=8);if(0===s)s=1-h;else{if(s===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=h}return(d?-1:1)*o*Math.pow(2,s-n)},r.write=function(e,t,r,n,i,s){var o,a,c,h=8*s-i-1,u=(1<<h)-1,l=u>>1,f=5960464477539062e-23*(23===i),d=n?0:s-1,g=n?1:-1,p=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+l>=1?t+=f/c:t+=f*Math.pow(2,1-l),t*c>=2&&(o++,c/=2),o+l>=u?(a=0,o=u):o+l>=1?(a=(t*c-1)*Math.pow(2,i),o+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=g,a/=256,i-=8);for(o=o<<i|a,h+=i;h>0;e[r+d]=255&o,d+=g,o/=256,h-=8);e[r+d-g]|=128*p}},16148,(e,t,r)=>{"use strict";let n=e.r(97570),i=e.r(31164),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>
vendor: 10,346 bytes, line 1
10x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);let r=0|g(n,i),s=o(r),c=s.write(n,i);return c!==r&&(s=s.slice(0,c)),s}if(ArrayBuffer.isView(e)){var s=e;if(x(s,Uint8Array)){let e=new Uint8Array(s);return f(e.buffer,e.byteOffset,e.byteLength)}return l(s)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return a.from(c,t,r);let h=function(e){if(a.isBuffer(e)){let t=0|d(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(h)return h;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return h(e),o(e<0?0:0|d(e))}function l(e){let t=e.length<0?0:0|d(e.length),r=o(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){let n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function g(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return L(e).length;default:if(i)return n?-1:D(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=H[e[n]];return i}(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return function(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":var s,o,a;return s=this,o=t,a=r,0===o&&a===s.length?n.fromByteArray(s):n.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function y(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return m(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){let s,o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,c/=2,r/=2}function h(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;s<a;s++)if(h(e,s)===h(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*o}else -1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(h(e,s+n)!==h(t,n)){r=!1;break}if(r)return s}return -1}function w(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,c;switch(o){case 1:t<128&&(s=t);break;case 2:(192&(r=e[i+1]))==128&&(c=(31&t)<<6|63&r)>127&&(s=c);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(c=(15&t)<<12|(63&r)<<6|63&n)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}var s=n;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",c=0;for(;c<o;)a+=String.fromCharCode.apply(String,s.slice(c,c+=4096));return a}function S(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function T(e,t,r,n,i){P(t,n,i,e,r,7);let s=Number(t&BigInt(0xffffffff));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function k(e,t,r,n,i){P(t,n,i,e,r,7);let s=Number(t&BigInt(0xffffffff));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function v(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function I(e,t,r,n,s){return t*=1,r>>>=0,s||v(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function b(e,t,r,n,s){return t*=1,r>>>=0,s||v(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}r.Buffer=a,r.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},r.INSPECT_MAX_BYTES=50,r.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(h(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return u(e)},a.allocUnsafeSlow=function(e){return u(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(x(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){let r;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;let n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(x(t,Uint8Array))i+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=g,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?w(this,0,e):p.apply(this,arguments)}
vendor: 11,051 bytes, line 1
1,a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(x(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let s=i-n,o=r-t,c=Math.min(s,o),h=this.slice(n,i),u=e.slice(t,r);for(let e=0;e<c;++e)if(h[e]!==u[e]){s=h[e],o=u[e];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return E(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return E(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){var i,s,o,a,c,h,u,l;if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let d=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;let o=t.length;for(n>o/2&&(n=o/2),i=0;i<n;++i){var a;let n=parseInt(t.substr(2*i,2),16);if((a=n)!=a)break;e[r+i]=n}return i}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,B(D(e,this.length-i),this,i,s);case"ascii":case"latin1":case"binary":return o=t,a=r,B(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,o,a);case"base64":return c=t,h=r,B(L(e),this,c,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,l=r,B(function(e,t){let r,n,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,l);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||S(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||S(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||S(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||S(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||S(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=F(function(e){U(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&N(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*r;return BigInt(n)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=F(function(e){U(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&N(e,this.length-8);let n=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||S(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||S(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||S(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||S(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||S(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=F(function(e){U(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&N(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),a.prototype.readBigInt64BE=F(function(e){U(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&N(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+r)}),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||S(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||S(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||S(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||S(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;R(this,e,t,r,n,0)}let i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;R(this,e,t,r,n,0)}let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return T(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){let n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||R(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return T(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=F(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return b(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return b(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},a.prototype.fill=function(e,t,r,n){let i;if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),o=s.length;
1if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};let O={};function _(e,t,r){O[e]=class extends r{get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(e,"]"),this.stack,delete this.name}}}function A(e){let t="",r=e.length,n=+("-"===e[0]);for(;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function P(e,t,r,n,i,s){if(e>r||e<t){let n,i="bigint"==typeof t?"n":"";throw n=s>3?0===t||t===BigInt(0)?">= 0".concat(i," and < 2").concat(i," ** ").concat((s+1)*8).concat(i):">= -(2".concat(i," ** ").concat((s+1)*8-1).concat(i,") and < 2 ** ")+"".concat((s+1)*8-1).concat(i):">= ".concat(t).concat(i," and <= ").concat(r).concat(i),new O.ERR_OUT_OF_RANGE("value",n,e)}U(i,"offset"),(void 0===n[i]||void 0===n[i+s])&&N(i,n.length-(s+1))}function U(e,t){if("number"!=typeof e)throw new O.ERR_INVALID_ARG_TYPE(t,"number",e)}function N(e,t,r){if(Math.floor(e)!==e)throw U(e,r),new O.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new O.ERR_BUFFER_OUT_OF_BOUNDS;throw new O.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(+!!r," and <= ").concat(t),e)}_("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),_("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)},TypeError),_("ERR_OUT_OF_RANGE",function(e,t,r){let n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>0x100000000?i=A(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=A(i)),i+="n"),n+=" It must be ".concat(t,". Received ").concat(i)},RangeError);let C=/[^+/0-9A-Za-z-_]/g;function D(e,t){let r;t=t||1/0;let n=e.length,i=null,s=[];for(let o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function L(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let H=function(){let e="0123456789abcdef",t=Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function F(e){return"u"<typeof BigInt?G:e}function G(){throw Error("BigInt not supported")}},69108,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isValidJWT=r.getJWTExpiryDate=r.decodeJWT=void 0;let n=e.r(16148),i=e.r(48606);r.decodeJWT=e=>{try{let[,t]=e.split(".");return JSON.parse(n.Buffer.from(t,"base64").toString("binary"))}catch(e){throw console.debug("isValidJWT - failed to decode base64 payload"),Error("Failed to decode base64 payload")}},r.getJWTExpiryDate=e=>{let t=(0,r.decodeJWT)(e);if(!Object.keys(t).includes("exp"))throw console.debug("isValidJWT - jwt does not contain an exp"),Error("JWT does not contain an exp");return new Date(1e3*t.exp)},r.isValidJWT=(e,t)=>{if(!i.RequestHandler.isValidString(e))return console.debug("isValidJWT - falsy jwt value passed"),!1;if(!e.includes("."))return console.debug("isValidJWT - does not contain two dots"),!1;let n=(0,r.decodeJWT)(e);if(!Object.keys(n).includes("exp"))return console.debug("isValidJWT - jwt does not contain an exp"),!1;let s=Math.floor(new Date().getTime()/1e3)+t;return n.exp>s||(console.debug("isValidJWT - does not pass the exp threashold"),!1)}},48606,(e,t,r)=>{"use strict";var n,i,s,o,a,c,h,u;
1Object.defineProperty(r,"__esModule",{value:!0}),r.RequestHandler=r.LogLevels=r.Levels=void 0;let l=e.r(69108),f=e.r(51933);(o=n||(r.Levels=n={})).INFO="info",o.WARNING="warning",o.ERROR="error",(a=i||(i={})).LOGGED_IN="i-logged-in",a.NEW_ACCESS_TOKEN="i-new-at",a.NEW_REFRESH_TOKEN="i-new-rt",a.LOGOUT="i-logout",a.UPGRADED_FROM_PHPSESSID="i-upgraded-from-PHPSESSID",a.UPGRADED_FROM_CHECK_SUPPORTER="i-upgraded-from-check-supporter",a.UPGRADED_FROM_OTHER_JWTS="i-upgraded-from-other-jwts",a.WARNING_NO_VALID_REFRESH_TOKEN_LOGGING_OUT="w-no-valid-refresh-token-logging-out",a.ERROR_API_ERROR="e-api-error",a.ERROR_UNABLE_TO_GET_ACCESS_TOKEN="e-unable-to-get-access-token",a.ERROR_UNABLE_TO_GET_REFRESH_TOKEN="e-unable-to-get-refresh-token",a.ERROR_SYSTEM_ERROR="e-system-error",a.ERROR_SESSION_UPGRADE_FAILED="e-session-upgrade-failed",a.ERROR_SESSION_RETROFIT_FAILED="e-session-retrofit-failed",a.ERROR_TOKEN_PROCESSING_ACCESS_TOKEN="e-token-processing-access-token",a.ERROR_TOKEN_PROCESSING_REFRESH_TOKEN="e-token-processing-refresh-token",a.ERROR_TOKEN_REFRESH_FAILED="e-token-refresh-failed",a.ERROR_DELETING_TOKENS_FAILED="e-deleting-tokens-failed",a.ERROR_READING_TOKENS_FROM_STORAGE_FAILED="e-reading-tokens-from-storage-failed",a.ERROR_FINDING_WORKING_CREDENTIALS="e-finding-working-credentials";let d={production:{accessToken:3e3,refreshToken:7776e3},staging:{accessToken:60,refreshToken:180}};(c=s||(r.LogLevels=s={}))[c.DEBUG=0]="DEBUG",c[c.WARNING=1]="WARNING",c[c.INFO=2]="INFO",c[c.ERROR=3]="ERROR";class g{static isValidString(e){return"string"==typeof e&&""!==e.trim()}static getCookieExpireDate(e){let t=new Date;return t.setDate(t.getDate()+e),t.toUTCString()}getIsProcessing(){return this.isProcessing}_addToQueue(e){this.queue.push(e)}getUserId(){return this.userId}setUserId(e){this.userId=e}unsetUserId(){this.userId=null}getHidePersonalData(){return this.hidePersonalData}setHidePersonalData(e){this.hidePersonalData=e}async processTask(e){this.info("Starting processTask for task '".concat(e.tid,"'"),e,e.tid);let t=await this.storageLayer.getInstallationId();e.authorisationHeaders={...e.authorisationHeaders,installationId:t};try{return this.transportLayer[e.method.toLowerCase()]({...e}).then(async t=>{if(this.info("processTask ".concat(e.method," ").concat(e.url," successful"),t,e.tid),e.resolve(t),e.requiresAuth)return t}).catch(async t=>{this.error("processTask ".concat(e.method," ").concat(e.url," failed"),t,e.tid);let r=t instanceof f.RequestError?t.responseCode:null;429===r&&t instanceof f.RequestError&&(t=new f.TooManyRequestsError("Rate limit exceeded",t.childError,t.body)),e.reject(t);let s=t instanceof f.SystemError?i.ERROR_SYSTEM_ERROR:i.ERROR_API_ERROR;if(r&&e.dontErrorOnStatusCodes&&e.dontErrorOnStatusCodes.includes(r)?this.warning("Not sending analytic/event errors due to response code ".concat(r," being in the dontErrorOnStatusCodes array"),t,e.tid):await this.analyticEvent({event:s,userId:this.getUserId(),data:{errorName:t.name,message:t.message,resource:e.url,debugger:"Failed to call ".concat(e.method," on the transport layer"),task:JSON.stringify(e),taskObject:e,responseCode:r},level:n.ERROR}),e.requiresAuth)throw t})}catch(r){let t=new f.SystemError("Failed to call ".concat(e.method," on the transport layer"),r);return await this.analyticEvent({event:i.ERROR_SYSTEM_ERROR,userId:this.getUserId(),data:{errorName:t.name,message:t.message,resource:e.url,debugger:"Failed to call ".concat(e.method," on the transport layer"),task:JSON.stringify(e),taskObject:e},level:n.ERROR}),e.reject(t),await Promise.reject(t)}}async analyticEvent(e){let{event:t,userId:r,data:s={},level:o=n.INFO,_disableSendingErrorOnFailure:a=!1}=e;this.info("â© Triggering analytic event ".concat(t," for user ").concat(r),{});let c=await this.storageLayer.getInstallationId(),h=this.clientSessionId;this.hidePersonalData&&null!==r&&(r=-1);try{let e=g.windowLocationGetter();await this.transportLayer.post({url:"".concat(this.baseDomain,"/analytics/event"),data:{eventTime:new Date().toISOString(),property:this.analyticsDefaultOptions.client,category:"request-handler",location:e,event:t,level:o,eventData:{installationId:c,clientSessionId:h,...this.analyticsDefaultOptions,...s,userId:r}}})}catch(e){if(this.warning("Failed to send Analytics Event!",e),a)return void this.warning("Not sending further analytic/event errors due to _disableSendingErrorOnFailure being true",e);this.error("â Problem sending event! ".concat(t," for user ").concat(r),e),await this.analyticEvent({event:i.ERROR_SYSTEM_ERROR,userId:this.getUserId(),data:{errorName:e.name,message:e.message,debugger:"Failed to send analytic event",event:JSON.stringify({event:JSON.parse(JSON.stringify(t)),userId:r,data:JSON.parse(JSON.stringify(s)),level:o}),resource:"analyticEvent"},level:n.ERROR,_disableSendingErrorOnFailure:!0})}}async maintainPHPSESSID(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._maintainPHPSESSID)return;this.debug("Maintaining the PHPSESSID");let t=await this.storageLayer.getPHPSESSID().catch(e=>{throw new f.SystemError("Failed to get the PHPSESSID from the storage layer",e)}),r=await this.storageLayer.getCheckSupporter().catch(e=>{throw new f.SystemError("Failed to get the checkSupporter from the storage layer",e)}),s=await this.storageLayer.getAccessToken().catch(e=>{throw new f.SystemError("Failed to get the access token from the storage layer",e)});if(this.debug(" >> PHPSESSID is ".concat(t,", checkSupporter is ").concat(r,", and access token is ").concat(s)),e||!g.isValidString(t)||!g.isValidString(r))return await this.sessionRetrofit({accessToken:s}),await Promise.resolve();let o=await this.transportLayer.get({url:"".concat(this.baseDomain,"/auth/logged-in"),authorisationHeaders:{"x-phpsessid":t}}).catch(e=>e);if(this.debug("Logged in response is ".concat(JSON.stringify(o))),o instanceof Error){if(o instanceof f.RequestError&&429===o.responseCode){let e=new f.TooManyRequestsError("Rate limit exceeded",o.childError,o.body);return this.warning("Rate limited when maintaining PHPSESSID",e),await Promise.reject(e)}if(o instanceof f.RequestError&&401===o.responseCode){this.warning("Removing PHPSESSID due to idle rejection from legacy",o),await this.storageLayer.deletePHPSESSID(),await this.sessionRetrofit({accessToken:s});return}return this.error("Failed to maintain the PHPSESSID due to error ".concat(o.name," ").concat(o.message),o),await this.analyticEvent({event:i.ERROR_SYSTEM_ERROR,userId:this.getUserId(),data:{errorName:o.name,message:o.message,debugger:"Failed to maintain the PHPSESSID",resource:"maintainPhpSessId"},level:n.ERROR}),await Promise.reject(new f.SystemError("Failed to maintain the PHPSESSID",o))}let a=g.getCookieExpireDate(g.PHPSESSIDCookieExpiryDays);this.debug(" >> Updating the expiry date of the PHPSESSID (".concat(t,") to ").concat(a)),await this.storageLayer.setPHPSESSID(t,a);let c=g.getCookieExpireDate(g.checkSupporterCookieExpiryDays);this.debug(" >> Updating the expiry date of the checkSupporter (".concat(r,") to ").concat(c)),await this.storageLayer.setCheckSupporter(r,c)}async ruok(){this.debug("starting ruok checks");try{let e=await this.areTokensOk();if(this.debug(" >> Tokens are ok?",e),e)return;let t=await this.canUpgradeUsingSession();if(this.debug(" >> Upgraded from session?",t),t)return;let r=await this.canUpgradeUsingCheckSupporter();if(this.debug(" >> Upgraded from checkSupporter?",r),r)return}catch(e){throw this.error("error checking if tokens are ok in ruok, ".concat(e.name,", ").concat(e.message),e),await this.analyticEvent({event:i.ERROR_SYSTEM_ERROR,userId:this.getUserId(),data:{errorName:e.name,message:e.message,resource:"ruok",debugger:"Error checking if tokens are ok in ruok"},level:n.ERROR}),e}throw this.debug(" >> Throwing UserCredentialsError as no credentials to do anything"),new f.UserCredentialsError("No tokens in storage and no upgrade route available",Error("Failed to upgrade via ruok"),{})}async canUpgradeUsingSession(){let e=await this.storageLayer.getPHPSESSID();if(!g.isValidString(e))return!1;try{return this.info("Attempting to upgrade a session ".concat(e," for tokens")),await this.sessionUpgrade({sessionId:e})}catch(t){return this.error("Caught an ".concat(t.name," error in canUpgradeUsingSession"),t),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{errorName:t.name,message:t.message,debugger:"Failed to upgrade the session from PHPSESSID",sessionId:e,resource:"canUpgradeUsingSession"},level:n.ERROR}),!1}}async canUpgradeUsingCheckSupporter(){let e=await this.storageLayer.getCheckSupporter();if(!g.isValidString(e))return!1;try{return this.info("Attempting to upgrade a checkSupporter ".concat(e," for tokens")),await this.checkSupporterUpgrade({checkSupporter:e})}catch(t){return this.error("Caught an ".concat(t.name," error in canUpgradeUsingCheckSupporter"),t),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{errorName:t.name,message:t.message,checkSupporter:e,resource:"canUpgradeUsingCheckSupporter",debugger:"Failed to upgrade the session from checkSupporter"},level:n.ERROR}),!1}}async areTokensOk(){this.debug("Checking if tokens are ok");try{return await this.checkTokensAreValid(),await this.doesRefreshTokenNeedRefreshing()&&(this.debug("ruok Refreshing refresh token"),await this.refreshToken({type:"refresh"})),await this.doesAccessTokenNeedRefreshing()&&(this.debug("ruok Refreshing access token"),await this.refreshToken({type:"access"})),this.debug("ruok Everything is good"),!0}catch(e){if(this.error("Error in ruok",e),await this.analyticEvent({event:i.ERROR_FINDING_WORKING_CREDENTIALS,userId:this.getUserId(),data:{errorName:e.name,message:e.message,resource:"areTokensOk",debugger:"An error in `ruok`, and a '".concat(e.name,"' error was thrown")},level:n.ERROR}),e instanceof f.UserCredentialsError)return!1;throw e}}async checkTokensAreValid(){let[e,t]=await Promise.all([this.storageLayer.getRefreshToken(),this.storageLayer.getAccessToken()]).catch(async e=>{throw this.error("Error when getting tokens from storage",e),await this.analyticEvent({event:i.ERROR_READING_TOKENS_FROM_STORAGE_FAILED,userId:this.getUserId(),data:{errorName:e.name,message:e.message,debugger:"Error when getting tokens from storage",resource:"checkTokensAreValid"},level:n.ERROR}),new f.SystemError("Error when getting tokens from storage",e)});if(!g.isValidString(e)&&!g.isValidString(t))throw new f.UserCredentialsError("No tokens in storage");if(!(0,l.isValidJWT)(e,1)){let t,r=this.getUserId();this.unsetUserId(),await Promise.all([this.storageLayer.deleteRefreshToken(),this.storageLayer.deleteAcce
1ssToken()]).catch(async e=>{throw this.error("Error when deleting tokens from storage",e),await this.analyticEvent({event:i.ERROR_DELETING_TOKENS_FAILED,userId:r,data:{errorName:e.name,message:e.message,debugger:"Error when deleting tokens from storage",resource:"checkTokensAreValid"},level:n.ERROR}),new f.SystemError("Error when deleting tokens from storage",e)}),this.warning("No valid refresh token in storage for checkTokensAreValid to work");try{let r=(0,l.decodeJWT)(e);t=new Date(1e3*r.exp).toISOString()}catch(e){}throw await this.analyticEvent({event:i.WARNING_NO_VALID_REFRESH_TOKEN_LOGGING_OUT,userId:r,data:{message:"No valid refresh token in storage for checkTokensAreValid to work",resource:"checkTokensAreValid",refreshToken:e,...t&&{refreshTokenExpiry:t}},level:n.WARNING}),new f.UserCredentialsError("No valid refresh token in storage")}return!0}async doesRefreshTokenNeedRefreshing(){return!(0,l.isValidJWT)(await this.storageLayer.getRefreshToken(),this.ttls.refreshToken)}async doesAccessTokenNeedRefreshing(){return!(0,l.isValidJWT)(await this.storageLayer.getAccessToken(),this.ttls.accessToken)}async refreshToken(e){let{type:t}=e,r=await this.storageLayer.getRefreshToken(),s={refresh:{domain:"".concat(this.baseDomain,"/auth/refresh/refreshToken")},access:{domain:"".concat(this.baseDomain,"/auth/refresh/accessToken")}};return await new Promise(async(e,o)=>{await this.processTask({method:"POST",url:s[t].domain,data:{},authorisationHeaders:{Authorization:"Bearer ".concat(r)},clientOptions:{},requiresAuth:!1,resolve:e,reject:o,tid:this.short()}).catch(async e=>{throw this.error("Error when refreshing tokens: ".concat(e.message),e),await this.analyticEvent({event:"refresh"===t?i.ERROR_UNABLE_TO_GET_REFRESH_TOKEN:i.ERROR_UNABLE_TO_GET_ACCESS_TOKEN,userId:this.getUserId(),data:{errorName:e.name,message:e.message,debugger:"Error when refreshing the ".concat(t," token"),resource:"refreshToken",url:s[t].domain},level:n.ERROR}),e})}).then(async e=>{let{body:r}=e;return this.info("Got new ".concat(t," token"),{body:r}),await this.processTokens(r.details)}).catch(async e=>{if(e instanceof f.RequestError&&401===e.responseCode&&"RefreshTokenNotFound"===e.message){let r=this.getUserId();throw this.unsetUserId(),this.error("API error when refreshing the ".concat(t," token"),e.body),await this.analyticEvent({event:i.ERROR_API_ERROR,userId:r,data:{errorName:"RefreshTokenNotFound",message:"Refresh Token not in the database",debugger:"API error when refreshing the ".concat(t," token"),resource:"refreshToken"},level:n.ERROR}),await Promise.all([this.storageLayer.deleteRefreshToken(),this.storageLayer.deleteAccessToken()]).catch(async e=>{throw this.error("Error when deleting tokens from storage",e),await this.analyticEvent({event:i.ERROR_DELETING_TOKENS_FAILED,userId:r,data:{errorName:e.name,message:e.message,debugger:"Error when deleting tokens from storage",resource:"refreshToken"},level:n.ERROR}),new f.SystemError("Error when deleting tokens from storage",e)}),new f.SystemError("API error when refreshing the ".concat(t," token"),Error("RefreshTokenNotFound"))}throw this.error("Error when refreshing tokens: ".concat(e.message),e),await this.analyticEvent({event:i.ERROR_TOKEN_REFRESH_FAILED,userId:this.getUserId(),data:{errorName:e.name,message:e.message,debugger:"Error when refreshing the ".concat(t," token"),resource:"refreshToken"},level:n.ERROR}),new f.SystemError("Error when refreshing the ".concat(t," token"),e)})}async sessionRetrofit(e){let{accessToken:t}=e;return this.debug("Trying to retrofit the session using access token ".concat(t),{}),await new Promise(async(e,r)=>{await this.processTask({method:"POST",url:"".concat(this.baseDomain,"/auth/session-retrofit"),authorisationHeaders:{Authorization:"Bearer ".concat(t)},data:{},clientOptions:{},requiresAuth:!1,resolve:e,reject:r,tid:this.randomizer()})}).then(async e=>{let{body:t}=e,{sessionId:r,checkSupporter:n}=t.details;return this.debug("received the new PHPSESSID ".concat(r)),await this.storageLayer.setPHPSESSID(r,g.getCookieExpireDate(g.PHPSESSIDCookieExpiryDays)),await this.storageLayer.setCheckSupporter(n,g.getCookieExpireDate(g.checkSupporterCookieExpiryDays)),!0}).catch(async e=>{this.error("Error when upgrading the session",e);let r=(0,l.decodeJWT)(t);throw await this.analyticEvent({event:i.ERROR_SESSION_RETROFIT_FAILED,userId:this.getUserId(),data:{debugger:"Error when retrofitting the session using access token",errorName:e.name,message:e.message,resource:"sessionRetrofit",decodedJWT:JSON.parse(JSON.stringify(r)),accessToken:t},level:n.WARNING}),new f.SystemError("Error when retrofitting the session",e)})}async sessionUpgrade(e){let{sessionId:t}=e;return await new Promise(async(e,r)=>{await this.processTask({method:"POST",url:"".concat(this.baseDomain,"/auth/session-upgrade"),data:{sessionId:t},clientOptions:{},requiresAuth:!1,resolve:e,reject:r,tid:this.randomizer()}).catch(async e=>{throw this.error("Error when upgrading the session",e),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{debugger:"Error when upgrading the session",errorName:e.name,message:e.message,resource:"sessionUpgrade",sessionId:t},level:n.WARNING}),e})}).then(async e=>{let{body:r}=e;this.debug("trying to decode the token ".concat(r.details.tokens.accessToken));let s=(0,l.decodeJWT)(r.details.tokens.accessToken);return this.debug("new tokens are for user Id ".concat(s.userId)),this.setUserId(s.userId),await this.processTokens(r.details.tokens),await this.analyticEvent({event:i.UPGRADED_FROM_PHPSESSID,userId:this.getUserId(),data:{debugger:"Upgraded from PHPSESSID",sessionId:t,resource:"sessionUpgrade"},level:n.INFO}),!0}).catch(async e=>{throw this.error("Error when decoding the access token payload when doing a session upgrade.",e),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{debugger:"Error when decoding the access token payload when doing a session upgrade.",errorName:e.name,message:e.message,resource:"sessionUpgrade"},level:n.ERROR}),new f.SystemError("Error when decoding the access token payload",e)})}async checkSupporterUpgrade(e){let{checkSupporter:t}=e;return await new Promise(async(e,r)=>{await this.processTask({method:"POST",url:"".concat(this.baseDomain,"/auth/checksupporter-upgrade"),data:{checkSupporter:t},clientOptions:{},requiresAuth:!1,resolve:e,reject:r,tid:this.randomizer()}).catch(async e=>{throw this.error("Error when upgrading from checkSupporter",e),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{debugger:"Error when upgrading from checkSupporter",error:e.name,message:e.message,resource:"checkSupporterUpgrade"},level:n.WARNING}),e})}).then(async e=>{let{body:r}=e;this.debug("trying to decode the token ".concat(r.details.tokens.accessToken));let s=(0,l.decodeJWT)(r.details.tokens.accessToken);return this.info("new tokens are for user Id ".concat(s.userId)),this.setUserId(s.userId),await this.processTokens(r.details.tokens),await this.analyticEvent({event:i.UPGRADED_FROM_CHECK_SUPPORTER,userId:this.getUserId(),data:{debugger:"Upgraded from checkSupporter",checkSupporter:t,resource:"checkSupporterUpgrade"},level:n.INFO}),!0}).catch(async e=>{throw this.error("Error when decoding the access token payload when doing a checkSupporter upgrade.",e),await this.analyticEvent({event:i.ERROR_SESSION_UPGRADE_FAILED,userId:this.getUserId(),data:{debugger:"Error when decoding the access token payload when doing a checkSupporter upgrade.",errorName:e.name,message:e.message,resource:"checkSupporterUpgrade"},level:n.ERROR}),new f.SystemError("Error when decoding the access token payload",e)})}async processTokens(e){let{accessToken:t,refreshToken:r}=e;this.debug("Processing tokens ".concat(JSON.stringify({accessToken:t,refreshToken:r})));let s=this.getUserId();if(g.isValidString(t)){let e=(0,l.getJWTExpiryDate)(t);await this.storageLayer.setAccessToken(t).then(async()=>await this.analyticEvent({event:i.NEW_ACCESS_TOKEN,userId:s,data:{ttl:e.toISOString(),debugger:"New access token",resource:"processTokens"},level:n.INFO})).catch(async e=>{throw this.error("Error when processing the access token",e),await this.analyticEvent({event:i.ERROR_TOKEN_PROCESSING_ACCESS_TOKEN,userId:s,data:{errorName:e.name,message:e.message,debugger:"Error when processing access token",resource:"processTokens"},level:n.ERROR}),new f.SystemError("Error when processing the access token",e)})}if(g.isValidString(r)){let e=(0,l.getJWTExpiryDate)(r);await this.storageLayer.setRefreshToken(r).then(async()=>await this.analyticEvent({event:i.NEW_REFRESH_TOKEN,userId:s,data:{ttl:e.toISOString(),debugger:"New refresh token",resource:"processTokens"},level:n.INFO})).catch(async e=>{throw this.error("Error when processing the refresh token",e),await this.analyticEvent({event:i.ERROR_TOKEN_PROCESSING_REFRESH_TOKEN,userId:s,data:{errorName:e.name,message:e.message,debugger:"Error when processing refresh token",resource:"processTokens"},level:n.ERROR}),new f.SystemError("Error when processing the refresh token",e)})}}async login(e){this.info("Login call",e);let{body:t}=e;if(!Object.keys(t.details).includes("tokens")){let e=Error("No tokens returned from login");throw this.error("missing user credentials",e),new f.UserCredentialsError("No tokens returned from login",e,t)}let r=t.details.user.id;if(this.setUserId(r),await this.processTokens({accessToken:t.details.tokens.accessToken,refreshToken:t.details.tokens.refreshToken}).catch(e=>{throw this.error("Error when processing tokens in login",e),e}),this._maintainPHPSESSID){if(!Object.keys(t.details).includes("sessionId")){let e=Error("No session returned from login");throw this.error("missing user credentials",e),new f.UserCredentialsError("No session returned from login",e,t)}let{sessionId:r,user:n}=e.body.details;await this.storageLayer.setPHPSESSID(r,g.getCookieExpireDate(g.PHPSESSIDCookieExpiryDays)),await this.storageLayer.setCheckSupporter(n.hash,g.getCookieExpireDate(g.checkSupporterCookieExpiryDays))}return await this.analyticEvent({event:i.LOGGED_IN,userId:r,data:{resource:"login"},level:n.INFO}),e}async logout(){let e=this.getUserId();this.info("Logging out user ".concat(this.getUserId()));let t=await this.storageLayer.getRefreshToken(),r=await this.storageLayer.getAccessToken();await new Promise(async(e,n)=>{await this.processTask({method:"POST",url:"".concat(this.baseDomain,"/logout"),data:{accessToken:r},authorisationHeaders:{Authorization:"Bearer ".concat(t)},clientOptions:{},requiresAuth:!1,resolve:e,reject:n,tid:this.randomizer()}).catch(e=>{throw this.error("Error when logging the user out",e),e})}).catch(e=>(this.error("Error when decoding the access token payload when trying to log a user out.",e),!0)),this.unsetUserId(),await Promise.all([this.storageLayer.deleteAcce
1ssToken(),this.storageLayer.deleteRefreshToken(),this.storageLayer.deletePHPSESSID(),this.storageLayer.deleteCheckSupporter()]).catch(e=>{throw this.error("Error when deleting tokens from storage",e),new f.SystemError("Error when deleting tokens from storage",e)}),await this.analyticEvent({event:i.LOGOUT,userId:e,data:{debugger:"Logout"},level:n.INFO})}async get(e){let{url:t,requiresAuth:r=!1,clientOptions:n,dontErrorOnStatusCodes:i}=e;return await this.addTask({method:"GET",url:t,data:{},requiresAuth:r,clientOptions:n,dontErrorOnStatusCodes:i})}async post(e){let{url:t,data:r={},requiresAuth:n=!1,clientOptions:i,dontErrorOnStatusCodes:s}=e;return await this.addTask({method:"POST",url:t,data:r,requiresAuth:n,clientOptions:i,dontErrorOnStatusCodes:s})}async delete(e){let{url:t,requiresAuth:r=!1,clientOptions:n,dontErrorOnStatusCodes:i}=e;return await this.addTask({method:"DELETE",url:t,requiresAuth:r,clientOptions:n,dontErrorOnStatusCodes:i})}async patch(e){let{url:t,data:r={},requiresAuth:n=!1,clientOptions:i,dontErrorOnStatusCodes:s}=e;return await this.addTask({method:"PATCH",url:t,data:r,requiresAuth:n,clientOptions:i,dontErrorOnStatusCodes:s})}async put(e){let{url:t,data:r={},requiresAuth:n=!1,clientOptions:i,dontErrorOnStatusCodes:s}=e;return await this.addTask({method:"PUT",url:t,data:r,requiresAuth:n,clientOptions:i,dontErrorOnStatusCodes:s})}async addTask(e){let{method:t,url:r,data:n={},requiresAuth:i=!1,clientOptions:s={},dontErrorOnStatusCodes:o}=e;return this.debug("Starting addTask"),await new Promise((e,a)=>{let c=this.short();this.info("Creating task '".concat(c,"', ").concat(t,", ").concat(r,", requiresAuth: ").concat(i?"true":"false"),{},c);let h={method:t,url:r,data:n,resolve:e,reject:a,requiresAuth:i,clientOptions:s,tid:c,dontErrorOnStatusCodes:o},u=this.getUserId();null!==u&&(h.userId=u),i?(this.info("Task requires authentication, adding to the queue",{},h.tid),this.queue.push(h),this.isProcessing||this.processQueue()):(this.info("Task does not require authentication, processing immediately",{},h.tid),this.processTask(h))})}getQueue(){return this.queue}rejectAllItemsInQueue(e){this.queue.splice(0,this.queue.length).forEach(t=>{this.warning("Rejecting task because ruok failed with ".concat(e.message," [").concat(e.name,"]"),t,t.tid),t.reject(e)})}async processQueue(){if(this.debug("Starting processQueue"),0===this.queue.length||(this.isProcessing=!0,this.info("â¾ï¸ Queue length is ".concat(this.queue.length,", setting processing to true")),await this.ruok().then(async()=>await this.maintainPHPSESSID().catch(e=>{this.error("Failed to maintain the PHPSESSID: ".concat(e.message),e)})).catch(e=>{this.error("Error when checking if we are ok",e),this.warning("Going to reject all the items on the queue with the error ".concat(e.message," [").concat(e.name,"]")),this.rejectAllItemsInQueue(e)}),0===this.queue.length)){this.info("â¾ï¸ Queue length is 0, setting processing to false"),this.isProcessing=!1;return}let e=await this.storageLayer.getAccessToken(),t={Authorization:"Bearer ".concat(e)},r=this.queue.splice(0,this.numberToProcess);this.debug("Got ".concat(r.length," items from the queue")),await Promise.allSettled(r.map(async e=>await this.processTask({...e,authorisationHeaders:t}))).finally(async()=>{this.info("Finally in processQueue, going again."),await this.processQueue()})}async getOwnJWTs(e){this.debug("Going to get our own JWTs from another set of JWTs!");let t=await e();if(this.debug("Got the refresh token ".concat(t)),!g.isValidString(t))throw Error("Refresh token is not a valid string");let r=await this.getFingerprint(e).catch(e=>{throw this.error("Failed to get a fingerprint to upgrade with using the provided source refresh token: ".concat(e.message),e),e}),s=await this.exchangeFingerprint({fingerprint:r});return await this.analyticEvent({event:i.UPGRADED_FROM_OTHER_JWTS,userId:this.getUserId(),data:{debugger:"Upgraded from other JWTs via fingerprint",fingerprint:r,resource:"getOwnJWTs"},level:n.INFO}),s}async getFingerprint(e){let t="function"==typeof e?await e():await this.storageLayer.getRefreshToken();return await new Promise(async(e,r)=>{await this.processTask({method:"POST",url:"".concat(this.baseDomain,"/auth/fingerprints"),authorisationHeaders:{Authorization:"Bearer ".concat(t)},clientOptions:{},requiresAuth:!1,data:{},resolve:e,reject:r,tid:this.randomizer()}).catch(e=>{throw console.error(">",e),this.error("Error when getting a fingerprint",e),e})}).then(async e=>{let{body:t}=e;return t.details.fingerprint})}async exchangeFingerprint(e){let{fingerprint:t}=e;return this.info("Exchanging fingerprint ".concat(t)),await this.post({url:"".concat(this.baseDomain,"/auth/fingerprints/").concat(t),data:{},requiresAuth:!1,clientOptions:{}}).then(async e=>{let{body:t}=e;this.debug("trying to decode the token ".concat(t.details.tokens.accessToken));let r=(0,l.decodeJWT)(t.details.tokens.accessToken);
1if(this.debug("new tokens are for user Id ".concat(r.userId)),null!==this.getUserId()){if(this.debug("User is logged in as ".concat(this.getUserId())),this.getUserId()===r.userId)return this.info("User Id has not changed, not logging out"),g.FingerprintStatus.NO_CHANGE;this.info("User Id has changed from ".concat(this.getUserId()," to ").concat(r.userId,", logging out")),await this.logout()}else this.debug("Not logged in",{});return await this.processTokens(t.details.tokens),await this.maintainPHPSESSID(!0),this.setUserId(r.userId),g.FingerprintStatus.NEW_USER}).catch(async e=>(this.error("Error when exchanging fingerprint ".concat(t,", not changing state, ").concat(e.message),e),g.FingerprintStatus.NO_CHANGE))}constructor({transportLayer:e,storageLayer:t,randomizer:r,baseDomain:n,analyticsDefaultOptions:i,numberToProcess:o=5,environment:a="production",maintainPHPSESSID:c=!1,level:h=s.DEBUG,hidePersonalData:u=!1,clientSessionId:l,customTTLOptions:f}){var p=this;this.queue=[],this.isProcessing=!1,this.userId=null,this.hidePersonalData=!1,this.short=()=>{let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length,n=0;for(;n<4;)e+=t.charAt(Math.floor(Math.random()*r)),n+=1;return e},this.logArgs={info:console.info,debug:console.debug,warning:console.warn,error:console.error},this.debugger=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return p.logArgs[e](">> ".concat(p.GUUID," >> ").concat(g.isValidString(n)?" [ ".concat(n," ] "):""," ").concat(t),JSON.stringify(r))},this.error=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return s.ERROR>=p.level?p.debugger("error","ð£ ".concat(e),t,r):null},this.info=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return s.INFO>=p.level?p.debugger("info",e,t,r):null},this.debug=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return s.DEBUG>
1=p.level?p.debugger("debug"," ".concat(e),t,r):null},this.warning=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return s.WARNING>=p.level?p.debugger("warning","ð ".concat(e),t,r):null},this.transportLayer=e,this.storageLayer=t,this.numberToProcess=o,this._maintainPHPSESSID=c,this.GUUID=r(),this.randomizer=r,this.analyticsDefaultOptions=i,this.baseDomain=n,this.ttls=d[a],void 0!==f&&Number.isSafeInteger(f.accessToken)&&Number.isSafeInteger(f.refreshToken)&&(this.ttls=f),this.environment=a,this.level=h,this.hidePersonalData=u,this.clientSessionId=l,this.info("ð Completed RequestHandler constructor, have a nice day")}}r.RequestHandler=g,g.PHPSESSIDCookieExpiryDays=7,g.checkSupporterCookieExpiryDays=730,g.windowLocationGetter=()=>{var e;return window.hasOwnProperty("location")?(null==(e=window.location)?void 0:e.href)||"unknown":"no-location-maybe-react-native"},(u=(h=g||(r.RequestHandler=g={})).FingerprintStatus||(h.FingerprintStatus={}))[u.NO_CHANGE=0]="NO_CHANGE",u[u.NEW_USER=1]="NEW_USER"},4848,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0})},75543,(e,t,r)=>{"use strict";var n=e.e&&e.e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=e.e&&e.e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=e.e&&e.e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},o=e.e&&e.e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(r,"__esModule",{value:!0}),r.Errors=void 0,s(e.r(50107),r),s(e.r(53306),r),r.Errors=o(e.r(51933)),s(e.r(48606),r),s(e.r(4848),r)},93800,20661,41934,2576,2032,e=>{"use strict";let t;var r=e.i(90077);let n=(e,t)=>({title:e,href:t}),i=e=>{let{name:t,uri:r,id:i,logoHttps:s}=e,o="/settings/cause/".concat(i,"/cause-page/"),a="/settings/cause/".concat(i,"/cause-information/"),c="/settings/cause/".concat(i,"/supporter-communications/");return{header:t,title:t,href:"/causes/".concat(r,"/"),thumbnail:s||"/images/no-image.svg",subcategories:[n("View/edit my page",o),n("Manage my cause info",a),n("View donations and reports","/settings/cause/".concat(i,"/transactions/"))],more:{title:"Tools and guides",links:[n("Refer a friend","/referrals/"),n("Raise more","/raisemore"),n("Manage Supporter Communications",c)]}}};e.s(["makeCauseMenuItem",0,i,"makeLink",0,n],62097);let s={START:"searchSessionStart",FOCUS:"searchBoxFocus",ENTRY:"searchBoxEntry",RESULT_CLICK:"searchResultClick",BTN_CLICK:"searchButtonClick",SHOW_MORE:"searchShowMore",SHOW_SUGGESTIONS_INSTANT:"searchShowSuggestionsInstant",SHOW_SUGGESTIONS_LIST:"searchShowSuggestionsList"},o={...s,SEARCH_SUPPORT_CAUSE:"searchSupportCause"},a={...s,CLICK_OUT:"searchClickout"},c={PAGE_INSTANT:"searchResultPageInstantResult",PAGE:"searchResultPage"},h={...c,HEADER_INSTANT:"headerInstantResult"},u={...c,HOME_HERO_INSTANT_RESULT:"homeHeroInstantResult",HOME_HERO:"homeHero",SAGC_INSTANT_RESULT:"sagcInstantResult",SAGC_HERO:"sagcHero"},l={HEADER:"header",SEARCHPAGE:"searchPage",HERO:"hero"},f=e=>{if(["retailer","cause"].includes(e)){let t=localStorage.getItem("".concat(e,"SearchSessionId")),n=parseInt(localStorage.getItem("".concat(e,"SearchSessionLastMs")));return(Date.now()-n>3e5||!t)&&(t=(0,r.v4)()),localStorage.setItem("".concat(e,"SearchSessionId"),t),localStorage.setItem("".concat(e,"SearchSessionLastMs"),Date.now()),t}},d=e=>e&&e.slice(0,10).map((e,t)=>e.id).join(",");function g(e){let{navData:t,user:r}=e;return function(){let e={...t},n=e.nav.items.findIndex(e=>"myCauses"===e.id);if(r&&r.adminCauses&&r.adminCauses.length){let t=e.nav.items.findIndex(e=>"missingDonations"===e.id);e.nav.items.splice(t,1),e.nav.items[n].hidden=!1,e.nav.items[n].categories.items=r.adminCauses.slice(0,4).map(i)}else{e.nav.items[n].hidden=!0;let t=e.nav.items.findIndex(e=>"bigDonations"===e.id);e.nav.items.splice(1,0,e.nav.items.splice(t,1)[0])}return e}}e.s(["baseSearchMethods",0,c,"causeEventType",0,o,"causeSearchMethod",0,u,"getSearchSuggestionsCSV",0,d,"getSessionId",0,f,"processCauseLinksCurrier",0,g,"retailerEventType",0,a,"retailerSearchMethod",0,h,"searchLocation",0,l],4236);class p{enforceHTTPS(e){return e.includes("http")?e:"https://".concat(e)}stripTrailingSlash(e){return(null==e?void 0:e.endsWith("/"))?e.slice(0,-1):e}get(e){let{path:t,headers:r={},keepAlive:n=!0,signal:i=null,searchParams:s}=e;return fetch(this.buildUri(t,s),{method:"GET",headers:this.buildHeaders(r),keepAlive:n,signal:i,mode:"cors"})}post(e){let{path:t,body:r={},headers:n={},keepAlive:i=!0,queryParams:s={}}=e;return fetch(this.buildUri(t,s),{method:"POST",body:JSON.stringify(r),headers:this.buildHeaders(n),keepAlive:i,mode:"cors"})}buildUri(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new URL(e,this.endpoint);return r.search=new URLSearchParams(t).toString(),r.toString()}buildHeaders(e){return{...e,...this.basicHeaders}}getAbortSignal(){return this.abortController.signal}constructor({endpoint:e,apiKey:t=null}){return this.endpoint=this.stripTrailingSlash(this.enforceHTTPS(e)),this.apiKey=t,this.basicHeaders={"Content-Type":"application/json"},t&&(this.basicHeaders["x-authorization"]=t),this}}let y={};y.warn=console.warn,y.error=console.error,y.info=console.info;
1class E extends p{getResults(e){let{type:t,term:r,supportingRegisteredCharity:n=!1,userId:i=0,abortSignal:s=null,perPage:o=10}=e;return super.get({path:"/".concat(t,"/search"),searchParams:{q:r,perPage:o,supportingRegisteredCharity:n,userId:i},signal:s}).then(e=>e.ok?e.json().then(t=>{let{results:r}=t.details.result;return{results:r,segmentation:e.headers.get("segmentation"),searchtype:e.headers.get("searchtype")}}):Promise.reject(Error("non successful response from the search api!"))).catch(e=>(y.warn("[API] /".concat(t,"/search term: ").concat(r," ").concat(n)),console.error("Failed to get search results: ",e.toString()),Promise.reject(Error("Failed to communicate with the API!"))))}constructor({endpoint:e,apiKey:t=null}){super({endpoint:e,apiKey:t})}}class m extends p{createEvent(e){let t=this.mapEvent(e);this.reports.push(t),this.debounce(this.timeout)}mapEvent(e){let{searchEventCategory:t=null,searchEventProperty:r=null,eventType:n=null,userId:i=null,searchTerm:s=null,searchLocation:o=null,searchMethod:a=null,searchType:c=null,searchResults:h=null,identifier:u=null,searchResultPosition:l=null,searchTypeHeader:d=null,segmentationHeader:g=null}=e;return{event:n,category:t,property:r,level:"info",eventData:{userId:i,searchTerm:s,searchSessionId:f(c),pageUrl:"".concat(window.location.href),searchLocation:o,searchMethod:a,searchType:c,...u&&{["".concat(c,"Id")]:u},...l&&{searchResultPosition:l},searchTimeStamp:new Date().toISOString(),...h&&{returnedResults:h},...d&&{searchTypeHeader:d},...g&&{segmentationHeader:g}}}}postAnalyticsEvents(e){if(0===this.reports.length)return;let t=localStorage.getItem("installationId"),r=e.map(e=>{let r=(null==e?void 0:e.eventData)||{};return t&&(r.installationId=t),this.createPayload({...e,eventData:r})}).map(this.createPayload);return this.reports=[],super.post({path:"/analytics/event/bulk",body:{events:r}}).catch(function(e){return y.error("[API] /analytics/event/bulk",e),!1})}postAnalyticsEventQueue(){return this.postAnalyticsEvents(this.reports)}createPayload(e){let{property:t="unknown",category:r="unknown",event:n="unknown",level:i="warn",eventData:s={}}=e;return{eventTime:new Date().toISOString(),property:t,category:r,event:n,level:i,eventData:s}}debounce(e){let{timeoutTime:t}=e;clearTimeout(this.timer),this.timer=setTimeout(this.handleTimeout,t||this.timeout,this)}handleTimeout(e){e.postAnalyticsEvents(e.reports)}constructor({endpoint:e,apiKey:t=null,timeout:r=1e3}){super({endpoint:e,apiKey:t}),this.reports=[],this.timer=null,this.timeout=r}}class w extends p{fetchFeatureFlags(){return super.get({path:"/feature-toggles"}).then(e=>e.ok?e.json().then(e=>e.details.flags):Promise.reject(Error("Failed to get the feature flags from the API"))).catch(e=>{})}constructor({endpoint:e,apiKey:t=null}){super({endpoint:e,apiKey:t})}}e.s(["default",0,function(e){let{config:t,user:r,setSuggestions:n,headers:i,getFlag:s,flagsLoading:o,eventTemplate:c={searchEventCategory:"search",searchEventProperty:"website",searchType:"retailer"},onSearchOpts:u={},navData:p,clients:y={searchClient:null,analyticsClient:null,apiV3Client:null}}=e,S=r.id||0,R=y.apiV3Client||new w({endpoint:t.apiBase,apiKey:t.apiKey}),T=y.searchClient||new E({endpoint:t.causesSearchByLocation,apiKey:t.apiKey}),k=y.analyticsClient||new m({endpoint:t.apiBase,apiKey:t.apiKey});return{searchClient:T,analyticsClient:k,apiV3Client:R,onSearch:function(e){let{searchClient:t,analyticsClient:r,user:n,userId:i,setSuggestions:s,headers:o,getFlag:c,flagsLoading:u,eventTemplate:f,isSearchLoading:g,abortSignal:p}=e;return async function(e){console.log("searching for ",e,n,i,s,o,c,u,f);let g=e.toLowerCase().trim(),y=n.supportedCause.isRegisteredCharity;if(g.length<=0)return void s([]);let{results:E,searchtype:m,segmentation:w,canceled:S}=await t.getResults({type:"retailers",term:g,supportingRegisteredCharity:y,userId:i,abortSignal:p}).catch(()=>({results:[],cancelled:!1}));if(S)return;o.current.retailer.searchType=m,o.current.retailer.segmentation=w;let R=d(E);!u&&c("retailer-search-analytics")&&r.createEvent({searchEventCategory:f.searchEventCategory,searchEventProperty:f.searchEventProperty,eventType:a.ENTRY,userId:i,searchTerm:g,searchLocation:l.HEADER,searchMethod:h.HEADER_INSTANT,searchType:f.searchType,searchResults:null,identifier:null,searchResultPosition:null,searchTypeHeader:o.current.retailer.searchType,segmentationHeader:o.current.retailer.segmentation}),s(E),!u&&c("retailer-search-analytics")&&r.createEvent({searchEventCategory:f.searchEventCategory,searchEventProperty:f.searchEventProperty,eventType:a.SHOW_SUGGESTIONS_INSTANT,userId:i,searchTerm:g,searchLocation:l.HEADER,searchMethod:h.HEADER_INSTANT,searchType:f.searchType,searchResults:R,identifier:null,searchResultPosition:null,searchTypeHeader:o.current.retailer.searchType,segmentationHeader:o.current.retailer.segmentation})}}({searchClient:T,analyticsClient:k,user:r,userId:S,setSuggestions:n,headers:i,getFlag:s,flagsLoading:o,eventTemplate:c,isSearchLoading:null==u?void 0:u.isSearchLoading,abortSignal:null==u?void 0:u.abortSignal}),onSearchSubmit:function(e){let{analyticsClient:t,flagsLoading:r,getFlag:n,eventTemplate:i,headers:s,userId:o}=e;return function(e){!r&&n("retailer-search-analytics")&&["retailer","cause"].includes(i.searchType)&&(t.createEvent({searchEventCategory:i.searchEventCategory,searchEventProperty:i.searchEventProperty,eventType:a.BTN_CLICK,userId:o,searchTerm:e,searchLocation:l.HEADER,searchMethod:h.HEADER_INSTANT,searchType:i.searchType,searchResults:null,identifier:null,searchResultPosition:null,searchTypeHeader:s.current.retailer.searchType,segmentationHeader:s.current.retailer.segmentation}),t.postAnalyticsEventQueue())}}({analyticsClient:k,flagsLoading:o,getFlag:s,eventTemplate:c,headers:i,userId:S}),onInstantSearchClick:function(e){let{getFlag:t,flagsLoading:r,eventTemplate:n={},analyticsClient:i,headers:s,userId:o}=e;return async function(e,c,u){if(r||!t("retailer-search-analytics")||!["retailer","cause"].includes(n.searchType))return;let f=u[c].id,g=t("retailer-search-analytics-additional")?d(u):null;i.createEvent({searchEventCategory:n.searchEventCategory,searchEventProperty:n.searchEventProperty,eventType:a.RESULT_CLICK,userId:o,searchTerm:e,searchLocation:l.HEADER,searchMethod:h.HEADER_INSTANT,searchType:n.searchType,searchResults:g,identifier:f,searchResultPosition:c+1,searchTypeHeader:s.current.retailer.searchType,segmentationHeader:s.current.retailer.segmentation}),i.postAnalyticsEventQueue()}}({getFlag:s,flagsLoading:o,eventTemplate:c,analyticsClient:k,headers:i,userId:S}),onSearchFocus:function(e){let{getFlag:t,flagsLoading:r,eventTemplate:n={},analyticsClient:i,headers:s,userId:o}=e;return function(e){let c=e||null;!r&&t("retailer-search-analytics")&&(localStorage.getItem("".concat(n.searchType,"SearchSessionId"))||i.createEvent({searchEventCategory:n.searchEventCategory,searchEventProperty:n.searchEventProperty,eventType:a.START,userId:o,searchTerm:c,searchLocation:l.HEADER,searchMethod:null,
1searchType:n.searchType,searchResults:null,identifier:null,searchResultPosition:null,searchTypeHeader:s.current.retailer.searchType,segmentationHeader:s.current.retailer.segmentation}),i.createEvent({searchEventCategory:n.searchEventCategory,searchEventProperty:n.searchEventProperty,eventType:a.FOCUS,userId:o,searchTerm:c,searchLocation:l.HEADER,searchMethod:h.HEADER_INSTANT,searchType:n.searchType,searchResults:null,identifier:null,searchResultPosition:null,searchTypeHeader:s.current.retailer.searchType,segmentationHeader:s.current.retailer.segmentation}),f(n.searchType))}}({getFlag:s,flagsLoading:o,eventTemplate:c,analyticsClient:k,headers:i,userId:S}),processCauseLinks:g({navData:p,user:r}),processSupporterLinks:()=>p,getSearchSessionId:function(){if(!o&&s("retailer-search-analytics"))return f(c.searchType)}}}],20661),e.s(["default",0,class{async getRequestHandler(){if(!this.getRhFromWindow)return this.requestHandler;let e=5;for(;e--&&!window.requestHandler;)await new Promise(e=>setTimeout(e,100));return window.requestHandler?window.requestHandler:this.requestHandler}async get(e){let{url:t,options:r,requiresAuth:n,expectedResponses:i}=e,s=await this.getRequestHandler();try{return await s.get({url:t,requiresAuth:n,clientOptions:r,...i&&{dontErrorOnStatusCodes:i}})}catch(e){this.handleError(e)}}async post(e){let{url:t,data:r,options:n,requiresAuth:i,expectedResponses:s}=e,o=await this.getRequestHandler();try{return await o.post({url:t,data:r,requiresAuth:i,clientOptions:n,...s&&{dontErrorOnStatusCodes:s}})}catch(e){this.handleError(e)}}async put(e){let{url:t,data:r,options:n,requiresAuth:i,expectedResponses:s}=e,o=await this.getRequestHandler();try{return await o.put({url:t,data:r,requiresAuth:i,clientOptions:n,...s&&{dontErrorOnStatusCodes:s}})}catch(e){this.handleError(e)}}async patch(e){let{url:t,data:r,options:n,requiresAuth:i,expectedResponses:s}=e,o=await this.getRequestHandler();try{return await o.patch({url:t,data:r,requiresAuth:i,clientOptions:n,...s&&{dontErrorOnStatusCodes:s}})}catch(e){this.handleError(e)}}async delete(e){let{url:t,options:r,requiresAuth:n,expectedResponses:i}=e,s=await this.getRequestHandler();try{return await s.delete({url:t,requiresAuth:n,clientOptions:r,...i&&{dontErrorOnStatusCodes:i}})}catch(e){this.handleError(e)}}handleError(e){if(null==e?void 0:e.childError)throw e.childError.parentErrorType=null==e?void 0:e.name,e.childError;throw e}constructor(e,t=!1){this.requestHandler=e,this.getRhFromWindow=t}}],41934);let S=e=>{if("u"<typeof document)return null;let t="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===t.length?t.pop().split(";").shift():""};e.s(["getCookie",0,S],62323);let R="authenticated_full",T="authenticated_semi",k="unauthenticated",v=e=>"session"===e||"jwt"===e?R:"checkSupporter"===e?T:k;e.s(["authRules",0,{authenticated_full:[R],authenticated_semi:[R,T],unauthenticated:[R,T,k]},"authState",0,v,"availableAuthStates",0,{AuthenticatedFull:R,AuthenticatedSemi:T,Unauthenticated:k},"availableRoles",0,{supporter:"supporter",causeAdmin:"cause_admin"}],52354);let I=async e=>{let{apiV3Client:t}=e,r=S("checkSupporter"),n=S("PHPSESSID");return n||r?t.get({path:"/user/me",headers:{checkSupporter:r,PHPSESSID:n}}).then(e=>!!e.ok&&e.json().then(t=>{let{user:r,cause:n,preferences:i}=t.details;return r.supportedCause=n,r.preferences=i,r.authState=v(e.headers.get("x-auth-type")),r})):Promise.resolve(!1)},b=async e=>{let{apiClient:t,apiBase:r}=e;try{let{body:e,headers:n}=await t.get({url:"".concat(r,"/user/me"),requiresAuth:!0}),{user:i,cause:s,preferences:o}=e.details;return i.supportedCause=s,i.preferences=o,i.authState=v(n["x-auth-type"]),i}catch(t){let e=t.response;return(null==e?void 0:e.status)===401||"UserCredentialsError"===t.name?y.warn("[API] GET /user/me",t):y.error("[API] GET /user/me",t),!1}};e.s(["fetchUser",0,I,"prefetchUser",0,b],65170),e.i(65170);var O=e.i(30559);let _=async(e,t)=>{try{return await (0,O.default)({method:"post",url:"".concat(e,"/analytics/event/"),data:(e=>{let t=localStorage.getItem("installationId"),{property:r="unknown",category:n="unknown",event:i="unknown",level:s="warn",eventData:o={}}=e;return{eventTime:new Date().toISOString(),property:r,category:n,event:i,level:s,eventData:{...o,...t&&{installationId:t}}}})(t)}),!0}catch(e){return y.error("[API] POST /analytics/event/",e),!1}};e.s(["postAnalyticsEvent",0,_],13577),e.i(13577);let A=!1,P=async function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};
1if(!e)throw Error("Must have a valid experiment name");if(r&&"string"!=typeof r)throw Error("entityId must be a string");let{data:i}=await O.default.post("".concat(t,"/evaluation"),{entityID:r,flagKey:e,entityContext:n,entityType:"report",enableDebug:A});if(!i.variantID&&!i.variantKey)return null;let s={...i};return A||delete s.evalDebugLog,[{experimentName:i.flagKey,experimentId:i.flagID,segmentId:i.segmentID,variantName:i.variantKey,variantId:i.variantID,variantData:i.variantAttachment},s]},U=async function(e,r){var n,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Array.isArray(e))throw Error("Tags must be provided as an array.");if(0===e.length)throw Error("Tags must be a non-empty array.");if(!e.every(e=>"string"==typeof e))throw Error("Tags array should only consist of strings.");if(r&&"string"!=typeof r)throw Error("entityId must be a string");let o=await O.default.post("".concat(t,"/evaluation/batch"),{entities:[{entityID:r,entityType:"report",entityContext:s}],enableDebug:!1,flagTags:e});return null!=(n=null==o||null==(i=o.data)?void 0:i.evaluationResults)?n:null};e.s(["configureFlagr",0,e=>{let{endpoint:r}=e;void 0!==r&&(t=r)},"debug",0,e=>{A=e},"fetchExperimentData",0,P,"fetchExperimentsByTags",0,U],2576),e.i(2576);var N=e.i(52354),C=e.i(62323),D=e.i(4236);let L="product_adoption_attribution",B=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function x(e){if(!e)return null;let t=new URLSearchParams(e),r={},n=!1;return B.forEach(e=>{let i=t.get(e),s=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());i&&""!==i.trim()?(r[s]=i,n=!0):r[s]=null}),n?r:null}function H(e){if(!e)return!0;let t=new Date(e);return(new Date-t)/864e5>30}function F(e){return{utmSource:e.utmSource,utmMedium:e.utmMedium,utmCampaign:e.utmCampaign,utmContent:e.utmContent,utmTerm:e.utmTerm,createdAt:new Date().toISOString()}}function G(e){var t,r,n;return{pageType:(null==(t=e.pageType)?void 0:t.trim())||null,buttonId:(null==(r=e.buttonId)?void 0:r.trim())||null,buttonText:(null==(n=e.buttonText)?void 0:n.trim())||null,createdAt:new Date().toISOString()}}e.s(["EXPIRY_DAYS",0,30,"PRODUCT_FIELDS",0,["pageType","buttonId","buttonText"],"STORAGE_KEY",0,L,"UTM_PARAMS",0,B,"createMarketingAttribution",0,function(e){async function t(){try{let t=await e.getItem(L);return t?JSON.parse(t):null}catch(e){return null}}async function r(t){try{await e.setItem(L,JSON.stringify(t))}catch(e){}}async function n(e){let n=x(e);if(!n)return;let i=F(n),s=await t()||{},o=(s.marketing||{}).firstTouch,a=!o||H(o.createdAt),c={...s,marketing:{firstTouch:a?i:o,lastTouch:i}};await r(c)}async function i(e){if(!e)return;let n=G(e),i={...await t()||{},product:n};await r(i)}return{getAttribution:t,setAttribution:r,clearAttribution:async function(){try{await e.removeItem(L)}catch(e){}},captureMarketingAttribution:n,captureProductAttribution:i}},"createProductObject",0,G,"createTouchObject",0,F,"extractUtmParams",0,x,"isTouchExpired",0,H],42513);var M=e.i(42513),j=e.i(62097);function W(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)"__proto__"!==n&&(e[n]=r[n])}return e}e.s(["localStorageAdapter",0,{getItem:async e=>localStorage.getItem(e),async setItem(e,t){localStorage.setItem(e,t)},async removeItem(e){localStorage.removeItem(e)}}],2032);var q=function e(t,r){function n(e,n,i){if("u">typeof document){"number"==typeof(i=W({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in i)i[o]&&(s+="; "+o,!0!==i[o]&&(s+="="+i[o].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var s=r[i].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(a in n||(n[a]=t.read(o,a)),e===a)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){n(e,"",W({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,W({},this.attributes,t))},withConverter:function(t){return e(W({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
1URIComponent)}},{path:"/"}),V=e.i(75543);let K="accessToken",J="refreshToken",z="PHPSESSID",Y="checkSupporter",Q=".easyfundraising.org.uk",X="installationId",Z=(e,t)=>{console.debug("%c".concat(e,"%c -> ").concat(t),"color: white; padding: 2px 4px; background: red; border-radius: 2px;","color: white; padding: 0; baxkground: none; border-radius: none")};e.s(["accountLink",0,{title:"Account",href:"/account/home/"},"avatarLink",0,{href:"/account/home/"},"browserExtensionLink",0,{title:"Browser extension",href:"/donation-reminder/"},"campaignTrackingSuffix",0,"?efr_source=website&efr_medium=easyfundraising&efr_campaign=header-navigation","causeSignUpUrl",0,"/support-a-good-cause/step-1/?char=","floatingLinkIndex",0,4,"headerTypes",0,{LOGGED_OUT:"Logged out header",LOGGED_IN:"Logged in header"},"linkCta",0,{title:"How it works",href:"/how-it-works/"},"mobileAppLink",0,{title:"Mobile app",href:"/easyfundraising-app/"},"navigationLinksLogged",0,[{title:"Shop by category",href:"/retailers/"},{title:"Trending offers",href:"/offers/trending-offers/"},{title:"Gift cards",href:"/gift-cards/"}
1,{title:"How it works",href:"/how-it-works/"},{title:"Refer a friend",href:"/referrals/"},{title:"Promote my cause",href:"/raisemore"}],"navigationLinksLoggedOut",0,[{title:"How it works",href:"/how-it-works/"},{title:"Find a cause",href:"/support-a-good-cause/"},{title:"Register a cause",href:"/register-your-good-cause/"},{title:"Register a business",href:"/register-your-business/"}],"primaryCta",0,{title:"Sign up",href:"/create-an-account"},"secondaryCta",0,{title:"Log in",href:"/login"}],69279);var $=e.i(69279);e.s(["copyrightFunnelFooterText",0,"Copyright © 2026 Easyfundraising Limited. All rights reserved.","copyrightText",0,["Easyfundraising Limited is a company incorporated in England and Wales with company number 04764164 and a registered office at St Chadâs House, Suite 6, Cross Keys, Lichfield WS13 6DN. Easyfundraising Limited is a wholly owned subsidiary of The Support Group (UK) Limited.","The Support Group (UK) Limited is a company incorporated in England and Wales with company number 04760723 and a registered office at St Chadâs House, Suite 6, Cross Keys, Lichfield WS13 6DN.","EASYFUNDRAISING is a registered trade mark of The Support Group (UK) Limited, which along with the copyright in this website is licensed to Easyfundraising Limited. © 2026 The Support Group (UK) Limited. All rights reserved. Good Cause and Retailer trade marks are used on this website under licence from their respective owners."],"funnelLinks",0,[{linkTitle:"Terms and Conditions",href:"/terms/website/"},{linkTitle:"Help and Support",href:"https://support.easyfundraising.org.uk/hc/en-gb"}],"logoLink",0,{href:""},"navigationMenusData",0,[{menuTitle:"Get donations",links:[{linkTitle:"Browse our brands",href:"/retailers/",id:"browse-brands"},{linkTitle:"Browser extension",href:"/donation-reminder/?efr_source=easyfundraising&efr_medium=product-adoption&efr_campaign=website-footer-links",id:"browser-extension"},{linkTitle:"Mobile app",href:"/easyfundraising-app/?efr_source=easyfundraising&efr_medium=product-adoption&efr_campaign=website-footer-links",id:"mobile-app"},{linkTitle:"Refer a friend",href:"/referrals/",id:"refer-friend"},{linkTitle:"easysearch",href:"https://www.easysearch.org.uk/",id:"easysearch"}]},{menuTitle:"Resources",links:[{linkTitle:"Promote my cause",href:"/promote-my-cause/",id:"promote-cause"},{linkTitle:"Fundraising ideas",href:"/fundraising-ideas/",id:"fundraising-ideas"},{linkTitle:"Ideas for schools",href:"/ideas/fundraising-ideas-for-schools",id:"school-ideas"},{linkTitle:"Personal challenges",href:"/charity-challenge/",id:"personal-challenges"},{linkTitle:"Cause categories",href:"/cause-categories/",id:"cause-categories"},{linkTitle:"Cause directory",href:"/cause-directory/",id:"cause-directory"},{linkTitle:"Cause stories hub",href:"/content-hub/",id:"cause-stories"}]},{menuTitle:"Policies",links:[{linkTitle:"Website terms",href:"/terms/website/",id:"website-terms"},{linkTitle:"Supporter terms",href:"/terms/supporter/",id:"supporter-terms"},{linkTitle:"Cause terms",href:"/terms/cause/",id:"cause-terms"},{linkTitle:"Cookie policy",href:"/terms/cookies/",id:"cookie-policy"},{linkTitle:"Privacy policy",href:"/privacy/",id:"privacy-policy"},{linkTitle:"End user license agreement",href:"/eula/",id:"eula"},{linkTitle:"Advertising disclosure",href:"/terms/advertising-disclosure/",id:"advertising-disclosure"},{linkTitle:"Introducer Appointed Representative",href:"/introducer-appointed-representative/",id:"introducer-representative"}]},{menuTitle:"About",links:[{linkTitle:"Our history, mission and credentials",href:"/our-history-and-mission/",id:"history-mission"},{linkTitle:"Who can join easyfundraising",href:"/who-can-join/",id:"who-can-join"},{linkTitle:"Our fees explained",href:"/our-fees-explained/",id:"fees-explained"}
1,{linkTitle:"Blog",href:"/blog/",id:"blog"},{linkTitle:"Careers",href:"/careers/",id:"careers"},{linkTitle:"Become our partner",href:"/become-our-partner/",id:"become-partner"},{linkTitle:"Help",href:"https://support.easyfundraising.org.uk/hc/en-gb",id:"help"},{linkTitle:"Newsroom",href:"/newsroom/",id:"newsroom"}]}],"socialLinksData",0,[{href:"https://www.facebook.com/easyfundraising.org.uk",iconType:"social-facebook"},{href:"https://www.instagram.com/easyfundraising/",iconType:"social-instagram"},{href:"https://twitter.com/easyuk",iconType:"social-twitter"},{href:"https://www.youtube.com/user/easyfundraising",iconType:"social-youtube"}],"storeMenuData",0,{menuTitle:"Get the app",storeLinks:[{href:"https://apps.apple.com/app/apple-store/id915474725?pt=857672&ct=website-footer&mt=8",store:"apple"},{href:"https://play.google.com/store/apps/details?id=com.ef.easyfundraising&referrer=utm_source%3Dwebsite-footer%26utm_medium%3Dwebsite%26utm_campaign%3Dproduct-adoption",store:"google"}]}],16066);var ee=e.i(16066);e.s(["Data",0,{headerMenuLinks:$,footerMenuLinks:ee},"RequestHandler",0,{StorageLayer:class{async getValue(e){return localStorage.getItem(e)}async setValue(e,t){return localStorage.setItem(e,t)}async deleteValue(e){return localStorage.removeItem(e)}async getCookieValue(e){return q.get(e)}async setCookieValue(e,t,r){return q.set(e,t,{expires:new Date(r),domain:Q})}async deleteCookieValue(e){return q.remove(e,{domain:Q})}async getAccessToken(){try{return await this.getValue(K)}catch(e){throw new V.Errors.SystemError("failed to read access token from local storage",e)}}async setAccessToken(e){try{return await this.setValue(K,e)}catch(e){throw new V.Errors.SystemError("failed to set access token into local storage",e)}}async deleteAccessToken(){try{return await this.deleteValue(K)}catch(e){throw new V.Errors.SystemError("failed to delete access token from local storage",e)}}async getRefreshToken(){try{return await this.getValue(J)}catch(e){throw new V.Errors.SystemError("failed to read refresh token from local storage",e)}}async setRefreshToken(e){try{return await this.setValue(J,e)}catch(e){throw new V.Errors.SystemError("failed to set refresh token into local storage",e)}}async deleteRefreshToken(){try{return await this.deleteValue(J)}catch(e){throw new V.Errors.SystemError("failed to delete refresh token from local storage",e)}}async getAndSetInstallationId(){try{let e=await this.getValue(X);if(e)return Z("getInstallationID","returning existing installation ID"),e;return e=(0,r.v4)(),Z("getInstallationID","generating new installation ID"),await this.setValue(X,e),await this.postAnalyticsEvent({property:this.analyticsOptions.client,category:"authentication",event:"i-new-install-id",level:"info",eventData:{installationId:e,...this.analyticsOptions}}),e}catch(e){throw new V.Errors.SystemError("failed to get installation id from local storage",e)}}async getInstallationId(){return this.installationIdPromise||(this.installationIdPromise=this.getAndSetInstallationId()),await this.installationIdPromise}async getCheckSupporter(){try{return await this.getCookieValue(Y)}catch(e){throw new V.Errors.SystemError("failed to read checkSupporter cookie",e)}}async setCheckSupporter(e,t){try{return await this.setCookieValue(Y,e,t)}catch(e){throw new V.Errors.SystemError("failed to set checkSupporter cookie",e)}}async deleteCheckSupporter(){try{return await this.deleteCookieValue(Y)}catch(e){throw new V.Errors.SystemError("failed to delete checkSupporter cookie",e)}}async getPHPSESSID(){try{return await this.getCookieValue(z)}catch(e){throw new V.Errors.SystemError("failed to read PHPSESSID cookie",e)}}async setPHPSESSID(e,t){try{return await this.setCookieValue(z,e,t)}catch(e){throw new V.Errors.SystemError("failed to set PHPSESSID cookie",e)}}async deletePHPSESSID(){try{return await this.deleteCookieValue(z)}catch(e){throw new V.Errors.SystemError("failed to delete PHPSESSID cookie",e)}}constructor(e,t){this.analyticsOptions=e,this.postAnalyticsEvent=t}},TransportLayer:class{formatResponse(e){return{headers:e.headers,body:e.data,config:e.config}}formatError(e){return(null==e?void 0:e.response)?Promise.reject(new V.Errors.RequestError(e.message,e,e.response.data,e.response.status)):Promise.reject(new V.Errors.SystemError(e.message,e))}combineOptions(e,t,r){var n;return{...this.options,...r,...e,headers:{...null==(n=this.options)?void 0:n.headers,...null==e?void 0:e.headers,...null==r?void 0:r.headers,...t}}}async get(e){let{url:t,authorisationHeaders:r,clientOptions:n,requiresAuth:i}=e;return O.default.get(t,this.combineOptions({},r,n,i)).then(this.formatResponse).catch(this.formatError)}async post(e){let{url:t,data:r,authorisationHeaders:n,clientOptions:i,requiresAuth:s}=e;return O.default.post(t,r,this.combineOptions({},n,i,s)).then(this.formatResponse).catch(this.formatError)}async put(e){let{url:t,data:r,authorisationHeaders:n,clientOptions:i,requiresAuth:s}=e;return O.default.put(t,r,this.combineOptions({},n,i,s)).then(this.formatResponse).catch(this.formatError)}async patch(e){let{url:t,data:r,authorisationHeaders:n,clientOptions:i,requiresAuth:s}=e;return O.default.patch(t,r,this.combineOptions({},n,i,s)).then(this.formatResponse).catch(this.formatError)}async delete(e){let{url:t,authorisationHeaders:r,clientOptions:n,requiresAuth:i}=e;return O.default.delete(t,this.combineOptions({},r,n,i)).then(this.formatResponse).catch(this.formatError)}constructor(){this.options={timeout:3e3,headers:{}}}}},"Utils",0,{Cookies:C,SearchTracking:D,AuthState:N,MenuItems:j,Attribution:M}],93800)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.