@insure-os/client 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-sizes.json +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).InsureOSScripts={})}(this,function(t){"use strict";const e=()=>{globalThis.insureOSDebug};var n,r,i,o,s,a,c,u,l,d,h,f,m,p={},g=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function w(t,e){for(var n in e)t[n]=e[n];return t}function b(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function x(t,e,r){var i,o,s,a={};for(s in e)"key"==s?i=e[s]:"ref"==s?o=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return S(t,a,i,o,null)}function S(t,e,n,o,s){var a={type:t,props:e,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:null==s?++i:s,N:-1,C:0};return null==s&&null!=r.vnode&&r.vnode(a),a}function k(t){return t.children}function _(t,e){this.props=t,this.context=e}function $(t,e){if(null==e)return t.m?$(t.m,t.N+1):null;for(var n;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v)return n.v;return"function"==typeof t.type?$(t):null}function N(t){var e,n;if(null!=(t=t.m)&&null!=t.k){for(t.v=t.k.base=null,e=0;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v){t.v=t.k.base=n.v;break}return N(t)}}function E(t){(!t.I&&(t.I=!0)&&o.push(t)&&!T.O++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(T)}function T(){for(var t,e,n,i,s,a,u,l=1;o.length;)o.length>l&&o.sort(c),t=o.shift(),l=o.length,t.I&&(n=void 0,s=(i=(e=t)._).v,a=[],u=[],e.P&&((n=w({},i))._=i._+1,r.vnode&&r.vnode(n),R(e.P,n,i,e.R,e.P.namespaceURI,32&i.C?[s]:null,a,null==s?$(i):s,!!(32&i.C),u),n._=i._,n.m.i[n.N]=n,A(a,n,u),n.v!=s&&N(n)));T.O=0}function C(t,e,n,r,i,o,s,a,c,u,l){var d,h,f,m,y,w,b,x=r&&r.i||g,_=e.length;for(c=function(t,e,n,r,i){var o,s,a,c,u,l=n.length,d=l,h=0;for(t.i=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+h,(s=t.i[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?S(null,s,null,null,null):v(s)?S(k,{children:s},null,null,null):null==s.constructor&&s.p>0?S(s.type,s.props,s.key,s.ref?s.ref:null,s._):s).m=t,s.p=t.p+1,a=null,-1!=(u=s.N=M(s,n,c,d))&&(d--,(a=n[u])&&(a.C|=2)),null==a||null==a._?(-1==u&&(i>l?h--:i<l&&h++),"function"!=typeof s.type&&(s.C|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,s.C|=4))):t.i[o]=null;if(d)for(o=0;o<l;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=$(a)),L(a,a));return r}(n,e,x,c,_),d=0;d<_;d++)null!=(f=n.i[d])&&(h=-1==f.N?p:x[f.N]||p,f.N=d,w=R(t,f,h,i,o,s,a,c,u,l),m=f.v,f.ref&&h.ref!=f.ref&&(h.ref&&W(h.ref,null,f),l.push(f.ref,f.k||m,f)),null==y&&null!=m&&(y=m),(b=!!(4&f.C))||h.i===f.i?c=I(f,c,t,b):"function"==typeof f.type&&void 0!==w?c=w:m&&(c=m.nextSibling),f.C&=-7);return n.v=y,c}function I(t,e,n,r){var i,o;if("function"==typeof t.type){for(i=t.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=t,e=I(i[o],e,n,r));return e}t.v!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=$(t)),n.insertBefore(t.v,e||null)),e=t.v);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function M(t,e,n,r){var i,o,s,a=t.key,c=t.type,u=e[n],l=null!=u&&!(2&u.C);if(null===u&&null==t.key||l&&a==u.key&&c==u.type)return n;if(r>(l?1:0))for(i=n-1,o=n+1;i>=0||o<e.length;)if(null!=(u=e[s=i>=0?i--:o++])&&!(2&u.C)&&a==u.key&&c==u.type)return s;return-1}function D(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||y.test(e)?n:n+"px"}function O(t,e,n,r,i){var o,s;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||D(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||D(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(u,"$1")),s=e.toLowerCase(),e=s in t||"onFocusOut"==e||"onFocusIn"==e?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=l,t.addEventListener(e,o?h:d,o)):t.removeEventListener(e,o?h:d,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function P(t){return function(e){if(this.l){var n=this.l[e.type+t];if(null==e.t)e.t=l++;else if(e.t<n.u)return;return n(r.event?r.event(e):e)}}}function R(t,e,n,i,o,s,a,c,u,l){var d,h,f,m,p,g,y,x,S,$,N,E,T,I,M,D,O,P=e.type;if(null!=e.constructor)return null;128&n.C&&(u=!!(32&n.C),s=[c=e.v=n.v]),(d=r.p)&&d(e);t:if("function"==typeof P)try{if(x=e.props,S="prototype"in P&&P.prototype.render,$=(d=P.contextType)&&i[d.k],N=d?$?$.props.value:d.m:i,n.k?y=(h=e.k=n.k).m=h.j:(S?e.k=h=new P(x,N):(e.k=h=new _(x,N),h.constructor=P,h.render=q),$&&$.sub(h),h.props=x,h.state||(h.state={}),h.context=N,h.R=i,f=h.I=!0,h.A=[],h.W=[]),S&&null==h.L&&(h.L=h.state),S&&null!=P.getDerivedStateFromProps&&(h.L==h.state&&(h.L=w({},h.L)),w(h.L,P.getDerivedStateFromProps(x,h.L))),m=h.props,p=h.state,h._=e,f)S&&null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(S&&null==P.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,N),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.L,N)||e._==n._){for(e._!=n._&&(h.props=x,h.state=h.L,h.I=!1),e.v=n.v,e.i=n.i,e.i.some(function(t){t&&(t.m=e)}),E=0;E<h.W.length;E++)h.A.push(h.W[E]);h.W=[],h.A.length&&a.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.L,N),S&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=N,h.props=x,h.P=t,h.v=!1,T=r.O,I=0,S){for(h.state=h.L,h.I=!1,T&&T(e),d=h.render(h.props,h.state,h.context),M=0;M<h.W.length;M++)h.A.push(h.W[M]);h.W=[]}else do{h.I=!1,T&&T(e),d=h.render(h.props,h.state,h.context),h.state=h.L}while(h.I&&++I<25);h.state=h.L,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),S&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),D=d,null!=d&&d.type===k&&null==d.key&&(D=z(d.props.children)),c=C(t,v(D)?D:[D],e,n,i,o,s,a,c,u,l),h.base=e.v,e.C&=-161,h.A.length&&a.push(h),y&&(h.j=h.m=null)}catch(t){if(e._=null,u||null!=s)if(t.then){for(e.C|=u?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.v=c}else{for(O=s.length;O--;)b(s[O]);j(e)}else e.v=n.v,e.i=n.i,t.then||j(e);r.v(t,e,n)}else null==s&&e._==n._?(e.i=n.i,e.v=n.v):c=e.v=F(n.v,e,n,i,o,s,a,u,l);return(d=r.diffed)&&d(e),128&e.C?void 0:c}function j(t){t&&t.k&&(t.k.v=!0),t&&t.i&&t.i.forEach(j)}function A(t,e,n){for(var i=0;i<n.length;i++)W(n[i],n[++i],n[++i]);r.k&&r.k(e,t),t.some(function(e){try{t=e.A,e.A=[],t.some(function(t){t.call(e)})}catch(t){r.v(t,e._)}})}function z(t){return"object"!=typeof t||null==t||t.p&&t.p>0?t:v(t)?t.map(z):w({},t)}function F(t,e,i,o,s,a,c,u,l){var d,h,f,m,g,y,w,x=i.props,S=e.props,k=e.type;if("svg"==k?s="http://www.w3.org/2000/svg":"math"==k?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((g=a[d])&&"setAttribute"in g==!!k&&(k?g.localName==k:3==g.nodeType)){t=g,a[d]=null;break}if(null==t){if(null==k)return document.createTextNode(S);t=document.createElementNS(s,k,S.is&&S),u&&(r.B&&r.B(e,a),u=!1),a=null}if(null==k)x===S||u&&t.data==S||(t.data=S);else{if(a=a&&n.call(t.childNodes),x=i.props||p,!u&&null!=a)for(x={},d=0;d<t.attributes.length;d++)x[(g=t.attributes[d]).name]=g.value;for(d in x)if(g=x[d],"children"==d);else if("dangerouslySetInnerHTML"==d)f=g;else if(!(d in S)){if("value"==d&&"defaultValue"in S||"checked"==d&&"defaultChecked"in S)continue;O(t,d,null,g,s)}for(d in S)g=S[d],"children"==d?m=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?y=g:"checked"==d?w=g:u&&"function"!=typeof g||x[d]===g||O(t,d,g,x[d],s);if(h)u||f&&(h.H==f.H||h.H==t.innerHTML)||(t.innerHTML=h.H),e.i=[];else if(f&&(t.innerHTML=""),C("template"==e.type?t.content:t,v(m)?m:[m],e,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&$(i,0),u,l),null!=a)for(d=a.length;d--;)b(a[d]);u||(d="value","progress"==k&&null==y?t.removeAttribute("value"):null!=y&&(y!==t[d]||"progress"==k&&!y||"option"==k&&y!=x[d])&&O(t,d,y,x[d],s),d="checked",null!=w&&w!=t[d]&&O(t,d,w,x[d],s))}return t}function W(t,e,n){try{if("function"==typeof t){var i="function"==typeof t.C;i&&t.C(),i&&null==e||(t.C=t(e))}else t.current=e}catch(t){r.v(t,n)}}function L(t,e,n){var i,o;if(r.unmount&&r.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.v||W(i,null,e)),null!=(i=t.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){r.v(t,e)}i.base=i.P=null}if(i=t.i)for(o=0;o<i.length;o++)i[o]&&L(i[o],e,n||"function"!=typeof t.type);n||b(t.v),t.k=t.m=t.v=void 0}function q(t,e,n){return this.constructor(t,n)}n=g.slice,r={v:function(t,e,n,r){for(var i,o,s;e=e.m;)if((i=e.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.I),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.I),s)return i.j=i}catch(e){t=e}throw t}},i=0,_.prototype.setState=function(t,e){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=w({},this.state),"function"==typeof t&&(t=t(w({},n),this.props)),t&&w(n,t),null!=t&&this._&&(e&&this.W.push(e),E(this))},_.prototype.forceUpdate=function(t){this._&&(this.v=!0,t&&this.A.push(t),E(this))},_.prototype.render=k,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(t,e){return t._.p-e._.p},T.O=0,u=/(PointerCapture)$|Capture$/i,l=0,d=P(!1),h=P(!0),f=0,t.ErrorType=void 0,(m=t.ErrorType||(t.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",m.API_ERROR="API_ERROR",m.VALIDATION_ERROR="VALIDATION_ERROR",m.STORAGE_ERROR="STORAGE_ERROR",m.TIMEOUT_ERROR="TIMEOUT_ERROR",m.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class B extends Error{constructor(t,e,n=!1,r,i,o){super(e),this.type=t,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class H{constructor(t){this.config=t}shouldRetry(t,e){return!(e>=this.config.maxRetries)&&this.isRetryableError(t)}getDelay(t,e){if(e){const t=parseInt(e,10);if(!isNaN(t))return 1e3*t}const n=this.config.baseDelay*Math.pow(2,t);return Math.min(n,this.config.maxDelay)}isRetryableError(t){return t instanceof B?t.retryable:!("TypeError"!==t.name||!t.message.includes("fetch"))||"AbortError"===t.name}}class U{constructor(t){this.config=t,this.retryStrategy=new H(t.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:e,method:n,body:r}){return this.executeWithRetry(async()=>{const i=new AbortController,o=setTimeout(()=>i.abort(),this.config.timeout);try{const t={method:n,headers:{"Content-Type":"application/json","X-Organisation-ID":this.config.orgId},signal:i.signal};r&&(t.body=JSON.stringify(r));const s=await fetch(e,t);if(clearTimeout(o),!s.ok)throw await this.handleApiError(s);const a=await s.json();return a.data||a}catch(e){if(clearTimeout(o),e instanceof B)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new B(t.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new B(t.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(t){return this.makeRequest({url:t,method:"GET"})}createQuoteIntent(t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:t})}updateQuoteIntent(t,e){return this.makeRequest({url:t,method:"PUT",body:e})}deleteQuoteIntent(t){return this.makeRequest({url:t,method:"DELETE"})}calculateQuoteIntent(t){return this.makeRequest({url:t,method:"POST"})}initiatePayment(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/initiate`,method:"POST",body:t})}getPaymentStatus(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/status/${t}`,method:"GET"})}async executeWithRetry(t){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return e(this.config.retryConfig.maxRetries),await t()}catch(t){n=t;const i=this.retryStrategy.shouldRetry(n,r);if(e(t instanceof B&&(t.type,t.message)),e(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw e(),n;const o=t instanceof B?t.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);e(),await new Promise(t=>setTimeout(t,s))}throw n}async handleApiError(n){var r;const i=n.headers.get("retry-after"),o=await n.json().catch(()=>({}));if(e(),this.captureApiErrorToSentry(n,o),503===n.status)return new B(t.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status);if(429===n.status)return new B(t.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,i||void 0);if(n.status>=500){const e=o.message||"Service temporarily unavailable. Please try again in a moment.";return new B(t.ErrorType.API_ERROR,e,!1,n.status)}if(422===n.status)try{const e=o;return e.error&&e.error.details&&e.error.details.form_data?new B(t.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,e.error.details):new B(t.ErrorType.VALIDATION_ERROR,e.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(r=e.error)||void 0===r?void 0:r.details)}catch(e){return new B(t.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const e=o;return e.errors?new B(t.ErrorType.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,e.errors):new B(t.ErrorType.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(e){return new B(t.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const e=o.message||"Invalid request. Please refresh the page and try again.";return new B(t.ErrorType.API_ERROR,e,!1,n.status)}return new B(t.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(t,e){try{(t.status>=500||429===t.status)&&Promise.resolve().then(function(){return fd}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${t.status} ${t.statusText}`,category:"http",level:"error",data:{url:t.url,status:t.status,statusText:t.statusText}}),n(`API Error: ${t.status} - ${t.url}`,"error",{http:{status_code:t.status,url:t.url,method:"Unknown"},response:e}))}).catch(()=>{})}catch(t){}}}class Z{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return localStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{localStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{localStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{localStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const t="__insure_os_storage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch(t){return!1}}}class G{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return sessionStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{sessionStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{sessionStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{sessionStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const t="__insure_os_storage_test__";return sessionStorage.setItem(t,"test"),sessionStorage.removeItem(t),!0}catch(t){return!1}}}class Y{static generateKey(t,e,n){const r=[this.KEY_PREFIX+t,e];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(t){try{return JSON.stringify({data:t,timestamp:Date.now(),version:"1.0"})}catch(t){throw new Error(`Failed to serialize data: ${t}`)}}static deserialize(t){try{const e=JSON.parse(t);return e&&"object"==typeof e&&e.data?e.data:null}catch(t){return null}}static getTimestamp(t){try{return JSON.parse(t).timestamp||null}catch(t){return null}}static isExpired(t,e){const n=this.getTimestamp(t);return!n||Date.now()-n>e}}Y.KEY_PREFIX="insure_os_",Y.SEPARATOR="_";class J{constructor(t,e={}){this.storageAdapter=t,this.config={defaultExpirationMs:e.defaultExpirationMs||J.DEFAULT_EXPIRATION_MS,namespace:e.namespace||J.DEFAULT_NAMESPACE}}saveQuoteIntent(t,e){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(t),r=Y.serialize(e);this.storageAdapter.set(n,r)}catch(t){}}getQuoteIntent(t){if(!this.storageAdapter.isAvailable())return null;try{const e=this.generateStorageKey(t),n=this.storageAdapter.get(e);if(!n)return null;const r=Y.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(t),null)}catch(t){return null}}removeQuoteIntent(t){if(this.storageAdapter.isAvailable())try{const e=this.generateStorageKey(t);this.storageAdapter.remove(e)}catch(t){}}isQuoteIntentValid(t){if(!t||"object"!=typeof t)return!1;if(!t.id||!t.url||!t.org_id)return!1;const e=Date.now();return!(t.expires_at&&e>t.expires_at||t.created_at&&e-t.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(t){return Y.generateKey(this.config.namespace,t)}}J.DEFAULT_EXPIRATION_MS=864e5,J.DEFAULT_NAMESPACE="quote_intent";class V{constructor(t){this.stateManager=t}async getOrCreateQuoteIntent(t,e,n){const r=this.stateManager.getQuoteIntent(t);if(r&&this.stateManager.isQuoteIntentValid(r)){const e=await n(r.url);return this.stateManager.saveQuoteIntent(t,e),e}try{const n=await e();return this.stateManager.saveQuoteIntent(t,n),n}catch(e){throw r&&this.stateManager.removeQuoteIntent(t),e}}updateQuoteIntent(t,e){const n=this.stateManager.getQuoteIntent(t);if(!n)return null;const r={...n,...e};return this.stateManager.saveQuoteIntent(t,r),r}clearQuoteIntent(t){this.stateManager.removeQuoteIntent(t)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(t){const e=this.stateManager.getQuoteIntent(t);return null!==e&&this.stateManager.isQuoteIntentValid(e)}getQuoteIntentUrl(t){const e=this.stateManager.getQuoteIntent(t);return(null==e?void 0:e.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class Q{constructor(t,e){this.saveCallback=e,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=t}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval)}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return 0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1)}handleSaveError(t){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(t))}dispatchErrorEvent(t){if("undefined"!=typeof window){const e=new CustomEvent("form-autosave-error",{detail:{error:t,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(e)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function X(t,e){var n;const r=[];if("checkbox"===t.type&&t.required&&!0!==e&&"true"!==e)return r.push({field:t.code||t.id,message:`${t.label} must be accepted`}),r;"boolean"===t.type&&(null===(n=t.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===t.boolean_config.show_details_on&&(!0===e||"true"===e)||t.boolean_config.show_details_on);const i="boolean"===t.type?null==e:null==e||""===e;if(t.required&&i)return r.push({field:t.code||t.id,message:`${t.label} is required`}),r;if(!t.required&&i)return r;const o=t.validation;if(!o)return r;const s=String(e),a="number"==typeof e?e:parseFloat(s);return o.pattern&&"text"===t.type&&(new RegExp(o.pattern).test(s)||r.push({field:t.code||t.id,message:`${t.label} format is invalid`})),o.minLength&&s.length<o.minLength&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.maxLength} characters`}),"number"!==t.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:t.code||t.id,message:`${t.label} must be in increments of ${o.step}`})),r}function K(t,e){var n,r;const i=[];for(const r of t.fields){const t=r.code||r.id,o=e[t],s=X(r,o);if(i.push(...s),"boolean"===r.type&&(null===(n=r.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===r.boolean_config.show_details_on&&(!0===o||"true"===o)||"no"===r.boolean_config.show_details_on&&(!1===o||"false"===o))){const n=(e.U||{})[t];n&&""!==n.trim()||i.push({field:t,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=t.validation)||void 0===r?void 0:r.required_fields)for(const n of t.validation.required_fields){const r=t.fields.find(t=>(t.code||t.id)===n),o=e[n];if(r){const t=r.code||r.id,e=i.find(e=>e.field===t);if(e)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:t,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&i.push({field:t,message:`${r.label} is required`})}}return{isValid:0===i.length,errors:i}}function tt(t){const e=[];let n;if("object"==typeof t&&null!==t&&("validation_errors"in t&&t.validation_errors&&"object"==typeof t.validation_errors?n=t.validation_errors:"errors"in t&&t.errors&&"object"==typeof t.errors?n=t.errors:"message"in t||"validation_errors"in t||"errors"in t||(n=t)),n)for(const[t,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)e.push({field:t,message:n});return e}class et{constructor(t,e,n){this.httpClient=t,this.definition=e,this.quoteIntentStore=n}async load(t,e){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(t)){const t=await this.httpClient.getQuoteIntent(e);if(t.quote_intent.form_data)return t.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(e)).quote_intent.form_data||this.createEmptyFormData()}async save(t,e,n,r){try{const t=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(e,t),{success:!0}}catch(t){if(t&&"object"==typeof t&&"validationErrors"in t){const e=t.validationErrors;if(e&&"object"==typeof e)return{success:!1,validationErrors:tt(e)}}throw t}}prepareSavePayload(t,e){const n=this.getCurrentPageId(t);return{current_page_index:t.current_page,current_page_id:n,page_data:t.page_data,save_type:e.saveType}}getCurrentPageId(t){const e=this.definition;if(!e||!t.page_data)return;const n=t.current_page;if(n<0||n>=e.pages.length)return;const r=e.pages[n];return r&&r.id?r.id:void 0}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}}class nt{constructor(t,e,n,r){this.formDefinition=t,this.getFormData=e,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(t){const e=this.getFormData().current_page;if(t<=e)return!0;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<t;r++)if(r!==e&&!n.includes(r))return!1;return!0}async navigateToPage(t){if(t<0||t>=this.getTotalPages())return!1;if(!this.canNavigateToPage(t))return!1;const e=this.getFormData().current_page;if(t>e)try{await this.saveCallback(!0,"page")}catch(t){return t&&"object"==typeof t&&t.isValidationError,!1}return t>e&&this.markPageCompleted(e),this.updateFormData({current_page:t,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const t=this.getFormData().current_page;return this.navigateToPage(t+1)}navigateToPrevious(){const t=this.getFormData().current_page;return this.navigateToPage(t-1)}markPageCompleted(t){const e=this.getFormData();if(!e.completed_pages.includes(t)){const n=[...e.completed_pages,t].sort((t,e)=>t-e);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const t=this.getFormData(),e=this.getTotalPages(),n=[...t.completed_pages];return{totalPages:e,currentPage:t.current_page,completedPages:n,percentComplete:n.length/e*100}}isStagingEnvironment(){const t=window.location.hostname;return"localhost"===t||t.endsWith(".test")||t.includes("staging")}}class rt{constructor(t){this.httpClient=t}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function it(t,e,n){var r,i,o,s;const a=Date.now(),c=`${t}-${a}`;if(function(t,e,n){try{Promise.resolve().then(function(){return fd}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${e}`,category:"error",level:"error",data:{errorType:e,customMessage:n}}),r(t,{errorType:e,customMessage:n}))}).catch(()=>{})}catch(t){}}(e,t,n),e&&"object"==typeof e){if("statusCode"in e||"status"in e)return ot(c,t,e.statusCode||e.status||500,e.message||(null===(r=e.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in e)return ot(c,t,(null===(i=e.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||e.message||"Network error occurred",n,a);if(e.message)return{id:c,type:t,severity:at(t),title:st(t),message:n||e.message,retryable:ut(t,0),timestamp:a,trackingId:c}}const u="string"==typeof e?e:"An unexpected error occurred";return{id:c,type:t,severity:at(t),title:st(t),message:n||u,retryable:ut(t,0),timestamp:a,trackingId:c}}function ot(t,e,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=ut(e,n);return{id:t,type:e,severity:s,statusCode:n,title:st(e,n),message:i||ct(e,n,r),details:r,retryable:a,timestamp:o}}function st(t,e){if(e){if(404===e)return"Not Found";if(503===e)return"Service Unavailable";if(e>=500)return"Server Error";if(e>=400)return"Validation Error"}switch(t){case"initialization":return"Initialization Error";case"calculation":return"Calculation Error";case"network":return"Network Error";case"validation":return"Validation Error";case"maintenance":return"Maintenance Mode";default:return"Unexpected Error"}}function at(t){switch(t){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ct(t,e,n){return"calculation"===t&&(n.toLowerCase().includes("no matching values found")||n.toLowerCase().includes("rating table")||n.toLowerCase().includes("not supported"))?n:n.toLowerCase().includes("no matching values found")?"The entered value is not supported by our calculator. Please try a different amount.":n.toLowerCase().includes("rating table")?"Unable to calculate with the provided information. Please check your entries and try again.":404===e?"initialization"===t?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===e?"We're performing scheduled maintenance. Please check back in a few minutes.":e>=500?"calculation"===t?"We're experiencing technical difficulties with the calculation. Please try again in a moment.":"We're experiencing technical difficulties. Please try again in a moment.":429===e?"Too many requests. Please wait a moment and try again.":e>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function ut(t,e){return"validation"!==t&&"maintenance"!==t&&404!==e&&503!==e&&!(e>=400&&e<500&&429!==e)&&("network"===t||"calculation"===t||e>=500&&503!==e||429===e)}function lt(t){return"maintenance"===t.type||503===t.statusCode}function dt(t){return t.trackingId?`If this problem persists, please contact support and reference error ID: ${t.trackingId.slice(0,8).toUpperCase()}`:"critical"===t.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let ht=null;function ft(t){ht=t}function mt(t,e){var n,r;return{event:e,quote_id:t.id,organisation_slug:null===(n=t.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=t.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function pt(t){var e,n;if(!(null==ht?void 0:ht.isEnabled()))return;const r={...mt(t,"quote_started"),quote_status:t.status,total_pages:null===(n=null===(e=t.form_definition)||void 0===e?void 0:e.pages)||void 0===n?void 0:n.length};ht.push(r)}function gt(t,e,n,r){var i,o;if(!(null==ht?void 0:ht.isEnabled()))return;const s=(null===(o=null===(i=t.form_definition)||void 0===i?void 0:i.pages)||void 0===o?void 0:o.length)||0,a=s>0?Math.round(n.length/s*100):0,c={...mt(t,"quote_form_progress"),current_page:e,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};ht.push(c)}function yt(t,e){if(!(null==ht?void 0:ht.isEnabled()))return;const n=e.calculations||[],r=e.payment_options||[],i=n.find(t=>t.id===e.default_excess_id),o=n.map(t=>t.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,c=r.some(t=>"monthly"===t.amount.frequency),u={...mt(t,"quote_calculated"),excess_id:null==i?void 0:i.id,excess_amount:null==i?void 0:i.excess_amount,premium_subtotal:null==i?void 0:i.premium_subtotal,premium_total:null==i?void 0:i.premium_total,excess_options_count:n.length,payment_options_count:r.length,has_installments:c,min_premium:s,max_premium:a};ht.push(u)}function vt(t,e,n,r,i){if(!(null==ht?void 0:ht.isEnabled()))return;const o={...mt(t,"quote_at_checkout"),excess_id:e.id,excess_amount:e.excess_amount,premium_subtotal:e.premium_subtotal,premium_total:e.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:e.fees};ht.push(o)}function wt(t,e){if(!(null==ht?void 0:ht.isEnabled()))return;const n=e.referrals||[],r={...mt(t,"quote_referred"),referral_reason:e.referral_reason,referrals_count:n.length,referral_ids:n.map(t=>t.id)};ht.push(r)}function bt(t,e,n,r){if(!(null==ht?void 0:ht.isEnabled()))return;const i={...mt(t,"payment_initiated"),payment_amount:e.amount.dueToday,payment_gateway:e.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:e.amount.frequency,amount_due_today:e.amount.dueToday,installments_count:e.amount.numberOfInstallments};ht.push(i)}function xt(t,e,n,r,i,o){if(!(null==ht?void 0:ht.isEnabled()))return;const s={...mt(t,"payment_completed"),transaction_id:e,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};ht.push(s)}function St(t,e,n,r,i,o){if(!(null==ht?void 0:ht.isEnabled()))return;const s={...mt(t,"payment_failed"),transaction_id:e,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};ht.push(s)}class kt{constructor(t,e,n,r={}){this.quoteIntent=t,this.httpClient=e,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.validationErrors=[],this.serverValidationErrors=[],this.generalErrors=[],this.lastCalculationFailed=!1,this.config={autoSaveInterval:r.autoSaveInterval||1e3,autoSave:!1!==r.autoSave,maxRetryAttempts:r.maxRetryAttempts||3,retryDelay:r.retryDelay||2e3},this.formData=this.createEmptyFormData(),this.quoteIntentStore=n,this.lastCalculationFailed=this.getPersistedCalculationFailureState();const i=t.form_definition;this.persistenceManager=new et(e,i,n),this.autoSaveManager=new Q(this.config,this.saveFormData.bind(this)),this.navigationManager=new nt(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new rt(e),this.config.autoSave&&this.autoSaveManager.start()}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}async loadFormProgress(){var t,e;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(e=null===(t=this.formData.page_data)||void 0===t?void 0:t.Y)||void 0===e?void 0:e.lastCalculationFailed),this.notify(),this.formData}updatePageData(t,e){this.pendingChanges[t]={...this.pendingChanges[t],...e},this.formData.page_data={...this.formData.page_data,[t]:{...this.formData.page_data[t],...e}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(t,e,n){this.autoSaveManager.startTyping(),this.pendingChanges[t]||(this.pendingChanges[t]={}),this.pendingChanges[t][e]=n,this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t][e]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(t,e,n),this.notify()}updateFieldAnswer(t,e,n){this.autoSaveManager.startTyping(),this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t].U||(this.formData.page_data[t].U={}),this.formData.page_data[t].U[e]=n,this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){this.isUserTyping()||(this.formData=t,this.notify())}restoreCalculationResult(t){e(),e(t.outcome_type),this.calculationResult=t,t.default_excess_id&&(this.selectedExcessId=t.default_excess_id),e(),this.notify(),e()}processRatingFactorMappings(t){const e=this.getFormDefinition(),n={};return e.pages.forEach(e=>{const r=t.page_data[e.id]||{};e.fields.forEach(t=>{const e=r[t.code||t.id];null!=e&&""!==e&&t.rating_factor_mappings&&t.rating_factor_mappings.length>0&&t.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(e,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${t.code||t.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(t,n,r){return e(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(t,r):null}calculateAge(t,e){try{const n=new Date(t),r="current_date"===(null==e?void 0:e.reference_date)?new Date:new Date((null==e?void 0:e.reference_date)||Date.now());let i=r.getFullYear()-n.getFullYear();const o=r.getMonth()-n.getMonth();return(o<0||0===o&&r.getDate()<n.getDate())&&i--,i}catch(t){return null}}async saveFormData(t=!1,n="auto-save"){if(!t&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);e();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const e=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:t,saveType:n});if(!e.success){if(e.validationErrors){this.setServerValidationErrors(e.validationErrors),this.notify();const t=new Error("Validation failed");throw t.isValidationError=!0,t}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const t=this.formData;r.current_page===t.current_page?this.formData=o:this.formData={...o,current_page:t.current_page,completed_pages:t.completed_pages,last_updated:t.last_updated},this.notify()}}catch(t){if(t&&"object"==typeof t&&"type"in t&&"message"in t){const e=t;if(!e.validationErrors||0===Object.keys(e.validationErrors).length){const t=it("validation",e);this.addGeneralError(t),this.notify()}}throw t}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(t){return this.navigationManager.canNavigateToPage(t)}navigateToPage(t){return this.navigationManager.navigateToPage(t)}async navigateToNextPage(){var t,e;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(e=null===(t=this.quoteIntent.form_definition)||void 0===t?void 0:t.pages[n-1])||void 0===e?void 0:e.title;gt(this.quoteIntent,n,r,i)}return n}navigateToPreviousPage(){return this.navigationManager.navigateToPrevious()}getPageCompletionStatus(){return this.navigationManager.getCompletionStatus()}getFormProgress(){return this.formData}getFormDefinition(){return this.quoteIntent.form_definition}getTotalPages(){return this.navigationManager.getTotalPages()}getCurrentPageIndex(){return this.formData.current_page}isAutoSavePaused(){return this.autoSaveManager.status.isPaused}isUserTyping(){return this.autoSaveManager.status.isUserTyping}getIsCalculating(){return this.isCalculating}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(t){this.selectedExcessId=t,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(t){this.selectedPaymentOption=t,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const t=this.getCurrentPageIndex(),e=this.getFormDefinition().pages[t];if(!e)return[];const n=K(e,this.formData.page_data[e.id]||{});return this.validationErrors=n.errors,this.notify(),n.errors}validateField(t,e,n){const r=this.getFormDefinition().pages.find(e=>e.id===t),i=null==r?void 0:r.fields.find(t=>(t.code||t.id)===e);if(!i)return[];const o=X(i,n);return this.validationErrors=this.validationErrors.filter(t=>t.field!==e),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(t){return this.getValidationErrors().filter(e=>e.field===t)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(t){return this.getFieldErrors(t).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(t){this.serverValidationErrors=t,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const t=this.generalErrors.filter(t=>!t.dismissed);return t.length>0?[t[t.length-1]]:[]}addGeneralError(t){this.generalErrors.push(t),this.notify()}dismissGeneralError(t){const e=this.generalErrors.find(e=>e.id===t);e&&(e.dismissed=!0,this.notify())}clearGeneralErrors(){this.generalErrors=[],this.notify()}hasGeneralErrors(){return this.getGeneralErrors().length>0}hasLastCalculationFailed(){return this.lastCalculationFailed}dispose(){this.autoSaveManager.stop(),Object.keys(this.pendingChanges).length>0&&!this.isAutoSavePaused()&&this.saveFormData(!0).catch(console.error),this.subscribers.clear()}async filterHiddenFieldsAndSave(){const t=this.getFormDefinition(),e={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return _s});t.pages.forEach(t=>{const r=this.formData.page_data[t.id]||{},i={};t.fields.forEach(t=>{const e=t.code||t.id,o=r[e];let s=!0;if(t.visibility){const e=n(r,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions});s="show"===t.visibility.action?e.matched:!e.matched}s&&void 0!==o&&(i[e]=o)}),e.page_data[t.id]=i});const r=this.processRatingFactorMappings(e),i={...e,page_data:{...e.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){e();const t=this.getFormDefinition(),n=[];for(const r of t.pages){const t=K(r,this.formData.page_data[r.id]||{});e(r.title,t.errors.length>0&&t.errors),n.push(...t.errors)}if(n.length>0)throw e(),this.validationErrors=n,this.notify(),new Error("Form validation failed");e(),await this.filterHiddenFieldsAndSave();try{this.isCalculating=!0,this.notify();const t=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=t,this.selectedExcessId=t.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const e=this.generalErrors.filter(t=>"calculation"===t.type);return e.forEach(t=>this.dismissGeneralError(t.id)),"calculation"===t.outcome_type?yt(this.quoteIntent,t):"referral"===t.outcome_type&&wt(this.quoteIntent,t),t}catch(t){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const e={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=e,e}finally{this.isCalculating=!1,this.notify()}}notify(){this.subscribers.forEach(t=>t(this))}updateFormDataInternal(t){if(this.isUserTyping()&&t.page_data){const e={...t};delete e.page_data,this.formData={...this.formData,...e}}else this.formData={...this.formData,...t};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var t,e,n;return!!(null===(n=null===(e=null===(t=this.quoteIntent.form_data)||void 0===t?void 0:t.page_data)||void 0===e?void 0:e.Y)||void 0===n?void 0:n.lastCalculationFailed)&&!0===this.quoteIntent.form_data.page_data.Y.lastCalculationFailed}persistCalculationFailureState(){this.formData.page_data.Y||(this.formData.page_data.Y={}),this.formData.page_data.Y.lastCalculationFailed=this.lastCalculationFailed,this.formData.last_updated=(new Date).toISOString(),this.saveFormData(!0,"auto-save").catch(()=>{})}reset(){localStorage.clear();const t=new URL(window.location.href);t.searchParams.delete("url"),window.history.replaceState({},document.title,t.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(t){if(this.quoteIntentStore){const e=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,t);e&&(this.quoteIntent=e,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(t){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(e=>e.id===t.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");e();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(e=>e.gateway_id===t.gatewayId&&e.calculation_id===t.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(e=>e.id===t.calculationId);try{const e=await this.httpClient.initiatePayment(t,o);return s&&bt(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),e}catch(t){throw t}}async getPaymentStatus(t){var e;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(e=this.calculationResult)||void 0===e?void 0:e.payment_gateways)||[]).find(t=>t.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const e=await this.httpClient.getPaymentStatus(t,r);return this.notify(),e}catch(t){throw t}}startPaymentStatusPolling(t,e,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(t);e(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(t){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class _t{constructor(t,e){this.httpClient=t,this.response=e}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(t){const e=this.response.product.form_definition,n={...this.response.quote_intent.form_data};for(const r of e.pages){const e=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;t.hasOwnProperty(r)?e[r]=t[r]:("text"===n.type&&(e[r]="sample"),"number"===n.type&&(e[r]=1),"checkbox"===n.type&&(e[r]=!0))}n.page_data[r.id]=e}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class $t{constructor(t){this.httpClient=t}async createQuoteIntent(t,e){const n=await this.httpClient.createQuoteIntent({code:t,...e});return new _t(this.httpClient,n)}}var Nt=0;function Et(t,e,n,i,o,s){e||(e={});var a,c,u=e;if("ref"in u)for(c in u={},e)"ref"==c?a=e[c]:u[c]=e[c];var l={type:t,props:u,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:--Nt,N:-1,C:0,V:o,X:s};if("function"==typeof t&&(a=t.defaultProps))for(c in a)void 0===u[c]&&(u[c]=a[c]);return r.vnode&&r.vnode(l),l}var Tt,Ct,It,Mt,Dt=0,Ot=[],Pt=r,Rt=Pt.p,jt=Pt.O,At=Pt.diffed,zt=Pt.k,Ft=Pt.unmount,Wt=Pt.m;function Lt(t,e){Pt.A&&Pt.A(Ct,t,Dt||e),Dt=0;var n=Ct.K||(Ct.K={m:[],A:[]});return t>=n.m.length&&n.m.push({}),n.m[t]}function qt(t){return Dt=1,function(t,e){var n=Lt(Tt++,2);if(n.t=t,!n.k&&(n.m=[Xt(void 0,e),function(t){var e=n.et?n.et[0]:n.m[0],r=n.t(e,t);e!==r&&(n.et=[r,n.m[1]],n.k.setState({}))}],n.k=Ct,!Ct.nt)){var r=function(t,e,r){if(!n.k.K)return!0;var o=n.k.K.m.filter(function(t){return!!t.k});if(o.every(function(t){return!t.et}))return!i||i.call(this,t,e,r);var s=n.k.props!==t;return o.forEach(function(t){if(t.et){var e=t.m[0];t.m=t.et,t.et=void 0,e!==t.m[0]&&(s=!0)}}),i&&i.call(this,t,e,r)||s};Ct.nt=!0;var i=Ct.shouldComponentUpdate,o=Ct.componentWillUpdate;Ct.componentWillUpdate=function(t,e,n){if(this.v){var s=i;i=void 0,r(t,e,n),i=s}o&&o.call(this,t,e,n)},Ct.shouldComponentUpdate=r}return n.et||n.m}(Xt,t)}function Bt(t,e){var n=Lt(Tt++,3);!Pt.L&&Qt(n.K,e)&&(n.m=t,n.u=e,Ct.K.A.push(n))}function Ht(t){return Dt=5,Ut(function(){return{current:t}},[])}function Ut(t,e){var n=Lt(Tt++,7);return Qt(n.K,e)&&(n.m=t(),n.K=e,n.A=t),n.m}function Zt(){for(var t;t=Ot.shift();)if(t.P&&t.K)try{t.K.A.forEach(Jt),t.K.A.forEach(Vt),t.K.A=[]}catch(e){t.K.A=[],Pt.v(e,t._)}}Pt.p=function(t){Ct=null,Rt&&Rt(t)},Pt.m=function(t,e){t&&e.i&&e.i.B&&(t.B=e.i.B),Wt&&Wt(t,e)},Pt.O=function(t){jt&&jt(t),Tt=0;var e=(Ct=t.k).K;e&&(It===Ct?(e.A=[],Ct.A=[],e.m.forEach(function(t){t.et&&(t.m=t.et),t.u=t.et=void 0})):(e.A.forEach(Jt),e.A.forEach(Vt),e.A=[],Tt=0)),It=Ct},Pt.diffed=function(t){At&&At(t);var e=t.k;e&&e.K&&(e.K.A.length&&(1!==Ot.push(e)&&Mt===Pt.requestAnimationFrame||((Mt=Pt.requestAnimationFrame)||Yt)(Zt)),e.K.m.forEach(function(t){t.u&&(t.K=t.u),t.u=void 0})),It=Ct=null},Pt.k=function(t,e){e.some(function(t){try{t.A.forEach(Jt),t.A=t.A.filter(function(t){return!t.m||Vt(t)})}catch(n){e.some(function(t){t.A&&(t.A=[])}),e=[],Pt.v(n,t._)}}),zt&&zt(t,e)},Pt.unmount=function(t){Ft&&Ft(t);var e,n=t.k;n&&n.K&&(n.K.m.forEach(function(t){try{Jt(t)}catch(t){e=t}}),n.K=void 0,e&&Pt.v(e,n._))};var Gt="function"==typeof requestAnimationFrame;function Yt(t){var e,n=function(){clearTimeout(r),Gt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Gt&&(e=requestAnimationFrame(n))}function Jt(t){var e=Ct,n=t.k;"function"==typeof n&&(t.k=void 0,n()),Ct=e}function Vt(t){var e=Ct;t.k=t.m(),Ct=e}function Qt(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function Xt(t,e){return"function"==typeof e?e(t):e}const Kt="insure-os";let te=!1;const ee=new Map,ne={[`--${Kt}-radius`]:"0.75rem",[`--${Kt}-radius-sm`]:"0.5rem",[`--${Kt}-radius-lg`]:"1rem",[`--${Kt}-background`]:"oklch(0.955 0 0)",[`--${Kt}-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-card`]:"oklch(1 0 0)",[`--${Kt}-card-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-popover`]:"oklch(1 0 0)",[`--${Kt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-primary`]:"oklch(0.205 0 0)",[`--${Kt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${Kt}-secondary`]:"oklch(0.97 0 0)",[`--${Kt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${Kt}-muted`]:"oklch(0.97 0 0)",[`--${Kt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${Kt}-accent`]:"oklch(0.97 0 0)",[`--${Kt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${Kt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${Kt}-border`]:"oklch(0.9 0 0)",[`--${Kt}-input`]:"oklch(0.9 0 0)",[`--${Kt}-ring`]:"oklch(0.708 0 0)",[`--${Kt}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${Kt}-font-size-large`]:"18px",[`--${Kt}-font-size-small`]:"14px",[`--${Kt}-font-size`]:"16px",[`--${Kt}-border-width`]:"1px",[`--${Kt}-transition-duration`]:"200ms",[`--${Kt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${Kt}-shadow-sm`]:"0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)",[`--${Kt}-shadow`]:"0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.12)",[`--${Kt}-shadow-md`]:"0 4px 8px -1px rgba(0, 0, 0, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.14)",[`--${Kt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${Kt}-spacing-sm`]:"0.75rem",[`--${Kt}-spacing`]:"1rem",[`--${Kt}-spacing-md`]:"1.5rem",[`--${Kt}-spacing-lg`]:"2rem",[`--${Kt}-spacing-xl`]:"3rem"},re={colors:{background:`var(--${Kt}-background)`,foreground:`var(--${Kt}-foreground)`,card:`var(--${Kt}-card)`,popover:`var(--${Kt}-popover)`,popoverForeground:`var(--${Kt}-popover-foreground)`,primary:`var(--${Kt}-primary)`,primaryForeground:`var(--${Kt}-primary-foreground)`,secondary:`var(--${Kt}-secondary)`,muted:`var(--${Kt}-muted)`,mutedForeground:`var(--${Kt}-muted-foreground)`,accent:`var(--${Kt}-accent)`,accentForeground:`var(--${Kt}-accent-foreground)`,destructive:`var(--${Kt}-destructive)`,border:`var(--${Kt}-border)`,input:`var(--${Kt}-input)`,ring:`var(--${Kt}-ring)`},fontSize:{small:`var(--${Kt}-font-size-small)`,default:`var(--${Kt}-font-size)`,large:`var(--${Kt}-font-size-large)`},radius:{small:`var(--${Kt}-radius-sm)`,default:`var(--${Kt}-radius)`,large:`var(--${Kt}-radius-lg)`},shadow:{sm:`var(--${Kt}-shadow-sm)`,md:`var(--${Kt}-shadow-md)`},spacing:{sm:`var(--${Kt}-spacing-sm)`,md:`var(--${Kt}-spacing-md)`,lg:`var(--${Kt}-spacing-lg)`,xl:`var(--${Kt}-spacing-xl)`},fontFamily:`var(--${Kt}-font-family)`,borderWidth:`var(--${Kt}-border-width)`,transition:`var(--${Kt}-transition-duration) var(--${Kt}-transition-timing-function)`},ie=new Set;function oe(t){if(!document.getElementById(`${Kt}-styles`)){const t=document.createElement("style");t.id=`${Kt}-styles`,document.head.appendChild(t)}document.getElementById(`${Kt}-styles`).textContent+=t+"\n"}function se(t){return Object.entries(t).map(([t,e])=>{return`${n=t,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${e}`;var n}).join("; ")}function ae(){te||(oe(`:root {\n${Object.entries(ne).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`),te=!0)}const ce={name:t=>`${Kt}-${t}`,selector(t){return`.${this.name(t)}`},create(t,e,n){ae();const r=se(e),i=function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e).toString(36)}(`${t}:${r}:${n?JSON.stringify(n):""}`),o=`${t}-${i}`,s=ee.get(o);if(s)return s.fullClassName;let a=t;const c=this.name(a);return ie.has(a)||(oe(`.${c} { ${r} }`),ie.add(a)),ee.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([t,e])=>{this.media(t,{[a]:e})}),c},keyframes(t,e){const n=`${Kt}-${t}`;return ie.has(`keyframes-${t}`)||(oe(`@keyframes ${n} {\n${Object.entries(e).map(([t,e])=>` ${t} { ${se(e)} }`).join("\n")}\n}`),ie.add(`keyframes-${t}`)),n},media(t,e){const n=`media-${t}`;oe(`@media ${t} {\n${Object.entries(e).map(([t,e])=>` .${Kt}-${t} { ${se(e)} }`).join("\n")}\n}`),ie.add(n)},pseudoElement(t,e,n){const r=`${Kt}-${t}`,i=`${t}-${e}`;return ie.has(i)||(oe(`.${r}${e} { ${se(n)} }`),ie.add(i)),r}};var ue=Object.freeze({__proto__:null,baseVariables:ne,styles:ce,theme:re,updateBaseVariables:function(t){e(),Object.assign(ne,t);const n=document.getElementById(`${Kt}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(ne).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,i=t.includes(":root {")?t.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+t;n.textContent=i,e()}else ae()}});function le(t){return t&&t.rt&&{}.hasOwnProperty.call(t,"default")?t.default:t}var de,he={exports:{}};function fe(){return de||(de=1,function(t){!function(){var e={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=i(t,r(n)))}return t}function r(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!=={}.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var o in t)e.call(t,o)&&t[o]&&(r=i(r,o));return r}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(n.default=n,t.exports=n):window.classNames=n}()}(he)),he.exports}var me=le(fe());function pe({size:t="small"}){const e=ce.create("spinner-small",{width:"16px",height:"16px"}),n=ce.create("spinner-large",{width:"64px",height:"64px"}),r="small"===t?e:n;return ce.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Et("div",{className:ce.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:me(r),children:Et("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function ge({className:t,children:e,size:n="md"}){const r={sm:re.spacing.sm,md:re.spacing.md,lg:re.spacing.lg,xl:re.spacing.xl},i=ce.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?re.spacing.lg:"lg"===n?re.spacing.md:r[n]},"(max-width: 480px)":{padding:re.spacing.sm}});return Et("div",{className:me(i,t),children:e})}const ye=function(){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&n.forEach(function(t){t.v=!0,E(t)})},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),e.children}return t.k="__cC"+f++,t.m=null,t.Provider=t.it=(t.Consumer=function(t,e){return t.children(e)}).contextType=t,t}();function ve({children:t,httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i}){return Et(ye.Provider,{value:{httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i,currentRetryAttempt:0,maxRetryAttempts:3},children:t})}function we(t){const e=function(){const t=function(t){var e=Ct.context[t.k],n=Lt(Tt++,9);return n.c=t,e?(null==n.m&&(n.m=!0,e.sub(Ct)),e.props.value):t.m}(ye);if(!t)throw new Error("useFormContext must be used within a FormContext provider");return t}(),{formStateManager:n}=e;if(!n||"function"!=typeof n.subscribe)throw new Error("FormStateManager is not properly initialized. This component should not render during initialization errors.");const[r,i]=qt(()=>t(n));return Bt(()=>n.subscribe(()=>{i(t(n))}),[n,t]),{...r,fsm:n}}class be extends Error{}class xe extends be{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class Se extends be{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class ke extends be{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class _e extends be{}class $e extends be{constructor(t){super(`Invalid unit ${t}`)}}class Ne extends be{}class Ee extends be{constructor(){super("Zone is an abstract class")}}const Te="numeric",Ce="short",Ie="long",Me={year:Te,month:Te,day:Te},De={year:Te,month:Ce,day:Te},Oe={year:Te,month:Ce,day:Te,weekday:Ce},Pe={year:Te,month:Ie,day:Te},Re={year:Te,month:Ie,day:Te,weekday:Ie},je={hour:Te,minute:Te},Ae={hour:Te,minute:Te,second:Te},ze={hour:Te,minute:Te,second:Te,timeZoneName:Ce},Fe={hour:Te,minute:Te,second:Te,timeZoneName:Ie},We={hour:Te,minute:Te,hourCycle:"h23"},Le={hour:Te,minute:Te,second:Te,hourCycle:"h23"},qe={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Ce},Be={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Ie},He={year:Te,month:Te,day:Te,hour:Te,minute:Te},Ue={year:Te,month:Te,day:Te,hour:Te,minute:Te,second:Te},Ze={year:Te,month:Ce,day:Te,hour:Te,minute:Te},Ge={year:Te,month:Ce,day:Te,hour:Te,minute:Te,second:Te},Ye={year:Te,month:Ce,day:Te,weekday:Ce,hour:Te,minute:Te},Je={year:Te,month:Ie,day:Te,hour:Te,minute:Te,timeZoneName:Ce},Ve={year:Te,month:Ie,day:Te,hour:Te,minute:Te,second:Te,timeZoneName:Ce},Qe={year:Te,month:Ie,day:Te,weekday:Ie,hour:Te,minute:Te,timeZoneName:Ie},Xe={year:Te,month:Ie,day:Te,weekday:Ie,hour:Te,minute:Te,second:Te,timeZoneName:Ie};class Ke{get type(){throw new Ee}get name(){throw new Ee}get ianaName(){return this.name}get isUniversal(){throw new Ee}offsetName(t,e){throw new Ee}formatOffset(t,e){throw new Ee}offset(t){throw new Ee}equals(t){throw new Ee}get isValid(){throw new Ee}}let tn=null;class en extends Ke{static get instance(){return null===tn&&(tn=new en),tn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Sr(t,e,n)}formatOffset(t,e){return Nr(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}const nn=new Map,rn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},on=new Map;class sn extends Ke{static create(t){let e=on.get(t);return void 0===e&&on.set(t,e=new sn(t)),e}static resetCache(){on.clear(),nn.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=sn.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return Sr(t,e,n,this.name)}formatOffset(t,e){return Nr(this.offset(t),e)}offset(t){if(!this.valid)return NaN;const e=new Date(t);if(isNaN(e))return NaN;const n=function(t){let e=nn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),nn.set(t,e)),e}(this.name);let[r,i,o,s,a,c,u]=n.formatToParts?function(t,e){const n=t.formatToParts(e),r=[];for(let t=0;t<n.length;t++){const{type:e,value:i}=n[t],o=rn[e];"era"===e?r[o]=i:er(o)||(r[o]=parseInt(i,10))}return r}(n,e):function(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,c,u,l]=r;return[s,i,o,a,c,u,l]}(n,e);"BC"===s&&(r=1-Math.abs(r));let l=+e;const d=l%1e3;return l-=d>=0?d:1e3+d,(vr({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:u,millisecond:0})-l)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let an={};const cn=new Map;function un(t,e={}){const n=JSON.stringify([t,e]);let r=cn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(t,e),cn.set(n,r)),r}const ln=new Map,dn=new Map;let hn=null;const fn=new Map;function mn(t){let e=fn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),fn.set(t,e)),e}const pn=new Map;function gn(t,e,n,r){const i=t.listingMode();return"error"===i?null:"en"===i?n(e):r(e)}class yn{constructor(t,e,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!e||Object.keys(o).length>0){const e={useGrouping:!1,...n};n.padTo>0&&(e.minimumIntegerDigits=n.padTo),this.inf=function(t,e={}){const n=JSON.stringify([t,e]);let r=ln.get(n);return void 0===r&&(r=new Intl.NumberFormat(t,e),ln.set(n,r)),r}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return lr(this.floor?Math.floor(t):mr(t,3),this.padTo)}}class vn{constructor(t,e,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,n=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&sn.create(n).valid?(r=n,this.dt=t):(r="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,r=t.zone.name):(r="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=un(e,i)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t}):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class wn{constructor(t,e,n){this.opts={style:"long",...n},!e&&ir()&&(this.rtf=function(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let o=dn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(t,e),dn.set(i,o)),o}(t,n))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=-1===["hours","minutes","seconds"].indexOf(t);if("auto"===n&&o){const n="days"===t;switch(e){case 1:return n?"tomorrow":`next ${i[t][0]}`;case-1:return n?"yesterday":`last ${i[t][0]}`;case 0:return n?"today":`this ${i[t][0]}`}}const s=Object.is(e,-0)||e<0,a=Math.abs(e),c=1===a,u=i[t],l=r?c?u[1]:u[2]||u[1]:c?i[t][0]:t;return s?`${a} ${l} ago`:`in ${a} ${l}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const bn={firstDay:1,minimalDays:4,weekend:[6,7]};class xn{static fromOpts(t){return xn.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,n,r,i=!1){const o=t||Fn.defaultLocale,s=o||(i?"en-US":hn||(hn=(new Intl.DateTimeFormat).resolvedOptions().locale,hn)),a=e||Fn.defaultNumberingSystem,c=n||Fn.defaultOutputCalendar,u=cr(r)||Fn.defaultWeekSettings;return new xn(s,a,c,u,o)}static resetCache(){hn=null,cn.clear(),ln.clear(),dn.clear(),fn.clear(),pn.clear()}static fromObject({locale:t,numberingSystem:e,outputCalendar:n,weekSettings:r}={}){return xn.create(t,e,n,r)}constructor(t,e,n,r,i){const[o,s,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(-1===n)return[t];{let e,r;try{e=un(t).resolvedOptions(),r=t}catch(i){const o=t.substring(0,n);e=un(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=e;return[r,i,o]}}(t);this.locale=o,this.numberingSystem=e||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(t,e,n){return n||e?(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`),t):t}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){var t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===mn(t.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?xn.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,cr(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return gn(this,t,Mr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(e&=!n)?{month:t,day:"numeric"}:{month:t},i=e?"format":"standalone";if(!this.monthsCache[i][t]){const e=n?t=>this.dtFormatter(t,r).format():t=>this.extract(t,r,"month");this.monthsCache[i][t]=function(t){const e=[];for(let n=1;n<=12;n++){const r=Po.utc(2009,n,1);e.push(t(r))}return e}(e)}return this.monthsCache[i][t]})}weekdays(t,e=!1){return gn(this,t,Rr,()=>{const n=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},r=e?"format":"standalone";return this.weekdaysCache[r][t]||(this.weekdaysCache[r][t]=function(t){const e=[];for(let n=1;n<=7;n++){const r=Po.utc(2016,11,13+n);e.push(t(r))}return e}(t=>this.extract(t,n,"weekday"))),this.weekdaysCache[r][t]})}meridiems(){return gn(this,void 0,()=>jr,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Po.utc(2016,11,13,9),Po.utc(2016,11,13,19)].map(e=>this.extract(e,t,"dayperiod"))}return this.meridiemCache})}eras(t){return gn(this,t,Wr,()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[Po.utc(-40,1,1),Po.utc(2017,1,1)].map(t=>this.extract(t,e,"era"))),this.eraCache[t]})}extract(t,e,n){const r=this.dtFormatter(t,e).formatToParts().find(t=>t.type.toLowerCase()===n);return r?r.value:null}numberFormatter(t={}){return new yn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new vn(t,this.intl,e)}relFormatter(t={}){return new wn(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const n=JSON.stringify([t,e]);let r=an[n];return r||(r=new Intl.ListFormat(t,e),an[n]=r),r}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||mn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:or()?function(t){let e=pn.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={...bn,...e}),pn.set(t,e)}return e}(this.locale):bn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Sn=null;class kn extends Ke{static get utcInstance(){return null===Sn&&(Sn=new kn(0)),Sn}static instance(t){return 0===t?kn.utcInstance:new kn(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new kn(kr(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Nr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Nr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Nr(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class _n extends Ke{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function $n(t,e){if(er(t)||null===t)return e;if(t instanceof Ke)return t;if(function(t){return"string"==typeof t}(t)){const n=t.toLowerCase();return"default"===n?e:"local"===n||"system"===n?en.instance:"utc"===n||"gmt"===n?kn.utcInstance:kn.parseSpecifier(n)||sn.create(t)}return nr(t)?kn.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new _n(t)}const Nn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},En={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Tn=Nn.hanidec.replace(/[\[|\]]/g,"").split(""),Cn=new Map;function In({numberingSystem:t},e=""){const n=t||"latn";let r=Cn.get(n);void 0===r&&(r=new Map,Cn.set(n,r));let i=r.get(e);return void 0===i&&(i=new RegExp(`${Nn[n]}${e}`),r.set(e,i)),i}let Mn,Dn=()=>Date.now(),On="system",Pn=null,Rn=null,jn=null,An=60,zn=null;class Fn{static get now(){return Dn}static set now(t){Dn=t}static set defaultZone(t){On=t}static get defaultZone(){return $n(On,en.instance)}static get defaultLocale(){return Pn}static set defaultLocale(t){Pn=t}static get defaultNumberingSystem(){return Rn}static set defaultNumberingSystem(t){Rn=t}static get defaultOutputCalendar(){return jn}static set defaultOutputCalendar(t){jn=t}static get defaultWeekSettings(){return zn}static set defaultWeekSettings(t){zn=cr(t)}static get twoDigitCutoffYear(){return An}static set twoDigitCutoffYear(t){An=t%100}static get throwOnInvalid(){return Mn}static set throwOnInvalid(t){Mn=t}static resetCaches(){xn.resetCache(),sn.resetCache(),Po.resetCache(),Cn.clear()}}class Wn{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Ln=[0,31,59,90,120,151,181,212,243,273,304,334],qn=[0,31,60,91,121,152,182,213,244,274,305,335];function Bn(t,e){return new Wn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Hn(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function Un(t,e,n){return n+(pr(t)?qn:Ln)[e-1]}function Zn(t,e){const n=pr(t)?qn:Ln,r=n.findIndex(t=>t<e);return{month:r+1,day:e-n[r]}}function Gn(t,e){return(t-e+7)%7+1}function Yn(t,e=4,n=1){const{year:r,month:i,day:o}=t,s=Un(r,i,o),a=Gn(Hn(r,i,o),n);let c,u=Math.floor((s-a+14-e)/7);return u<1?(c=r-1,u=br(c,e,n)):u>br(r,e,n)?(c=r+1,u=1):c=r,{weekYear:c,weekNumber:u,weekday:a,...Er(t)}}function Jn(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=t,s=Gn(Hn(r,1,e),n),a=gr(r);let c,u=7*i+o-s-7+e;u<1?(c=r-1,u+=gr(c)):u>a?(c=r+1,u-=gr(r)):c=r;const{month:l,day:d}=Zn(c,u);return{year:c,month:l,day:d,...Er(t)}}function Vn(t){const{year:e,month:n,day:r}=t;return{year:e,ordinal:Un(e,n,r),...Er(t)}}function Qn(t){const{year:e,ordinal:n}=t,{month:r,day:i}=Zn(e,n);return{year:e,month:r,day:i,...Er(t)}}function Xn(t,e){if(!er(t.localWeekday)||!er(t.localWeekNumber)||!er(t.localWeekYear)){if(!er(t.weekday)||!er(t.weekNumber)||!er(t.weekYear))throw new _e("Cannot mix locale-based week fields with ISO-based week fields");return er(t.localWeekday)||(t.weekday=t.localWeekday),er(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),er(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function Kn(t){const e=rr(t.year),n=ur(t.month,1,12),r=ur(t.day,1,yr(t.year,t.month));return e?n?!r&&Bn("day",t.day):Bn("month",t.month):Bn("year",t.year)}function tr(t){const{hour:e,minute:n,second:r,millisecond:i}=t,o=ur(e,0,23)||24===e&&0===n&&0===r&&0===i,s=ur(n,0,59),a=ur(r,0,59),c=ur(i,0,999);return o?s?a?!c&&Bn("millisecond",i):Bn("second",r):Bn("minute",n):Bn("hour",e)}function er(t){return void 0===t}function nr(t){return"number"==typeof t}function rr(t){return"number"==typeof t&&t%1==0}function ir(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function or(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function sr(t,e,n){if(0!==t.length)return t.reduce((t,r)=>{const i=[e(r),r];return t&&n(t[0],i[0])===t[0]?t:i},null)[1]}function ar(t,e){return{}.hasOwnProperty.call(t,e)}function cr(t){if(null==t)return null;if("object"!=typeof t)throw new Ne("Week settings must be an object");if(!ur(t.firstDay,1,7)||!ur(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(t=>!ur(t,1,7)))throw new Ne("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function ur(t,e,n){return rr(t)&&t>=e&&t<=n}function lr(t,e=2){let n;return n=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),n}function dr(t){return er(t)||null===t||""===t?void 0:parseInt(t,10)}function hr(t){return er(t)||null===t||""===t?void 0:parseFloat(t)}function fr(t){if(!er(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function mr(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function pr(t){return t%4==0&&(t%100!=0||t%400==0)}function gr(t){return pr(t)?366:365}function yr(t,e){const n=(r=e-1)-12*Math.floor(r/12)+1;var r;return 2===n?pr(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function vr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function wr(t,e,n){return-Gn(Hn(t,1,e),n)+e-1}function br(t,e=4,n=1){const r=wr(t,e,n),i=wr(t+1,e,n);return(gr(t)-r+i)/7}function xr(t){return t>99?t:t>Fn.twoDigitCutoffYear?1900+t:2e3+t}function Sr(t,e,n,r=null){const i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(t=>"timezonename"===t.type.toLowerCase());return a?a.value:null}function kr(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function _r(t){const e=Number(t);if("boolean"==typeof t||""===t||!Number.isFinite(e))throw new Ne(`Invalid unit value ${t}`);return e}function $r(t,e){const n={};for(const r in t)if(ar(t,r)){const i=t[r];if(null==i)continue;n[e(r)]=_r(i)}return n}function Nr(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${lr(n,2)}:${lr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${lr(n,2)}${lr(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Er(t){return function(t){return["hour","minute","second","millisecond"].reduce((e,n)=>(e[n]=t[n],e),{})}(t)}const Tr=["January","February","March","April","May","June","July","August","September","October","November","December"],Cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ir=["J","F","M","A","M","J","J","A","S","O","N","D"];function Mr(t){switch(t){case"narrow":return[...Ir];case"short":return[...Cr];case"long":return[...Tr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Dr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Or=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Pr=["M","T","W","T","F","S","S"];function Rr(t){switch(t){case"narrow":return[...Pr];case"short":return[...Or];case"long":return[...Dr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const jr=["AM","PM"],Ar=["Before Christ","Anno Domini"],zr=["BC","AD"],Fr=["B","A"];function Wr(t){switch(t){case"narrow":return[...Fr];case"short":return[...zr];case"long":return[...Ar];default:return null}}function Lr(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const qr={D:Me,DD:De,DDD:Pe,DDDD:Re,t:je,tt:Ae,ttt:ze,tttt:Fe,T:We,TT:Le,TTT:qe,TTTT:Be,f:He,ff:Ze,fff:Je,ffff:Qe,F:Ue,FF:Ge,FFF:Ve,FFFF:Xe};class Br{static create(t,e={}){return new Br(t,e)}static parseFormat(t){let e=null,n="",r=!1;const i=[];for(let o=0;o<t.length;o++){const s=t.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),e=null,n="",r=!r):r||s===e?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,e=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(t){return qr[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0,n){if(this.opts.forceSimple)return lr(t,e);const r={...this.opts};return e>0&&(r.padTo=e),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,e){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",s=(e,r)=>n?function(t,e){return Mr(e)[t.month-1]}(t,e):i(r?{month:e}:{month:e,day:"numeric"},"month"),a=(e,r)=>n?function(t,e){return Rr(e)[t.weekday-1]}(t,e):i(r?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),c=e=>{const n=Br.macroTokenToFormatOpts(e);return n?this.formatWithSystemDefault(t,n):e},u=e=>n?function(t,e){return Wr(e)[t.year<0?0:1]}(t,e):i({era:e},"era");return Lr(Br.parseFormat(e),e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return n?function(t){return jr[t.hour<12?0:1]}(t):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(t.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.weekday);case"ccc":return a("short",!0);case"cccc":return a("long",!0);case"ccccc":return a("narrow",!0);case"EEE":return a("short",!1);case"EEEE":return a("long",!1);case"EEEEE":return a("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return s("short",!0);case"LLLL":return s("long",!0);case"LLLLL":return s("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(t.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return s("short",!1);case"MMMM":return s("long",!1);case"MMMMM":return s("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(t.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(t.year,6);case"G":return u("short");case"GG":return u("long");case"GGGGG":return u("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(e)}})}formatDurationFromString(t,e){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=t=>{switch(t[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=Br.parseFormat(e),o=i.reduce((t,{literal:e,val:n})=>e?t:t.concat(n),[]),s=t.shiftTo(...o.map(r).filter(t=>t));return Lr(i,((t,e)=>i=>{const o=r(i);if(o){const r=e.isNegativeDuration&&o!==e.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==e.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(t.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const Hr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ur(...t){const e=t.reduce((t,e)=>t+e.source,"");return RegExp(`^${e}$`)}function Zr(...t){return e=>t.reduce(([t,n,r],i)=>{const[o,s,a]=i(e,r);return[{...t,...o},s||n,a]},[{},null,1]).slice(0,2)}function Gr(t,...e){if(null==t)return[null,null];for(const[n,r]of e){const e=n.exec(t);if(e)return r(e)}return[null,null]}function Yr(...t){return(e,n)=>{const r={};let i;for(i=0;i<t.length;i++)r[t[i]]=dr(e[n+i]);return[r,null,n+i]}}const Jr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Vr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Qr=RegExp(`${Vr.source}(?:${Jr.source}?(?:\\[(${Hr.source})\\])?)?`),Xr=RegExp(`(?:[Tt]${Qr.source})?`),Kr=Yr("weekYear","weekNumber","weekDay"),ti=Yr("year","ordinal"),ei=RegExp(`${Vr.source} ?(?:${Jr.source}|(${Hr.source}))?`),ni=RegExp(`(?: ${ei.source})?`);function ri(t,e,n){const r=t[e];return er(r)?n:dr(r)}function ii(t,e){return[{hours:ri(t,e,0),minutes:ri(t,e+1,0),seconds:ri(t,e+2,0),milliseconds:fr(t[e+3])},null,e+4]}function oi(t,e){const n=!t[e]&&!t[e+1],r=kr(t[e+1],t[e+2]);return[{},n?null:kn.instance(r),e+3]}function si(t,e){return[{},t[e]?sn.create(t[e]):null,e+1]}const ai=RegExp(`^T?${Vr.source}$`),ci=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function ui(t){const[e,n,r,i,o,s,a,c,u]=t,l="-"===e[0],d=c&&"-"===c[0],h=(t,e=!1)=>void 0!==t&&(e||t&&l)?-t:t;return[{years:h(hr(n)),months:h(hr(r)),weeks:h(hr(i)),days:h(hr(o)),hours:h(hr(s)),minutes:h(hr(a)),seconds:h(hr(c),"-0"===c),milliseconds:h(fr(u),d)}]}const li={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function di(t,e,n,r,i,o,s){const a={year:2===e.length?xr(dr(e)):dr(e),month:Cr.indexOf(n)+1,day:dr(r),hour:dr(i),minute:dr(o)};return s&&(a.second=dr(s)),t&&(a.weekday=t.length>3?Dr.indexOf(t)+1:Or.indexOf(t)+1),a}const hi=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function fi(t){const[,e,n,r,i,o,s,a,c,u,l,d]=t,h=di(e,i,r,n,o,s,a);let f;return f=c?li[c]:u?0:kr(l,d),[h,new kn(f)]}const mi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,pi=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,gi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function yi(t){const[,e,n,r,i,o,s,a]=t;return[di(e,i,r,n,o,s,a),kn.utcInstance]}function vi(t){const[,e,n,r,i,o,s,a]=t;return[di(e,a,n,r,i,o,s),kn.utcInstance]}const wi=Ur(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xr),bi=Ur(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Xr),xi=Ur(/(\d{4})-?(\d{3})/,Xr),Si=Ur(Qr),ki=Zr(function(t,e){return[{year:ri(t,e),month:ri(t,e+1,1),day:ri(t,e+2,1)},null,e+3]},ii,oi,si),_i=Zr(Kr,ii,oi,si),$i=Zr(ti,ii,oi,si),Ni=Zr(ii,oi,si),Ei=Zr(ii),Ti=Ur(/(\d{4})-(\d\d)-(\d\d)/,ni),Ci=Ur(ei),Ii=Zr(ii,oi,si),Mi="Invalid Duration",Di={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Oi={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Di},Pi={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Di},Ri=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ji=Ri.slice(0).reverse();function Ai(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Li(r)}function zi(t,e){let n=e.milliseconds??0;for(const r of ji.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function Fi(t,e){const n=zi(t,e)<0?-1:1;Ri.reduceRight((r,i)=>{if(er(e[i]))return r;if(r){const o=e[r]*n,s=t[i][r],a=Math.floor(o/s);e[i]+=a*n,e[r]-=a*s*n}return i},null),Ri.reduce((n,r)=>{if(er(e[r]))return n;if(n){const i=e[n]%1;e[n]-=i,e[r]+=i*t[n][r]}return r},null)}function Wi(t){const e={};for(const[n,r]of Object.entries(t))0!==r&&(e[n]=r);return e}class Li{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let n=e?Pi:Oi;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||xn.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,e){return Li.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new Ne("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new Li({values:$r(t,Li.normalizeUnit),loc:xn.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(nr(t))return Li.fromMillis(t);if(Li.isDuration(t))return t;if("object"==typeof t)return Li.fromObject(t);throw new Ne(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[n]=function(t){return Gr(t,[ci,ui])}(t);return n?Li.fromObject(n,e):Li.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[n]=function(t){return Gr(t,[ai,Ei])}(t);return n?Li.fromObject(n,e):Li.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the Duration is invalid");const n=t instanceof Wn?t:new Wn(t,e);if(Fn.throwOnInvalid)throw new ke(n);return new Li({invalid:n})}static normalizeUnit(t){const e={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t?t.toLowerCase():t];if(!e)throw new $e(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const n={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?Br.create(this.loc,n).formatDurationFromString(this,t):Mi}toHuman(t={}){if(!this.isValid)return Mi;const e=!1!==t.showZeros,n=Ri.map(n=>{const r=this.values[n];return er(r)||0===r&&!e?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(r)}).filter(t=>t);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=mr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();return e<0||e>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},Po.fromMillis(e,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?zi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=Li.fromDurationLike(t),n={};for(const t of Ri)(ar(e.values,t)||ar(this.values,t))&&(n[t]=e.get(t)+this.get(t));return Ai(this,{values:n},!0)}minus(t){if(!this.isValid)return this;const e=Li.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=_r(t(this.values[n],n));return Ai(this,{values:e},!0)}get(t){return this[Li.normalizeUnit(t)]}set(t){return this.isValid?Ai(this,{values:{...this.values,...$r(t,Li.normalizeUnit)}}):this}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:n,matrix:r}={}){return Ai(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:r,conversionAccuracy:n})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return Fi(this.matrix,t),Ai(this,{values:t},!0)}rescale(){return this.isValid?Ai(this,{values:Wi(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map(t=>Li.normalizeUnit(t));const e={},n={},r=this.toObject();let i;for(const o of Ri)if(t.indexOf(o)>=0){i=o;let t=0;for(const e in n)t+=this.matrix[e][o]*n[e],n[e]=0;nr(r[o])&&(t+=r[o]);const s=Math.trunc(t);e[o]=s,n[o]=(1e3*t-1e3*s)/1e3}else nr(r[o])&&(n[o]=r[o]);for(const t in n)0!==n[t]&&(e[i]+=t===i?n[t]:n[t]/this.matrix[i][t]);return Fi(this.matrix,e),Ai(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Ai(this,{values:t},!0)}removeZeros(){return this.isValid?Ai(this,{values:Wi(this.values)},!0):this}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;function e(t,e){return void 0===t||0===t?void 0===e||0===e:t===e}for(const n of Ri)if(!e(this.values[n],t.values[n]))return!1;return!0}}const qi="Invalid Interval";class Bi{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the Interval is invalid");const n=t instanceof Wn?t:new Wn(t,e);if(Fn.throwOnInvalid)throw new Se(n);return new Bi({invalid:n})}static fromDateTimes(t,e){const n=Ro(t),r=Ro(e),i=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?Bi.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:Bi.invalid("missing or invalid end"):Bi.invalid("missing or invalid start")}(n,r);return null==i?new Bi({start:n,end:r}):i}static after(t,e){const n=Li.fromDurationLike(e),r=Ro(t);return Bi.fromDateTimes(r,r.plus(n))}static before(t,e){const n=Li.fromDurationLike(e),r=Ro(t);return Bi.fromDateTimes(r.minus(n),r)}static fromISO(t,e){const[n,r]=(t||"").split("/",2);if(n&&r){let t,i,o,s;try{t=Po.fromISO(n,e),i=t.isValid}catch(r){i=!1}try{o=Po.fromISO(r,e),s=o.isValid}catch(r){s=!1}if(i&&s)return Bi.fromDateTimes(t,o);if(i){const n=Li.fromISO(r,e);if(n.isValid)return Bi.after(t,n)}else if(s){const t=Li.fromISO(n,e);if(t.isValid)return Bi.before(o,t)}}return Bi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const n=this.start.startOf(t,e);let r;return r=e?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(t,e),Math.floor(r.diff(n,t).get(t))+(r.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&this.s<=t&&this.e>t}set({start:t,end:e}={}){return this.isValid?Bi.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Ro).filter(t=>this.contains(t)).sort((t,e)=>t.toMillis()-e.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const t=e[i]||this.e,o=+t>+this.e?this.e:t;n.push(Bi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(t){const e=Li.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const t=this.start.plus(e.mapUnits(t=>t*i));n=+t>+this.e?this.e:t,o.push(Bi.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e===+t.s}abutsEnd(t){return!!this.isValid&&+t.e===+this.s}engulfs(t){return!!this.isValid&&this.s<=t.s&&this.e>=t.e}equals(t){return!(!this.isValid||!t.isValid)&&this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return e>=n?null:Bi.fromDateTimes(e,n)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return Bi.fromDateTimes(e,n)}static merge(t){const[e,n]=t.sort((t,e)=>t.s-e.s).reduce(([t,e],n)=>e?e.overlaps(n)||e.abutsStart(n)?[t,e.union(n)]:[t.concat([e]),n]:[t,n],[[],null]);return n&&e.push(n),e}static xor(t){let e=null,n=0;const r=[],i=t.map(t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}]),o=[].concat(...i).sort((t,e)=>t.time-e.time);for(const t of o)n+="s"===t.type?1:-1,1===n?e=t.time:(e&&+e!==+t.time&&r.push(Bi.fromDateTimes(e,t.time)),e=null);return Bi.merge(r)}difference(...t){return Bi.xor([this].concat(t)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:qi}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Me,e={}){return this.isValid?Br.create(this.s.loc.clone(e),t).formatInterval(this):qi}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:qi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:qi}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:qi}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:qi}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):Li.invalid(this.invalidReason)}mapEndpoints(t){return Bi.fromDateTimes(t(this.s),t(this.e))}}class Hi{static hasDST(t=Fn.defaultZone){const e=Po.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return sn.isValidZone(t)}static normalizeZone(t){return $n(t,Fn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(e,n,i)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(e,n,i)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(e,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(e,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return xn.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return xn.create(e,null,"gregory").eras(t)}static features(){return{relative:ir(),localeWeek:or()}}}function Ui(t,e){const n=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(Li.fromMillis(r).as("days"))}function Zi(t,e=t=>t){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(-1!==t[n].search(Nn.hanidec))e+=Tn.indexOf(t[n]);else for(const t in En){const[n,i]=En[t];r>=n&&r<=i&&(e+=r-n)}}return parseInt(e,10)}return e}(t))}}const Gi=`[ ${String.fromCharCode(160)}]`,Yi=new RegExp(Gi,"g");function Ji(t){return t.replace(/\./g,"\\.?").replace(Yi,Gi)}function Vi(t){return t.replace(/\./g,"").replace(Yi," ").toLowerCase()}function Qi(t,e){return null===t?null:{regex:RegExp(t.map(Ji).join("|")),deser:([n])=>t.findIndex(t=>Vi(n)===Vi(t))+e}}function Xi(t,e){return{regex:t,deser:([,t,e])=>kr(t,e),groups:e}}function Ki(t){return{regex:t,deser:([t])=>t}}const to={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let eo=null;function no(t,e){return[].concat(...t.map(t=>function(t,e){if(t.literal)return t;const n=oo(Br.macroTokenToFormatOpts(t.val),e);return null==n||n.includes(void 0)?t:n}(t,e)))}class ro{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=no(Br.parseFormat(e),t),this.units=this.tokens.map(e=>function(t,e){const n=In(e),r=In(e,"{2}"),i=In(e,"{3}"),o=In(e,"{4}"),s=In(e,"{6}"),a=In(e,"{1,2}"),c=In(e,"{1,3}"),u=In(e,"{1,6}"),l=In(e,"{1,9}"),d=In(e,"{2,4}"),h=In(e,"{4,6}"),f=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return f(m);switch(m.val){case"G":return Qi(e.eras("short"),0);case"GG":return Qi(e.eras("long"),0);case"y":return Zi(u);case"yy":case"kk":return Zi(d,xr);case"yyyy":case"kkkk":return Zi(o);case"yyyyy":return Zi(h);case"yyyyyy":return Zi(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Zi(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Zi(r);case"MMM":return Qi(e.months("short",!0),1);case"MMMM":return Qi(e.months("long",!0),1);case"LLL":return Qi(e.months("short",!1),1);case"LLLL":return Qi(e.months("long",!1),1);case"o":case"S":return Zi(c);case"ooo":case"SSS":return Zi(i);case"u":return Ki(l);case"uu":return Ki(a);case"uuu":case"E":case"c":return Zi(n);case"a":return Qi(e.meridiems(),0);case"EEE":return Qi(e.weekdays("short",!1),1);case"EEEE":return Qi(e.weekdays("long",!1),1);case"ccc":return Qi(e.weekdays("short",!0),1);case"cccc":return Qi(e.weekdays("long",!0),1);case"Z":case"ZZ":return Xi(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Xi(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Ki(/[a-z_+-/]{1,256}?/i);case" ":return Ki(/[^\S\n\r]/);default:return f(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t)),this.disqualifyingUnit=this.units.find(t=>t.invalidReason),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map(t=>t.regex).reduce((t,e)=>`${t}(${e.source})`,"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,n]=function(t,e,n){const r=t.match(e);if(r){const t={};let e=1;for(const i in n)if(ar(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(t[o.token.val[0]]=o.deser(r.slice(e,e+s))),e+=s}return[r,t]}return[r,{}]}(t,this.regex,this.handlers),[r,i,o]=n?function(t){let e,n=null;er(t.z)||(n=sn.create(t.z)),er(t.Z)||(n||(n=new kn(t.Z)),e=t.Z),er(t.q)||(t.M=3*(t.q-1)+1),er(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),er(t.u)||(t.S=fr(t.u));const r=Object.keys(t).reduce((e,n)=>{const r=(t=>{switch(t){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(n);return r&&(e[r]=t[n]),e},{});return[r,n,e]}(n):[null,null,void 0];if(ar(n,"a")&&ar(n,"H"))throw new _e("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:n,result:r,zone:i,specificOffset:o}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function io(t,e,n){return new ro(t,n).explainFromTokens(e)}function oo(t,e){if(!t)return null;const n=Br.create(e,t).dtFormatter((eo||(eo=Po.fromMillis(1555555555555)),eo)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(e=>function(t,e,n){const{type:r,value:i}=t;if("literal"===r){const t=/^\s+$/.test(i);return{literal:!t,val:t?" ":i}}const o=e[r];let s=r;"hour"===r&&(s=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=to[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(e,t,i))}const so="Invalid DateTime",ao=864e13;function co(t){return new Wn("unsupported zone",`the zone "${t.name}" is not supported`)}function uo(t){return null===t.weekData&&(t.weekData=Yn(t.c)),t.weekData}function lo(t){return null===t.localWeekData&&(t.localWeekData=Yn(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function ho(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Po({...n,...e,old:n})}function fo(t,e,n){let r=t-60*e*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=60*(i-e)*1e3;const o=n.offset(r);return i===o?[r,i]:[t-60*Math.min(i,o)*1e3,Math.max(i,o)]}function mo(t,e){const n=new Date(t+=60*e*1e3);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function po(t,e,n){return fo(vr(t),e,n)}function go(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),o={...t.c,year:r,month:i,day:Math.min(t.c.day,yr(r,i))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},s=Li.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=vr(o);let[c,u]=fo(a,n,t.zone);return 0!==s&&(c+=s,u=t.zone.offset(c)),{ts:c,o:u}}function yo(t,e,n,r,i,o){const{setZone:s,zone:a}=n;if(t&&0!==Object.keys(t).length||e){const r=e||a,i=Po.fromObject(t,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Po.invalid(new Wn("unparsable",`the input "${i}" can't be parsed as ${r}`))}function vo(t,e,n=!0){return t.isValid?Br.create(xn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function wo(t,e,n){const r=t.c.year>9999||t.c.year<0;let i="";if(r&&t.c.year>=0&&(i+="+"),i+=lr(t.c.year,r?6:4),"year"===n)return i;if(e){if(i+="-",i+=lr(t.c.month),"month"===n)return i;i+="-"}else if(i+=lr(t.c.month),"month"===n)return i;return i+=lr(t.c.day),i}function bo(t,e,n,r,i,o,s){let a=!n||0!==t.c.millisecond||0!==t.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=lr(t.c.hour),"hour"===s)break;if(e){if(c+=":",c+=lr(t.c.minute),"minute"===s)break;a&&(c+=":",c+=lr(t.c.second))}else{if(c+=lr(t.c.minute),"minute"===s)break;a&&(c+=lr(t.c.second))}if("second"===s)break;!a||r&&0===t.c.millisecond||(c+=".",c+=lr(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&0===t.offset&&!o?c+="Z":t.o<0?(c+="-",c+=lr(Math.trunc(-t.o/60)),c+=":",c+=lr(Math.trunc(-t.o%60))):(c+="+",c+=lr(Math.trunc(t.o/60)),c+=":",c+=lr(Math.trunc(t.o%60)))),o&&(c+="["+t.zone.ianaName+"]"),c}const xo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},So={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ko={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_o=["year","month","day","hour","minute","second","millisecond"],$o=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],No=["year","ordinal","hour","minute","second","millisecond"];function Eo(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new $e(t);return e}function To(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Eo(t)}}function Co(t,e){const n=$n(e.zone,Fn.defaultZone);if(!n.isValid)return Po.invalid(co(n));const r=xn.fromObject(e);let i,o;if(er(t.year))i=Fn.now();else{for(const e of _o)er(t[e])&&(t[e]=xo[e]);const e=Kn(t)||tr(t);if(e)return Po.invalid(e);const r=function(t){if(void 0===Do&&(Do=Fn.now()),"iana"!==t.type)return t.offset(Do);const e=t.name;let n=Oo.get(e);return void 0===n&&(n=t.offset(Do),Oo.set(e,n)),n}(n);[i,o]=po(t,r,n)}return new Po({ts:i,zone:n,loc:r,o:o})}function Io(t,e,n){const r=!!er(n.round)||n.round,i=er(n.rounding)?"trunc":n.rounding,o=(t,o)=>(t=mr(t,r||n.calendary?0:2,n.calendary?"round":i),e.loc.clone(n).relFormatter(n).format(t,o)),s=r=>n.calendary?e.hasSame(t,r)?0:e.startOf(r).diff(t.startOf(r),r).get(r):e.diff(t,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const t of n.units){const e=s(t);if(Math.abs(e)>=1)return o(e,t)}return o(t>e?-0:0,n.units[n.units.length-1])}function Mo(t){let e,n={};return t.length>0&&"object"==typeof t[t.length-1]?(n=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[n,e]}let Do;const Oo=new Map;class Po{constructor(t){const e=t.zone||Fn.defaultZone;let n=t.invalid||(Number.isNaN(t.ts)?new Wn("invalid input"):null)||(e.isValid?null:co(e));this.ts=er(t.ts)?Fn.now():t.ts;let r=null,i=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[r,i]=[t.old.c,t.old.o];else{const o=nr(t.o)&&!t.old?t.o:e.offset(this.ts);r=mo(this.ts,o),n=Number.isNaN(r.year)?new Wn("invalid input"):null,r=n?null:r,i=n?null:o}this.ot=e,this.loc=t.loc||xn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Po({})}static local(){const[t,e]=Mo(arguments),[n,r,i,o,s,a,c]=e;return Co({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static utc(){const[t,e]=Mo(arguments),[n,r,i,o,s,a,c]=e;return t.zone=kn.utcInstance,Co({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static fromJSDate(t,e={}){const n=function(t){return"[object Date]"==={}.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(n))return Po.invalid("invalid input");const r=$n(e.zone,Fn.defaultZone);return r.isValid?new Po({ts:n,zone:r,loc:xn.fromObject(e)}):Po.invalid(co(r))}static fromMillis(t,e={}){if(nr(t))return t<-ao||t>ao?Po.invalid("Timestamp out of range"):new Po({ts:t,zone:$n(e.zone,Fn.defaultZone),loc:xn.fromObject(e)});throw new Ne(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(nr(t))return new Po({ts:1e3*t,zone:$n(e.zone,Fn.defaultZone),loc:xn.fromObject(e)});throw new Ne("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const n=$n(e.zone,Fn.defaultZone);if(!n.isValid)return Po.invalid(co(n));const r=xn.fromObject(e),i=$r(t,To),{minDaysInFirstWeek:o,startOfWeek:s}=Xn(i,r),a=Fn.now(),c=er(e.specificOffset)?n.offset(a):e.specificOffset,u=!er(i.ordinal),l=!er(i.year),d=!er(i.month)||!er(i.day),h=l||d,f=i.weekYear||i.weekNumber;if((h||u)&&f)throw new _e("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new _e("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=mo(a,c);m?(p=$o,g=So,y=Yn(y,o,s)):u?(p=No,g=ko,y=Vn(y)):(p=_o,g=xo);let v=!1;for(const t of p)er(i[t])?i[t]=v?g[t]:y[t]:v=!0;const w=m?function(t,e=4,n=1){const r=rr(t.weekYear),i=ur(t.weekNumber,1,br(t.weekYear,e,n)),o=ur(t.weekday,1,7);return r?i?!o&&Bn("weekday",t.weekday):Bn("week",t.weekNumber):Bn("weekYear",t.weekYear)}(i,o,s):u?function(t){const e=rr(t.year),n=ur(t.ordinal,1,gr(t.year));return e?!n&&Bn("ordinal",t.ordinal):Bn("year",t.year)}(i):Kn(i),b=w||tr(i);if(b)return Po.invalid(b);const x=m?Jn(i,o,s):u?Qn(i):i,[S,k]=po(x,c,n),_=new Po({ts:S,zone:n,o:k,loc:r});return i.weekday&&h&&t.weekday!==_.weekday?Po.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${_.toISO()}`):_.isValid?_:Po.invalid(_.invalid)}static fromISO(t,e={}){const[n,r]=function(t){return Gr(t,[wi,ki],[bi,_i],[xi,$i],[Si,Ni])}(t);return yo(n,r,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[n,r]=function(t){return Gr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[hi,fi])}(t);return yo(n,r,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[n,r]=function(t){return Gr(t,[mi,yi],[pi,yi],[gi,vi])}(t);return yo(n,r,e,"HTTP",e)}static fromFormat(t,e,n={}){if(er(t)||er(e))throw new Ne("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,u]=function(t,e,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=io(t,e,n);return[r,i,o,s]}(o,t,e);return u?Po.invalid(u):yo(s,a,n,`format ${e}`,t,c)}static fromString(t,e,n={}){return Po.fromFormat(t,e,n)}static fromSQL(t,e={}){const[n,r]=function(t){return Gr(t,[Ti,ki],[Ci,Ii])}(t);return yo(n,r,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the DateTime is invalid");const n=t instanceof Wn?t:new Wn(t,e);if(Fn.throwOnInvalid)throw new xe(n);return new Po({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const n=oo(t,xn.fromObject(e));return n?n.map(t=>t?t.val:null).join(""):null}static expandFormat(t,e={}){return no(Br.parseFormat(t),xn.fromObject(e)).map(t=>t.val).join("")}static resetCache(){Do=void 0,Oo.clear()}get(t){return this[t]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this.ot}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?uo(this).weekYear:NaN}get weekNumber(){return this.isValid?uo(this).weekNumber:NaN}get weekday(){return this.isValid?uo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?lo(this).weekday:NaN}get localWeekNumber(){return this.isValid?lo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?lo(this).weekYear:NaN}get ordinal(){return this.isValid?Vn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Hi.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Hi.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Hi.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Hi.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const t=864e5,e=6e4,n=vr(this.c),r=this.zone.offset(n-t),i=this.zone.offset(n+t),o=this.zone.offset(n-r*e),s=this.zone.offset(n-i*e);if(o===s)return[this];const a=n-o*e,c=n-s*e,u=mo(a,o),l=mo(c,s);return u.hour===l.hour&&u.minute===l.minute&&u.second===l.second&&u.millisecond===l.millisecond?[ho(this,{ts:a}),ho(this,{ts:c})]:[this]}get isInLeapYear(){return pr(this.year)}get daysInMonth(){return yr(this.year,this.month)}get daysInYear(){return this.isValid?gr(this.year):NaN}get weeksInWeekYear(){return this.isValid?br(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?br(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:n,calendar:r}=Br.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:n,outputCalendar:r}}toUTC(t=0,e={}){return this.setZone(kn.instance(t),e)}toLocal(){return this.setZone(Fn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:n=!1}={}){if((t=$n(t,Fn.defaultZone)).equals(this.zone))return this;if(t.isValid){let r=this.ts;if(e||n){const e=t.offset(this.ts),n=this.toObject();[r]=po(n,e,t)}return ho(this,{ts:r,zone:t})}return Po.invalid(co(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:n}={}){return ho(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:n})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=$r(t,To),{minDaysInFirstWeek:n,startOfWeek:r}=Xn(e,this.loc),i=!er(e.weekYear)||!er(e.weekNumber)||!er(e.weekday),o=!er(e.ordinal),s=!er(e.year),a=!er(e.month)||!er(e.day),c=s||a,u=e.weekYear||e.weekNumber;if((c||o)&&u)throw new _e("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new _e("Can't mix ordinal dates with month/day");let l;i?l=Jn({...Yn(this.c,n,r),...e},n,r):er(e.ordinal)?(l={...this.toObject(),...e},er(e.day)&&(l.day=Math.min(yr(l.year,l.month),l.day))):l=Qn({...Vn(this.c),...e});const[d,h]=po(l,this.o,this.zone);return ho(this,{ts:d,o:h})}plus(t){return this.isValid?ho(this,go(this,Li.fromDurationLike(t))):this}minus(t){return this.isValid?ho(this,go(this,Li.fromDurationLike(t).negate())):this}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const n={},r=Li.normalizeUnit(t);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0}if("weeks"===r)if(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(n.weekNumber=this.weekNumber-1),n.weekday=t}else n.weekday=1;if("quarters"===r){const t=Math.ceil(this.month/3);n.month=3*(t-1)+1}return this.set(n)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?Br.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):so}toLocaleString(t=Me,e={}){return this.isValid?Br.create(this.loc.clone(e),t).formatDateTime(this):so}toLocaleParts(t={}){return this.isValid?Br.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===t;let a=wo(this,s,o=Eo(o));return _o.indexOf(o)>=3&&(a+="T"),a+=bo(this,s,e,n,r,i,o),a}toISODate({format:t="extended",precision:e="day"}={}){return this.isValid?wo(this,"extended"===t,Eo(e)):null}toISOWeekDate(){return vo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Eo(s),(r&&_o.indexOf(s)>=3?"T":"")+bo(this,"extended"===o,e,t,n,i,s)):null}toRFC2822(){return vo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return vo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?wo(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(e||t)&&(n&&(r+=" "),e?r+="z":t&&(r+="ZZ")),vo(this,r,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():so}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",n={}){if(!this.isValid||!t.isValid)return Li.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=e,Array.isArray(a)?a:[a]).map(Li.normalizeUnit),o=t.valueOf()>this.valueOf(),s=function(t,e,n,r){let[i,o,s,a]=function(t,e,n){const r=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const n=Ui(t,e);return(n-n%7)/7}],["days",Ui]],i={},o=t;let s,a;for(const[c,u]of r)n.indexOf(c)>=0&&(s=c,i[c]=u(t,e),a=o.plus(i),a>e?(i[c]--,(t=o.plus(i))>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}(t,e,n);const c=e-i,u=n.filter(t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0);0===u.length&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const l=Li.fromObject(o,r);return u.length>0?Li.fromMillis(c,r).shiftTo(...u).plus(l):l}(o?this:t,o?t:this,i,r);var a;return o?s.negate():s}diffNow(t="milliseconds",e={}){return this.diff(Po.now(),t,e)}until(t){return this.isValid?Bi.fromDateTimes(this,t):this}hasSame(t,e,n){if(!this.isValid)return!1;const r=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(e,n)<=r&&r<=i.endOf(e,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||Po.fromObject({},{zone:this.zone}),n=t.padding?this<e?-t.padding:t.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=t.unit;return Array.isArray(t.unit)&&(r=t.unit,i=void 0),Io(e,this.plus(n),{...t,numeric:"always",units:r,unit:i})}toRelativeCalendar(t={}){return this.isValid?Io(t.base||Po.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(Po.isDateTime))throw new Ne("min requires all arguments be DateTimes");return sr(t,t=>t.valueOf(),Math.min)}static max(...t){if(!t.every(Po.isDateTime))throw new Ne("max requires all arguments be DateTimes");return sr(t,t=>t.valueOf(),Math.max)}static fromFormatExplain(t,e,n={}){const{locale:r=null,numberingSystem:i=null}=n;return io(xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,n={}){return Po.fromFormatExplain(t,e,n)}static buildFormatParser(t,e={}){const{locale:n=null,numberingSystem:r=null}=e,i=xn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new ro(i,t)}static fromFormatParser(t,e,n={}){if(er(t)||er(e))throw new Ne("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(e.locale))throw new Ne(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${e.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:u}=e.explainFromTokens(t);return u?Po.invalid(u):yo(s,a,n,`format ${e.format}`,t,c)}static get DATE_SHORT(){return Me}static get DATE_MED(){return De}static get DATE_MED_WITH_WEEKDAY(){return Oe}static get DATE_FULL(){return Pe}static get DATE_HUGE(){return Re}static get TIME_SIMPLE(){return je}static get TIME_WITH_SECONDS(){return Ae}static get TIME_WITH_SHORT_OFFSET(){return ze}static get TIME_WITH_LONG_OFFSET(){return Fe}static get TIME_24_SIMPLE(){return We}static get TIME_24_WITH_SECONDS(){return Le}static get TIME_24_WITH_SHORT_OFFSET(){return qe}static get TIME_24_WITH_LONG_OFFSET(){return Be}static get DATETIME_SHORT(){return He}static get DATETIME_SHORT_WITH_SECONDS(){return Ue}static get DATETIME_MED(){return Ze}static get DATETIME_MED_WITH_SECONDS(){return Ge}static get DATETIME_MED_WITH_WEEKDAY(){return Ye}static get DATETIME_FULL(){return Je}static get DATETIME_FULL_WITH_SECONDS(){return Ve}static get DATETIME_HUGE(){return Qe}static get DATETIME_HUGE_WITH_SECONDS(){return Xe}}function Ro(t){if(Po.isDateTime(t))return t;if(t&&t.valueOf&&nr(t.valueOf()))return Po.fromJSDate(t);if(t&&"object"==typeof t)return Po.fromObject(t);throw new Ne(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function jo({title:t,description:e,children:n,noSubscription:r,hideHeader:i}){return Et("div",{className:ce.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:re.colors.accent}),children:Et("div",{className:ce.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Et("div",{className:ce.create("page-heading-wrapper",{width:"100%",marginBottom:re.spacing.lg}),children:Et(ge,{children:Et("div",{className:ce.create("page-heading-container",{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,borderRadius:re.radius.large,padding:`${re.spacing.lg} ${re.spacing.xl}`,boxShadow:re.shadow.md}),children:Et("div",{className:ce.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:re.spacing.lg}),children:Et("div",{className:ce.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Et("h1",{className:ce.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:re.colors.primaryForeground,letterSpacing:"-0.025em"}),children:t}),e&&Et("p",{className:ce.create("page-template-description",{margin:"0",marginTop:re.spacing.sm,fontSize:re.fontSize.small,lineHeight:"1.5",color:re.colors.primaryForeground,opacity:"0.85"}),children:e})]})})})})}),n]})})}function Ao({className:t,children:e}){const n=ce.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Et("div",{className:me(n,t),children:e})}function zo({message:t}){return Et(jo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Et(ge,{children:Et(Ao,{className:ce.name("loading-container"),children:Et(pe,{size:"large"})})})})}function Fo({variant:t="primary",type:e="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,boxShadow:re.shadow.sm},outline:{border:`${re.borderWidth} solid ${re.colors.primary}`,backgroundColor:re.colors.card,color:re.colors.primary,boxShadow:re.shadow.sm}},u=ce.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:re.radius.default,cursor:"pointer",fontSize:re.fontSize.default,fontWeight:"500",transition:re.transition,fontFamily:re.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});ce.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),ce.pseudoElement(`button-${t}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:re.shadow.md}),ce.pseudoElement(`button-${t}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:re.shadow.sm});const l=ce.create(`button-${t}`,{...c[t]});return Et("button",{type:e,className:me(u,l,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Et(pe,{size:"small"}),o]})}function Wo({error:t}){ce.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:re.colors.background,textAlign:"center"});const e=ce.create("error-fallback-icon",{width:"4rem",height:"4rem",color:re.colors.destructive,marginBottom:"1.5rem"}),n=ce.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:re.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});ce.create("error-fallback-message",{fontSize:re.fontSize.large,color:re.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=ce.create("error-fallback-details",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,backgroundColor:re.colors.muted,padding:"1rem",borderRadius:re.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=ce.create("error-fallback-support",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=ce.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=t||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return Et(jo,{title:s.title,description:s.message,noSubscription:!0,children:Et(ge,{children:Et(Ao,{className:ce.name("loading-container"),children:[Et(()=>Et("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),{}),Et("h1",{className:n,children:s.title}),s.details&&Et("div",{className:r,children:[Et("strong",{children:"Error Details:"}),Et("br",{}),s.details,s.statusCode&&Et(k,{children:[Et("br",{}),Et("strong",{children:"Status Code:"})," ",s.statusCode]})]}),Et("p",{className:i,children:dt(s)}),Et("div",{className:o,children:Et(Fo,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function Lo({message:t,estimatedTime:e}){const n=ce.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=ce.create("maintenance-icon",{width:"4rem",height:"4rem",color:re.colors.primary,marginBottom:"1.5rem"}),i=ce.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:re.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=ce.create("maintenance-message",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=ce.create("maintenance-info-box",{backgroundColor:re.colors.muted,borderRadius:re.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=ce.create("maintenance-info-title",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,marginBottom:"0.5rem"}),c=ce.create("maintenance-info-text",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.4"}),u=ce.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Et(jo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Et(ge,{children:Et(Ao,{children:Et("div",{className:n,children:[Et(()=>Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:r,children:Et("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),{}),Et("h1",{className:i,children:"We'll be right back"}),Et("p",{className:o,children:t||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Et("div",{className:s,children:[Et("p",{className:a,children:"What's happening?"}),Et("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),e&&Et("p",{className:c,style:{marginTop:"0.5rem"},children:[Et("strong",{children:"Estimated time:"})," ",e]})]}),Et("div",{className:u,children:Et(Fo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function qo({children:t}){return Et("div",{className:ce.create("column",{display:"flex",flexDirection:"column",alignItems:"start",gap:"2rem"}),children:t})}function Bo({size:t="default",style:e="normal",className:n,children:r}){const i=ce.create("text",{marginTop:"0",marginBottom:"0"}),o=ce.create("text-small",{fontSize:re.fontSize.small}),s=ce.create("text-default",{fontSize:re.fontSize.default}),a=ce.create("text-italic",{fontStyle:"italic"}),c=ce.create("text-bold",{fontWeight:"bold"}),u=ce.create("text-underline",{textDecoration:"underline"}),l=me({[a]:"italic"===e,[c]:"bold"===e,[u]:"underline"===e}),d=me({[o]:"small"===t,[s]:"default"===t});return Et("p",{className:me(i,d,l,n),children:r})}function Ho({title:t,description:e}){return Et("div",{className:ce.create("section-header",{}),children:[Et("p",{className:ce.create("section-title",{fontSize:re.fontSize.large,margin:"0",color:re.colors.foreground}),children:t}),e&&Et(Bo,{className:ce.create("section-description",{color:re.colors.mutedForeground,margin:"0.25rem 0 0 0"}),children:"Choose your excess amount - the amount you'll pay if you need to make a claim"})]})}function Uo({selected:t}){return Et("div",{className:me(ce.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${re.borderWidth} solid transparent`}),t?ce.create("selected-indicator-selected",{backgroundColor:re.colors.primary}):ce.create("selected-indicator-unselected",{border:`${re.borderWidth} solid ${re.colors.border}`}))})}function Zo({excessOptions:t,selectedExcessId:e,onExcessSelect:n}){const r=[...t].sort((t,e)=>t.excess_amount-e.excess_amount);return Et("div",{className:ce.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Et(Ho,{title:"Excess Options"}),Et("div",{className:ce.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(t=>{const r=t.id===e;return Et("div",{className:me(ce.create("excess-option-card",{borderRadius:re.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?ce.create("excess-option-card-selected",{border:`2px solid ${re.colors.primary}`,backgroundColor:re.colors.accent}):ce.create("excess-option-card-unselected",{border:`2px solid ${re.colors.border}`,backgroundColor:re.colors.card})),onClick:()=>n(t.id),children:[Et(Uo,{selected:r}),Et("div",{className:ce.create("excess-amount",{color:re.colors.foreground}),children:["$",Number(t.excess_amount).toFixed(0)]})]},t.id)})})]})}function Go(t,e="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}function Yo(t){switch(t){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)} Installments`}}function Jo({paymentOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=Ut(()=>{if(!n)return[];const r=t.filter(t=>t.excess_id===n&&t.amount.success).map(t=>{const n=e.find(e=>e.id===t.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${t.gateway_id}`);return{...t,gateway:n}});return r.sort((t,e)=>("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0)-("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0))},[t,e,n]);return n?Et(Vo,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Et("div",{className:ce.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Et(Vo,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function Vo({sortedOptions:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=t.length>0;return Et("div",{className:ce.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Et(Ho,{title:"Payment Options"}),Et("div",r?{className:ce.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:t.map(t=>Et(Qo,{option:t,selectedPaymentOption:e,onPaymentSelect:n},`${t.gateway_id}-${t.excess_id}`))}:{className:ce.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${re.colors.border}`,borderRadius:re.radius.default,backgroundColor:re.colors.muted}),children:Et(Bo,{className:ce.create("placeholder-text",{color:re.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function Qo({option:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=(null==e?void 0:e.gateway_id)===t.gateway_id&&(null==e?void 0:e.excess_id)===t.excess_id;return Et("div",{className:me(ce.create("payment-option-row",{borderRadius:re.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?ce.create("payment-option-row-selected",{border:`2px solid ${re.colors.primary}`,backgroundColor:re.colors.accent}):ce.create("payment-option-row-unselected",{border:`2px solid ${re.colors.border}`,backgroundColor:re.colors.card})),onClick:()=>n(t),children:[Et(Uo,{selected:r}),Et("div",{className:ce.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[Et("div",{className:ce.create("frequency-title",{fontSize:re.fontSize.default,fontWeight:"500",color:re.colors.foreground}),children:Yo(t.amount.frequency)}),Et("div",{className:ce.create("gateway-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground}),children:["via ",t.gateway.name]})]}),Et("div",{className:ce.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[Et(Bo,{className:ce.create("amount-text",{textAlign:"right"}),children:"one-time"===t.amount.frequency?Go(t.amount.dueToday):`${Go(t.amount.installmentAmount||0)} x ${t.amount.numberOfInstallments}`}),Et(Bo,{size:"small",className:ce.create("gateway-fee-text",{textAlign:"right",color:re.colors.mutedForeground}),children:[Go(t.amount.gatewayFee)," fee"]})]})]})}function Xo({label:t,value:e,isTotal:n=!1,className:r}){return Et("div",{className:me(ce.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Et("span",{className:ce.create("summary-label",{color:re.colors.mutedForeground,fontSize:re.fontSize.small}),children:t}),Et("span",{className:ce.create("summary-value",{fontWeight:n?"600":"500",color:re.colors.foreground,fontSize:n?re.fontSize.large:"inherit"}),children:e})]})}function Ko({excessOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o}){const s=Ut(()=>n?t.find(t=>t.id===n):null,[t,n]),a=Ut(()=>r?e.find(t=>t.id===r.gateway_id):null,[e,r]);return Et("div",{className:ce.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Et(Ho,{title:"Payment Summary"}),Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Excess Amount"}),s?Et(Xo,{label:`$${Number(s.excess_amount).toFixed(0)} excess`,value:Go(s.premium_total)}):Et(Bo,{className:ce.create("summary-placeholder",{color:re.colors.mutedForeground,margin:"0",fontSize:re.fontSize.small}),children:"No excess selected"})]}),Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Payment Method"}),r&&a?Et("div",{className:ce.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:Et("div",{className:ce.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[Et("span",{className:ce.create("gateway-name",{fontWeight:"500",color:re.colors.foreground}),children:Yo(r.amount.frequency)}),Et("span",{className:ce.create("gateway-provider",{fontSize:re.fontSize.small,color:re.colors.mutedForeground}),children:["via ",a.name]})]})}):Et(Bo,{className:ce.create("summary-placeholder",{color:re.colors.mutedForeground,margin:"0",fontSize:re.fontSize.small}),children:"No payment method selected"})]}),r&&Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Payment Details"}),Et("div",{className:ce.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Et(k,{children:[Et(Xo,{label:"Total Due Today:",value:Go(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Et(Xo,{label:"Gateway Fee:",value:Go(r.amount.gatewayFee)})]}):Et(k,{children:[Et(Xo,{label:"Due Today:",value:Go(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Et(Xo,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:Go(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Et(Xo,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Et(k,{children:Et(Xo,{label:"Total Payable:",value:Go(r.amount.totalRepayable),className:ce.create("total-item",{})})})]})})]}),Et(Fo,{onClick:i,disabled:!o,className:ce.create("purchase-button",{width:"100%",height:"3rem",fontSize:re.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function ts({isOpen:t,onClose:e,onSuccess:n,onError:r,paymentRequest:i}){const{fsm:o}=we(()=>({})),[s,a]=qt("initiating"),[c,u]=qt(null),[l,d]=qt(null),[h,f]=qt(null);Bt(()=>{t&&i&&m()},[t,i]);const m=async()=>{if(i)try{a("initiating"),u(null);const t={...i,returnUrl:window.location.href},e=await o.initiatePayment(t);f(e.transaction_id),a("redirecting"),window.location.href=e.gateway_acceptance_url}catch(t){u(t.message||"Failed to initiate payment"),a("failed")}},p=()=>{l&&!l.closed&&l.close(),a("initiating"),u(null),f(null),d(null),e()};return t?Et("div",{className:ce.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[Et("div",{className:ce.create("modal-content",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Et("div",{className:ce.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(s){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Et("h2",{className:ce.create("modal-title",{margin:"0",color:re.colors.foreground,fontSize:re.fontSize.large}),children:"Payment Processing"})]}),Et("div",{className:ce.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Et(Bo,{className:ce.create("status-message",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(s){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),c&&Et(Bo,{className:ce.create("error-message",{color:re.colors.destructive,fontSize:re.fontSize.small,padding:"0.75rem",backgroundColor:re.colors.destructive+"10",borderRadius:re.radius.default,border:`1px solid ${re.colors.destructive}30`}),children:c}),("redirecting"===s||"initiating"===s)&&Et("div",{className:ce.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${re.colors.border}`,borderTop:`3px solid ${re.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Et("div",{className:ce.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===s||"cancelled"===s?Et(k,{children:[Et(Fo,{onClick:p,variant:"outline",children:"Close"}),"cancelled"===s&&Et(Fo,{onClick:()=>{a("initiating"),u(null),m()},children:"Try Again"})]}):Et(Fo,"completed"===s?{onClick:p,children:"Continue"}:{onClick:p,variant:"outline",disabled:"initiating"===s,children:"Cancel"})})]}),Et("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function es({type:t,transactionId:e,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(t){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.primary||"#10b981"},children:Et("path",{d:"M20 6 9 17l-5-5"})}),buttonText:"Close"};case"declined":return{title:"Payment Declined",message:"Your payment was declined by the payment processor. Please try a different payment method or contact your bank.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.destructive},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"m15 9-6 6"}),Et("path",{d:"m9 9 6 6"})]}),buttonText:"Close"};case"cancelled":return{title:"Payment Cancelled",message:"You cancelled the payment process. You can try again when you're ready.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.secondary},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"m15 9-6 6"}),Et("path",{d:"m9 9 6 6"})]}),buttonText:"Continue"};default:return{title:"Payment Error",message:"There was an issue processing your payment. Please try again or contact support if the problem persists.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.destructive},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"M12 8v4"}),Et("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=ce.create("modal-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",padding:"1rem"}),s=ce.create("modal-content",{backgroundColor:re.colors.background,borderRadius:re.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${re.borderWidth} solid ${re.colors.border}`}),a=ce.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=ce.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:re.colors.foreground,margin:"0"}),u=ce.create("modal-message",{color:re.colors.foreground,lineHeight:"1.5",margin:"0"});ce.create("transaction-info",{backgroundColor:re.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:re.radius.small,border:`${re.borderWidth} solid ${re.colors.border}`,fontSize:re.fontSize.small,color:re.colors.mutedForeground,wordBreak:"break-all"});const l=ce.create("modal-button",{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,border:"none",borderRadius:re.radius.default,padding:"0.75rem 1.5rem",fontSize:re.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=ce.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Et("div",{className:o,onClick:r,children:Et("div",{className:s,onClick:t=>t.stopPropagation(),children:Et("div",{className:a,children:[i.icon,Et("div",{className:d,children:[Et("h2",{className:c,children:i.title}),Et("p",{className:u,children:i.message})]}),Et("button",{className:l,onClick:r,children:i.buttonText})]})})})}function ns({results:t}){const{fsm:e,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i}=we(t=>({selectedExcessId:t.getSelectedExcessId(),selectedPaymentOption:t.getSelectedPaymentOption(),quoteIntent:t.getQuoteIntent()})),[o,s]=qt(!1),[a,c]=qt(null),u=t.calculations,l=t.payment_options,d=t.payment_gateways;Bt(()=>{const t=u.find(t=>t.id===n);if(t&&i){const n=l.some(t=>"monthly"===t.amount.frequency),r=e.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);vt(i,t,l.length,n,o)}},[]);const h=Boolean(n&&r),f=null==i?void 0:i.payment_return,m=f&&("declined"===f.paymentStatus||"cancelled"===f.paymentStatus||"error"===f.paymentStatus);return ce.media("(max-width: 767px)",{"checkout-sidebar":{display:"none"}}),ce.media("(min-width: 768px)",{"checkout-actions-mobile":{display:"none"}}),Et(jo,{title:"Checkout",description:"Complete your insurance purchase",children:Et("div",{children:[Et("div",{className:ce.create("checkout-container",{display:"flex",flexDirection:"row",gap:"2rem",width:"100%",alignItems:"flex-start"},{"(max-width: 700px)":{flexDirection:"column"}}),children:[Et("div",{className:ce.create("checkout-main",{flex:"1",minWidth:"0"}),children:Et(qo,{children:[Et(Zo,{excessOptions:u,selectedExcessId:n,onExcessSelect:t=>e.setSelectedExcessId(t)}),Et(Jo,{paymentOptions:l,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:t=>e.setSelectedPaymentOption(t)})]})}),Et("div",{className:ce.create("checkout-sidebar",{width:"300px",flexShrink:"0",position:"sticky",display:"flex",flexDirection:"column",top:"2rem",height:"100%"},{"(max-width: 700px)":{position:"static",width:"100%"}}),children:Et(Ko,{excessOptions:u,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPurchase:()=>{if(!n||!r)return void alert("Please select both an excess amount and payment option");const e={quoteIntentId:t.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};c(e),s(!0)},canPurchase:h})})]}),m&&Et(es,{type:f.paymentStatus,transactionId:f.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{e.updateQuoteIntent({payment_return:void 0})}}),Et(ts,{isOpen:o,onClose:()=>{s(!1),c(null)},onSuccess:()=>{s(!1),c(null),alert("Payment completed successfully!")},onError:t=>{alert("Payment failed: "+t)},paymentRequest:a})]})})}function rs({results:t}){var e,n,r;const{quoteIntent:i}=we(t=>({quoteIntent:t.getQuoteIntent()})),o=null===(e=null==i?void 0:i.organisation)||void 0===e?void 0:e.admin_email,s=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,a=ce.create("referral-container",{display:"flex",flexDirection:"column",alignItems:"center",maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),c=ce.create("referral-icon",{width:"4rem",height:"4rem",color:re.colors.primary,marginBottom:"1.5rem"}),u=ce.create("referral-title",{fontSize:"1.875rem",fontWeight:"bold",color:re.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),l=ce.create("referral-subtitle",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"1rem",lineHeight:"1.5"});ce.create("referral-reason-box",{backgroundColor:re.colors.primary+"20",border:`1px solid ${re.colors.primary}40`,borderRadius:re.radius.default,padding:"1rem",marginBottom:"1.5rem",textAlign:"left"}),ce.create("referral-reason-title",{fontSize:re.fontSize.small,fontWeight:"600",color:re.colors.foreground,marginBottom:"0.5rem"}),ce.create("referral-reason-text",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.4"});const d=ce.create("referral-process-box",{backgroundColor:re.colors.muted,borderRadius:re.radius.default,padding:"1rem",marginBottom:"3rem",marginTop:"3rem",textAlign:"left"}),h=ce.create("referral-process-title",{fontSize:re.fontSize.large,fontWeight:"600",color:re.colors.foreground,marginBottom:"0.75rem",marginTop:"0.25rem"}),f=ce.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0"}),m=ce.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.4",marginBottom:"0.5rem"}),p=ce.create("referral-bullet",{width:"0.5rem",height:"0.5rem",backgroundColor:re.colors.primary,borderRadius:"50%",marginRight:"0.75rem",marginTop:"0.5rem",flexShrink:"0"}),g=ce.create("referral-contact-text",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,marginBottom:"1rem"});ce.create("referral-contact-box",{backgroundColor:re.colors.muted,borderRadius:re.radius.default,padding:"1.5rem",marginBottom:"2rem",textAlign:"left"}),ce.create("referral-contact-box-title",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,marginBottom:"1rem"}),ce.create("referral-contact-item",{display:"flex",alignItems:"center",fontSize:re.fontSize.small,color:re.colors.foreground,marginBottom:"0.75rem"}),ce.create("referral-contact-label",{fontWeight:"600",marginRight:"0.5rem",minWidth:"4rem"}),ce.create("referral-contact-value",{color:re.colors.mutedForeground});const y=ce.create("referral-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center",marginBottom:"2rem"}),v=ce.create("referral-reference",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,borderTop:`1px solid ${re.colors.border}`,paddingTop:"1rem"});return Et(jo,{title:"Quote Under Review",description:"We'll get back to you",children:Et(ge,{children:Et(Ao,{children:Et("div",{className:a,children:[Et(()=>Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:c,children:[Et("path",{d:"M7 10v12"}),Et("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),{}),Et("h1",{className:u,children:"Thank you for your submission"}),Et("p",{className:l,children:"Our team is reviewing your quote request."}),Et("div",{className:d,children:[Et("h3",{className:h,children:"What happens next?"}),Et("ul",{className:f,children:[Et("li",{className:m,children:[Et("span",{className:p}),"Our team will review your application within 1-2 business days"]}),Et("li",{className:m,children:[Et("span",{className:p}),"We'll contact you with either approval or additional requirements"]}),Et("li",{className:m,children:[Et("span",{className:p}),"If approved, we'll provide you with payment options to complete your purchase"]})]})]}),Et("p",{className:g,children:"Need to speak with someone about your quote?"}),Et("div",{className:y,children:[s&&Et(Fo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:"Call Us"}),o&&Et(Fo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:"Email Us"})]}),(null===(r=t.quote_intent)||void 0===r?void 0:r.id)&&Et("div",{className:v,children:["Quote Reference: ",t.quote_intent.id.slice(0,8).toUpperCase()]})]})})})})}function is({results:t}){return"referral"===t.outcome_type?Et(rs,{results:t}):Et(ns,{results:t})}function os({value:t,onChange:e,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:u="$"}){const l=Ht(null),[d,h]=qt("");function f(t){if(!t)return"";const e=t.replace(/[^\d.]/g,"");if(!e)return"";const n=e.split(".");let r=n[0];const i=n[1];r=r.replace(/^0+/,"")||"0";const o=r.replace(/\B(?=(\d{3})+(?!\d))/g,",");return void 0!==i?o+"."+i:o}Bt(()=>{h(null!=t&&""!==t?f(t):"")},[t]);const m=ce.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=ce.create("money-input-prefix",{position:"absolute",left:"1rem",color:re.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=ce.create("money-input-with-prefix",{paddingLeft:u?"2rem":"1rem"});return Et("div",{className:m,children:[u&&Et("span",{className:p,children:u}),Et("input",{ref:l,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(t){const n=t.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=f(o);h(s),e(o),requestAnimationFrame(()=>{if(l.current){const t=function(t,e,n){let r=n+(e.length-t.length);return r=Math.max(0,Math.min(r,e.length)),r}(i,s,r);l.current.setSelectionRange(t,t)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:me(a,u&&g)})]})}function ss(t){var e,n,r,i;const o=ce.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,fontSize:re.fontSize.default,backgroundColor:re.colors.card,color:re.colors.foreground,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none"});ce.pseudoElement("input",":focus",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const s=ce.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${re.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:re.fontSize.default,backgroundColor:"transparent",color:re.colors.foreground}),a=ce.create("select-wrapper",{border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,backgroundColor:re.colors.card,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none",overflow:"hidden"});ce.pseudoElement("select-wrapper",":focus-within",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const{onChange:c,className:u,validation:l,errors:d,...h}=t;function f(t){c(t.currentTarget.value)}function m(t){c(t.currentTarget.value)}if("select"===t.type)return Et("div",{className:a,children:Et("select",{...h,onChange:f,className:s,children:[Et("option",{value:"",children:"Select an option"}),null===(n=null===(e=t.validation)||void 0===e?void 0:e.options)||void 0===n?void 0:n.map(t=>Et("option",{value:t.value,children:t.label},t.value))]})});if("date"===t.type)return Et("input",{...h,type:"date",min:null===(r=t.validation)||void 0===r?void 0:r.minDate,max:null===(i=t.validation)||void 0===i?void 0:i.maxDate,onInput:m,onChange:f,className:me(o,u)});if("monthyear"===t.type){function p(t){const e=t.currentTarget.value;c(e?`${e}-01`:"")}const g=t.value?t.value.substring(0,7):"";return Et("input",{...h,type:"month",value:g,onInput:p,onChange:p,className:me(o,u)})}if("year"===t.type){const y=(new Date).getFullYear();return Et("input",{...h,type:"number",min:y-100,max:y,placeholder:"YYYY",onInput:m,onChange:f,className:me(o,u)})}if("money"===t.type)return Et(os,{value:t.value,onChange:c,name:t.name,id:t.id,placeholder:t.placeholder,required:t.required,disabled:t.disabled,className:me(o,u),hasError:t.hasError});if("checkbox"===t.type){const v=!0===t.value||"true"===t.value||"true"===t.value,w=ce.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),b=ce.create("checkbox-"+(v?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${v?re.colors.primary:t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:v?re.colors.primary:re.colors.card,transition:re.transition,position:"absolute"});function x(t){t.preventDefault(),c(v?"false":"true")}return ce.pseudoElement("checkbox-"+(v?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px ${re.colors.ring}20`}),Et("div",{className:w,children:[Et("input",{type:"checkbox",id:t.id,name:t.name,checked:v,onClick:x,className:me(b,u),required:t.required,readOnly:!0}),v&&Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:re.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Et("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===t.type){const S=ce.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),k=ce.create("boolean-radio-group",{display:"flex",gap:"1rem"}),_=ce.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),$=ce.create("boolean-radio",{accentColor:re.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),N=ce.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,fontSize:re.fontSize.default,backgroundColor:re.colors.card,color:re.colors.foreground,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none",resize:"vertical",fontFamily:re.fontFamily});ce.pseudoElement("boolean-textarea",":focus",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const E=!0===t.value||"true"===t.value,T=!1===t.value||"false"===t.value,C=t.answer||"",I=t.booleanConfig,M=(null==I?void 0:I.enable_details_textbox)&&("yes"===I.show_details_on&&E||"no"===I.show_details_on&&T);function D(e){c(e),(!(null==I?void 0:I.enable_details_textbox)||!("yes"===I.show_details_on&&"true"===e||"no"===I.show_details_on&&"false"===e))&&t.onAnswerChange&&t.onAnswerChange("")}return Et("div",{className:me(S,u),children:[Et("div",{className:k,children:[Et("label",{className:_,children:[Et("input",{type:"radio",name:t.name,checked:E,onChange:()=>D("true"),className:$}),Et("span",{children:"Yes"})]}),Et("label",{className:_,children:[Et("input",{type:"radio",name:t.name,checked:T,onChange:()=>D("false"),className:$}),Et("span",{children:"No"})]})]}),M&&Et("textarea",{placeholder:(null==I?void 0:I.details_placeholder)||"Please provide details",value:C,required:!0,onInput:e=>{return n=e.target.value,void(t.onAnswerChange&&t.onAnswerChange(n));var n},className:N})]})}return Et("input",{...h,onInput:m,onChange:f,className:me(o,u)})}function as({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,lastUpdated:i,isSaving:o}=we(t=>{var e,n;return{lastUpdated:null!==(n=null===(e=t.getFormProgress())||void 0===e?void 0:e.last_updated)&&void 0!==n?n:null,isSaving:t.getIsSaving()}}),s=Ht(null),a=Ht(null);Bt(()=>{if(s.current&&a.current){const t=a.current,e=s.current,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]);const c=Math.round((e+1)/t.length*100);return Et("div",{className:ce.create("sidebar-navigation",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.lg,boxShadow:re.shadow.sm,position:"sticky",top:re.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:re.spacing.lg}),children:[Et("div",{className:ce.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:re.spacing.sm}),children:[Et("span",{className:ce.create("sidebar-progress-text",{fontSize:re.fontSize.small,fontWeight:"600",color:re.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Et("div",{className:ce.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:re.colors.muted,borderRadius:re.radius.small,overflow:"hidden"}),children:Et("div",{className:ce.create("sidebar-progress-fill",{height:"100%",backgroundColor:re.colors.primary,borderRadius:re.radius.small,transition:re.transition,width:`${c}%`})})})]}),Et("hr",{className:ce.create("sidebar-divider",{borderColor:re.colors.border})}),Et("nav",{ref:a,className:ce.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:re.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:re.spacing.sm}),children:t.map((t,i)=>{const a=i===e,c=n.includes(i),u=r.canNavigateToPage(i),l=ce.create(`sidebar-nav-item-${i}`,{display:"flex",alignItems:"flex-start",gap:re.spacing.sm,padding:`${re.spacing.sm} ${re.spacing.sm}`,borderRadius:re.radius.default,border:"none",backgroundColor:a?re.colors.accent:"transparent",color:a?re.colors.accentForeground:re.colors.foreground,cursor:u&&!o?"pointer":"not-allowed",transition:re.transition,textAlign:"left",width:"100%",fontFamily:re.fontFamily,fontSize:re.fontSize.small,opacity:u&&!o?"1":"0.5"});return u&&!a&&ce.pseudoElement(`sidebar-nav-item-${i}`,":hover",{backgroundColor:re.colors.muted}),Et("button",{ref:a?s:null,onClick:()=>{return t=i,void(r.canNavigateToPage(t)&&r.navigateToPage(t));var t},disabled:!u||o,className:l,children:[Et("div",{className:ce.create(`sidebar-indicator-${i}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:c?re.colors.primary:a?re.colors.accentForeground:re.colors.muted,color:c?re.colors.primaryForeground:a?re.colors.accent:re.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})}):i+1}),Et("div",{className:ce.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:[Et("span",{className:ce.create("sidebar-page-title",{fontWeight:a?"600":"500",fontSize:"0.875rem",lineHeight:"1.4",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.title}),t.description&&Et("span",{className:ce.create("sidebar-page-description",{fontSize:"0.75rem",opacity:"0.7",lineHeight:"1.3",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.description})]})]},t.id)})}),Et("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&r.reset()},className:ce.create("sidebar-reset-button",{padding:`${re.spacing.sm} ${re.spacing.md}`,border:`${re.borderWidth} solid ${re.colors.border}`,borderRadius:re.radius.default,backgroundColor:"transparent",color:re.colors.mutedForeground,fontSize:re.fontSize.small,fontFamily:re.fontFamily,cursor:"pointer",transition:re.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),i&&Et("div",{className:ce.create("sidebar-last-saved",{fontSize:"0.6875rem",color:re.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Po.fromJSDate(new Date(i)).toFormat("T")]})]})}function cs({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,isSaving:i}=we(t=>({fsm:t,isSaving:t.getIsSaving()})),[o,s]=qt(!1),a=Math.round((e+1)/t.length*100);return Et("div",{className:ce.create("mobile-sidebar",{overflow:"hidden"}),children:[Et("button",{onClick:()=>s(!o),className:ce.create("mobile-sidebar-header",{width:"100%",padding:re.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:re.spacing.sm}),children:[Et("div",{className:ce.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Et("span",{className:ce.create("mobile-sidebar-step-text",{fontSize:re.fontSize.small,fontWeight:"600",color:re.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:ce.create("mobile-sidebar-chevron",{transition:re.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:re.colors.mutedForeground}),children:Et("path",{d:"m6 9 6 6 6-6"})})]}),Et("div",{className:ce.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:re.colors.muted,borderRadius:re.radius.small,overflow:"hidden"}),children:Et("div",{className:ce.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:re.colors.primary,borderRadius:re.radius.small,transition:re.transition,width:`${a}%`})})})]}),Et("hr",{className:ce.create("mobile-sidebar-border",{borderColor:re.colors.border})}),o&&Et("div",{className:ce.create("mobile-sidebar-content",{padding:re.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:t.map((t,o)=>{const a=o===e,c=n.includes(o),u=r.canNavigateToPage(o);return Et("button",{onClick:()=>{return t=o,void(r.canNavigateToPage(t)&&(r.navigateToPage(t),s(!1)));var t},disabled:!u||i,className:ce.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:re.spacing.sm,padding:re.spacing.sm,border:"none",borderRadius:re.radius.default,backgroundColor:a?re.colors.accent:"transparent",color:a?re.colors.accentForeground:re.colors.foreground,cursor:u&&!i?"pointer":"not-allowed",opacity:u&&!i?"1":"0.5",transition:re.transition,width:"100%",textAlign:"left",fontFamily:re.fontFamily}),children:[Et("div",{className:ce.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?re.colors.primary:a?re.colors.accentForeground:re.colors.muted,color:c?re.colors.primaryForeground:a?re.colors.accent:re.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Et("span",{className:ce.create("mobile-sidebar-page-title",{fontSize:re.fontSize.small,fontWeight:a?"600":"500"}),children:t.title})]},t.id)})})]})}function us({organisation:t}){return Et("div",{className:ce.create("welcome-card",{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},{"(max-width: 950px)":{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingTop:re.spacing.md}}),children:[Et("h2",{className:ce.create("welcome-title",{margin:"0",marginBottom:re.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:re.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:re.spacing.sm}}),children:["Thank you for choosing ",t.name,"."]}),Et("p",{className:ce.create("welcome-text",{margin:"0",fontSize:re.fontSize.default,lineHeight:"1.6",color:re.colors.foreground,opacity:"0.9"}),children:"Getting a quote online is quick and easy. Simply complete the form below with your details, and we'll provide you with a personalied quote. Our secure platform ensures your information is protected every step of the way."}),Et("hr",{className:ce.create("welcome-border",{marginTop:re.spacing.lg,borderColor:re.colors.border})})]})}function ls({title:t,description:e}){return Et(jo,{title:t,description:e,children:Et(ge,{children:Et(Ao,{className:ce.name("error-container"),children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-ban-icon lucide-ban",children:[Et("path",{d:"M4.929 4.929 19.07 19.071"}),Et("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function ds({errors:t,className:e}){return t&&0!==t.length?Et("div",{className:ce.create("field-error",{color:re.colors.destructive,fontSize:re.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:t.map((t,e)=>Et("span",{className:ce.create("field-error-message",{lineHeight:"1.4"}),children:t.message},e))}):null}function hs({htmlFor:t,label:e,children:n,required:r,tooltip:i,...o}){const[s,a]=qt(!1);return Et("label",{for:t,className:ce.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Et("span",{className:ce.create("label-text",{marginBottom:re.spacing.sm,fontSize:re.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:re.spacing.sm,color:re.colors.foreground}),children:[Et("span",{children:[e,r&&Et("span",{className:ce.create("label-required-indicator",{color:re.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Et("span",{className:ce.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Et("svg",{className:ce.create("tooltip-icon",{width:"1rem",height:"1rem",color:re.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Et("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Et("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Et("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Et("span",{className:ce.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:re.colors.popover,color:re.colors.popoverForeground,fontSize:"0.875rem",borderRadius:re.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Et("span",{className:ce.create("tooltip-arrow",{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`6px solid ${re.colors.popover}`})})]})]})]}),n]})}function fs(t){switch(null!=t?t:100){case 25:return ce.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return ce.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return ce.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return ce.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return ce.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return ce.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function ms(t){return t?t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,e,n)=>{const r=n.trim();return r.match(/^(https?:\/\/|mailto:)/i)?`<a href="${r}" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">${e}</a>`:t}):""}function ps({field:t,errors:e,children:n,className:r}){const i=t.code||t.id,o=(null==e?void 0:e.filter(t=>t.field===i))||[],s=ce.create("validated-field",{display:"flex",flexDirection:"column",gap:re.spacing.sm});if("checkbox"===t.type){const e=ce.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:re.spacing.sm}),a=ce.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=ce.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),u=ce.create("checkbox-label-text",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Et("div",{className:me(s,fs(t.width),r),children:[Et("div",{className:e,children:Et("div",{className:a,children:[Et("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Et("label",{htmlFor:i,className:c,children:[Et("span",{className:u,children:[t.label,t.required&&Et("span",{className:ce.create("checkbox-required-indicator",{color:re.colors.destructive}),children:"*"})]}),t.description&&Et("div",{className:ce.create("checkbox-field-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ms(t.description)}})]})]})}),Et(ds,{errors:o})]})}return Et("div",{className:me(s,fs(t.width),r),children:[Et(hs,{htmlFor:i,label:t.label,required:t.required,tooltip:t.tooltip,children:[t.description&&Et("div",{className:ce.create("field-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,marginBottom:re.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ms(t.description)}}),n]}),Et(ds,{errors:o})]})}function gs({error:t,onDismiss:e,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:re.colors.secondary+"08",borderColor:re.colors.secondary+"30",iconColor:re.colors.secondary,titleColor:re.colors.foreground},error:{backgroundColor:re.colors.destructive+"08",borderColor:re.colors.destructive,iconColor:re.colors.destructive,titleColor:re.colors.destructive},critical:{backgroundColor:re.colors.destructive+"10",borderColor:re.colors.destructive,iconColor:re.colors.destructive,titleColor:re.colors.destructive}}[t.severity],o=ce.create("error-card",{padding:re.spacing.md,borderRadius:re.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:re.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=ce.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=ce.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=ce.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),u=ce.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),l=ce.create("error-card-title",{fontSize:re.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=ce.create("error-card-message",{fontSize:re.fontSize.small,color:re.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=ce.create("error-card-details",{fontSize:"0.8125rem",color:re.colors.mutedForeground,fontFamily:"monospace",backgroundColor:re.colors.muted,padding:"0.625rem",borderRadius:re.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=ce.create("error-card-support",{fontSize:"0.8125rem",color:re.colors.mutedForeground,lineHeight:"1.4"}),m=ce.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:re.colors.mutedForeground,cursor:"pointer",borderRadius:re.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:re.transition});return ce.pseudoElement("error-card-dismiss",":hover",{backgroundColor:re.colors.muted,color:re.colors.foreground}),Et("div",{className:me(o,n),children:Et("div",{className:s,children:[Et(()=>"warning"===t.severity?Et("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}):Et("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),{}),Et("div",{className:c,children:[Et("div",{className:u,children:[Et("div",{className:l,children:t.title}),Et("div",{className:d,children:t.message}),r&&t.details&&Et("div",{className:h,children:t.details}),Et("div",{className:f,children:dt(t)})]}),e&&Et("button",{className:m,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none"},children:[Et("path",{d:"M18 6 6 18"}),Et("path",{d:"m6 6 12 12"})]})})]})]})})}function ys(t,e){const n=e.operator,r=e.value,i=null==r?"":String(r),o=null==t?"":String(t);switch(n){case"=":return o===i;case"!=":return o!==i;case"contains":return o.includes(i);case"not_contains":return!o.includes(i);case"starts_with":return o.startsWith(i);case"ends_with":return o.endsWith(i);case"is_empty":return void 0===t||null==t||""===t||""===t.trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function vs(t,e){const n=e.operator,r=null==e.value?0:Number(e.value),i=null==t?0:Number(t.toString().replace(/,/g,"").trim());switch(n){case">":return i>r;case">=":return i>=r;case"<":return i<r;case"<=":return i<=r;case"=":return i===r;case"!=":return i!==r;case"is_empty":return void 0===t||null==t||""===t||""===t.toString().trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function ws(t,e){const n=e.operator;switch(e.operator){case"true":return!0===t||"true"===t||1===t;case"false":return!1===t||"false"===t||0===t||void 0===t;case"=":return Boolean(t);case"!=":return!Boolean(t);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function bs(t,e){const n=e.operator,r=e.value,i=null==r?0:Number(e.value);if(null==t||""===t.toString().trim())return"is_empty"===n;const o=t.toString().trim(),s=/^\d{4}$/.test(o)&&Number(o)>=1900&&Number(o)<=2100?new Date(Number(o),0,1).getTime():Date.parse(o),a=Math.floor((Date.now()-s)/315576e5),c=Math.floor((Date.now()-s)/864e5);switch(n){case">":return s>Date.parse(r);case">=":return s>=Date.parse(r);case"<":return s<Date.parse(r);case"<=":return s<=Date.parse(r);case"age_less_than":return a<i;case"age_less_than_or_equal":return a<=i;case"age_greater_than":return a>i;case"age_greater_than_or_equal":return a>=i;case"age_days_less_than":return c<i;case"age_days_less_than_or_equal":return c<=i;case"age_days_greater_than":return c>i;case"age_days_greater_than_or_equal":return c>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}ce.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:re.colors.muted,borderColor:re.colors.primary,color:re.colors.primary});class xs{static create(t){switch(t){case"string":case"text":case"select":return ys;case"numeric":return vs;case"boolean":return ws;case"date":return bs;default:throw new Error(`Unsupported condition type: ${t}`)}}}function Ss(t,e){const n=e.condition_type||"and";if(!e.conditions||0===e.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:e.conditions.map(e=>{const n={...e,matched:ks(t,e),string:`${e.field} ${e.operator}`};return e.value&&(n.string+=` ${e.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(t=>t.matched)),"or"===n&&(r.matched=r.conditions.some(t=>t.matched)),"not"===n&&(r.matched=r.conditions.every(t=>!t.matched)),r}function ks(t,e){const n=t[e.field],r=xs.create(e.type);if(!r)throw new Error(`Unsupported condition type: ${e.type}`);return r(n,e)}var _s=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:xs,booleanMatchesCondition:ws,checkSimpleConditions:Ss,dateMatchesCondition:bs,numericMatchesCondition:vs,textMatchesCondition:ys});function $s(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=we(t=>({definition:t.getFormDefinition(),currentPageIndex:t.getCurrentPageIndex(),totalPages:t.getTotalPages(),results:t.getCalculationResult(),validationErrors:t.getValidationErrors(),generalErrors:t.getGeneralErrors(),quoteIntent:t.getQuoteIntent(),isSaving:t.getIsSaving()})),u=t.pages[n];if(!u)return Et(ls,{title:"Unexpected Error",description:"No page available"});const l=Ht(new Map),d=(t,e)=>{var n;const r=c.getFormProgress().page_data[u.id],i=null==r?void 0:r[t];if(null!=i&&""!==i)return i;if(e&&("date"===e.type||"monthyear"===e.type)&&(null===(n=e.validation)||void 0===n?void 0:n.defaultDate)){const n=h(e.validation.defaultDate,"monthyear"===e.type);if(n)return c.updateFieldValue(u.id,t,n),n}return""},h=(t,e)=>{const n=new Date;let r=new Date;switch(t){case"today":r=n;break;case"+1week":r.setDate(n.getDate()+7);break;case"+1month":r.setMonth(n.getMonth()+1);break;case"+1year":r.setFullYear(n.getFullYear()+1);break;default:return""}const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return e?`${i}-${o}-01`:`${i}-${o}-${s}`},f=t=>{const e=c.getFormProgress().page_data[u.id];return((null==e?void 0:e.U)||{})[t]||""},m=c.getFormProgress().page_data[u.id]||{},p=null==s?void 0:s.payment_return,g=p&&("declined"===p.paymentStatus||"cancelled"===p.paymentStatus||"error"===p.paymentStatus),y=c.getFormProgress().completed_pages||[];return Et(jo,{title:u.title,description:u.description,hideHeader:!0,children:Et("div",{children:[g&&Et(es,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Et(ge,{children:Et("div",{className:ce.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:re.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Et("div",{className:ce.create("form-content-wrapper",{minWidth:"0",backgroundColor:re.colors.card,boxShadow:re.shadow.sm,borderRadius:re.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Et("div",{className:ce.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Et(cs,{pages:t.pages,currentPageIndex:n,completedPages:y})}),n>0&&Et("div",{className:ce.create("page-heading-container",{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},{"(max-width: 950px)":{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingTop:re.spacing.md}}),children:[Et("div",{className:ce.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:re.spacing.lg}),children:Et("div",{className:ce.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Et("h1",{className:ce.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:re.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:u.title}),u.description&&Et("p",{className:ce.create("page-template-description",{margin:"0",marginTop:re.spacing.sm,fontSize:re.fontSize.small,lineHeight:"1.5",color:re.colors.foreground,opacity:"0.7"}),children:u.description})]})}),Et("hr",{className:ce.create("page-heading-border",{marginTop:re.spacing.lg,borderColor:re.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Et(us,{organisation:s.organisation}),o.length>0&&o.map(t=>Et(gs,{error:t,onDismiss:()=>c.dismissGeneralError(t.id)},t.id)),Et("div",{className:ce.create("form-card",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.lg,boxShadow:re.shadow.sm,display:"flex",flexDirection:"column",gap:re.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:re.spacing.md,gap:re.spacing.lg},"(max-width: 480px)":{padding:re.spacing.md,gap:re.spacing.md}}),children:[Et("form",{onSubmit:t=>t.preventDefault(),className:ce.create("form-fields-container",{flex:"1"}),children:Et("div",{className:ce.create("form-content-page",{display:"grid",gap:re.spacing.md,rowGap:re.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:u.fields.map(t=>{const n=t.code||t.id;return(t=>{if(!t.visibility)return!0;const n=Ss(m,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),r="show"===t.visibility.action?n.matched:!n.matched;return l.current.get(t.id)!==r&&(e((t.label,t.code)),e(),l.current.set(t.id,r)),r})(t)?Et(ps,{field:t,errors:i,children:Et(ss,{value:d(n,t).toString(),onChange:e=>{let r=e;"boolean"!==t.type&&"checkbox"!==t.type||(r="true"===e),c.updateFieldValue(u.id,n,r)},answer:f(n),onAnswerChange:t=>{c.updateFieldAnswer(u.id,n,t)},id:n,name:n,type:t.type,placeholder:t.placeholder,validation:t.validation,booleanConfig:t.boolean_config,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},t.id):null})})}),Et("hr",{className:ce.create("form-navigation-border",{borderColor:re.colors.border})}),Et("div",{className:ce.create("form-navigation-inline",{paddingTop:re.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Et(Fo,{onClick:()=>c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Et(Fo,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await c.calculateQuote():await c.navigateToNextPage())},disabled:n>=r-1||a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Et("div",{className:ce.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Et(as,{pages:t.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function Ns(){var t,e,n;const{quoteIntent:r,fsm:i}=we(t=>({quoteIntent:t.getQuoteIntent(),fsm:t})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.name,u=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.admin_email,l=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=u||l;Bt(()=>{if(s&&r){const t=null==o?void 0:o.paymentStatus,e=null==a?void 0:a.amount;"success"===t&&a?xt(r,s,e||0,a.gateway_code,e,void 0):t&&["declined","cancelled","error"].includes(t)&&St(r,s,e,null==a?void 0:a.gateway_code,t,null==a?void 0:a.status)}const t=setTimeout(()=>{i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(t)},[i,s,o,r]);const h=ce.create("referral-reference",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,borderTop:`1px solid ${re.colors.border}`,marginTop:"1rem",paddingTop:"1rem"}),f=ce.create("contact-box",{backgroundColor:re.colors.muted,borderRadius:re.radius.default,padding:"1.5rem",marginTop:"2rem",textAlign:"left"}),m=ce.create("contact-box-title",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,marginBottom:"1rem"}),p=ce.create("contact-item",{display:"flex",alignItems:"center",fontSize:re.fontSize.small,color:re.colors.foreground,marginBottom:"0.75rem"}),g=ce.create("contact-label",{fontWeight:"600",marginRight:"0.5rem",minWidth:"4rem"}),y=ce.create("contact-value",{color:re.colors.mutedForeground});return ce.create("actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center",marginTop:"1rem"}),Et(jo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,children:Et(ge,{children:Et("div",{className:ce.create("payment-success-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"2rem",textAlign:"center",maxWidth:"600px",margin:"0 auto"}),children:[Et("div",{className:ce.create("success-icon",{display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"80px",borderRadius:"50%",backgroundColor:"#10b981",color:"white"}),children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})})}),Et("div",{className:ce.create("success-content",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Et(Bo,{size:"default",style:"bold",children:"Payment Complete!"}),Et(Bo,{children:["Your payment has been processed successfully and your policy is being setup. You will receive your policy documentation by email.",Et("br",{}),"For now, you can relax knowing you're ",c?`covered by ${c}`:"covered","."]}),d&&Et("div",{className:f,children:[Et("h3",{className:m,children:"If you need to contact us at all:"}),u&&Et("div",{className:p,children:[Et("span",{className:g,children:"Email:"}),Et("span",{className:y,children:u})]}),l&&Et("div",{className:p,children:[Et("span",{className:g,children:"Phone:"}),Et("span",{className:y,children:l})]})]}),Et("div",{className:h,children:["Quote Reference: ",r.id.slice(0,8).toUpperCase()]})]})]})})})}function Es(){const{isCalculating:t,results:e,quoteIntent:n}=we(t=>({isCalculating:t.getIsCalculating(),results:t.getCalculationResult(),quoteIntent:t.getQuoteIntent()})),r="paid"===(null==n?void 0:n.status)||"completed"===(null==n?void 0:n.status);return t?Et(zo,{message:"Processing your quote, please wait..."}):r?Et(Ns,{}):e?Et(is,{results:e}):Et($s,{})}function Ts(t){return Et(ve,{...t,children:Et(Es,{})})}class Cs extends _{constructor(t){super(t),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return fd}).then(({captureException:e,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),e(t,{componentStack:n.componentStack}))}).catch(()=>{})}catch(t){}const r=it("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const t=this.state.error;return lt(t)?Et(Lo,{message:t.message}):Et(Wo,{error:t})}return this.props.children}}function Is({config:t,initializeFormContext:n}){const[r,i]=qt({type:"loading",message:"Loading application..."});return Bt(()=>{(async()=>{try{e();const r=await n(t);if(!r.formStateManager||"function"!=typeof r.formStateManager.getFormProgress)throw new Error("FormStateManager was not properly initialized");e(),i({type:"success",formContextProps:r})}catch(t){let n;e(),n=t&&"object"==typeof t&&"type"in t&&"MAINTENANCE_ERROR"===t.type||t&&"object"==typeof t&&"statusCode"in t&&503===t.statusCode||t&&"object"==typeof t&&"status"in t&&503===t.status?it("maintenance",t):it("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),Et(Cs,{children:Et("div",{className:ce.create("root",{fontFamily:re.fontFamily,backgroundColor:re.colors.background,minHeight:"100vh",color:re.colors.foreground}),children:function(){switch(r.type){case"loading":return Et(zo,{message:r.message});case"error":return lt(r.error)?Et(Lo,{message:r.error.message}):Et(Wo,{error:r.error});case"success":return Et(Ts,{...r.formContextProps});default:return Et(Wo,{})}}()})})}class Ms{static async loadTheme(t){try{if(e(t.slug),e(t.theme_url),this.loadedThemes.has(t.slug))return void e(t.slug);const n=await fetch(t.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();e(r.substring(0,200));const i=this.parseCSSContent(r);e(i.mappedVariables),e(i.classRules.length),this.applyParsedTheme(t.slug,i),this.loadedThemes.add(t.slug),e(t.slug)}catch(n){throw e(t.slug),n}}static parseCSSContent(t){e();const n={},r={};let i="";const o=t.match(/:root\s*\{([^}]+)\}/);if(o){const t=o[1];e(null==t||t.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(t));){const t=`--${s[1]}`,i=s[2].trim();n[t]=i;const o=this.variableMapping[t];o?(r[o]=i,e()):e()}}else e();return i=t.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&e(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(t,n){e(),Promise.resolve().then(function(){return ue}).then(({updateBaseVariables:t})=>{Object.keys(n.mappedVariables).length>0&&(e(n.mappedVariables),t(n.mappedVariables))}).catch(()=>{e()}),n.classRules&&this.applyClassRules(t,n.classRules),this.injectOriginalCSS(t,n)}static applyClassRules(t,n){const r=document.getElementById(`insure-os-theme-classes-${t}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static injectOriginalCSS(t,n){const r=document.getElementById(`insure-os-theme-original-${t}`);r&&r.remove();const i={};for(const[t,e]of Object.entries(n.variables))this.variableMapping[t]||(i[t]=e);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static removeTheme(t){let n=!1;[`insure-os-theme-classes-${t}`,`insure-os-theme-original-${t}`].forEach(t=>{const e=document.getElementById(t);e&&(e.remove(),n=!0)}),n&&(this.loadedThemes.delete(t),e())}static isThemeLoaded(t){return this.loadedThemes.has(t)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}Ms.loadedThemes=new Set,Ms.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};const Ds="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Os=globalThis,Ps="10.17.0";function Rs(){return js(Os),Os}function js(t){const e=t.st=t.st||{};return e.version=e.version||Ps,e[Ps]=e[Ps]||{}}function As(t,e,n=Os){const r=n.st=n.st||{},i=r[Ps]=r[Ps]||{};return i[t]||(i[t]=e())}const zs=["debug","info","warn","error","log","assert","trace"],Fs={};function Ws(t){if(!("console"in Os))return t();const e=Os.console,n={},r=Object.keys(Fs);r.forEach(t=>{const r=Fs[t];n[t]=e[t],e[t]=r});try{return t()}finally{r.forEach(t=>{e[t]=n[t]})}}function Ls(){return Bs().enabled}function qs(t,...e){Ds&&Ls()&&Ws(()=>{Os.console[t](`Sentry Logger [${t}]:`,...e)})}function Bs(){return Ds?As("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Hs=function(){Bs().enabled=!0},Us=function(...t){qs("log",...t)},Zs=function(...t){qs("warn",...t)},Gs=function(...t){qs("error",...t)},Ys="?",Js=/\(error: (.*)\)/,Vs=/captureMessage|captureException/;function Qs(...t){const e=t.sort((t,e)=>t[0]-e[0]).map(t=>t[1]);return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){let n=o[t];n.length>1024&&(n=n.slice(0,1024));const s=Js.test(n)?n.replace(Js,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Xs(e).function||"")&&e.pop(),e.reverse(),Vs.test(Xs(e).function||"")&&(e.pop(),Vs.test(Xs(e).function||"")&&e.pop()),e.slice(0,50).map(t=>({...t,filename:t.filename||Xs(e).filename,function:t.function||Ys}))}(i.slice(r))}}function Xs(t){return t[t.length-1]||{}}const Ks="<anonymous>";function ta(t){try{return t&&"function"==typeof t&&t.name||Ks}catch{return Ks}}function ea(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach(e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)}),t}catch{return}}}const na={},ra={};function ia(t,e){na[t]=na[t]||[],na[t].push(e)}function oa(t,e){if(!ra[t]){ra[t]=!0;try{e()}catch(e){Ds&&Gs(`Error while instrumenting ${t}`,e)}}}function sa(t,e){const n=t&&na[t];if(n)for(const r of n)try{r(e)}catch(e){Ds&&Gs(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${ta(r)}\nError:`,e)}}let aa=null;function ca(){aa=Os.onerror,Os.onerror=function(t,e,n,r,i){return sa("error",{column:r,error:i,line:n,msg:t,url:e}),!!aa&&aa.apply(this,arguments)},Os.onerror.ct=!0}let ua=null;function la(){ua=Os.onunhandledrejection,Os.onunhandledrejection=function(t){return sa("unhandledrejection",t),!ua||ua.apply(this,arguments)},Os.onunhandledrejection.ct=!0}const da={}.toString;function ha(t){switch(da.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Sa(t,Error)}}function fa(t,e){return da.call(t)===`[object ${e}]`}function ma(t){return fa(t,"ErrorEvent")}function pa(t){return fa(t,"DOMError")}function ga(t){return fa(t,"String")}function ya(t){return"object"==typeof t&&null!==t&&"ut"in t&&"lt"in t}function va(t){return null===t||ya(t)||"object"!=typeof t&&"function"!=typeof t}function wa(t){return fa(t,"Object")}function ba(t){return"undefined"!=typeof Event&&Sa(t,Event)}function xa(t){return Boolean(t?.then&&"function"==typeof t.then)}function Sa(t,e){try{return t instanceof e}catch{return!1}}function ka(t){return!("object"!=typeof t||null===t||!t.ht&&!t.ft)}const _a=Os;function $a(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let u;const l=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(u=Na(n,l),!("html"===u||o>1&&s+i.length*c+u.length>=d));)i.push(u),s+=u.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Na(t,e){const n=t,r=[];if(!n?.tagName)return"";if(_a.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e?.length?e.filter(t=>n.getAttribute(t)).map(t=>[t,n.getAttribute(t)]):null;if(i?.length)i.forEach(t=>{r.push(`[${t[0]}="${t[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&ga(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}function Ea(){try{return _a.document.location.href}catch{return""}}function Ta(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function Ca(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{ka(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Ia(t,e,n=!1){return!!ga(t)&&(fa(e,"RegExp")?e.test(t):!!ga(e)&&(n?t===e:t.includes(e)))}function Ma(t,e=[],n=!1){return e.some(e=>Ia(t,e,n))}function Da(t,e,n){if(!(e in t))return;const r=t[e];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Pa(i,r);try{t[e]=i}catch{Ds&&Us(`Failed to replace method "${e}" in object`,t)}}function Oa(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Ds&&Us(`Failed to add non-enumerable property "${e}" to object`,t)}}function Pa(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Oa(t,"__sentry_original__",e)}catch{}}function Ra(t){return t.gt}function ja(t){if(ha(t))return{message:t.message,name:t.name,stack:t.stack,...za(t)};if(ba(t)){const e={type:t.type,target:Aa(t.target),currentTarget:Aa(t.currentTarget),...za(t)};return"undefined"!=typeof CustomEvent&&Sa(t,CustomEvent)&&(e.detail=t.detail),e}return t}function Aa(t){try{return"undefined"!=typeof Element&&Sa(t,Element)?$a(t):{}.toString.call(t)}catch{return"<unknown>"}}function za(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function Fa(t=function(){const t=Os;return t.crypto||t.msCrypto}()){let e=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(15&e())>>t/4).toString(16))}function Wa(t){return t.exception?.values?.[0]}function La(t){const{message:e,event_id:n}=t;if(e)return e;const r=Wa(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function qa(t,e){const n=t.exception=t.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Ba(t,e){const n=Wa(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r?.data,...e.data};n.mechanism.data=t}}function Ha(t){if(function(t){try{return t.yt}catch{}}(t))return!0;try{Oa(t,"__sentry_captured__",!0)}catch{}return!1}function Ua(){return Date.now()/1e3}let Za;function Ga(){return(Za??(Za=function(){const{performance:t}=Os;if(!t?.now||!t.timeOrigin)return Ua;const e=t.timeOrigin;return()=>(e+t.now())/1e3}()))()}function Ya(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Ga(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Fa()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ja(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)({}).hasOwnProperty.call(e,t)&&(r[t]=Ja(r[t],e[t],n-1));return r}function Va(){return Fa()}function Qa(){return Fa().substring(16)}const Xa="_sentrySpan";function Ka(t,e){e?Oa(t,Xa,e):delete t[Xa]}function tc(t){return t[Xa]}class ec{constructor(){this.vt=!1,this.wt=[],this.bt=[],this.xt=[],this.St=[],this.kt={},this._t={},this.$t={},this.Nt={},this.Et={},this.Tt={traceId:Va(),sampleRand:Math.random()}}clone(){const t=new ec;return t.xt=[...this.xt],t._t={...this._t},t.$t={...this.$t},t.Nt={...this.Nt},this.Nt.flags&&(t.Nt.flags={values:[...this.Nt.flags.values]}),t.kt=this.kt,t.Ct=this.Ct,t.It=this.It,t.Mt=this.Mt,t.Dt=this.Dt,t.bt=[...this.bt],t.St=[...this.St],t.Et={...this.Et},t.Tt={...this.Tt},t.Ot=this.Ot,t.Pt=this.Pt,Ka(t,tc(this)),t}setClient(t){this.Ot=t}setLastEventId(t){this.Pt=t}getClient(){return this.Ot}lastEventId(){return this.Pt}addScopeListener(t){this.wt.push(t)}addEventProcessor(t){return this.bt.push(t),this}setUser(t){return this.kt=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.It&&Ya(this.It,{user:t}),this.Rt(),this}getUser(){return this.kt}setTags(t){return this._t={...this._t,...t},this.Rt(),this}setTag(t,e){return this._t={...this._t,[t]:e},this.Rt(),this}setExtras(t){return this.$t={...this.$t,...t},this.Rt(),this}setExtra(t,e){return this.$t={...this.$t,[t]:e},this.Rt(),this}setFingerprint(t){return this.Dt=t,this.Rt(),this}setLevel(t){return this.Ct=t,this.Rt(),this}setTransactionName(t){return this.Mt=t,this.Rt(),this}setContext(t,e){return null===e?delete this.Nt[t]:this.Nt[t]=e,this.Rt(),this}setSession(t){return t?this.It=t:delete this.It,this.Rt(),this}getSession(){return this.It}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,n=e instanceof ec?e.getScopeData():wa(e)?t:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:u}=n||{};return this._t={...this._t,...r},this.$t={...this.$t,...i},this.Nt={...this.Nt,...s},o&&Object.keys(o).length&&(this.kt=o),a&&(this.Ct=a),c.length&&(this.Dt=c),u&&(this.Tt=u),this}clear(){return this.xt=[],this._t={},this.$t={},this.kt={},this.Nt={},this.Ct=void 0,this.Mt=void 0,this.Dt=void 0,this.It=void 0,Ka(this,void 0),this.St=[],this.setPropagationContext({traceId:Va(),sampleRand:Math.random()}),this.Rt(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:Ua(),...t,message:t.message?Ta(t.message,2048):t.message};return this.xt.push(r),this.xt.length>n&&(this.xt=this.xt.slice(-n),this.Ot?.recordDroppedEvent("buffer_overflow","log_item")),this.Rt(),this}getLastBreadcrumb(){return this.xt[this.xt.length-1]}clearBreadcrumbs(){return this.xt=[],this.Rt(),this}addAttachment(t){return this.St.push(t),this}clearAttachments(){return this.St=[],this}getScopeData(){return{breadcrumbs:this.xt,attachments:this.St,contexts:this.Nt,tags:this._t,extra:this.$t,user:this.kt,level:this.Ct,fingerprint:this.Dt||[],eventProcessors:this.bt,propagationContext:this.Tt,sdkProcessingMetadata:this.Et,transactionName:this.Mt,span:tc(this)}}setSDKProcessingMetadata(t){return this.Et=Ja(this.Et,t,2),this}setPropagationContext(t){return this.Tt=t,this}getPropagationContext(){return this.Tt}captureException(t,e){const n=e?.event_id||Fa();if(!this.Ot)return Ds&&Zs("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ot.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n?.event_id||Fa();if(!this.Ot)return Ds&&Zs("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this.Ot.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e?.event_id||Fa();return this.Ot?(this.Ot.captureEvent(t,{...e,event_id:n},this),n):(Ds&&Zs("No client configured on scope - will not capture event!"),n)}Rt(){this.vt||(this.vt=!0,this.wt.forEach(t=>{t(this)}),this.vt=!1)}}class nc{constructor(t,e){let n,r;n=t||new ec,r=e||new ec,this.jt=[{scope:n}],this.At=r}withScope(t){const e=this.zt();let n;try{n=t(e)}catch(t){throw this.Ft(),t}return xa(n)?n.then(t=>(this.Ft(),t),t=>{throw this.Ft(),t}):(this.Ft(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.At}getStackTop(){return this.jt[this.jt.length-1]}zt(){const t=this.getScope().clone();return this.jt.push({client:this.getClient(),scope:t}),t}Ft(){return!(this.jt.length<=1||!this.jt.pop())}}function rc(){const t=js(Rs());return t.stack=t.stack||new nc(As("defaultCurrentScope",()=>new ec),As("defaultIsolationScope",()=>new ec))}function ic(t){return rc().withScope(t)}function oc(t,e){const n=rc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function sc(t){return rc().withScope(()=>t(rc().getIsolationScope()))}function ac(t){const e=js(t);return e.acs?e.acs:{withIsolationScope:sc,withScope:ic,withSetScope:oc,withSetIsolationScope:(t,e)=>sc(e),getCurrentScope:()=>rc().getScope(),getIsolationScope:()=>rc().getIsolationScope()}}function cc(){return ac(Rs()).getCurrentScope()}function uc(){return ac(Rs()).getIsolationScope()}function lc(...t){const e=ac(Rs());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}function dc(){return cc().getClient()}function hc(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,o={trace_id:n,span_id:i||Qa()};return r&&(o.parent_span_id=r),o}const fc="sentry.profile_id",mc="sentry.exclusive_time";function pc(t){if(t){if("object"==typeof t&&"deref"in t&&"function"==typeof t.deref)try{return t.deref()}catch{return}return t}}function gc(t){const e=t;return{scope:e.Wt,isolationScope:pc(e.Lt)}}const yc=/^sentry-/;function vc(t){return t.split(",").map(t=>t.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((t,[e,n])=>(e&&n&&(t[e]=n),t),{})}const wc=/^o(\d+)\./,bc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function xc(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Sc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function kc(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=function(t){const e=t.match(wc);return e?.[1]}(n)),r}let _c=!1;function $c(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:Cc(t).parent_span_id,o=gc(t).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||Qa():e,trace_id:n}}function Nc(t){return t&&t.length>0?t.map(({context:{spanId:t,traceId:e,traceFlags:n,...r},attributes:i})=>({span_id:t,trace_id:e,sampled:1===n,attributes:i,...r})):void 0}function Ec(t){return"number"==typeof t?Tc(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Tc(t.getTime()):Ga()}function Tc(t){return t>9999999999?t/1e3:t}function Cc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:Ec(i),timestamp:Ec(s)||void 0,status:Ic(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Nc(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Ic(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Mc(t){return t.qt||t}function Dc(){_c||(Ws(()=>{}),_c=!0)}function Oc(t){Us(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Pc(t,e){if(!e?.length||!t.description)return!1;for(const n of e){if(jc(n)){if(Ia(t.description,n))return Ds&&Oc(t),!0;continue}if(!n.name&&!n.op)continue;const e=!n.name||Ia(t.description,n.name),r=!n.op||t.op&&Ia(t.op,n.op);if(e&&r)return Ds&&Oc(t),!0}return!1}function Rc(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const e of t)e.parent_span_id===r&&(e.parent_span_id=n)}function jc(t){return"string"==typeof t||t instanceof RegExp}const Ac="production";function zc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||Ac,release:n.release,public_key:r,trace_id:t,org_id:kc(e)};return e.emit("createDsc",i),i}function Fc(t){const e=dc();if(!e)return{};const n=Mc(t),r=Cc(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function a(t){return"number"!=typeof s&&"string"!=typeof s||(t.sample_rate=`${s}`),t}const c=n.Bt;if(c)return a(c);const u=o?.get("sentry.dsc"),l=u&&function(t){const e=function(t){if(t&&(ga(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce((t,e)=>{const n=vc(e);return Object.entries(n).forEach(([e,n])=>{t[e]=n}),t},{}):vc(t)}(t);if(!e)return;const n=Object.entries(e).reduce((t,[e,n])=>(e.match(yc)&&(t[e.slice(7)]=n),t),{});return Object.keys(n).length>0?n:void 0}(u);if(l)return a(l);const d=zc(t.spanContext().traceId,e),h=i["sentry.source"],f=r.description;return"url"!==h&&f&&(d.transaction=f),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=dc()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(n)),d.sample_rand=o?.get("sentry.sample_rand")??gc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function Wc(t,e=100,n=1/0){try{return qc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Lc(t,e=3,n=102400){const r=Wc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?Lc(t,e-1,n):r;var i}function qc(t,e,n=1/0,r=1/0,i=function(){const t=new WeakSet;return[function(e){return!!t.has(e)||(t.add(e),!1)},function(e){t.delete(e)}]}()){const[o,s]=i;if(null==e||["boolean","string"].includes(typeof e)||"number"==typeof e&&Number.isFinite(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.Ht)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(ka(e))return"[VueViewModel]";if(wa(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&!Number.isFinite(e))return`[${e}]`;if("function"==typeof e)return`[Function: ${ta(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.Ut)return e;const c="number"==typeof e.Zt?e.Zt:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const u=e;if(u&&"function"==typeof u.toJSON)try{return qc("",u.toJSON(),c-1,r,i)}catch{}const l=Array.isArray(e)?[]:{};let d=0;const h=ja(e);for(const t in h){if(!{}.hasOwnProperty.call(h,t))continue;if(d>=r){l[t]="[MaxProperties ~]";break}const e=h[t];l[t]=qc(t,e,c-1,r,i),d++}return s(e),l}function Bc(t,e=[]){return[t,e]}function Hc(t,e){const[n,r]=t;return[n,[...r,e]]}function Uc(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Zc(t){const e=js(Os);return e.encodePolyfill?e.encodePolyfill(t):(new TextEncoder).encode(t)}function Gc(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Zc(r),t]:r.push("string"==typeof t?Zc(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch{t=JSON.stringify(Wc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function Yc(t){const e="string"==typeof t.data?Zc(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const Jc={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Vc(t){return Jc[t]}function Qc(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Xc(t){return new tu(e=>{e(t)})}function Kc(t){return new tu((e,n)=>{n(t)})}class tu{constructor(t){this.Gt=0,this.Yt=[],this.Jt(t)}then(t,e){return new tu((n,r)=>{this.Yt.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.Vt()})}catch(t){return this.then(t=>t,t)}finally(t){return new tu((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{i?n(r):e(r)})})}Vt(){if(0===this.Gt)return;const t=this.Yt.slice();this.Yt=[],t.forEach(t=>{t[0]||(1===this.Gt&&t[1](this.Qt),2===this.Gt&&t[2](this.Qt),t[0]=!0)})}Jt(t){const e=(t,e)=>{0===this.Gt&&(xa(e)?e.then(n,r):(this.Gt=t,this.Qt=e,this.Vt()))},n=t=>{e(1,t)},r=t=>{e(2,t)};try{t(n,r)}catch(t){r(t)}}}function eu(t,e,n,r=0){try{const i=nu(e,n,t,r);return xa(i)?i:Xc(i)}catch(t){return Kc(t)}}function nu(t,e,n,r){const i=n[r];if(!t||!i)return t;const o=i({...t},e);return Ds&&null===o&&Us(`Event processor "${i.id||"?"}" dropped event`),xa(o)?o.then(t=>nu(t,e,n,r+1)):nu(o,e,n,r+1)}function ru(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:h,transactionName:f,span:m}=e;iu(t,"extra",n),iu(t,"tags",r),iu(t,"user",i),iu(t,"contexts",o),t.sdkProcessingMetadata=Ja(t.sdkProcessingMetadata,a,2),s&&(t.level=s),f&&(t.transactionName=f),m&&(t.span=m),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),l.length&&(t.eventProcessors=[...t.eventProcessors,...l]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function iu(t,e,n){t[e]=Ja(t[e],n,1)}let ou,su,au;function cu(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||Fa(),timestamp:e.timestamp||Ua()},u=n.integrations||t.integrations.map(t=>t.name);!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||n||Ac,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const s=t.request;s?.url&&(s.url=Ta(s.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,u),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=function(t){const e=Os.Xt;if(!e)return{};const n=Object.keys(e);return au&&n.length===su||(su=n.length,au=n.reduce((n,r)=>{ou||(ou={});const i=ou[r];if(i)n[i[0]]=i[1];else{const i=t(r);for(let t=i.length-1;t>=0;t--){const o=i[t],s=o?.filename,a=e[r];if(s&&a){n[s]=a,ou[r]=[s,a];break}}}return n},{})),au}(e);t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.filename&&(t.debug_id=n[t.filename])})})}(c,t.stackParser);const l=function(t,e){if(!e)return t;const n=t?t.clone():new ec;return n.update(e),n}(r,n.captureContext);n.mechanism&&Ba(c,n.mechanism);const d=i?i.getEventProcessors():[],h=As("globalScope",()=>new ec).getScopeData();o&&ru(h,o.getScopeData()),l&&ru(h,l.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(o).length&&(t.contexts={...o,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:$c(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Fc(e),...t.sdkProcessingMetadata};const n=Cc(Mc(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,h),eu([...d,...h.eventProcessors],c,n).then(t=>(t&&function(t){const e={};if(t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)})}),0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})})}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>({...t,...t.data&&{data:Wc(t.data,e,n)}}))},...t.user&&{user:Wc(t.user,e,n)},...t.contexts&&{contexts:Wc(t.contexts,e,n)},...t.extra&&{extra:Wc(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Wc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(t=>({...t,...t.data&&{data:Wc(t.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Wc(t.contexts.flags,3,n)),r}(t,s,a):t))}function uu(t){return cc().captureException(t,void 0)}function lu(t,e){const n="string"==typeof e?e:void 0,r="string"!=typeof e?{captureContext:e}:void 0;return cc().captureMessage(t,n,r)}function du(t,e){return cc().captureEvent(t,e)}function hu(t){const e=uc(),n=cc(),{userAgent:r}=Os.navigator||{},i=function(t){const e=Ga(),n={sid:Fa(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(n)};return t&&Ya(n,t),n}({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),o=e.getSession();return"ok"===o?.status&&Ya(o,{status:"exited"}),fu(),e.setSession(i),i}function fu(){const t=uc(),e=cc().getSession()||t.getSession();e&&function(t){let e={};"ok"===t.status&&(e={status:"exited"}),Ya(t,e)}(e),mu(),t.setSession()}function mu(){const t=uc(),e=dc(),n=t.getSession();n&&e&&e.captureSession(n)}function pu(t=!1){t?fu():mu()}const gu=[];function yu(t){const e=t.defaultIntegrations||[],n=t.integrations;let r;if(e.forEach(t=>{t.isDefaultInstance=!0}),Array.isArray(n))r=[...e,...n];else if("function"==typeof n){const t=n(e);r=Array.isArray(t)?t:[t]}else r=e;return function(t){const e={};return t.forEach(t=>{const{name:n}=t,r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)}),Object.values(e)}(r)}function vu(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function wu(t,e,n){if(n[e.name])Ds&&Us(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===gu.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),gu.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(e,r)=>n(e,r,t))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign((e,r)=>n(e,r,t),{id:e.name});t.addEventProcessor(r)}Ds&&Us(`Integration installed: ${e.name}`)}}function bu(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}const xu="Not capturing exception because it's already been captured.",Su="Discarded session because of missing or non-string release",ku=Symbol.for("SentryInternalError"),_u=Symbol.for("SentryDoNotSendEventError");function $u(t){return{message:t,[ku]:!0}}function Nu(t){return{message:t,[_u]:!0}}function Eu(t){return!!t&&"object"==typeof t&&ku in t}function Tu(t){return!!t&&"object"==typeof t&&_u in t}class Cu{constructor(t){if(this.Kt=t,this.te={},this.ee=0,this.ne={},this.re={},this.bt=[],t.dsn?this.ie=function(t){const e="string"==typeof t?function(t){const e=bc.exec(t);if(!e)return void Ws(()=>{});const[n,r,i="",o="",s="",a=""]=e.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const t=u.match(/^\d+/);t&&(u=t[0])}return Sc({host:o,pass:i,path:c,projectId:u,port:s,protocol:n,publicKey:r})}(t):Sc(t);if(e&&function(t){if(!Ds)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find(e=>!t[e]&&(Gs(`Invalid Sentry Dsn: ${e} missing`),!0))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(Gs(`Invalid Sentry Dsn: Invalid port ${e}`),1):(Gs(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Gs(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):Ds&&Zs("No DSN provided, client will not send events."),this.ie){const i=(e=this.ie,n=t.tunnel,r=t.oe?t.oe.sdk:void 0,n||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(e)}?${function(t,e){const n={sentry_version:"7"};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}(e,r)}`);this.se=t.transport({tunnel:this.Kt.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}var e,n,r}captureException(t,e,n){const r=Fa();if(Ha(t))return Ds&&Us(xu),r;const i={event_id:r,...e};return this.ae(this.eventFromException(t,i).then(t=>this.ce(t,i,n))),i.event_id}captureMessage(t,e,n,r){const i={event_id:Fa(),...n},o=ya(t)?t:String(t),s=va(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this.ae(s.then(t=>this.ce(t,i,r))),i.event_id}captureEvent(t,e,n){const r=Fa();if(e?.originalException&&Ha(e.originalException))return Ds&&Us(xu),r;const i={event_id:r,...e},o=t.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.ae(this.ce(t,i,s||n,a)),i.event_id}captureSession(t){this.sendSession(t),Ya(t,{init:!1})}getDsn(){return this.ie}getOptions(){return this.Kt}getSdkMetadata(){return this.Kt.oe}getTransport(){return this.se}async flush(t){const e=this.se;if(!e)return!0;this.emit("flush");const n=await this.ue(t),r=await e.flush(t);return n&&r}async close(t){const e=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),e}getEventProcessors(){return this.bt}addEventProcessor(t){this.bt.push(t)}init(){(this.le()||this.Kt.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this.de()}getIntegrationByName(t){return this.te[t]}addIntegration(t){const e=this.te[t.name];wu(this,t,this.te),e||vu(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=Qc(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){if(!e)return t;const n=t.sdk||{};t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0}}(t,n?.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:xc(r)},...i&&{trace:i}}}(t,i,r,e);return delete t.sdkProcessingMetadata,Bc(s,[[{type:o},t]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);for(const t of e.attachments||[])n=Hc(n,Yc(t));this.sendEnvelope(n).then(e=>this.emit("afterSendEvent",t,e))}sendSession(t){const{release:e,environment:n=Ac}=this.Kt;if("aggregates"in t){const r=t.attrs||{};if(!r.release&&!e)return void(Ds&&Zs(Su));r.release=r.release||e,r.environment=r.environment||n,t.attrs=r}else{if(!t.release&&!e)return void(Ds&&Zs(Su));t.release=t.release||e,t.environment=t.environment||n}this.emit("beforeSendSession",t);const r=function(t,e,n,r){const i=Qc(n);return Bc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:xc(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);this.sendEnvelope(r)}recordDroppedEvent(t,e,n=1){if(this.Kt.sendClientReports){const r=`${t}:${e}`;Ds&&Us(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.ne[r]=(this.ne[r]||0)+n}}on(t,e){const n=this.re[t]=this.re[t]||new Set,r=(...t)=>e(...t);return n.add(r),()=>{n.delete(r)}}emit(t,...e){const n=this.re[t];n&&n.forEach(t=>t(...e))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this.le()&&this.se)try{return await this.se.send(t)}catch(t){return Ds&&Gs("Error while sending envelope:",t),{}}return Ds&&Gs("Transport disabled"),{}}de(){const{integrations:t}=this.Kt;this.te=function(t,e){const n={};return e.forEach(e=>{e&&wu(t,e,n)}),n}(this,t),vu(this,t)}he(t,e){let n="fatal"===e.level,r=!1;const i=e.exception?.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(!1===e?.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(Ya(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}async ue(t){let e=0;for(;!t||e<t;){if(await new Promise(t=>setTimeout(t,1)),!this.ee)return!0;e++}return!1}le(){return!1!==this.getOptions().enabled&&void 0!==this.se}fe(t,e,n,r){const i=this.getOptions(),o=Object.keys(this.te);return!e.integrations&&o?.length&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),cu(i,t,e,n,this,r).then(t=>{if(null===t)return t;this.emit("postprocessEvent",t,e),t.contexts={trace:hc(n),...t.contexts};const r=function(t,e){const n=e.getPropagationContext();return n.dsc||zc(n.traceId,t)}(this,n);return t.sdkProcessingMetadata={dynamicSamplingContext:r,...t.sdkProcessingMetadata},t})}ce(t,e={},n=cc(),r=uc()){return Ds&&Iu(t)&&Us(`Captured error event \`${bu(t)[0]||"<unknown>"}\``),this.me(t,e,n,r).then(t=>t.event_id,t=>{Ds&&(Tu(t)?Us(t.message):Eu(t)?Zs(t.message):Zs(t))})}me(t,e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Mu(t),a=Iu(t),c=t.type||"error",u=`before send for type \`${c}\``,l=void 0===o?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;return"number"!=typeof e||isNaN(e)||e<0||e>1?void 0:e}(o);if(a&&"number"==typeof l&&Math.random()>l)return this.recordDroppedEvent("sample_rate","error"),Kc(Nu(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.fe(t,e,n,r).then(t=>{if(null===t)throw this.recordDroppedEvent("event_processor",d),Nu("An event processor returned `null`, will not send event.");if(e.data&&!0===e.data.pe)return t;const n=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=e;let c=n;if(Iu(c)&&i)return i(c,r);if(Mu(c)){if(s||a){const e=function(t){const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[fc],exclusive_time:s?.[mc],measurements:t.measurements,is_segment:!0}}(c);if(a?.length&&Pc(e,a))return null;if(s){const t=s(e);t?c=Ja(n,{type:"transaction",timestamp:(u=t).timestamp,start_timestamp:u.start_timestamp,transaction:u.description,contexts:{trace:{trace_id:u.trace_id,span_id:u.span_id,parent_span_id:u.parent_span_id,op:u.op,status:u.status,origin:u.origin,data:{...u.data,...u.profile_id&&{[fc]:u.profile_id},...u.exclusive_time&&{[mc]:u.exclusive_time}}}},measurements:u.measurements}):Dc()}if(c.spans){const e=[],n=c.spans;for(const t of n)if(a?.length&&Pc(t,a))Rc(n,t);else if(s){const n=s(t);n?e.push(n):(Dc(),e.push(t))}else e.push(t);const r=c.spans.length-e.length;r&&t.recordDroppedEvent("before_send","span",r),c.spans=e}}if(o){if(c.spans){const t=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:t}}return o(c,r)}}var u;return c}(this,i,t,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(xa(t))return t.then(t=>{if(!wa(t)&&null!==t)throw $u(n);return t},t=>{throw $u(`${e} rejected with ${t}`)});if(!wa(t)&&null!==t)throw $u(n);return t}(n,u)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const e=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",e)}throw Nu(`${u} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.he(o,i),s){const t=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);t>0&&this.recordDroppedEvent("before_send","span",t)}const c=i.transaction_info;if(s&&c&&i.transaction!==t.transaction){const t="custom";i.transaction_info={...c,source:t}}return this.sendEvent(i,e),i}).then(null,t=>{if(Tu(t)||Eu(t))throw t;throw this.captureException(t,{mechanism:{handled:!1,type:"internal"},data:{pe:!0},originalException:t}),$u(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)})}ae(t){this.ee++,t.then(t=>(this.ee--,t),t=>(this.ee--,t))}ge(){const t=this.ne;return this.ne={},Object.entries(t).map(([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}})}ye(){Ds&&Us("Flushing outcomes...");const t=this.ge();if(0===t.length)return void(Ds&&Us("No outcomes to send"));if(!this.ie)return void(Ds&&Us("No dsn provided, will not send outcomes"));Ds&&Us("Sending outcomes:",t);const e=(n=t,Bc((r=this.Kt.tunnel&&xc(this.ie))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Ua(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}function Iu(t){return void 0===t.type}function Mu(t){return"transaction"===t.type}function Du(t){const e=function(t){return Ou().get(t)}(t)??[];if(0===e.length)return;const n=t.getOptions(),r=function(t,e,n,r){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=xc(r)),Bc(i,[(o=t,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(e,n.oe,n.tunnel,t.getDsn());Ou().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(r)}function Ou(){return As("clientToLogBufferMap",()=>new WeakMap)}const Pu=Symbol.for("SentryBufferFullError");function Ru(t,e,n=function(t=100){const e=new Set;function n(t){e.delete(t)}return{get $(){return Array.from(e)},add:function(r){if(!(e.size<t))return Kc(Pu);const i=r();return e.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(t){if(!e.size)return Xc(!0);const n=Promise.allSettled(Array.from(e)).then(()=>!0);if(!t)return n;const r=[n,new Promise(e=>setTimeout(()=>e(!1),t))];return Promise.race(r)}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Uc(i,(e,n)=>{const i=Vc(n);!function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)?o.push(e):t.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=Bc(i[0],o),a=e=>{Uc(s,(n,r)=>{t.recordDroppedEvent(e,Vc(r))})};return n.add(()=>e({body:Gc(s)}).then(t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&Ds&&Zs(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t),t=>{throw a("network_error"),Ds&&Gs("Encountered error running transport request:",t),t})).then(t=>t,t=>{if(t===Pu)return Ds&&Gs("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw t})},flush:t=>n.drain(t)}}function ju(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Au(t){"aggregates"in t?void 0===t.attrs?.ip_address&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):void 0===t.ipAddress&&(t.ipAddress="{{auto}}")}const zu=100;function Fu(t,e){const n=dc(),r=uc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=zu}=n.getOptions();if(o<=0)return;const s={timestamp:Ua(),...t},a=i?Ws(()=>i(s,e)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let Wu;const Lu=new WeakMap,qu=()=>({name:"FunctionToString",setupOnce(){Wu=function(){}.toString;try{Function.prototype.toString=function(...t){const e=Ra(this),n=Lu.has(dc())&&void 0!==e?e:this;return Wu.apply(n,t)}}catch{}},setup(t){Lu.set(t,!0)}}),Bu=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Hu=(t={})=>{let e;return{name:"EventFilters",setup(n){const r=n.getOptions();e=Zu(t,r)},processEvent(n,r,i){if(!e){const n=i.getOptions();e=Zu(t,n)}return function(t,e){if(t.type){if("transaction"===t.type&&function(t,e){if(!e?.length)return!1;const n=t.transaction;return!!n&&Ma(n,e)}(t,e.ignoreTransactions))return Ds&&Zs(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${La(t)}`),!0}else{if(function(t,e){return!!e?.length&&bu(t).some(t=>Ma(t,e))}(t,e.ignoreErrors))return Ds&&Zs(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${La(t)}`),!0;if(function(t){return!!t.exception?.values?.length&&(!t.message&&!t.exception.values.some(t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))}(t))return Ds&&Zs(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${La(t)}`),!0;if(function(t,e){if(!e?.length)return!1;const n=Gu(t);return!!n&&Ma(n,e)}(t,e.denyUrls))return Ds&&Zs(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${La(t)}.\nUrl: ${Gu(t)}`),!0;if(!function(t,e){if(!e?.length)return!0;const n=Gu(t);return!n||Ma(n,e)}(t,e.allowUrls))return Ds&&Zs(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${La(t)}.\nUrl: ${Gu(t)}`),!0}return!1}(n,e)?null:n}}},Uu=(t={})=>({...Hu(t),name:"InboundFilters"});function Zu(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:Bu],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Gu(t){try{const e=[...t.exception?.values??[]].reverse().find(t=>void 0===t.mechanism?.parent_id&&t.stacktrace?.frames?.length),n=e?.stacktrace?.frames;return n?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Ds&&Gs(`Cannot extract url for event ${La(t)}`),null}}function Yu(t,e,n,r,i,o){if(!i.exception?.values||!o||!Sa(o.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Ju(t,e,r,o.originalException,n,i.exception.values,s,0))}function Ju(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(Sa(r[i],Error)){Vu(s,a);const o=t(e,r[i]),u=c.length;Qu(o,i,u,a),c=Ju(t,e,n,r[i],i,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(Sa(r,Error)){Vu(s,a);const u=t(e,r),l=c.length;Qu(u,`errors[${o}]`,l,a),c=Ju(t,e,n,r,i,[u,...c],u,l)}}),c}function Vu(t,e){t.mechanism={handled:!0,type:"auto.core.linked_errors",...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function Qu(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Xu(){"console"in Os&&zs.forEach(function(t){t in Os.console&&Da(Os.console,t,function(e){return Fs[t]=e,function(...e){sa("console",{args:e,level:t});const n=Fs[t];n?.apply(Os.console,e)}})})}const Ku=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!el(t,e)&&!!tl(t,e))))}(t,e)||!!function(t,e){const n=nl(e),r=nl(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!el(t,e)&&!!tl(t,e)))}(t,e))}(e,t))return Ds&&Zs("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function tl(t,e){let n=ea(t),r=ea(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function el(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function nl(t){return t.exception?.values?.[0]}function rl(t){return void 0===t?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const il=Os;function ol(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function sl(t,e){const n="fetch";ia(n,t),oa(n,()=>function(t,e=!1){e&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in il))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(ol(il.fetch))return!0;let t=!1;const e=il.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=ol(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){Ds&&Zs("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t}()||Da(Os,"fetch",function(t){return function(...e){const n=new Error,{method:r,url:i}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:cl(e),method:al(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:cl(e),method:al(e,"method")?String(e.method).toUpperCase():"GET"}}(e),o={args:e,fetchData:{method:r,url:i},startTimestamp:1e3*Ga(),virtualError:n,headers:ul(e)};return sa("fetch",{...o}),t.apply(Os,e).then(async t=>(sa("fetch",{...o,endTimestamp:1e3*Ga(),response:t}),t),t=>{if(sa("fetch",{...o,endTimestamp:1e3*Ga(),error:t}),ha(t)&&void 0===t.stack&&(t.stack=n.stack,Oa(t,"framesToPop",1)),t instanceof TypeError&&("Failed to fetch"===t.message||"Load failed"===t.message||"NetworkError when attempting to fetch resource."===t.message))try{const e=new URL(o.fetchData.url);t.message=`${t.message} (${e.host})`}catch{}throw t})}})}(0,e))}function al(t,e){return!!t&&"object"==typeof t&&!!t[e]}function cl(t){return"string"==typeof t?t:t?al(t,"url")?t.url:t.toString?t.toString():"":""}function ul(t){const[e,n]=t;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&Sa(e,Request))return new Headers(e.headers)}catch{}}const ll=Os;let dl=0;function hl(){return dl>0}function fl(t,e={}){if(!function(t){return"function"==typeof t}(t))return t;try{const e=t.ve;if(e)return"function"==typeof e?e:t;if(Ra(t))return t}catch{return t}const n=function(...n){try{const r=n.map(t=>fl(t,e));return t.apply(this,r)}catch(t){throw dl++,setTimeout(()=>{dl--}),lc(r=>{r.addEventProcessor(t=>(e.mechanism&&(qa(t,void 0),Ba(t,e.mechanism)),t.extra={...t.extra,arguments:n},t)),uu(t)}),t}};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}catch{}Pa(n,t),Oa(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}function ml(t,e){const n=gl(t,e),r={type:wl(e),value:bl(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function pl(t,e){return{exception:{values:[ml(t,e)]}}}function gl(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&yl.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const yl=/Minified React error #\d+;/i;function vl(t){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&t instanceof WebAssembly.Exception}function wl(t){const e=t?.name;return!e&&vl(t)?t.message&&Array.isArray(t.message)&&2==t.message.length?t.message[0]:"WebAssembly.Exception":e}function bl(t){const e=t?.message;return vl(t)?Array.isArray(t.message)&&2==t.message.length?t.message[1]:"wasm exception":e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function xl(t,e,n,r,i){let o;if(ma(e)&&e.error)return pl(t,e.error);if(pa(e)||fa(e,"DOMException")){const i=e;if("stack"in e)o=pl(t,e);else{const e=i.name||(pa(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=Sl(t,s,n,r),qa(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return ha(e)?pl(t,e):wa(e)||ba(e)?(o=function(t,e,n,r){const i=dc(),o=i?.getOptions().normalizeDepth,s=function(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={we:Lc(e,o)};if(s)return{exception:{values:[ml(t,s)]},extra:a};const c={exception:{values:[{type:ba(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:kl(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=gl(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),Ba(o,{synthetic:!0}),o):(o=Sl(t,e,n,r),qa(o,`${e}`),Ba(o,{synthetic:!0}),o)}function Sl(t,e,n,r){const i={};if(r&&n){const r=gl(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),Ba(i,{synthetic:!0})}if(ya(e)){const{ut:t,lt:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function kl(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(ja(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Ta(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Ta(r,e)}return""}(t),r=e?"promise rejection":"exception";return ma(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:ba(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class _l extends Cu{constructor(t){const e=(n=t,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:ll.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(t,e,n=[e],r="npm"){const i=t.oe||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(t=>({name:`${r}:@sentry/${t}`,version:Ps})),version:Ps}),t.oe=i}(e,"browser",["browser"],ll.SENTRY_SDK_SOURCE||"npm"),e.oe?.sdk&&(e.oe.sdk.settings={infer_ip:e.sendDefaultPii?"auto":"never",...e.oe.sdk.settings}),super(e);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Kt;ll.document&&(i||o)&&ll.document.addEventListener("visibilitychange",()=>{"hidden"===ll.document.visibilityState&&(i&&this.ye(),o&&Du(this))}),o&&(this.on("flush",()=>{Du(this)}),this.on("afterCaptureLog",()=>{this.be&&clearTimeout(this.be),this.be=setTimeout(()=>{Du(this)},5e3)})),r&&this.on("beforeSendSession",Au)}eventFromException(t,e){return function(t,e,n,r){const i=xl(t,e,n?.syntheticException||void 0,r);return Ba(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Xc(i)}(this.Kt.stackParser,t,e,this.Kt.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=Sl(t,e,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Xc(o)}(this.Kt.stackParser,t,e,n,this.Kt.attachStacktrace)}fe(t,e,n,r){return t.platform=t.platform||"javascript",super.fe(t,e,n,r)}}const $l="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Nl=Os;let El,Tl,Cl,Il;function Ml(){if(!Nl.document)return;const t=sa.bind(null,"dom"),e=Dl(t,!0);Nl.document.addEventListener("click",e,!1),Nl.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(e=>{const n=Nl,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Da(r,"addEventListener",function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xe=this.xe||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=Dl(t);o.handler=r,e.call(this,n,r,i)}o.refCount++}catch{}return e.call(this,n,r,i)}}),Da(r,"removeEventListener",function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this.xe||{},i=n[e];i&&(i.refCount--,i.refCount<=0&&(t.call(this,e,i.handler,r),i.handler=void 0,delete n[e]),0===Object.keys(n).length&&delete this.xe)}catch{}return t.call(this,e,n,r)}}))})}function Dl(t,e=!1){return n=>{if(!n||n.Se)return;const r=function(t){try{return t.target}catch{return null}}(n);if(function(t,e){return"keypress"===t&&(!e?.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;Oa(n,"_sentryCaptured",!0),r&&!r.ke&&Oa(r,"_sentryId",Fa());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Tl)return!1;try{if(!t.target||t.target.ke!==Cl)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Tl=n.type,Cl=r?r.ke:void 0),clearTimeout(El),El=Nl.setTimeout(()=>{Cl=void 0,Tl=void 0},1e3)}}function Ol(t){const e="history";ia(e,t),oa(e,Pl)}function Pl(){function t(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const r=Il,i=function(t){try{return new URL(t,Nl.location.origin).toString()}catch{return t}}(String(n));if(Il=i,r===i)return t.apply(this,e);sa("history",{from:r,to:i})}return t.apply(this,e)}}Nl.addEventListener("popstate",()=>{const t=Nl.location.href,e=Il;Il=t,e!==t&&sa("history",{from:e,to:t})}),"history"in il&&il.history&&(Da(Nl.history,"pushState",t),Da(Nl.history,"replaceState",t))}const Rl={},jl="__sentry_xhr_v3__";function Al(){if(!Nl.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(t,e,n){const r=new Error,i=1e3*Ga(),o=ga(n[0])?n[0].toUpperCase():void 0,s=function(t){if(ga(t))return t;try{return t.toString()}catch{}}(n[1]);if(!o||!s)return t.apply(e,n);e[jl]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(e._e=!0);const a=()=>{const t=e[jl];if(t&&4===e.readyState){try{t.status_code=e.status}catch{}sa("xhr",{endTimestamp:1e3*Ga(),startTimestamp:i,xhr:e,virtualError:r})}};return"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?e.onreadystatechange=new Proxy(e.onreadystatechange,{apply:(t,e,n)=>(a(),t.apply(e,n))}):e.addEventListener("readystatechange",a),e.setRequestHeader=new Proxy(e.setRequestHeader,{apply(t,e,n){const[r,i]=n,o=e[jl];return o&&ga(r)&&ga(i)&&(o.request_headers[r.toLowerCase()]=i),t.apply(e,n)}}),t.apply(e,n)}}),t.send=new Proxy(t.send,{apply(t,e,n){const r=e[jl];return r?(void 0!==n[0]&&(r.body=n[0]),sa("xhr",{startTimestamp:1e3*Ga(),xhr:e}),t.apply(e,n)):t.apply(e,n)}})}function zl(t,e=function(t){const e=Rl[t];if(e)return e;let n=Nl[t];if(ol(n))return Rl[t]=n.bind(Nl);const r=Nl.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){$l&&Zs(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?Rl[t]=n.bind(Nl):n}("fetch")){let n=0,r=0;return Ru(t,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const n=await e(t.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(t){throw Rl.fetch=void 0,t}finally{n-=o,r--}})}function Fl(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?Ys:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Wl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ll=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ql=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bl=/at (.+?) ?\(data:(.+?),/,Hl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ul=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Zl=Qs([30,t=>{const e=t.match(Bl);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=Wl.exec(t);if(n){const[,t,e,r]=n;return Fl(t,Ys,+e,+r)}const r=Ll.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){const t=ql.exec(r[2]);t&&(r[2]=t[1],r[3]=t[2],r[4]=t[3])}const[t,e]=Gl(r[1]||Ys,r[2]);return Fl(e,t,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,t=>{const e=Hl.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Ul.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||Ys;return[n,t]=Gl(n,t),Fl(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Gl=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:Ys,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Yl="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Jl=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";ia(e,t),oa(e,Xu)}(function(t){return function(e){if(dc()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Ca(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${Ca(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}Fu(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(dc()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(Yl&&Zs(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=$a(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!_a.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),Fu(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),ia("dom",n),oa("dom",Ml)),e.xhr&&function(t){ia("xhr",t),oa("xhr",Al)}(function(t){return function(e){if(dc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[jl];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i,u={method:o,url:s,status_code:a},l={xhr:e.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:u,type:"http",level:rl(a)};t.emit("beforeOutgoingRequestBreadcrumb",d,l),Fu(d,l)}}(t)),e.fetch&&sl(function(t){return function(e){if(dc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error){const i=e.fetchData,o={data:e.error,input:e.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",s,o),Fu(s,o)}else{const i=e.response,o={...e.fetchData,status_code:i?.status},s={input:e.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:rl(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",a,s),Fu(a,s)}}}(t)),e.history&&Ol(function(t){return function(e){if(dc()!==t)return;let n=e.from,r=e.to;const i=ju(ll.location.href);let o=n?ju(n):void 0;const s=ju(r);o?.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Fu({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){dc()===t&&Fu({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:La(e)},{event:e})}}(t))}}},Vl=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Ql=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&Da(ll,"setTimeout",Xl),e.setInterval&&Da(ll,"setInterval",Xl),e.requestAnimationFrame&&Da(ll,"requestAnimationFrame",Kl),e.XMLHttpRequest&&"XMLHttpRequest"in ll&&Da(XMLHttpRequest.prototype,"send",td);const t=e.eventTarget;t&&(Array.isArray(t)?t:Vl).forEach(t=>function(t,e){const n=ll,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Da(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=fl(i.handleEvent,{mechanism:{data:{handler:ta(i),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&function(t,e,n){t&&"object"==typeof t&&"removeEventListener"in t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n)}(this,r,i),n.apply(this,[r,fl(i,{mechanism:{data:{handler:ta(i),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Da(r,"removeEventListener",function(t){return function(e,n,r){try{const i=n.ve;i&&t.call(this,e,i,r)}catch{}return t.call(this,e,n,r)}}))}(t,e))}}};function Xl(t){return function(...e){const n=e[0];return e[0]=fl(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${ta(t)}`}}),t.apply(this,e)}}function Kl(t){return function(e){return t.apply(this,[fl(e,{mechanism:{data:{handler:ta(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function td(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&Da(n,t,function(e){const n={mechanism:{data:{handler:ta(e)},handled:!1,type:`auto.browser.browserapierrors.xhr.${t}`}},r=Ra(e);return r&&(n.mechanism.data.handler=ta(r)),fl(e,n)})}),t.apply(this,e)}}const ed=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";ia(e,e=>{const{stackParser:n,attachStacktrace:r}=rd();if(dc()!==t||hl())return;const{msg:i,url:o,line:s,column:a,error:c}=e,u=function(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],u=r,l=n,d=function(t){if(ga(t)&&0!==t.length){if(t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);return`<data:${e?e[1]:"text/javascript"}${t.includes("base64,")?",base64":""}>`}return t.slice(0,1024)}}(e)??Ea();return 0===c.length&&c.push({colno:u,filename:d,function:Ys,in_app:!0,lineno:l}),t}(xl(n,c||i,void 0,r,!1),o,s,a);u.level="error",du(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),oa(e,ca)}()}(t),nd("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";ia(e,e=>{const{stackParser:n,attachStacktrace:r}=rd();if(dc()!==t||hl())return;const i=function(t){if(va(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}(e),o=va(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:xl(n,i,void 0,r,!0);o.level="error",du(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),oa(e,la)}()}(t),nd("onunhandledrejection"))}}};function nd(t){Yl&&Us(`Global Handler attached: ${t}`)}function rd(){const t=dc();return t?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const id=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){Yu(ml,i.getOptions().stackParser,n,e,t,r)}}};let od=!1;function sd(t){if(od)e();else if(t.enabled&&t.dsn)try{const n=t.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];!function(t={}){const e=!t.skipBrowserExtensionCheck&&!!function(){if(void 0===ll.window)return!1;const t=ll;if(t.nw)return!1;const e=t.chrome||t.browser;if(!e?.runtime?.id)return!1;const n=Ea();return!(ll===ll.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(t=>n.startsWith(`${t}://`)))}()&&(Yl&&Ws(()=>{}),!0),n={...t,enabled:!e&&t.enabled,stackParser:(r=t.stackParser||Zl,Array.isArray(r)?Qs(...r):r),integrations:yu({integrations:t.integrations,defaultIntegrations:null==t.defaultIntegrations?[Uu(),qu(),Ql(),Jl(),ed(),id(),Ku(),{name:"HttpContext",preprocessEvent(t){if(!ll.navigator&&!ll.location&&!ll.document)return;const e=function(){const t=Ea(),{referrer:e}=ll.document||{},{userAgent:n}=ll.navigator||{};return{url:t,headers:{...e&&{Referer:e},...n&&{"User-Agent":n}}}}(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}},{name:"BrowserSession",setupOnce(){void 0!==ll.document?(hu({ignoreDuration:!0}),pu(),Ol(({from:t,to:e})=>{void 0!==t&&t!==e&&(hu({ignoreDuration:!0}),pu())})):Yl&&Zs("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:t.defaultIntegrations}),transport:t.transport||zl};var r;!function(t,e){!0===e.debug&&(Ds?Hs():Ws(()=>{})),cc().update(e.initialScope);const n=new t(e);(function(t){cc().setClient(t)})(n),n.init()}(_l,n)}({dsn:t.dsn,environment:t.environment||"production",release:t.release,beforeSend:t=>function(t,e){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=t.exception)||void 0===n?void 0:n.values)||void 0===r?void 0:r[0])||void 0===i?void 0:i.stacktrace)||void 0===o?void 0:o.frames;if(!s||0===s.length)return!0;return s.some(t=>!!t.filename&&e.some(e=>e.test(t.filename||"")))}(t,n)?(t.tags={...t.tags,source:"insureos-widget"},e(t.exception),t):(e(t.exception),null),allowUrls:n,sampleRate:t.sampleRate||1,tracesSampleRate:t.tracesSampleRate||.1,integrations:[Jl({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Ku()],ignoreErrors:["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]}),od=!0,e()}catch(t){}else e()}function ad(t,n){if(od)try{n?lc(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),uu(t)}):uu(t)}catch(t){e()}}function cd(t,n="info",r){if(od)try{r?lc(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),lu(t,n)}):lu(t,n)}catch(t){e()}}function ud(t){if(od)try{!function(t){uc().setUser(t)}(t)}catch(t){e()}}function ld(t){if(od)try{Fu(t)}catch(t){e()}}function dd(t,n){if(od)try{!function(t,e){uc().setTag(t,e)}(t,n)}catch(t){e()}}function hd(){return od}var fd=Object.freeze({__proto__:null,addBreadcrumb:ld,captureException:ad,captureMessage:cd,initializeSentry:sd,isSentryInitialized:hd,setTag:dd,setUser:ud});const md="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",pd="production",gd="insureos-scripts",yd=!0,vd=1,wd=.1;class bd{constructor(t={}){var e,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(e=t.enabled)||void 0===e||e,customDataLayer:null!==(n=t.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=t.includePersonalData)&&void 0!==r&&r,debug:null!==(i=t.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const t=this.config.customDataLayer;window[t]||(window[t]=[],this.logDebug(`Created new ${t} array`)),Array.isArray(window[t])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${t}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${t}' exists but is not an array`))}catch(t){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",t)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const t=window[this.config.customDataLayer];return Array.isArray(t)?t:null}catch(t){return this.logDebug("Failed to get data layer:",t),null}}push(t){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",t.event);const e=this.getDataLayer();if(e)try{const n=this.config.includePersonalData?t:this.removePII(t);e.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(t){this.logDebug("❌ Failed to push event to data layer:",t)}else this.logDebug("⚠️ Data layer not available, skipping event:",t.event)}removePII(t){const e={...t},n=["email","phone","name","address","client_name","client_email"];for(const t of n)t in e&&delete e[t];return e}logDebug(...t){this.config.debug&&e("[Analytics]",...t)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(t){this.logDebug("Failed to clear data layer:",t)}}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},(t.customDataLayer||void 0!==t.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class xd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{sd({dsn:md,environment:pd,release:gd,enabled:yd,sampleRate:vd,tracesSampleRate:wd}),this.sentryInitialized=!0,e()}catch(t){e()}}validateConfig(t){if(!t.orgId)throw new Error("orgId is required")}initializeAnalyticsOnce(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new bd({enabled:null===(n=t.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=t.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=t.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=t.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:t.debug}),ft(this.analyticsManager),e()}catch(t){e()}}async mount(t,e){e.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(e),this.initializeSentryOnce(),this.initializeAnalyticsOnce(e),function(t,e){var i,o,s;e==document&&(e=document.documentElement),r.m&&r.m(t,e),i=e.i,o=[],s=[],R(e,t=e.i=x(k,null,[t]),i||p,p,e.namespaceURI,i?null:e.firstChild?n.call(e.childNodes):null,o,i?i.v:e.firstChild,!1,s),A(o,t,s)}(x(Is,{config:e,initializeFormContext:this.initializeFormContext.bind(this)}),t)}createHttpClient(t){var e,n,r,i,o,s,a,c,u,l;this.validateConfig(t);const d=t.apiBaseUrl||"https://api.os.insure";return new U({orgId:t.orgId,apiBaseUrl:d,timeout:(null===(e=t.httpConfig)||void 0===e?void 0:e.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=t.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=t.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=t.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(u=null===(c=t.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===u?void 0:u.retryableStatusCodes)||[429,500,502,503,504],...null===(l=t.httpConfig)||void 0===l?void 0:l.retryConfig}})}createClient(t){const e=this.createHttpClient(t);return new $t(e)}async initializeFormContext(t){const n=this.createHttpClient(t),r="sessionStorage"===t.storageType?new G:new Z;r.isAvailable()?e(r.constructor.name):e();const i=new J(r),o=new V(i),s=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent(t.product);return e(),{id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_url,expires_at:new Date(r.quote_intent.expires_at).getTime(),updated_at:new Date(r.quote_intent.updated_at).getTime(),created_at:new Date(r.quote_intent.created_at).getTime(),org_id:t.orgId,product_id:r.product.id,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,organisation:r.organisation,cached_result:r.cached_result}},a=async r=>{e();const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id"),a=await n.getQuoteIntent(r);let c;if(e(),e(a.cached_result),a.cached_result?(e(),e(a.cached_result.outcome_type)):e(),s&&a.payment_transactions){e();const t=a.payment_transactions.find(t=>t.id===s);if(t){e();let n="unknown";switch(t.status){case"completed":n="success";break;case"failed":n="declined";break;case"cancelled":n="cancelled";break;default:n="error"}c={paymentTransactionId:t.id,paymentStatus:n,transactionStatus:t};const r=new URL(window.location.href);r.searchParams.delete("transaction_id"),r.searchParams.delete("payment_id"),r.searchParams.delete("payment"),r.searchParams.delete("payment_status"),r.searchParams.delete("status"),window.history.replaceState({},"",r.toString())}else e()}const u={id:a.quote_intent.id,url:a.url,calculate_url:a.calculate_url,expires_at:new Date(a.quote_intent.expires_at).getTime(),updated_at:new Date(a.quote_intent.updated_at).getTime(),created_at:new Date(a.quote_intent.created_at).getTime(),org_id:t.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,organisation:a.organisation,payment_return:c,cached_result:a.cached_result};return e(),c&&i.saveQuoteIntent(t.orgId,u),u};e();const c=`insure_os_quote_intent_${t.orgId}`;localStorage.getItem(c),e(),i.getQuoteIntent(t.orgId),e(),e();let u=null,l=!1;try{const n=i.getQuoteIntent(t.orgId),r=await o.getOrCreateQuoteIntent(t.orgId,s,a);e(),e(r.cached_result),r.cached_result&&e(r.cached_result.outcome_type),u=r,l=!n}catch(n){if(e(),!(n instanceof B&&404===n.statusCode))throw n;e(),o.clearQuoteIntent(t.orgId),u=await o.getOrCreateQuoteIntent(t.orgId,s,a),l=!0}if(l&&u&&pt(u),!u)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(e(),localStorage.clear());const d=new kt(u,n,o,{autoSave:u.form_definition.settings.autoSave,autoSaveInterval:u.form_definition.settings.autoSaveInterval});if(u.form_data&&d.restoreFormProgress(u.form_data),e(u.cached_result),u.cached_result?(e(u.cached_result),d.restoreCalculationResult(u.cached_result),e(),e(d.hasCalculationResponse())):e(),u.organisation&&u.organisation.theme)try{await Ms.loadTheme({slug:u.organisation.slug,theme_url:u.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:u,quoteIntentStore:o,formStateManager:d}}async handleAutoCalculationIfComplete(t){try{const n=t.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void e();if(t.hasCalculationResponse())return void e();if(t.hasLastCalculationFailed())return void e();const r=t.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;e((o.length,t.getIsCalculating(),t.hasLastCalculationFailed())),s&&!t.getIsCalculating()&&(e(),await t.calculateQuote(),e())}catch(t){e()}}}const Sd=new xd;"undefined"!=typeof window&&(window.InsureOS=Sd,function(){const t=document.querySelectorAll('script[src*="insureos"]'),e=t[t.length-1];if(e&&e.src){const t=new URL(e.src),n=t.searchParams.get("orgId"),r=t.searchParams.get("productCode");if(n&&r){const e=t.searchParams.get("container"),i=e?document.getElementById(e):document.body;if(i){const t={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(t);const e=async()=>{try{await Sd.mount(i,t)}catch(t){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}}}}());class kd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,kd.instance)return kd.instance;kd.instance=this}startMeasurement(t){this.measurements.set(t,this.now())}endMeasurement(t){const e=this.measurements.get(t);if(void 0===e)throw new Error(`No measurement started for: ${t}`);const n=this.now()-e;return this.measurements.delete(t),this.completedMeasurements.has(t)||this.completedMeasurements.set(t,[]),this.completedMeasurements.get(t).push(n),"initialization"===t&&(this.initializationTime=n),n}async measureApiCall(t,e){const n=this.now();let r,i=!1;try{const t=await e();return i=!0,t}catch(t){throw i=!1,r=t instanceof Error?t.message:"Unknown error",t}finally{const e=this.now()-n;this.apiCallMetrics.push({operation:t,duration:e,timestamp:Date.now(),success:i,error:r})}}measureMemoryUsage(){return"undefined"!=typeof performance&&"memory"in performance&&performance.memory.usedJSHeapSize||0}getDetailedMemoryInfo(){if("undefined"!=typeof performance&&"memory"in performance){const t=performance.memory;return{usedJSHeapSize:t.usedJSHeapSize||0,totalJSHeapSize:t.totalJSHeapSize||0,jsHeapSizeLimit:t.jsHeapSizeLimit||0}}return null}getMetrics(){var t;const e=this.apiCallMetrics.filter(t=>t.success).map(t=>t.duration),n=e.length>0?e.reduce((t,e)=>t+e,0)/e.length:0,r={};return this.completedMeasurements.forEach((t,e)=>{r[e]=[...t]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:e.length>0&&null!==(t=e[e.length-1])&&void 0!==t?t:0,memoryUsage:this.measureMemoryUsage(),averageApiCallTime:n,totalApiCalls:this.apiCallMetrics.length},measurements:r}}getApiCallMetrics(){return[...this.apiCallMetrics]}clearMetrics(){this.completedMeasurements.clear(),this.apiCallMetrics=[],this.initializationTime=0}generateReport(){const t=this.getMetrics(),e=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${t.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${t.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${t.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(t.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,e&&(n+="Memory Details:\n",n+=` Used Heap: ${(e.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(e.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(e.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const t=new Map;this.apiCallMetrics.forEach(e=>{t.has(e.operation)||t.set(e.operation,{count:0,totalTime:0,errors:0});const n=t.get(e.operation);n.count++,n.totalTime+=e.duration,e.success||n.errors++}),t.forEach((t,e)=>{const r=t.totalTime/t.count,i=(t.errors/t.count*100).toFixed(1);n+=` ${e}: ${t.count} calls, ${r.toFixed(2)}ms avg, ${i}% errors\n`})}return n}static async getBundleSizes(){return{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}}}now(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()}static startMeasurement(t){(new kd).startMeasurement(t)}static endMeasurement(t){return(new kd).endMeasurement(t)}static measureMemoryUsage(){return(new kd).measureMemoryUsage()}static async measureApiCall(t,e){return(new kd).measureApiCall(t,e)}static getMetrics(){return(new kd).getMetrics()}static generateReport(){return(new kd).generateReport()}}var _d;t.VersionStrategy=void 0,(_d=t.VersionStrategy||(t.VersionStrategy={})).FIXED="fixed",_d.LATEST="latest";let $d=class t{constructor(e){this.headers=new Map,e&&(Array.isArray(e)?e.forEach(([t,e])=>this.set(t,e)):e instanceof t?e.forEach((t,e)=>this.set(e,t)):Object.entries(e).forEach(([t,e])=>this.set(t,e)))}append(t,e){const n=this.get(t);this.set(t,n?`${n}, ${e}`:e)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())||null}has(t){return this.headers.has(t.toLowerCase())}set(t,e){this.headers.set(t.toLowerCase(),e)}forEach(t){this.headers.forEach(t)}},Nd=class{constructor(t,e={}){var n;"string"==typeof t?(this.url=t,this.method=e.method||"GET",this.headers=new $d(e.headers),this.body=e.body||null,this.signal=e.signal||void 0):(this.url=t.url,this.method=e.method||t.method,this.headers=new $d(e.headers||t.headers),this.body=void 0!==e.body?e.body:t.body,this.signal=void 0!==e.signal?null!==(n=e.signal)&&void 0!==n?n:void 0:t.signal)}},Ed=class{constructor(t="",e={}){this.status=e.status||200,this.statusText=e.statusText||"OK",this.headers=new $d(e.headers),this.ok=this.status>=200&&this.status<300,this.$e=t}async text(){return this.$e}async json(){return JSON.parse(this.$e)}};var Td=Object.freeze({__proto__:null,Headers:$d,Request:Nd,Response:Ed,fetch:async function(t,e={}){return new Promise((n,r)=>{const i=new Nd(t,e),o=new XMLHttpRequest;i.signal&&i.signal.addEventListener("abort",()=>{o.abort(),r(new Error("Request aborted"))}),o.open(i.method,i.url),i.headers.forEach((t,e)=>{o.setRequestHeader(e,t)}),o.onload=()=>{const t=new $d;o.getAllResponseHeaders().split("\r\n").forEach(e=>{const[n,r]=e.split(": ");n&&r&&t.set(n,r)});const e=new Ed(o.responseText,{status:o.status,statusText:o.statusText,headers:t});n(e)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class Cd{constructor(t){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{t(this.resolve.bind(this),this.reject.bind(this))}catch(t){this.reject(t)}}resolve(t){"pending"===this.state&&(this.state="fulfilled",this.value=t,this.onFulfilledCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}reject(t){"pending"===this.state&&(this.state="rejected",this.reason=t,this.onRejectedCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}then(t,e){return new Cd((n,r)=>{const i=e=>{try{if(t){const i=t(e);i instanceof Cd?i.then(n,r):n(i)}else n(e)}catch(t){r(t)}},o=t=>{try{if(e){const i=e(t);i instanceof Cd?i.then(n,r):n(i)}else r(t)}catch(t){r(t)}};"fulfilled"===this.state?setTimeout(()=>i(this.value),0):"rejected"===this.state?setTimeout(()=>o(this.reason),0):(this.onFulfilledCallbacks.push(i),this.onRejectedCallbacks.push(o))})}catch(t){return this.then(void 0,t)}static resolve(t){return new Cd(e=>e(t))}static reject(t){return new Cd((e,n)=>n(t))}static all(t){return new Cd((e,n)=>{if(0===t.length)return void e([]);const r=[];let i=0;t.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===t.length&&e(r)},n)})})}}var Id=Object.freeze({__proto__:null,PromisePolyfill:Cd});class Md{constructor(t){this.params=new Map,"string"==typeof t?this.parseString(t):t&&"object"==typeof t&&"forEach"in t&&"function"==typeof t.forEach?t.forEach((t,e)=>this.append(e,t)):t&&"object"==typeof t&&Object.entries(t).forEach(([t,e])=>this.set(t,e))}parseString(t){const e=t.startsWith("?")?t.slice(1):t;e&&e.split("&").forEach(t=>{if(!t)return;const e=t.indexOf("=");let n,r;-1===e?(n=t,r=""):(n=t.substring(0,e),r=t.substring(e+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(t,e){const n=this.params.get(t)||[];n.push(e),this.params.set(t,n)}delete(t){this.params.delete(t)}get(t){var e;const n=this.params.get(t);return n&&n.length>0&&null!==(e=n[0])&&void 0!==e?e:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}forEach(t){this.params.forEach((e,n)=>{e.forEach(e=>t(e,n))})}toString(){const t=[];return this.params.forEach((e,n)=>{e.forEach(e=>{t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`)})}),t.join("&")}}var Dd=Object.freeze({__proto__:null,URLPolyfill:class{constructor(t,e){const n=this.parseUrl(t,e);this.protocol=n.protocol,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.hash=n.hash,this.host=this.port?`${this.hostname}:${this.port}`:this.hostname,this.origin=`${this.protocol}//${this.host}`,this.href=this.toString(),this.searchParams=new Md(this.search)}parseUrl(t,e){const n=document.createElement("a");if(e){const r=document.createElement("a");r.href=e,n.href=this.resolveUrl(t,r.href)}else n.href=t;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(t,e){if(t.includes("://"))return t;if(t.startsWith("/")){const n=document.createElement("a");return n.href=e,`${n.protocol}//${n.host}${t}`}return`${e.split("/").slice(0,-1).join("/")}/${t}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:Md});t.DataLayerManager=bd,t.EnhancedHttpClient=U,t.ErrorHandlingStrategy=class{handleNetworkError(e){return new B(t.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new B(t.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);const n=e.status>=500||429===e.status;return 429===e.status?new B(t.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new B(t.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new B(t.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new B(t.ErrorType.API_ERROR,`Request failed: ${e.statusText}`,n,e.status)}handleStorageError(e){return new B(t.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(t){return t.retryable}getUserFriendlyMessage(e){switch(e.type){case t.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case t.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case t.ErrorType.API_ERROR:return 429===e.statusCode?"Too many requests. Please wait a moment and try again.":e.statusCode&&e.statusCode>=400&&e.statusCode<500?"Invalid request. Please refresh the page and try again.":e.statusCode&&e.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case t.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case t.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case t.ErrorType.VALIDATION_ERROR:return e.validationErrors&&Object.keys(e.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}},t.FormStateManager=kt,t.InsureOS=Sd,t.InsureOSClient=xd,t.InsureOSError=B,t.LocalStateManager=J,t.LocalStorageAdapter=Z,t.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(t){return this.storage.get(t)||null}set(t,e){this.storage.set(t,e)}remove(t){this.storage.delete(t)}clear(){this.storage.clear()}isAvailable(){return!0}},t.PerformanceMonitor=kd,t.PolyfillManager=class{constructor(t={}){var e,n,r;this.detectionResults=null,this.config={fetch:null===(e=t.fetch)||void 0===e||e,promise:null===(n=t.promise)||void 0===n||n,url:null===(r=t.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(t){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const t=Promise.resolve(42);return"function"!=typeof t.then||"function"!=typeof t.catch}catch(t){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const t=new URL("http://example.com/path?param=value#hash");if("string"!=typeof t.protocol||"string"!=typeof t.hostname||"string"!=typeof t.pathname||"string"!=typeof t.search||"string"!=typeof t.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const e=new URLSearchParams("param=value");return"function"!=typeof e.get||"function"!=typeof e.set}catch(t){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:t,Headers:e,Request:n,Response:r}=await Promise.resolve().then(function(){return Td});void 0===globalThis.fetch&&(globalThis.fetch=t),void 0===globalThis.Headers&&(globalThis.Headers=e),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(t){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:t}=await Promise.resolve().then(function(){return Id});void 0===globalThis.Promise&&(globalThis.Promise=t)}catch(t){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:t,URLSearchParamsPolyfill:e}=await Promise.resolve().then(function(){return Dd});void 0===globalThis.URL&&(globalThis.URL=t),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=e)}catch(t){}}},t.RetryStrategy=H,t.SessionStorageAdapter=G,t.ThemeLoader=Ms,t.addBreadcrumb=ld,t.captureException=ad,t.captureMessage=cd,t.createAppError=it,t.getAnalytics=function(){return ht},t.getSupportMessage=dt,t.groupErrorsByField=function(t){return t.reduce((t,e)=>(t[e.field]||(t[e.field]=[]),t[e.field].push(e),t),{})},t.initializeAnalytics=ft,t.initializeSentry=sd,t.isSentryInitialized=hd,t.parseServerValidationErrors=tt,t.setTag=dd,t.setUser=ud,t.shouldShowErrorPage=function(t){return"initialization"===t.type&&"critical"===t.severity},t.shouldShowMaintenancePage=lt,t.trackFormProgress=gt,t.trackPaymentCompleted=xt,t.trackPaymentFailed=St,t.trackPaymentInitiated=bt,t.trackQuoteAtCheckout=vt,t.trackQuoteCalculated=yt,t.trackQuoteReferred=wt,t.trackQuoteStarted=pt,t.validateField=X,t.validatePage=K});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).InsureOSScripts={})}(this,function(t){"use strict";const e=()=>{globalThis.insureOSDebug};var n,r,i,o,s,a,c,l,u,d,h,f,m,p={},g=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function w(t,e){for(var n in e)t[n]=e[n];return t}function b(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function x(t,e,r){var i,o,s,a={};for(s in e)"key"==s?i=e[s]:"ref"==s?o=e[s]:a[s]=e[s];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(s in t.defaultProps)void 0===a[s]&&(a[s]=t.defaultProps[s]);return k(t,a,i,o,null)}function k(t,e,n,o,s){var a={type:t,props:e,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:null==s?++i:s,N:-1,C:0};return null==s&&null!=r.vnode&&r.vnode(a),a}function S(t){return t.children}function _(t,e){this.props=t,this.context=e}function $(t,e){if(null==e)return t.m?$(t.m,t.N+1):null;for(var n;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v)return n.v;return"function"==typeof t.type?$(t):null}function N(t){var e,n;if(null!=(t=t.m)&&null!=t.k){for(t.v=t.k.base=null,e=0;e<t.i.length;e++)if(null!=(n=t.i[e])&&null!=n.v){t.v=t.k.base=n.v;break}return N(t)}}function E(t){(!t.I&&(t.I=!0)&&o.push(t)&&!T.O++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(T)}function T(){for(var t,e,n,i,s,a,l,u=1;o.length;)o.length>u&&o.sort(c),t=o.shift(),u=o.length,t.I&&(n=void 0,s=(i=(e=t)._).v,a=[],l=[],e.P&&((n=w({},i))._=i._+1,r.vnode&&r.vnode(n),R(e.P,n,i,e.R,e.P.namespaceURI,32&i.C?[s]:null,a,null==s?$(i):s,!!(32&i.C),l),n._=i._,n.m.i[n.N]=n,A(a,n,l),n.v!=s&&N(n)));T.O=0}function C(t,e,n,r,i,o,s,a,c,l,u){var d,h,f,m,y,w,b,x=r&&r.i||g,_=e.length;for(c=function(t,e,n,r,i){var o,s,a,c,l,u=n.length,d=u,h=0;for(t.i=new Array(i),o=0;o<i;o++)null!=(s=e[o])&&"boolean"!=typeof s&&"function"!=typeof s?(c=o+h,(s=t.i[o]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?k(null,s,null,null,null):v(s)?k(S,{children:s},null,null,null):null==s.constructor&&s.p>0?k(s.type,s.props,s.key,s.ref?s.ref:null,s._):s).m=t,s.p=t.p+1,a=null,-1!=(l=s.N=M(s,n,c,d))&&(d--,(a=n[l])&&(a.C|=2)),null==a||null==a._?(-1==l&&(i>u?h--:i<u&&h++),"function"!=typeof s.type&&(s.C|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?h--:h++,s.C|=4))):t.i[o]=null;if(d)for(o=0;o<u;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=$(a)),W(a,a));return r}(n,e,x,c,_),d=0;d<_;d++)null!=(f=n.i[d])&&(h=-1==f.N?p:x[f.N]||p,f.N=d,w=R(t,f,h,i,o,s,a,c,l,u),m=f.v,f.ref&&h.ref!=f.ref&&(h.ref&&L(h.ref,null,f),u.push(f.ref,f.k||m,f)),null==y&&null!=m&&(y=m),(b=!!(4&f.C))||h.i===f.i?c=I(f,c,t,b):"function"==typeof f.type&&void 0!==w?c=w:m&&(c=m.nextSibling),f.C&=-7);return n.v=y,c}function I(t,e,n,r){var i,o;if("function"==typeof t.type){for(i=t.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=t,e=I(i[o],e,n,r));return e}t.v!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=$(t)),n.insertBefore(t.v,e||null)),e=t.v);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function M(t,e,n,r){var i,o,s,a=t.key,c=t.type,l=e[n],u=null!=l&&!(2&l.C);if(null===l&&null==t.key||u&&a==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<e.length;)if(null!=(l=e[s=i>=0?i--:o++])&&!(2&l.C)&&a==l.key&&c==l.type)return s;return-1}function D(t,e,n){"-"==e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||y.test(e)?n:n+"px"}function O(t,e,n,r,i){var o,s;t:if("style"==e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof r&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||D(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||D(t.style,e,n[e])}else if("o"==e[0]&&"n"==e[1])o=e!=(e=e.replace(l,"$1")),s=e.toLowerCase(),e=s in t||"onFocusOut"==e||"onFocusIn"==e?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n.u=r.u:(n.u=u,t.addEventListener(e,o?h:d,o)):t.removeEventListener(e,o?h:d,o);else{if("http://www.w3.org/2000/svg"==i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function P(t){return function(e){if(this.l){var n=this.l[e.type+t];if(null==e.t)e.t=u++;else if(e.t<n.u)return;return n(r.event?r.event(e):e)}}}function R(t,e,n,i,o,s,a,c,l,u){var d,h,f,m,p,g,y,x,k,$,N,E,T,I,M,D,O,P=e.type;if(null!=e.constructor)return null;128&n.C&&(l=!!(32&n.C),s=[c=e.v=n.v]),(d=r.p)&&d(e);t:if("function"==typeof P)try{if(x=e.props,k="prototype"in P&&P.prototype.render,$=(d=P.contextType)&&i[d.k],N=d?$?$.props.value:d.m:i,n.k?y=(h=e.k=n.k).m=h.j:(k?e.k=h=new P(x,N):(e.k=h=new _(x,N),h.constructor=P,h.render=q),$&&$.sub(h),h.props=x,h.state||(h.state={}),h.context=N,h.R=i,f=h.I=!0,h.A=[],h.L=[]),k&&null==h.W&&(h.W=h.state),k&&null!=P.getDerivedStateFromProps&&(h.W==h.state&&(h.W=w({},h.W)),w(h.W,P.getDerivedStateFromProps(x,h.W))),m=h.props,p=h.state,h._=e,f)k&&null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),k&&null!=h.componentDidMount&&h.A.push(h.componentDidMount);else{if(k&&null==P.getDerivedStateFromProps&&x!==m&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(x,N),!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(x,h.W,N)||e._==n._){for(e._!=n._&&(h.props=x,h.state=h.W,h.I=!1),e.v=n.v,e.i=n.i,e.i.some(function(t){t&&(t.m=e)}),E=0;E<h.L.length;E++)h.A.push(h.L[E]);h.L=[],h.A.length&&a.push(h);break t}null!=h.componentWillUpdate&&h.componentWillUpdate(x,h.W,N),k&&null!=h.componentDidUpdate&&h.A.push(function(){h.componentDidUpdate(m,p,g)})}if(h.context=N,h.props=x,h.P=t,h.v=!1,T=r.O,I=0,k){for(h.state=h.W,h.I=!1,T&&T(e),d=h.render(h.props,h.state,h.context),M=0;M<h.L.length;M++)h.A.push(h.L[M]);h.L=[]}else do{h.I=!1,T&&T(e),d=h.render(h.props,h.state,h.context),h.state=h.W}while(h.I&&++I<25);h.state=h.W,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),k&&!f&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(m,p)),D=d,null!=d&&d.type===S&&null==d.key&&(D=z(d.props.children)),c=C(t,v(D)?D:[D],e,n,i,o,s,a,c,l,u),h.base=e.v,e.C&=-161,h.A.length&&a.push(h),y&&(h.j=h.m=null)}catch(t){if(e._=null,l||null!=s)if(t.then){for(e.C|=l?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;s[s.indexOf(c)]=null,e.v=c}else{for(O=s.length;O--;)b(s[O]);j(e)}else e.v=n.v,e.i=n.i,t.then||j(e);r.v(t,e,n)}else null==s&&e._==n._?(e.i=n.i,e.v=n.v):c=e.v=F(n.v,e,n,i,o,s,a,l,u);return(d=r.diffed)&&d(e),128&e.C?void 0:c}function j(t){t&&t.k&&(t.k.v=!0),t&&t.i&&t.i.forEach(j)}function A(t,e,n){for(var i=0;i<n.length;i++)L(n[i],n[++i],n[++i]);r.k&&r.k(e,t),t.some(function(e){try{t=e.A,e.A=[],t.some(function(t){t.call(e)})}catch(t){r.v(t,e._)}})}function z(t){return"object"!=typeof t||null==t||t.p&&t.p>0?t:v(t)?t.map(z):w({},t)}function F(t,e,i,o,s,a,c,l,u){var d,h,f,m,g,y,w,x=i.props,k=e.props,S=e.type;if("svg"==S?s="http://www.w3.org/2000/svg":"math"==S?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=a)for(d=0;d<a.length;d++)if((g=a[d])&&"setAttribute"in g==!!S&&(S?g.localName==S:3==g.nodeType)){t=g,a[d]=null;break}if(null==t){if(null==S)return document.createTextNode(k);t=document.createElementNS(s,S,k.is&&k),l&&(r.B&&r.B(e,a),l=!1),a=null}if(null==S)x===k||l&&t.data==k||(t.data=k);else{if(a=a&&n.call(t.childNodes),x=i.props||p,!l&&null!=a)for(x={},d=0;d<t.attributes.length;d++)x[(g=t.attributes[d]).name]=g.value;for(d in x)if(g=x[d],"children"==d);else if("dangerouslySetInnerHTML"==d)f=g;else if(!(d in k)){if("value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k)continue;O(t,d,null,g,s)}for(d in k)g=k[d],"children"==d?m=g:"dangerouslySetInnerHTML"==d?h=g:"value"==d?y=g:"checked"==d?w=g:l&&"function"!=typeof g||x[d]===g||O(t,d,g,x[d],s);if(h)l||f&&(h.H==f.H||h.H==t.innerHTML)||(t.innerHTML=h.H),e.i=[];else if(f&&(t.innerHTML=""),C("template"==e.type?t.content:t,v(m)?m:[m],e,i,o,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,a,c,a?a[0]:i.i&&$(i,0),l,u),null!=a)for(d=a.length;d--;)b(a[d]);l||(d="value","progress"==S&&null==y?t.removeAttribute("value"):null!=y&&(y!==t[d]||"progress"==S&&!y||"option"==S&&y!=x[d])&&O(t,d,y,x[d],s),d="checked",null!=w&&w!=t[d]&&O(t,d,w,x[d],s))}return t}function L(t,e,n){try{if("function"==typeof t){var i="function"==typeof t.C;i&&t.C(),i&&null==e||(t.C=t(e))}else t.current=e}catch(t){r.v(t,n)}}function W(t,e,n){var i,o;if(r.unmount&&r.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.v||L(i,null,e)),null!=(i=t.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){r.v(t,e)}i.base=i.P=null}if(i=t.i)for(o=0;o<i.length;o++)i[o]&&W(i[o],e,n||"function"!=typeof t.type);n||b(t.v),t.k=t.m=t.v=void 0}function q(t,e,n){return this.constructor(t,n)}n=g.slice,r={v:function(t,e,n,r){for(var i,o,s;e=e.m;)if((i=e.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(t)),s=i.I),null!=i.componentDidCatch&&(i.componentDidCatch(t,r||{}),s=i.I),s)return i.j=i}catch(e){t=e}throw t}},i=0,_.prototype.setState=function(t,e){var n;n=null!=this.W&&this.W!=this.state?this.W:this.W=w({},this.state),"function"==typeof t&&(t=t(w({},n),this.props)),t&&w(n,t),null!=t&&this._&&(e&&this.L.push(e),E(this))},_.prototype.forceUpdate=function(t){this._&&(this.v=!0,t&&this.A.push(t),E(this))},_.prototype.render=S,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,c=function(t,e){return t._.p-e._.p},T.O=0,l=/(PointerCapture)$|Capture$/i,u=0,d=P(!1),h=P(!0),f=0,t.ErrorType=void 0,(m=t.ErrorType||(t.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",m.API_ERROR="API_ERROR",m.VALIDATION_ERROR="VALIDATION_ERROR",m.STORAGE_ERROR="STORAGE_ERROR",m.TIMEOUT_ERROR="TIMEOUT_ERROR",m.MAINTENANCE_ERROR="MAINTENANCE_ERROR";class B extends Error{constructor(t,e,n=!1,r,i,o){super(e),this.type=t,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.name="InsureOSError"}}class H{constructor(t){this.config=t}shouldRetry(t,e){return!(e>=this.config.maxRetries)&&this.isRetryableError(t)}getDelay(t,e){if(e){const t=parseInt(e,10);if(!isNaN(t))return 1e3*t}const n=this.config.baseDelay*Math.pow(2,t);return Math.min(n,this.config.maxDelay)}isRetryableError(t){return t instanceof B?t.retryable:!("TypeError"!==t.name||!t.message.includes("fetch"))||"AbortError"===t.name}}class U{constructor(t){this.config=t,this.retryStrategy=new H(t.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:e,method:n,body:r}){return this.executeWithRetry(async()=>{const i=new AbortController,o=setTimeout(()=>i.abort(),this.config.timeout);try{const t={method:n,headers:{"Content-Type":"application/json","X-Organisation-ID":this.config.orgId},signal:i.signal};r&&(t.body=JSON.stringify(r));const s=await fetch(e,t);if(clearTimeout(o),!s.ok)throw await this.handleApiError(s);const a=await s.json();return a.data||a}catch(e){if(clearTimeout(o),e instanceof B)throw e;if(e instanceof Error&&"AbortError"===e.name)throw new B(t.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(e instanceof TypeError&&e.message.includes("fetch"))throw new B(t.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw e}})}getQuoteIntent(t){return this.makeRequest({url:t,method:"GET"})}createQuoteIntent(t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:t})}updateQuoteIntent(t,e){return this.makeRequest({url:t,method:"PUT",body:e})}deleteQuoteIntent(t){return this.makeRequest({url:t,method:"DELETE"})}calculateQuoteIntent(t){return this.makeRequest({url:t,method:"POST"})}initiatePayment(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/initiate`,method:"POST",body:t})}getPaymentStatus(t,e){return this.makeRequest({url:`${this.config.apiBaseUrl}/integrations/${e.code}/status/${t}`,method:"GET"})}async executeWithRetry(t){let n;for(let r=0;r<=this.config.retryConfig.maxRetries;r++)try{return e(this.config.retryConfig.maxRetries),await t()}catch(t){n=t;const i=this.retryStrategy.shouldRetry(n,r);if(e(t instanceof B&&(t.type,t.message)),e(this.config.retryConfig.maxRetries),r===this.config.retryConfig.maxRetries||!i)throw e(),n;const o=t instanceof B?t.retryAfter:void 0,s=this.retryStrategy.getDelay(r,o);e(),await new Promise(t=>setTimeout(t,s))}throw n}async handleApiError(n){var r;const i=n.headers.get("retry-after"),o=await n.json().catch(()=>({}));if(e(),this.captureApiErrorToSentry(n,o),503===n.status)return new B(t.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status);if(429===n.status)return new B(t.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,i||void 0);if(n.status>=500){const e=o.message||"Service temporarily unavailable. Please try again in a moment.";return new B(t.ErrorType.API_ERROR,e,!1,n.status)}if(422===n.status)try{const e=o;return e.error&&e.error.details&&e.error.details.form_data?new B(t.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,e.error.details):new B(t.ErrorType.VALIDATION_ERROR,e.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(r=e.error)||void 0===r?void 0:r.details)}catch(e){return new B(t.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const e=o;return e.errors?new B(t.ErrorType.VALIDATION_ERROR,e.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,e.errors):new B(t.ErrorType.API_ERROR,e.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(e){return new B(t.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const e=o.message||"Invalid request. Please refresh the page and try again.";return new B(t.ErrorType.API_ERROR,e,!1,n.status)}return new B(t.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(t,e){try{(t.status>=500||429===t.status)&&Promise.resolve().then(function(){return hd}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${t.status} ${t.statusText}`,category:"http",level:"error",data:{url:t.url,status:t.status,statusText:t.statusText}}),n(`API Error: ${t.status} - ${t.url}`,"error",{http:{status_code:t.status,url:t.url,method:"Unknown"},response:e}))}).catch(()=>{})}catch(t){}}}class Z{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return localStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{localStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{localStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{localStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const t="__insure_os_storage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),!0}catch(t){return!1}}}class G{constructor(){this.available=this.checkAvailability()}get(t){if(!this.available)return null;try{return sessionStorage.getItem(t)}catch(t){return null}}set(t,e){if(this.available)try{sessionStorage.setItem(t,e)}catch(t){}}remove(t){if(this.available)try{sessionStorage.removeItem(t)}catch(t){}}clear(){if(this.available)try{sessionStorage.clear()}catch(t){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const t="__insure_os_storage_test__";return sessionStorage.setItem(t,"test"),sessionStorage.removeItem(t),!0}catch(t){return!1}}}class Y{static generateKey(t,e,n){const r=[this.KEY_PREFIX+t,e];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(t){try{return JSON.stringify({data:t,timestamp:Date.now(),version:"1.0"})}catch(t){throw new Error(`Failed to serialize data: ${t}`)}}static deserialize(t){try{const e=JSON.parse(t);return e&&"object"==typeof e&&e.data?e.data:null}catch(t){return null}}static getTimestamp(t){try{return JSON.parse(t).timestamp||null}catch(t){return null}}static isExpired(t,e){const n=this.getTimestamp(t);return!n||Date.now()-n>e}}Y.KEY_PREFIX="insure_os_",Y.SEPARATOR="_";class J{constructor(t,e={}){this.storageAdapter=t,this.config={defaultExpirationMs:e.defaultExpirationMs||J.DEFAULT_EXPIRATION_MS,namespace:e.namespace||J.DEFAULT_NAMESPACE}}saveQuoteIntent(t,e){if(this.storageAdapter.isAvailable())try{const n=this.generateStorageKey(t),r=Y.serialize(e);this.storageAdapter.set(n,r)}catch(t){}}getQuoteIntent(t){if(!this.storageAdapter.isAvailable())return null;try{const e=this.generateStorageKey(t),n=this.storageAdapter.get(e);if(!n)return null;const r=Y.deserialize(n);return r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(t),null)}catch(t){return null}}removeQuoteIntent(t){if(this.storageAdapter.isAvailable())try{const e=this.generateStorageKey(t);this.storageAdapter.remove(e)}catch(t){}}isQuoteIntentValid(t){if(!t||"object"!=typeof t)return!1;if(!t.id||!t.url||!t.org_id)return!1;const e=Date.now();return!(t.expires_at&&e>t.expires_at||t.created_at&&e-t.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(t){return Y.generateKey(this.config.namespace,t)}}J.DEFAULT_EXPIRATION_MS=864e5,J.DEFAULT_NAMESPACE="quote_intent";class V{constructor(t){this.stateManager=t}async getOrCreateQuoteIntent(t,e,n){const r=this.stateManager.getQuoteIntent(t);if(r&&this.stateManager.isQuoteIntentValid(r)){const e=await n(r.url);return this.stateManager.saveQuoteIntent(t,e),e}try{const n=await e();return this.stateManager.saveQuoteIntent(t,n),n}catch(e){throw r&&this.stateManager.removeQuoteIntent(t),e}}updateQuoteIntent(t,e){const n=this.stateManager.getQuoteIntent(t);if(!n)return null;const r={...n,...e};return this.stateManager.saveQuoteIntent(t,r),r}clearQuoteIntent(t){this.stateManager.removeQuoteIntent(t)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(t){const e=this.stateManager.getQuoteIntent(t);return null!==e&&this.stateManager.isQuoteIntentValid(e)}getQuoteIntentUrl(t){const e=this.stateManager.getQuoteIntent(t);return(null==e?void 0:e.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class Q{constructor(t,e){this.saveCallback=e,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=t}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.intervalId=window.setInterval(()=>{this.isPaused||this.isUserTyping||!this.shouldAttemptSave()||this.saveCallback().catch(this.handleSaveError.bind(this))},this.config.autoSaveInterval)}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}pause(){this.isPaused=!0,setTimeout(()=>this.resume(),6e4)}resume(){this.isPaused=!1,this.consecutiveFailures=0}shouldAttemptSave(){return 0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1)}handleSaveError(t){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(t))}dispatchErrorEvent(t){if("undefined"!=typeof window){const e=new CustomEvent("form-autosave-error",{detail:{error:t,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(e)}}onSaveSuccess(){this.consecutiveFailures=0,this.lastErrorTime=0,this.isPaused&&this.resume()}startTyping(){this.isUserTyping=!0,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=window.setTimeout(()=>{this.stopTyping()},500)}stopTyping(){this.isUserTyping=!1,this.typingTimeoutId&&(clearTimeout(this.typingTimeoutId),this.typingTimeoutId=void 0)}get status(){return{isPaused:this.isPaused,consecutiveFailures:this.consecutiveFailures,isActive:!!this.intervalId,isUserTyping:this.isUserTyping}}}function X(t,e){var n;const r=[];if("checkbox"===t.type&&t.required&&!0!==e&&"true"!==e)return r.push({field:t.code||t.id,message:`${t.label} must be accepted`}),r;"boolean"===t.type&&(null===(n=t.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===t.boolean_config.show_details_on&&(!0===e||"true"===e)||t.boolean_config.show_details_on);const i="boolean"===t.type?null==e:null==e||""===e;if(t.required&&i)return r.push({field:t.code||t.id,message:`${t.label} is required`}),r;if(!t.required&&i)return r;const o=t.validation;if(!o)return r;const s=String(e),a="number"==typeof e?e:parseFloat(s);return o.pattern&&"text"===t.type&&(new RegExp(o.pattern).test(s)||r.push({field:t.code||t.id,message:`${t.label} format is invalid`})),o.minLength&&s.length<o.minLength&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.maxLength} characters`}),"number"!==t.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:t.code||t.id,message:`${t.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:t.code||t.id,message:`${t.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:t.code||t.id,message:`${t.label} must be in increments of ${o.step}`})),r}function K(t,e){var n,r;const i=[];for(const r of t.fields){const t=r.code||r.id,o=e[t],s=X(r,o);if(i.push(...s),"boolean"===r.type&&(null===(n=r.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===r.boolean_config.show_details_on&&(!0===o||"true"===o)||"no"===r.boolean_config.show_details_on&&(!1===o||"false"===o))){const n=(e.U||{})[t];n&&""!==n.trim()||i.push({field:t,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=t.validation)||void 0===r?void 0:r.required_fields)for(const n of t.validation.required_fields){const r=t.fields.find(t=>(t.code||t.id)===n),o=e[n];if(r){const t=r.code||r.id,e=i.find(e=>e.field===t);if(e)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:t,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&i.push({field:t,message:`${r.label} is required`})}}return{isValid:0===i.length,errors:i}}function tt(t){const e=[];let n;if("object"==typeof t&&null!==t&&("validation_errors"in t&&t.validation_errors&&"object"==typeof t.validation_errors?n=t.validation_errors:"errors"in t&&t.errors&&"object"==typeof t.errors?n=t.errors:"message"in t||"validation_errors"in t||"errors"in t||(n=t)),n)for(const[t,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)e.push({field:t,message:n});return e}class et{constructor(t,e,n){this.httpClient=t,this.definition=e,this.quoteIntentStore=n}async load(t,e){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(t)){const t=await this.httpClient.getQuoteIntent(e);if(t.quote_intent.form_data)return t.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(e)).quote_intent.form_data||this.createEmptyFormData()}async save(t,e,n,r){try{const t=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(e,t),{success:!0}}catch(t){if(t&&"object"==typeof t&&"validationErrors"in t){const e=t.validationErrors;if(e&&"object"==typeof e)return{success:!1,validationErrors:tt(e)}}throw t}}prepareSavePayload(t,e){const n=this.getCurrentPageId(t);return{current_page_index:t.current_page,current_page_id:n,page_data:t.page_data,save_type:e.saveType}}getCurrentPageId(t){const e=this.definition;if(!e||!t.page_data)return;const n=t.current_page;if(n<0||n>=e.pages.length)return;const r=e.pages[n];return r&&r.id?r.id:void 0}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}}class nt{constructor(t,e,n,r){this.formDefinition=t,this.getFormData=e,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(t){const e=this.getFormData().current_page;if(t<=e)return!0;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<t;r++)if(r!==e&&!n.includes(r))return!1;return!0}async navigateToPage(t){if(t<0||t>=this.getTotalPages())return!1;if(!this.canNavigateToPage(t))return!1;const e=this.getFormData().current_page;if(t>e)try{await this.saveCallback(!0,"page")}catch(t){return t&&"object"==typeof t&&t.isValidationError,!1}return t>e&&this.markPageCompleted(e),this.updateFormData({current_page:t,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const t=this.getFormData().current_page;return this.navigateToPage(t+1)}navigateToPrevious(){const t=this.getFormData().current_page;return this.navigateToPage(t-1)}markPageCompleted(t){const e=this.getFormData();if(!e.completed_pages.includes(t)){const n=[...e.completed_pages,t].sort((t,e)=>t-e);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const t=this.getFormData(),e=this.getTotalPages(),n=[...t.completed_pages];return{totalPages:e,currentPage:t.current_page,completedPages:n,percentComplete:n.length/e*100}}isStagingEnvironment(){const t=window.location.hostname;return"localhost"===t||t.endsWith(".test")||t.includes("staging")}}class rt{constructor(t){this.httpClient=t}async calculateQuote(t){const n=await this.httpClient.calculateQuoteIntent(t);return e(),n}}function it(t,e,n){var r,i,o,s;const a=Date.now(),c=`${t}-${a}`;if(function(t,e,n){try{Promise.resolve().then(function(){return hd}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${e}`,category:"error",level:"error",data:{errorType:e,customMessage:n}}),r(t,{errorType:e,customMessage:n}))}).catch(()=>{})}catch(t){}}(e,t,n),e&&"object"==typeof e){if("statusCode"in e||"status"in e)return ot(c,t,e.statusCode||e.status||500,e.message||(null===(r=e.data)||void 0===r?void 0:r.message)||"Server error occurred",n,a);if("response"in e)return ot(c,t,(null===(i=e.response)||void 0===i?void 0:i.status)||500,(null===(s=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||e.message||"Network error occurred",n,a);if(e.message)return{id:c,type:t,severity:at(t),title:st(t),message:n||e.message,retryable:lt(t,0),timestamp:a,trackingId:c}}const l="string"==typeof e?e:"An unexpected error occurred";return{id:c,type:t,severity:at(t),title:st(t),message:n||l,retryable:lt(t,0),timestamp:a,trackingId:c}}function ot(t,e,n,r,i,o){const s=n>=500?"critical":n>=400?"error":"warning",a=lt(e,n);return{id:t,type:e,severity:s,statusCode:n,title:st(e,n),message:i||ct(e,n,r),details:r,retryable:a,timestamp:o}}function st(t,e){if(e){if(404===e)return"Not Found";if(503===e)return"Service Unavailable";if(e>=500)return"Server Error";if(e>=400)return"Validation Error"}switch(t){case"initialization":return"Initialization Error";case"calculation":return"Calculation Error";case"network":return"Network Error";case"validation":return"Validation Error";case"maintenance":return"Maintenance Mode";default:return"Unexpected Error"}}function at(t){switch(t){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":return"warning"}}function ct(t,e,n){return"calculation"===t&&(n.toLowerCase().includes("no matching values found")||n.toLowerCase().includes("rating table")||n.toLowerCase().includes("not supported"))?n:n.toLowerCase().includes("no matching values found")?"The entered value is not supported by our calculator. Please try a different amount.":n.toLowerCase().includes("rating table")?"Unable to calculate with the provided information. Please check your entries and try again.":404===e?"initialization"===t?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===e?"We're performing scheduled maintenance. Please check back in a few minutes.":e>=500?"calculation"===t?"We're experiencing technical difficulties with the calculation. Please try again in a moment.":"We're experiencing technical difficulties. Please try again in a moment.":429===e?"Too many requests. Please wait a moment and try again.":e>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function lt(t,e){return"validation"!==t&&"maintenance"!==t&&404!==e&&503!==e&&!(e>=400&&e<500&&429!==e)&&("network"===t||"calculation"===t||e>=500&&503!==e||429===e)}function ut(t){return"maintenance"===t.type||503===t.statusCode}function dt(t){return t.trackingId?`If this problem persists, please contact support and reference error ID: ${t.trackingId.slice(0,8).toUpperCase()}`:"critical"===t.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let ht=null;function ft(t){ht=t}function mt(t,e){var n,r;return{event:e,quote_id:t.id,organisation_slug:null===(n=t.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=t.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function pt(t){var e,n;if(!(null==ht?void 0:ht.isEnabled()))return;const r={...mt(t,"quote_started"),quote_status:t.status,total_pages:null===(n=null===(e=t.form_definition)||void 0===e?void 0:e.pages)||void 0===n?void 0:n.length};ht.push(r)}function gt(t,e,n,r){var i,o;if(!(null==ht?void 0:ht.isEnabled()))return;const s=(null===(o=null===(i=t.form_definition)||void 0===i?void 0:i.pages)||void 0===o?void 0:o.length)||0,a=s>0?Math.round(n.length/s*100):0,c={...mt(t,"quote_form_progress"),current_page:e,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};ht.push(c)}function yt(t,e){if(!(null==ht?void 0:ht.isEnabled()))return;const n=e.calculations||[],r=e.payment_options||[],i=n.find(t=>t.id===e.default_excess_id),o=n.map(t=>t.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,c=r.some(t=>"monthly"===t.amount.frequency),l={...mt(t,"quote_calculated"),excess_id:null==i?void 0:i.id,excess_amount:null==i?void 0:i.excess_amount,premium_subtotal:null==i?void 0:i.premium_subtotal,premium_total:null==i?void 0:i.premium_total,excess_options_count:n.length,payment_options_count:r.length,has_installments:c,min_premium:s,max_premium:a};ht.push(l)}function vt(t,e,n,r,i){if(!(null==ht?void 0:ht.isEnabled()))return;const o={...mt(t,"quote_at_checkout"),excess_id:e.id,excess_amount:e.excess_amount,premium_subtotal:e.premium_subtotal,premium_total:e.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:e.fees};ht.push(o)}function wt(t,e){if(!(null==ht?void 0:ht.isEnabled()))return;const n=e.referrals||[],r={...mt(t,"quote_referred"),referral_reason:e.referral_reason,referrals_count:n.length,referral_ids:n.map(t=>t.id)};ht.push(r)}function bt(t,e,n,r){if(!(null==ht?void 0:ht.isEnabled()))return;const i={...mt(t,"payment_initiated"),payment_amount:e.amount.dueToday,payment_gateway:e.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:e.amount.frequency,amount_due_today:e.amount.dueToday,installments_count:e.amount.numberOfInstallments};ht.push(i)}function xt(t,e,n,r,i,o){if(!(null==ht?void 0:ht.isEnabled()))return;const s={...mt(t,"payment_completed"),transaction_id:e,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};ht.push(s)}function kt(t,e,n,r,i,o){if(!(null==ht?void 0:ht.isEnabled()))return;const s={...mt(t,"payment_failed"),transaction_id:e,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};ht.push(s)}class St{constructor(t,e,n,r={}){this.quoteIntent=t,this.httpClient=e,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.validationErrors=[],this.serverValidationErrors=[],this.generalErrors=[],this.lastCalculationFailed=!1,this.config={autoSaveInterval:r.autoSaveInterval||1e3,autoSave:!1!==r.autoSave,maxRetryAttempts:r.maxRetryAttempts||3,retryDelay:r.retryDelay||2e3},this.formData=this.createEmptyFormData(),this.quoteIntentStore=n,this.lastCalculationFailed=this.getPersistedCalculationFailureState();const i=t.form_definition;this.persistenceManager=new et(e,i,n),this.autoSaveManager=new Q(this.config,this.saveFormData.bind(this)),this.navigationManager=new nt(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new rt(e),this.config.autoSave&&this.autoSaveManager.start()}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}async loadFormProgress(){var t,e;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(e=null===(t=this.formData.page_data)||void 0===t?void 0:t.Y)||void 0===e?void 0:e.lastCalculationFailed),this.notify(),this.formData}updatePageData(t,e){this.pendingChanges[t]={...this.pendingChanges[t],...e},this.formData.page_data={...this.formData.page_data,[t]:{...this.formData.page_data[t],...e}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(t,e,n){this.autoSaveManager.startTyping(),this.pendingChanges[t]||(this.pendingChanges[t]={}),this.pendingChanges[t][e]=n,this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t][e]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(t,e,n),this.notify()}updateFieldAnswer(t,e,n){this.autoSaveManager.startTyping(),this.formData.page_data[t]||(this.formData.page_data[t]={}),this.formData.page_data[t].U||(this.formData.page_data[t].U={}),this.formData.page_data[t].U[e]=n,this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(t){this.isUserTyping()||(this.formData=t,this.notify())}restoreCalculationResult(t){e(),e(t.outcome_type),this.calculationResult=t,t.default_excess_id&&(this.selectedExcessId=t.default_excess_id),e(),this.notify(),e()}processRatingFactorMappings(t){const e=this.getFormDefinition(),n={};return e.pages.forEach(e=>{const r=t.page_data[e.id]||{};e.fields.forEach(t=>{const e=r[t.code||t.id];null!=e&&""!==e&&t.rating_factor_mappings&&t.rating_factor_mappings.length>0&&t.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(e,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${t.code||t.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(t,n,r){return e(JSON.stringify(r)),"calculate_age"===n?this.calculateAge(t,r):null}calculateAge(t,e){try{const n=new Date(t),r="current_date"===(null==e?void 0:e.reference_date)?new Date:new Date((null==e?void 0:e.reference_date)||Date.now());let i=r.getFullYear()-n.getFullYear();const o=r.getMonth()-n.getMonth();return(o<0||0===o&&r.getDate()<n.getDate())&&i--,i}catch(t){return null}}async saveFormData(t=!1,n="auto-save"){if(!t&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);e();const o={...this.formData,page_data:{...this.formData.page_data,J:i}};try{const e=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:t,saveType:n});if(!e.success){if(e.validationErrors){this.setServerValidationErrors(e.validationErrors),this.notify();const t=new Error("Validation failed");throw t.isValidationError=!0,t}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const t=this.formData;r.current_page===t.current_page?this.formData=o:this.formData={...o,current_page:t.current_page,completed_pages:t.completed_pages,last_updated:t.last_updated},this.notify()}}catch(t){if(t&&"object"==typeof t&&"type"in t&&"message"in t){const e=t;if(!e.validationErrors||0===Object.keys(e.validationErrors).length){const t=it("validation",e);this.addGeneralError(t),this.notify()}}throw t}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(t){return this.navigationManager.canNavigateToPage(t)}navigateToPage(t){return this.navigationManager.navigateToPage(t)}async navigateToNextPage(){var t,e;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(e=null===(t=this.quoteIntent.form_definition)||void 0===t?void 0:t.pages[n-1])||void 0===e?void 0:e.title;gt(this.quoteIntent,n,r,i)}return n}navigateToPreviousPage(){return this.navigationManager.navigateToPrevious()}getPageCompletionStatus(){return this.navigationManager.getCompletionStatus()}getFormProgress(){return this.formData}getFormDefinition(){return this.quoteIntent.form_definition}getTotalPages(){return this.navigationManager.getTotalPages()}getCurrentPageIndex(){return this.formData.current_page}isAutoSavePaused(){return this.autoSaveManager.status.isPaused}isUserTyping(){return this.autoSaveManager.status.isUserTyping}getIsCalculating(){return this.isCalculating}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(t){this.selectedExcessId=t,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(t){this.selectedPaymentOption=t,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const t=this.getCurrentPageIndex(),e=this.getFormDefinition().pages[t];if(!e)return[];const n=K(e,this.formData.page_data[e.id]||{});return this.validationErrors=n.errors,this.notify(),n.errors}validateField(t,e,n){const r=this.getFormDefinition().pages.find(e=>e.id===t),i=null==r?void 0:r.fields.find(t=>(t.code||t.id)===e);if(!i)return[];const o=X(i,n);return this.validationErrors=this.validationErrors.filter(t=>t.field!==e),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(t){return this.getValidationErrors().filter(e=>e.field===t)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(t){return this.getFieldErrors(t).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(t){this.serverValidationErrors=t,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const t=this.generalErrors.filter(t=>!t.dismissed);return t.length>0?[t[t.length-1]]:[]}addGeneralError(t){this.generalErrors.push(t),this.notify()}dismissGeneralError(t){const e=this.generalErrors.find(e=>e.id===t);e&&(e.dismissed=!0,this.notify())}clearGeneralErrors(){this.generalErrors=[],this.notify()}hasGeneralErrors(){return this.getGeneralErrors().length>0}hasLastCalculationFailed(){return this.lastCalculationFailed}dispose(){this.autoSaveManager.stop(),Object.keys(this.pendingChanges).length>0&&!this.isAutoSavePaused()&&this.saveFormData(!0).catch(console.error),this.subscribers.clear()}async filterHiddenFieldsAndSave(){const t=this.getFormDefinition(),e={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return Ss});t.pages.forEach(t=>{const r=this.formData.page_data[t.id]||{},i={};t.fields.forEach(t=>{const e=t.code||t.id,o=r[e];let s=!0;if(t.visibility){const e=n(r,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions});s="show"===t.visibility.action?e.matched:!e.matched}s&&void 0!==o&&(i[e]=o)}),e.page_data[t.id]=i});const r=this.processRatingFactorMappings(e),i={...e,page_data:{...e.page_data,J:r}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,i,{force:!0,saveType:"full"})}async calculateQuote(){e();const t=this.getFormDefinition(),n=[];for(const r of t.pages){const t=K(r,this.formData.page_data[r.id]||{});e(r.title,t.errors.length>0&&t.errors),n.push(...t.errors)}if(n.length>0)throw e(),this.validationErrors=n,this.notify(),new Error("Form validation failed");e(),await this.filterHiddenFieldsAndSave();try{this.isCalculating=!0,this.notify();const t=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=t,this.selectedExcessId=t.default_excess_id||null,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const e=this.generalErrors.filter(t=>"calculation"===t.type);return e.forEach(t=>this.dismissGeneralError(t.id)),"calculation"===t.outcome_type?yt(this.quoteIntent,t):"referral"===t.outcome_type&&wt(this.quoteIntent,t),t}catch(t){this.lastCalculationFailed=!0,this.persistCalculationFailureState();const e={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=e,e}finally{this.isCalculating=!1,this.notify()}}notify(){this.subscribers.forEach(t=>t(this))}updateFormDataInternal(t){if(this.isUserTyping()&&t.page_data){const e={...t};delete e.page_data,this.formData={...this.formData,...e}}else this.formData={...this.formData,...t};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var t,e,n;return!!(null===(n=null===(e=null===(t=this.quoteIntent.form_data)||void 0===t?void 0:t.page_data)||void 0===e?void 0:e.Y)||void 0===n?void 0:n.lastCalculationFailed)&&!0===this.quoteIntent.form_data.page_data.Y.lastCalculationFailed}persistCalculationFailureState(){this.formData.page_data.Y||(this.formData.page_data.Y={}),this.formData.page_data.Y.lastCalculationFailed=this.lastCalculationFailed,this.formData.last_updated=(new Date).toISOString(),this.saveFormData(!0,"auto-save").catch(()=>{})}reset(){localStorage.clear();const t=new URL(window.location.href);t.searchParams.delete("url"),window.history.replaceState({},document.title,t.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(t){if(this.quoteIntentStore){const e=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,t);e&&(this.quoteIntent=e,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(t){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(e=>e.id===t.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");e();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(e=>e.gateway_id===t.gatewayId&&e.calculation_id===t.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(e=>e.id===t.calculationId);try{const e=await this.httpClient.initiatePayment(t,o);return s&&bt(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),e}catch(t){throw t}}async getPaymentStatus(t){var e;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(e=this.calculationResult)||void 0===e?void 0:e.payment_gateways)||[]).find(t=>t.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const e=await this.httpClient.getPaymentStatus(t,r);return this.notify(),e}catch(t){throw t}}startPaymentStatusPolling(t,e,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(t);e(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(t){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class _t{constructor(t,e){this.httpClient=t,this.response=e}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(t){const e=this.response.product.form_definition,n={...this.response.quote_intent.form_data};for(const r of e.pages){const e=n.page_data[r.id]||{};for(const n of r.fields){const r=n.code||n.id;t.hasOwnProperty(r)?e[r]=t[r]:("text"===n.type&&(e[r]="sample"),"number"===n.type&&(e[r]=1),"checkbox"===n.type&&(e[r]=!0))}n.page_data[r.id]=e}const r={current_page_index:0,save_type:"full",page_data:{...n.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,r)}}class $t{constructor(t){this.httpClient=t}async createQuoteIntent(t,e){const n=await this.httpClient.createQuoteIntent({code:t,...e});return new _t(this.httpClient,n)}}var Nt=0;function Et(t,e,n,i,o,s){e||(e={});var a,c,l=e;if("ref"in l)for(c in l={},e)"ref"==c?a=e[c]:l[c]=e[c];var u={type:t,props:l,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,_:--Nt,N:-1,C:0,V:o,X:s};if("function"==typeof t&&(a=t.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return r.vnode&&r.vnode(u),u}var Tt,Ct,It,Mt,Dt=0,Ot=[],Pt=r,Rt=Pt.p,jt=Pt.O,At=Pt.diffed,zt=Pt.k,Ft=Pt.unmount,Lt=Pt.m;function Wt(t,e){Pt.A&&Pt.A(Ct,t,Dt||e),Dt=0;var n=Ct.K||(Ct.K={m:[],A:[]});return t>=n.m.length&&n.m.push({}),n.m[t]}function qt(t){return Dt=1,function(t,e){var n=Wt(Tt++,2);if(n.t=t,!n.k&&(n.m=[Xt(void 0,e),function(t){var e=n.et?n.et[0]:n.m[0],r=n.t(e,t);e!==r&&(n.et=[r,n.m[1]],n.k.setState({}))}],n.k=Ct,!Ct.nt)){var r=function(t,e,r){if(!n.k.K)return!0;var o=n.k.K.m.filter(function(t){return!!t.k});if(o.every(function(t){return!t.et}))return!i||i.call(this,t,e,r);var s=n.k.props!==t;return o.forEach(function(t){if(t.et){var e=t.m[0];t.m=t.et,t.et=void 0,e!==t.m[0]&&(s=!0)}}),i&&i.call(this,t,e,r)||s};Ct.nt=!0;var i=Ct.shouldComponentUpdate,o=Ct.componentWillUpdate;Ct.componentWillUpdate=function(t,e,n){if(this.v){var s=i;i=void 0,r(t,e,n),i=s}o&&o.call(this,t,e,n)},Ct.shouldComponentUpdate=r}return n.et||n.m}(Xt,t)}function Bt(t,e){var n=Wt(Tt++,3);!Pt.W&&Qt(n.K,e)&&(n.m=t,n.u=e,Ct.K.A.push(n))}function Ht(t){return Dt=5,Ut(function(){return{current:t}},[])}function Ut(t,e){var n=Wt(Tt++,7);return Qt(n.K,e)&&(n.m=t(),n.K=e,n.A=t),n.m}function Zt(){for(var t;t=Ot.shift();)if(t.P&&t.K)try{t.K.A.forEach(Jt),t.K.A.forEach(Vt),t.K.A=[]}catch(e){t.K.A=[],Pt.v(e,t._)}}Pt.p=function(t){Ct=null,Rt&&Rt(t)},Pt.m=function(t,e){t&&e.i&&e.i.B&&(t.B=e.i.B),Lt&&Lt(t,e)},Pt.O=function(t){jt&&jt(t),Tt=0;var e=(Ct=t.k).K;e&&(It===Ct?(e.A=[],Ct.A=[],e.m.forEach(function(t){t.et&&(t.m=t.et),t.u=t.et=void 0})):(e.A.forEach(Jt),e.A.forEach(Vt),e.A=[],Tt=0)),It=Ct},Pt.diffed=function(t){At&&At(t);var e=t.k;e&&e.K&&(e.K.A.length&&(1!==Ot.push(e)&&Mt===Pt.requestAnimationFrame||((Mt=Pt.requestAnimationFrame)||Yt)(Zt)),e.K.m.forEach(function(t){t.u&&(t.K=t.u),t.u=void 0})),It=Ct=null},Pt.k=function(t,e){e.some(function(t){try{t.A.forEach(Jt),t.A=t.A.filter(function(t){return!t.m||Vt(t)})}catch(n){e.some(function(t){t.A&&(t.A=[])}),e=[],Pt.v(n,t._)}}),zt&&zt(t,e)},Pt.unmount=function(t){Ft&&Ft(t);var e,n=t.k;n&&n.K&&(n.K.m.forEach(function(t){try{Jt(t)}catch(t){e=t}}),n.K=void 0,e&&Pt.v(e,n._))};var Gt="function"==typeof requestAnimationFrame;function Yt(t){var e,n=function(){clearTimeout(r),Gt&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Gt&&(e=requestAnimationFrame(n))}function Jt(t){var e=Ct,n=t.k;"function"==typeof n&&(t.k=void 0,n()),Ct=e}function Vt(t){var e=Ct;t.k=t.m(),Ct=e}function Qt(t,e){return!t||t.length!==e.length||e.some(function(e,n){return e!==t[n]})}function Xt(t,e){return"function"==typeof e?e(t):e}const Kt="insure-os";let te=!1;const ee=new Map,ne={[`--${Kt}-radius`]:"0.75rem",[`--${Kt}-radius-sm`]:"0.5rem",[`--${Kt}-radius-lg`]:"1rem",[`--${Kt}-background`]:"oklch(0.955 0 0)",[`--${Kt}-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-card`]:"oklch(1 0 0)",[`--${Kt}-card-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-popover`]:"oklch(1 0 0)",[`--${Kt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${Kt}-primary`]:"oklch(0.205 0 0)",[`--${Kt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${Kt}-secondary`]:"oklch(0.97 0 0)",[`--${Kt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${Kt}-muted`]:"oklch(0.97 0 0)",[`--${Kt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${Kt}-accent`]:"oklch(0.97 0 0)",[`--${Kt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${Kt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${Kt}-border`]:"oklch(0.9 0 0)",[`--${Kt}-input`]:"oklch(0.9 0 0)",[`--${Kt}-ring`]:"oklch(0.708 0 0)",[`--${Kt}-font-family`]:"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${Kt}-font-size-large`]:"18px",[`--${Kt}-font-size-small`]:"14px",[`--${Kt}-font-size`]:"16px",[`--${Kt}-border-width`]:"1px",[`--${Kt}-transition-duration`]:"200ms",[`--${Kt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${Kt}-shadow-sm`]:"0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08)",[`--${Kt}-shadow`]:"0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.12)",[`--${Kt}-shadow-md`]:"0 4px 8px -1px rgba(0, 0, 0, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.14)",[`--${Kt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${Kt}-spacing-sm`]:"0.75rem",[`--${Kt}-spacing`]:"1rem",[`--${Kt}-spacing-md`]:"1.5rem",[`--${Kt}-spacing-lg`]:"2rem",[`--${Kt}-spacing-xl`]:"3rem"},re={colors:{background:`var(--${Kt}-background)`,foreground:`var(--${Kt}-foreground)`,card:`var(--${Kt}-card)`,popover:`var(--${Kt}-popover)`,popoverForeground:`var(--${Kt}-popover-foreground)`,primary:`var(--${Kt}-primary)`,primaryForeground:`var(--${Kt}-primary-foreground)`,secondary:`var(--${Kt}-secondary)`,muted:`var(--${Kt}-muted)`,mutedForeground:`var(--${Kt}-muted-foreground)`,accent:`var(--${Kt}-accent)`,accentForeground:`var(--${Kt}-accent-foreground)`,destructive:`var(--${Kt}-destructive)`,border:`var(--${Kt}-border)`,input:`var(--${Kt}-input)`,ring:`var(--${Kt}-ring)`},fontSize:{small:`var(--${Kt}-font-size-small)`,default:`var(--${Kt}-font-size)`,large:`var(--${Kt}-font-size-large)`},radius:{small:`var(--${Kt}-radius-sm)`,default:`var(--${Kt}-radius)`,large:`var(--${Kt}-radius-lg)`},shadow:{sm:`var(--${Kt}-shadow-sm)`,md:`var(--${Kt}-shadow-md)`},spacing:{sm:`var(--${Kt}-spacing-sm)`,md:`var(--${Kt}-spacing-md)`,lg:`var(--${Kt}-spacing-lg)`,xl:`var(--${Kt}-spacing-xl)`},fontFamily:`var(--${Kt}-font-family)`,borderWidth:`var(--${Kt}-border-width)`,transition:`var(--${Kt}-transition-duration) var(--${Kt}-transition-timing-function)`},ie=new Set;function oe(t){if(!document.getElementById(`${Kt}-styles`)){const t=document.createElement("style");t.id=`${Kt}-styles`,document.head.appendChild(t)}document.getElementById(`${Kt}-styles`).textContent+=t+"\n"}function se(t){return Object.entries(t).map(([t,e])=>{return`${n=t,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${e}`;var n}).join("; ")}function ae(){te||(oe(`:root {\n${Object.entries(ne).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`),te=!0)}const ce={name:t=>`${Kt}-${t}`,selector(t){return`.${this.name(t)}`},create(t,e,n){ae();const r=se(e),i=function(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e).toString(36)}(`${t}:${r}:${n?JSON.stringify(n):""}`),o=`${t}-${i}`,s=ee.get(o);if(s)return s.fullClassName;let a=t;const c=this.name(a);return ie.has(a)||(oe(`.${c} { ${r} }`),ie.add(a)),ee.set(o,{contentHash:i,fullClassName:c}),n&&Object.entries(n).forEach(([t,e])=>{this.media(t,{[a]:e})}),c},keyframes(t,e){const n=`${Kt}-${t}`;return ie.has(`keyframes-${t}`)||(oe(`@keyframes ${n} {\n${Object.entries(e).map(([t,e])=>` ${t} { ${se(e)} }`).join("\n")}\n}`),ie.add(`keyframes-${t}`)),n},media(t,e){const n=`media-${t}`;oe(`@media ${t} {\n${Object.entries(e).map(([t,e])=>` .${Kt}-${t} { ${se(e)} }`).join("\n")}\n}`),ie.add(n)},pseudoElement(t,e,n){const r=`${Kt}-${t}`,i=`${t}-${e}`;return ie.has(i)||(oe(`.${r}${e} { ${se(n)} }`),ie.add(i)),r}};var le=Object.freeze({__proto__:null,baseVariables:ne,styles:ce,theme:re,updateBaseVariables:function(t){e(),Object.assign(ne,t);const n=document.getElementById(`${Kt}-styles`);if(n){const t=n.textContent||"",r=`:root {\n${Object.entries(ne).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,i=t.includes(":root {")?t.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+t;n.textContent=i,e()}else ae()}});function ue(t){return t&&t.rt&&{}.hasOwnProperty.call(t,"default")?t.default:t}var de,he={exports:{}};function fe(){return de||(de=1,function(t){!function(){var e={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=i(t,r(n)))}return t}function r(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!=={}.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var r="";for(var o in t)e.call(t,o)&&t[o]&&(r=i(r,o));return r}function i(t,e){return e?t?t+" "+e:t+e:t}t.exports?(n.default=n,t.exports=n):window.classNames=n}()}(he)),he.exports}var me=ue(fe());function pe({size:t="small"}){const e=ce.create("spinner-small",{width:"16px",height:"16px"}),n=ce.create("spinner-large",{width:"64px",height:"64px"}),r="small"===t?e:n;return ce.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Et("div",{className:ce.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:me(r),children:Et("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function ge({className:t,children:e,size:n="md"}){const r={sm:re.spacing.sm,md:re.spacing.md,lg:re.spacing.lg,xl:re.spacing.xl},i=ce.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?re.spacing.lg:"lg"===n?re.spacing.md:r[n]},"(max-width: 480px)":{padding:re.spacing.sm}});return Et("div",{className:me(i,t),children:e})}const ye=function(){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&n.forEach(function(t){t.v=!0,E(t)})},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),e.children}return t.k="__cC"+f++,t.m=null,t.Provider=t.it=(t.Consumer=function(t,e){return t.children(e)}).contextType=t,t}();function ve({children:t,httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i}){return Et(ye.Provider,{value:{httpClient:e,stateManager:n,quoteIntentStore:r,formStateManager:i,currentRetryAttempt:0,maxRetryAttempts:3},children:t})}function we(t){const e=function(){const t=function(t){var e=Ct.context[t.k],n=Wt(Tt++,9);return n.c=t,e?(null==n.m&&(n.m=!0,e.sub(Ct)),e.props.value):t.m}(ye);if(!t)throw new Error("useFormContext must be used within a FormContext provider");return t}(),{formStateManager:n}=e;if(!n||"function"!=typeof n.subscribe)throw new Error("FormStateManager is not properly initialized. This component should not render during initialization errors.");const[r,i]=qt(()=>t(n));return Bt(()=>n.subscribe(()=>{i(t(n))}),[n,t]),{...r,fsm:n}}class be extends Error{}class xe extends be{constructor(t){super(`Invalid DateTime: ${t.toMessage()}`)}}class ke extends be{constructor(t){super(`Invalid Interval: ${t.toMessage()}`)}}class Se extends be{constructor(t){super(`Invalid Duration: ${t.toMessage()}`)}}class _e extends be{}class $e extends be{constructor(t){super(`Invalid unit ${t}`)}}class Ne extends be{}class Ee extends be{constructor(){super("Zone is an abstract class")}}const Te="numeric",Ce="short",Ie="long",Me={year:Te,month:Te,day:Te},De={year:Te,month:Ce,day:Te},Oe={year:Te,month:Ce,day:Te,weekday:Ce},Pe={year:Te,month:Ie,day:Te},Re={year:Te,month:Ie,day:Te,weekday:Ie},je={hour:Te,minute:Te},Ae={hour:Te,minute:Te,second:Te},ze={hour:Te,minute:Te,second:Te,timeZoneName:Ce},Fe={hour:Te,minute:Te,second:Te,timeZoneName:Ie},Le={hour:Te,minute:Te,hourCycle:"h23"},We={hour:Te,minute:Te,second:Te,hourCycle:"h23"},qe={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Ce},Be={hour:Te,minute:Te,second:Te,hourCycle:"h23",timeZoneName:Ie},He={year:Te,month:Te,day:Te,hour:Te,minute:Te},Ue={year:Te,month:Te,day:Te,hour:Te,minute:Te,second:Te},Ze={year:Te,month:Ce,day:Te,hour:Te,minute:Te},Ge={year:Te,month:Ce,day:Te,hour:Te,minute:Te,second:Te},Ye={year:Te,month:Ce,day:Te,weekday:Ce,hour:Te,minute:Te},Je={year:Te,month:Ie,day:Te,hour:Te,minute:Te,timeZoneName:Ce},Ve={year:Te,month:Ie,day:Te,hour:Te,minute:Te,second:Te,timeZoneName:Ce},Qe={year:Te,month:Ie,day:Te,weekday:Ie,hour:Te,minute:Te,timeZoneName:Ie},Xe={year:Te,month:Ie,day:Te,weekday:Ie,hour:Te,minute:Te,second:Te,timeZoneName:Ie};class Ke{get type(){throw new Ee}get name(){throw new Ee}get ianaName(){return this.name}get isUniversal(){throw new Ee}offsetName(t,e){throw new Ee}formatOffset(t,e){throw new Ee}offset(t){throw new Ee}equals(t){throw new Ee}get isValid(){throw new Ee}}let tn=null;class en extends Ke{static get instance(){return null===tn&&(tn=new en),tn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return kr(t,e,n)}formatOffset(t,e){return Nr(this.offset(t),e)}offset(t){return-new Date(t).getTimezoneOffset()}equals(t){return"system"===t.type}get isValid(){return!0}}const nn=new Map,rn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},on=new Map;class sn extends Ke{static create(t){let e=on.get(t);return void 0===e&&on.set(t,e=new sn(t)),e}static resetCache(){on.clear(),nn.clear()}static isValidSpecifier(t){return this.isValidZone(t)}static isValidZone(t){if(!t)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:t}).format(),!0}catch(t){return!1}}constructor(t){super(),this.zoneName=t,this.valid=sn.isValidZone(t)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(t,{format:e,locale:n}){return kr(t,e,n,this.name)}formatOffset(t,e){return Nr(this.offset(t),e)}offset(t){if(!this.valid)return NaN;const e=new Date(t);if(isNaN(e))return NaN;const n=function(t){let e=nn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),nn.set(t,e)),e}(this.name);let[r,i,o,s,a,c,l]=n.formatToParts?function(t,e){const n=t.formatToParts(e),r=[];for(let t=0;t<n.length;t++){const{type:e,value:i}=n[t],o=rn[e];"era"===e?r[o]=i:er(o)||(r[o]=parseInt(i,10))}return r}(n,e):function(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,c,l,u]=r;return[s,i,o,a,c,l,u]}(n,e);"BC"===s&&(r=1-Math.abs(r));let u=+e;const d=u%1e3;return u-=d>=0?d:1e3+d,(vr({year:r,month:i,day:o,hour:24===a?0:a,minute:c,second:l,millisecond:0})-u)/6e4}equals(t){return"iana"===t.type&&t.name===this.name}get isValid(){return this.valid}}let an={};const cn=new Map;function ln(t,e={}){const n=JSON.stringify([t,e]);let r=cn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(t,e),cn.set(n,r)),r}const un=new Map,dn=new Map;let hn=null;const fn=new Map;function mn(t){let e=fn.get(t);return void 0===e&&(e=new Intl.DateTimeFormat(t).resolvedOptions(),fn.set(t,e)),e}const pn=new Map;function gn(t,e,n,r){const i=t.listingMode();return"error"===i?null:"en"===i?n(e):r(e)}class yn{constructor(t,e,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!e||Object.keys(o).length>0){const e={useGrouping:!1,...n};n.padTo>0&&(e.minimumIntegerDigits=n.padTo),this.inf=function(t,e={}){const n=JSON.stringify([t,e]);let r=un.get(n);return void 0===r&&(r=new Intl.NumberFormat(t,e),un.set(n,r)),r}(t,e)}}format(t){if(this.inf){const e=this.floor?Math.floor(t):t;return this.inf.format(e)}return ur(this.floor?Math.floor(t):mr(t,3),this.padTo)}}class vn{constructor(t,e,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=t;else if("fixed"===t.zone.type){const e=t.offset/60*-1,n=e>=0?`Etc/GMT+${e}`:`Etc/GMT${e}`;0!==t.offset&&sn.create(n).valid?(r=n,this.dt=t):(r="UTC",this.dt=0===t.offset?t:t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone)}else"system"===t.zone.type?this.dt=t:"iana"===t.zone.type?(this.dt=t,r=t.zone.name):(r="UTC",this.dt=t.setZone("UTC").plus({minutes:t.offset}),this.originalZone=t.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=ln(e,i)}format(){return this.originalZone?this.formatToParts().map(({value:t})=>t).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const t=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?t.map(t=>{if("timeZoneName"===t.type){const e=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:e}}return t}):t}resolvedOptions(){return this.dtf.resolvedOptions()}}class wn{constructor(t,e,n){this.opts={style:"long",...n},!e&&ir()&&(this.rtf=function(t,e={}){const{base:n,...r}=e,i=JSON.stringify([t,r]);let o=dn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(t,e),dn.set(i,o)),o}(t,n))}format(t,e){return this.rtf?this.rtf.format(t,e):function(t,e,n="always",r=!1){const i={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},o=-1===["hours","minutes","seconds"].indexOf(t);if("auto"===n&&o){const n="days"===t;switch(e){case 1:return n?"tomorrow":`next ${i[t][0]}`;case-1:return n?"yesterday":`last ${i[t][0]}`;case 0:return n?"today":`this ${i[t][0]}`}}const s=Object.is(e,-0)||e<0,a=Math.abs(e),c=1===a,l=i[t],u=r?c?l[1]:l[2]||l[1]:c?i[t][0]:t;return s?`${a} ${u} ago`:`in ${a} ${u}`}(e,t,this.opts.numeric,"long"!==this.opts.style)}formatToParts(t,e){return this.rtf?this.rtf.formatToParts(t,e):[]}}const bn={firstDay:1,minimalDays:4,weekend:[6,7]};class xn{static fromOpts(t){return xn.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,e,n,r,i=!1){const o=t||Fn.defaultLocale,s=o||(i?"en-US":hn||(hn=(new Intl.DateTimeFormat).resolvedOptions().locale,hn)),a=e||Fn.defaultNumberingSystem,c=n||Fn.defaultOutputCalendar,l=cr(r)||Fn.defaultWeekSettings;return new xn(s,a,c,l,o)}static resetCache(){hn=null,cn.clear(),un.clear(),dn.clear(),fn.clear(),pn.clear()}static fromObject({locale:t,numberingSystem:e,outputCalendar:n,weekSettings:r}={}){return xn.create(t,e,n,r)}constructor(t,e,n,r,i){const[o,s,a]=function(t){const e=t.indexOf("-x-");-1!==e&&(t=t.substring(0,e));const n=t.indexOf("-u-");if(-1===n)return[t];{let e,r;try{e=ln(t).resolvedOptions(),r=t}catch(i){const o=t.substring(0,n);e=ln(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=e;return[r,i,o]}}(t);this.locale=o,this.numberingSystem=e||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(t,e,n){return n||e?(t.includes("-u-")||(t+="-u"),n&&(t+=`-ca-${n}`),e&&(t+=`-nu-${e}`),t):t}(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){var t;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(t=this).numberingSystem||"latn"===t.numberingSystem)&&("latn"===t.numberingSystem||!t.locale||t.locale.startsWith("en")||"latn"===mn(t.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const t=this.isEnglish(),e=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return t&&e?"en":"intl"}clone(t){return t&&0!==Object.getOwnPropertyNames(t).length?xn.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,cr(t.weekSettings)||this.weekSettings,t.defaultToEN||!1):this}redefaultToEN(t={}){return this.clone({...t,defaultToEN:!0})}redefaultToSystem(t={}){return this.clone({...t,defaultToEN:!1})}months(t,e=!1){return gn(this,t,Mr,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(e&=!n)?{month:t,day:"numeric"}:{month:t},i=e?"format":"standalone";if(!this.monthsCache[i][t]){const e=n?t=>this.dtFormatter(t,r).format():t=>this.extract(t,r,"month");this.monthsCache[i][t]=function(t){const e=[];for(let n=1;n<=12;n++){const r=Po.utc(2009,n,1);e.push(t(r))}return e}(e)}return this.monthsCache[i][t]})}weekdays(t,e=!1){return gn(this,t,Rr,()=>{const n=e?{weekday:t,year:"numeric",month:"long",day:"numeric"}:{weekday:t},r=e?"format":"standalone";return this.weekdaysCache[r][t]||(this.weekdaysCache[r][t]=function(t){const e=[];for(let n=1;n<=7;n++){const r=Po.utc(2016,11,13+n);e.push(t(r))}return e}(t=>this.extract(t,n,"weekday"))),this.weekdaysCache[r][t]})}meridiems(){return gn(this,void 0,()=>jr,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Po.utc(2016,11,13,9),Po.utc(2016,11,13,19)].map(e=>this.extract(e,t,"dayperiod"))}return this.meridiemCache})}eras(t){return gn(this,t,Lr,()=>{const e={era:t};return this.eraCache[t]||(this.eraCache[t]=[Po.utc(-40,1,1),Po.utc(2017,1,1)].map(t=>this.extract(t,e,"era"))),this.eraCache[t]})}extract(t,e,n){const r=this.dtFormatter(t,e).formatToParts().find(t=>t.type.toLowerCase()===n);return r?r.value:null}numberFormatter(t={}){return new yn(this.intl,t.forceSimple||this.fastNumbers,t)}dtFormatter(t,e={}){return new vn(t,this.intl,e)}relFormatter(t={}){return new wn(this.intl,this.isEnglish(),t)}listFormatter(t={}){return function(t,e={}){const n=JSON.stringify([t,e]);let r=an[n];return r||(r=new Intl.ListFormat(t,e),an[n]=r),r}(this.intl,t)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||mn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:or()?function(t){let e=pn.get(t);if(!e){const n=new Intl.Locale(t);e="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in e||(e={...bn,...e}),pn.set(t,e)}return e}(this.locale):bn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(t){return this.locale===t.locale&&this.numberingSystem===t.numberingSystem&&this.outputCalendar===t.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let kn=null;class Sn extends Ke{static get utcInstance(){return null===kn&&(kn=new Sn(0)),kn}static instance(t){return 0===t?Sn.utcInstance:new Sn(t)}static parseSpecifier(t){if(t){const e=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(e)return new Sn(Sr(e[1],e[2]))}return null}constructor(t){super(),this.fixed=t}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Nr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Nr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(t,e){return Nr(this.fixed,e)}get isUniversal(){return!0}offset(){return this.fixed}equals(t){return"fixed"===t.type&&t.fixed===this.fixed}get isValid(){return!0}}class _n extends Ke{constructor(t){super(),this.zoneName=t}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function $n(t,e){if(er(t)||null===t)return e;if(t instanceof Ke)return t;if(function(t){return"string"==typeof t}(t)){const n=t.toLowerCase();return"default"===n?e:"local"===n||"system"===n?en.instance:"utc"===n||"gmt"===n?Sn.utcInstance:Sn.parseSpecifier(n)||sn.create(t)}return nr(t)?Sn.instance(t):"object"==typeof t&&"offset"in t&&"function"==typeof t.offset?t:new _n(t)}const Nn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},En={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Tn=Nn.hanidec.replace(/[\[|\]]/g,"").split(""),Cn=new Map;function In({numberingSystem:t},e=""){const n=t||"latn";let r=Cn.get(n);void 0===r&&(r=new Map,Cn.set(n,r));let i=r.get(e);return void 0===i&&(i=new RegExp(`${Nn[n]}${e}`),r.set(e,i)),i}let Mn,Dn=()=>Date.now(),On="system",Pn=null,Rn=null,jn=null,An=60,zn=null;class Fn{static get now(){return Dn}static set now(t){Dn=t}static set defaultZone(t){On=t}static get defaultZone(){return $n(On,en.instance)}static get defaultLocale(){return Pn}static set defaultLocale(t){Pn=t}static get defaultNumberingSystem(){return Rn}static set defaultNumberingSystem(t){Rn=t}static get defaultOutputCalendar(){return jn}static set defaultOutputCalendar(t){jn=t}static get defaultWeekSettings(){return zn}static set defaultWeekSettings(t){zn=cr(t)}static get twoDigitCutoffYear(){return An}static set twoDigitCutoffYear(t){An=t%100}static get throwOnInvalid(){return Mn}static set throwOnInvalid(t){Mn=t}static resetCaches(){xn.resetCache(),sn.resetCache(),Po.resetCache(),Cn.clear()}}class Ln{constructor(t,e){this.reason=t,this.explanation=e}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Wn=[0,31,59,90,120,151,181,212,243,273,304,334],qn=[0,31,60,91,121,152,182,213,244,274,305,335];function Bn(t,e){return new Ln("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Hn(t,e,n){const r=new Date(Date.UTC(t,e-1,n));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function Un(t,e,n){return n+(pr(t)?qn:Wn)[e-1]}function Zn(t,e){const n=pr(t)?qn:Wn,r=n.findIndex(t=>t<e);return{month:r+1,day:e-n[r]}}function Gn(t,e){return(t-e+7)%7+1}function Yn(t,e=4,n=1){const{year:r,month:i,day:o}=t,s=Un(r,i,o),a=Gn(Hn(r,i,o),n);let c,l=Math.floor((s-a+14-e)/7);return l<1?(c=r-1,l=br(c,e,n)):l>br(r,e,n)?(c=r+1,l=1):c=r,{weekYear:c,weekNumber:l,weekday:a,...Er(t)}}function Jn(t,e=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=t,s=Gn(Hn(r,1,e),n),a=gr(r);let c,l=7*i+o-s-7+e;l<1?(c=r-1,l+=gr(c)):l>a?(c=r+1,l-=gr(r)):c=r;const{month:u,day:d}=Zn(c,l);return{year:c,month:u,day:d,...Er(t)}}function Vn(t){const{year:e,month:n,day:r}=t;return{year:e,ordinal:Un(e,n,r),...Er(t)}}function Qn(t){const{year:e,ordinal:n}=t,{month:r,day:i}=Zn(e,n);return{year:e,month:r,day:i,...Er(t)}}function Xn(t,e){if(!er(t.localWeekday)||!er(t.localWeekNumber)||!er(t.localWeekYear)){if(!er(t.weekday)||!er(t.weekNumber)||!er(t.weekYear))throw new _e("Cannot mix locale-based week fields with ISO-based week fields");return er(t.localWeekday)||(t.weekday=t.localWeekday),er(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),er(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function Kn(t){const e=rr(t.year),n=lr(t.month,1,12),r=lr(t.day,1,yr(t.year,t.month));return e?n?!r&&Bn("day",t.day):Bn("month",t.month):Bn("year",t.year)}function tr(t){const{hour:e,minute:n,second:r,millisecond:i}=t,o=lr(e,0,23)||24===e&&0===n&&0===r&&0===i,s=lr(n,0,59),a=lr(r,0,59),c=lr(i,0,999);return o?s?a?!c&&Bn("millisecond",i):Bn("second",r):Bn("minute",n):Bn("hour",e)}function er(t){return void 0===t}function nr(t){return"number"==typeof t}function rr(t){return"number"==typeof t&&t%1==0}function ir(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(t){return!1}}function or(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(t){return!1}}function sr(t,e,n){if(0!==t.length)return t.reduce((t,r)=>{const i=[e(r),r];return t&&n(t[0],i[0])===t[0]?t:i},null)[1]}function ar(t,e){return{}.hasOwnProperty.call(t,e)}function cr(t){if(null==t)return null;if("object"!=typeof t)throw new Ne("Week settings must be an object");if(!lr(t.firstDay,1,7)||!lr(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(t=>!lr(t,1,7)))throw new Ne("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function lr(t,e,n){return rr(t)&&t>=e&&t<=n}function ur(t,e=2){let n;return n=t<0?"-"+(""+-t).padStart(e,"0"):(""+t).padStart(e,"0"),n}function dr(t){return er(t)||null===t||""===t?void 0:parseInt(t,10)}function hr(t){return er(t)||null===t||""===t?void 0:parseFloat(t)}function fr(t){if(!er(t)&&null!==t&&""!==t){const e=1e3*parseFloat("0."+t);return Math.floor(e)}}function mr(t,e,n="round"){const r=10**e;switch(n){case"expand":return t>0?Math.ceil(t*r)/r:Math.floor(t*r)/r;case"trunc":return Math.trunc(t*r)/r;case"round":return Math.round(t*r)/r;case"floor":return Math.floor(t*r)/r;case"ceil":return Math.ceil(t*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function pr(t){return t%4==0&&(t%100!=0||t%400==0)}function gr(t){return pr(t)?366:365}function yr(t,e){const n=(r=e-1)-12*Math.floor(r/12)+1;var r;return 2===n?pr(t+(e-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function vr(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function wr(t,e,n){return-Gn(Hn(t,1,e),n)+e-1}function br(t,e=4,n=1){const r=wr(t,e,n),i=wr(t+1,e,n);return(gr(t)-r+i)/7}function xr(t){return t>99?t:t>Fn.twoDigitCutoffYear?1900+t:2e3+t}function kr(t,e,n,r=null){const i=new Date(t),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:e,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(t=>"timezonename"===t.type.toLowerCase());return a?a.value:null}function Sr(t,e){let n=parseInt(t,10);Number.isNaN(n)&&(n=0);const r=parseInt(e,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function _r(t){const e=Number(t);if("boolean"==typeof t||""===t||!Number.isFinite(e))throw new Ne(`Invalid unit value ${t}`);return e}function $r(t,e){const n={};for(const r in t)if(ar(t,r)){const i=t[r];if(null==i)continue;n[e(r)]=_r(i)}return n}function Nr(t,e){const n=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),i=t>=0?"+":"-";switch(e){case"short":return`${i}${ur(n,2)}:${ur(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${ur(n,2)}${ur(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Er(t){return function(t){return["hour","minute","second","millisecond"].reduce((e,n)=>(e[n]=t[n],e),{})}(t)}const Tr=["January","February","March","April","May","June","July","August","September","October","November","December"],Cr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ir=["J","F","M","A","M","J","J","A","S","O","N","D"];function Mr(t){switch(t){case"narrow":return[...Ir];case"short":return[...Cr];case"long":return[...Tr];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Dr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Or=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Pr=["M","T","W","T","F","S","S"];function Rr(t){switch(t){case"narrow":return[...Pr];case"short":return[...Or];case"long":return[...Dr];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const jr=["AM","PM"],Ar=["Before Christ","Anno Domini"],zr=["BC","AD"],Fr=["B","A"];function Lr(t){switch(t){case"narrow":return[...Fr];case"short":return[...zr];case"long":return[...Ar];default:return null}}function Wr(t,e){let n="";for(const r of t)r.literal?n+=r.val:n+=e(r.val);return n}const qr={D:Me,DD:De,DDD:Pe,DDDD:Re,t:je,tt:Ae,ttt:ze,tttt:Fe,T:Le,TT:We,TTT:qe,TTTT:Be,f:He,ff:Ze,fff:Je,ffff:Qe,F:Ue,FF:Ge,FFF:Ve,FFFF:Xe};class Br{static create(t,e={}){return new Br(t,e)}static parseFormat(t){let e=null,n="",r=!1;const i=[];for(let o=0;o<t.length;o++){const s=t.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),e=null,n="",r=!r):r||s===e?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,e=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(t){return qr[t]}constructor(t,e){this.opts=e,this.loc=t,this.systemLoc=null}formatWithSystemDefault(t,e){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(t,{...this.opts,...e}).format()}dtFormatter(t,e={}){return this.loc.dtFormatter(t,{...this.opts,...e})}formatDateTime(t,e){return this.dtFormatter(t,e).format()}formatDateTimeParts(t,e){return this.dtFormatter(t,e).formatToParts()}formatInterval(t,e){return this.dtFormatter(t.start,e).dtf.formatRange(t.start.toJSDate(),t.end.toJSDate())}resolvedOptions(t,e){return this.dtFormatter(t,e).resolvedOptions()}num(t,e=0,n){if(this.opts.forceSimple)return ur(t,e);const r={...this.opts};return e>0&&(r.padTo=e),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(t)}formatDateTimeFromString(t,e){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&0===t.offset&&e.allowZ?"Z":t.isValid?t.zone.formatOffset(t.ts,e.format):"",s=(e,r)=>n?function(t,e){return Mr(e)[t.month-1]}(t,e):i(r?{month:e}:{month:e,day:"numeric"},"month"),a=(e,r)=>n?function(t,e){return Rr(e)[t.weekday-1]}(t,e):i(r?{weekday:e}:{weekday:e,month:"long",day:"numeric"},"weekday"),c=e=>{const n=Br.macroTokenToFormatOpts(e);return n?this.formatWithSystemDefault(t,n):e},l=e=>n?function(t,e){return Lr(e)[t.year<0?0:1]}(t,e):i({era:e},"era");return Wr(Br.parseFormat(e),e=>{switch(e){case"S":return this.num(t.millisecond);case"u":case"SSS":return this.num(t.millisecond,3);case"s":return this.num(t.second);case"ss":return this.num(t.second,2);case"uu":return this.num(Math.floor(t.millisecond/10),2);case"uuu":return this.num(Math.floor(t.millisecond/100));case"m":return this.num(t.minute);case"mm":return this.num(t.minute,2);case"h":return this.num(t.hour%12==0?12:t.hour%12);case"hh":return this.num(t.hour%12==0?12:t.hour%12,2);case"H":return this.num(t.hour);case"HH":return this.num(t.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return t.zone.offsetName(t.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return t.zone.offsetName(t.ts,{format:"long",locale:this.loc.locale});case"z":return t.zoneName;case"a":return n?function(t){return jr[t.hour<12?0:1]}(t):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(t.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(t.day,2);case"c":case"E":return this.num(t.weekday);case"ccc":return a("short",!0);case"cccc":return a("long",!0);case"ccccc":return a("narrow",!0);case"EEE":return a("short",!1);case"EEEE":return a("long",!1);case"EEEEE":return a("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(t.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(t.month,2);case"LLL":return s("short",!0);case"LLLL":return s("long",!0);case"LLLLL":return s("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(t.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(t.month,2);case"MMM":return s("short",!1);case"MMMM":return s("long",!1);case"MMMMM":return s("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(t.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(t.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(t.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(t.year,6);case"G":return l("short");case"GG":return l("long");case"GGGGG":return l("narrow");case"kk":return this.num(t.weekYear.toString().slice(-2),2);case"kkkk":return this.num(t.weekYear,4);case"W":return this.num(t.weekNumber);case"WW":return this.num(t.weekNumber,2);case"n":return this.num(t.localWeekNumber);case"nn":return this.num(t.localWeekNumber,2);case"ii":return this.num(t.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(t.localWeekYear,4);case"o":return this.num(t.ordinal);case"ooo":return this.num(t.ordinal,3);case"q":return this.num(t.quarter);case"qq":return this.num(t.quarter,2);case"X":return this.num(Math.floor(t.ts/1e3));case"x":return this.num(t.ts);default:return c(e)}})}formatDurationFromString(t,e){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=t=>{switch(t[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=Br.parseFormat(e),o=i.reduce((t,{literal:e,val:n})=>e?t:t.concat(n),[]),s=t.shiftTo(...o.map(r).filter(t=>t));return Wr(i,((t,e)=>i=>{const o=r(i);if(o){const r=e.isNegativeDuration&&o!==e.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==e.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(t.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const Hr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Ur(...t){const e=t.reduce((t,e)=>t+e.source,"");return RegExp(`^${e}$`)}function Zr(...t){return e=>t.reduce(([t,n,r],i)=>{const[o,s,a]=i(e,r);return[{...t,...o},s||n,a]},[{},null,1]).slice(0,2)}function Gr(t,...e){if(null==t)return[null,null];for(const[n,r]of e){const e=n.exec(t);if(e)return r(e)}return[null,null]}function Yr(...t){return(e,n)=>{const r={};let i;for(i=0;i<t.length;i++)r[t[i]]=dr(e[n+i]);return[r,null,n+i]}}const Jr=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Vr=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Qr=RegExp(`${Vr.source}(?:${Jr.source}?(?:\\[(${Hr.source})\\])?)?`),Xr=RegExp(`(?:[Tt]${Qr.source})?`),Kr=Yr("weekYear","weekNumber","weekDay"),ti=Yr("year","ordinal"),ei=RegExp(`${Vr.source} ?(?:${Jr.source}|(${Hr.source}))?`),ni=RegExp(`(?: ${ei.source})?`);function ri(t,e,n){const r=t[e];return er(r)?n:dr(r)}function ii(t,e){return[{hours:ri(t,e,0),minutes:ri(t,e+1,0),seconds:ri(t,e+2,0),milliseconds:fr(t[e+3])},null,e+4]}function oi(t,e){const n=!t[e]&&!t[e+1],r=Sr(t[e+1],t[e+2]);return[{},n?null:Sn.instance(r),e+3]}function si(t,e){return[{},t[e]?sn.create(t[e]):null,e+1]}const ai=RegExp(`^T?${Vr.source}$`),ci=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function li(t){const[e,n,r,i,o,s,a,c,l]=t,u="-"===e[0],d=c&&"-"===c[0],h=(t,e=!1)=>void 0!==t&&(e||t&&u)?-t:t;return[{years:h(hr(n)),months:h(hr(r)),weeks:h(hr(i)),days:h(hr(o)),hours:h(hr(s)),minutes:h(hr(a)),seconds:h(hr(c),"-0"===c),milliseconds:h(fr(l),d)}]}const ui={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function di(t,e,n,r,i,o,s){const a={year:2===e.length?xr(dr(e)):dr(e),month:Cr.indexOf(n)+1,day:dr(r),hour:dr(i),minute:dr(o)};return s&&(a.second=dr(s)),t&&(a.weekday=t.length>3?Dr.indexOf(t)+1:Or.indexOf(t)+1),a}const hi=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function fi(t){const[,e,n,r,i,o,s,a,c,l,u,d]=t,h=di(e,i,r,n,o,s,a);let f;return f=c?ui[c]:l?0:Sr(u,d),[h,new Sn(f)]}const mi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,pi=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,gi=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function yi(t){const[,e,n,r,i,o,s,a]=t;return[di(e,i,r,n,o,s,a),Sn.utcInstance]}function vi(t){const[,e,n,r,i,o,s,a]=t;return[di(e,a,n,r,i,o,s),Sn.utcInstance]}const wi=Ur(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Xr),bi=Ur(/(\d{4})-?W(\d\d)(?:-?(\d))?/,Xr),xi=Ur(/(\d{4})-?(\d{3})/,Xr),ki=Ur(Qr),Si=Zr(function(t,e){return[{year:ri(t,e),month:ri(t,e+1,1),day:ri(t,e+2,1)},null,e+3]},ii,oi,si),_i=Zr(Kr,ii,oi,si),$i=Zr(ti,ii,oi,si),Ni=Zr(ii,oi,si),Ei=Zr(ii),Ti=Ur(/(\d{4})-(\d\d)-(\d\d)/,ni),Ci=Ur(ei),Ii=Zr(ii,oi,si),Mi="Invalid Duration",Di={weeks:{days:7,hours:168,minutes:10080,seconds:604800,milliseconds:6048e5},days:{hours:24,minutes:1440,seconds:86400,milliseconds:864e5},hours:{minutes:60,seconds:3600,milliseconds:36e5},minutes:{seconds:60,milliseconds:6e4},seconds:{milliseconds:1e3}},Oi={years:{quarters:4,months:12,weeks:52,days:365,hours:8760,minutes:525600,seconds:31536e3,milliseconds:31536e6},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:131040,seconds:7862400,milliseconds:78624e5},months:{weeks:4,days:30,hours:720,minutes:43200,seconds:2592e3,milliseconds:2592e6},...Di},Pi={years:{quarters:4,months:12,weeks:52.1775,days:365.2425,hours:8765.82,minutes:525949.2,seconds:525949.2*60,milliseconds:525949.2*60*1e3},quarters:{months:3,weeks:13.044375,days:91.310625,hours:2191.455,minutes:131487.3,seconds:525949.2*60/4,milliseconds:7889237999.999999},months:{weeks:4.3481250000000005,days:30.436875,hours:730.485,minutes:43829.1,seconds:2629746,milliseconds:2629746e3},...Di},Ri=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],ji=Ri.slice(0).reverse();function Ai(t,e,n=!1){const r={values:n?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new Wi(r)}function zi(t,e){let n=e.milliseconds??0;for(const r of ji.slice(1))e[r]&&(n+=e[r]*t[r].milliseconds);return n}function Fi(t,e){const n=zi(t,e)<0?-1:1;Ri.reduceRight((r,i)=>{if(er(e[i]))return r;if(r){const o=e[r]*n,s=t[i][r],a=Math.floor(o/s);e[i]+=a*n,e[r]-=a*s*n}return i},null),Ri.reduce((n,r)=>{if(er(e[r]))return n;if(n){const i=e[n]%1;e[n]-=i,e[r]+=i*t[n][r]}return r},null)}function Li(t){const e={};for(const[n,r]of Object.entries(t))0!==r&&(e[n]=r);return e}class Wi{constructor(t){const e="longterm"===t.conversionAccuracy||!1;let n=e?Pi:Oi;t.matrix&&(n=t.matrix),this.values=t.values,this.loc=t.loc||xn.create(),this.conversionAccuracy=e?"longterm":"casual",this.invalid=t.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,e){return Wi.fromObject({milliseconds:t},e)}static fromObject(t,e={}){if(null==t||"object"!=typeof t)throw new Ne("Duration.fromObject: argument expected to be an object, got "+(null===t?"null":typeof t));return new Wi({values:$r(t,Wi.normalizeUnit),loc:xn.fromObject(e),conversionAccuracy:e.conversionAccuracy,matrix:e.matrix})}static fromDurationLike(t){if(nr(t))return Wi.fromMillis(t);if(Wi.isDuration(t))return t;if("object"==typeof t)return Wi.fromObject(t);throw new Ne(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,e){const[n]=function(t){return Gr(t,[ci,li])}(t);return n?Wi.fromObject(n,e):Wi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,e){const[n]=function(t){return Gr(t,[ai,Ei])}(t);return n?Wi.fromObject(n,e):Wi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the Duration is invalid");const n=t instanceof Ln?t:new Ln(t,e);if(Fn.throwOnInvalid)throw new Se(n);return new Wi({invalid:n})}static normalizeUnit(t){const e={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[t?t.toLowerCase():t];if(!e)throw new $e(t);return e}static isDuration(t){return t&&t.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(t,e={}){const n={...e,floor:!1!==e.round&&!1!==e.floor};return this.isValid?Br.create(this.loc,n).formatDurationFromString(this,t):Mi}toHuman(t={}){if(!this.isValid)return Mi;const e=!1!==t.showZeros,n=Ri.map(n=>{const r=this.values[n];return er(r)||0===r&&!e?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...t,unit:n.slice(0,-1)}).format(r)}).filter(t=>t);return this.loc.listFormatter({type:"conjunction",style:t.listStyle||"narrow",...t}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let t="P";return 0!==this.years&&(t+=this.years+"Y"),0===this.months&&0===this.quarters||(t+=this.months+3*this.quarters+"M"),0!==this.weeks&&(t+=this.weeks+"W"),0!==this.days&&(t+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(t+="T"),0!==this.hours&&(t+=this.hours+"H"),0!==this.minutes&&(t+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(t+=mr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===t&&(t+="T0S"),t}toISOTime(t={}){if(!this.isValid)return null;const e=this.toMillis();return e<0||e>=864e5?null:(t={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...t,includeOffset:!1},Po.fromMillis(e,{zone:"UTC"}).toISOTime(t))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?zi(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;const e=Wi.fromDurationLike(t),n={};for(const t of Ri)(ar(e.values,t)||ar(this.values,t))&&(n[t]=e.get(t)+this.get(t));return Ai(this,{values:n},!0)}minus(t){if(!this.isValid)return this;const e=Wi.fromDurationLike(t);return this.plus(e.negate())}mapUnits(t){if(!this.isValid)return this;const e={};for(const n of Object.keys(this.values))e[n]=_r(t(this.values[n],n));return Ai(this,{values:e},!0)}get(t){return this[Wi.normalizeUnit(t)]}set(t){return this.isValid?Ai(this,{values:{...this.values,...$r(t,Wi.normalizeUnit)}}):this}reconfigure({locale:t,numberingSystem:e,conversionAccuracy:n,matrix:r}={}){return Ai(this,{loc:this.loc.clone({locale:t,numberingSystem:e}),matrix:r,conversionAccuracy:n})}as(t){return this.isValid?this.shiftTo(t).get(t):NaN}normalize(){if(!this.isValid)return this;const t=this.toObject();return Fi(this.matrix,t),Ai(this,{values:t},!0)}rescale(){return this.isValid?Ai(this,{values:Li(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...t){if(!this.isValid)return this;if(0===t.length)return this;t=t.map(t=>Wi.normalizeUnit(t));const e={},n={},r=this.toObject();let i;for(const o of Ri)if(t.indexOf(o)>=0){i=o;let t=0;for(const e in n)t+=this.matrix[e][o]*n[e],n[e]=0;nr(r[o])&&(t+=r[o]);const s=Math.trunc(t);e[o]=s,n[o]=(1e3*t-1e3*s)/1e3}else nr(r[o])&&(n[o]=r[o]);for(const t in n)0!==n[t]&&(e[i]+=t===i?n[t]:n[t]/this.matrix[i][t]);return Fi(this.matrix,e),Ai(this,{values:e},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const t={};for(const e of Object.keys(this.values))t[e]=0===this.values[e]?0:-this.values[e];return Ai(this,{values:t},!0)}removeZeros(){return this.isValid?Ai(this,{values:Li(this.values)},!0):this}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(t){if(!this.isValid||!t.isValid)return!1;if(!this.loc.equals(t.loc))return!1;function e(t,e){return void 0===t||0===t?void 0===e||0===e:t===e}for(const n of Ri)if(!e(this.values[n],t.values[n]))return!1;return!0}}const qi="Invalid Interval";class Bi{constructor(t){this.s=t.start,this.e=t.end,this.invalid=t.invalid||null,this.isLuxonInterval=!0}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the Interval is invalid");const n=t instanceof Ln?t:new Ln(t,e);if(Fn.throwOnInvalid)throw new ke(n);return new Bi({invalid:n})}static fromDateTimes(t,e){const n=Ro(t),r=Ro(e),i=function(t,e){return t&&t.isValid?e&&e.isValid?e<t?Bi.invalid("end before start",`The end of an interval must be after its start, but you had start=${t.toISO()} and end=${e.toISO()}`):null:Bi.invalid("missing or invalid end"):Bi.invalid("missing or invalid start")}(n,r);return null==i?new Bi({start:n,end:r}):i}static after(t,e){const n=Wi.fromDurationLike(e),r=Ro(t);return Bi.fromDateTimes(r,r.plus(n))}static before(t,e){const n=Wi.fromDurationLike(e),r=Ro(t);return Bi.fromDateTimes(r.minus(n),r)}static fromISO(t,e){const[n,r]=(t||"").split("/",2);if(n&&r){let t,i,o,s;try{t=Po.fromISO(n,e),i=t.isValid}catch(r){i=!1}try{o=Po.fromISO(r,e),s=o.isValid}catch(r){s=!1}if(i&&s)return Bi.fromDateTimes(t,o);if(i){const n=Wi.fromISO(r,e);if(n.isValid)return Bi.after(t,n)}else if(s){const t=Wi.fromISO(n,e);if(t.isValid)return Bi.before(o,t)}}return Bi.invalid("unparsable",`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(t){return t&&t.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return null===this.invalidReason}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(t="milliseconds"){return this.isValid?this.toDuration(t).get(t):NaN}count(t="milliseconds",e){if(!this.isValid)return NaN;const n=this.start.startOf(t,e);let r;return r=e?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(t,e),Math.floor(r.diff(n,t).get(t))+(r.valueOf()!==this.end.valueOf())}hasSame(t){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,t))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(t){return!!this.isValid&&this.s>t}isBefore(t){return!!this.isValid&&this.e<=t}contains(t){return!!this.isValid&&this.s<=t&&this.e>t}set({start:t,end:e}={}){return this.isValid?Bi.fromDateTimes(t||this.s,e||this.e):this}splitAt(...t){if(!this.isValid)return[];const e=t.map(Ro).filter(t=>this.contains(t)).sort((t,e)=>t.toMillis()-e.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const t=e[i]||this.e,o=+t>+this.e?this.e:t;n.push(Bi.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(t){const e=Wi.fromDurationLike(t);if(!this.isValid||!e.isValid||0===e.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const t=this.start.plus(e.mapUnits(t=>t*i));n=+t>+this.e?this.e:t,o.push(Bi.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(t){return this.isValid?this.splitBy(this.length()/t).slice(0,t):[]}overlaps(t){return this.e>t.s&&this.s<t.e}abutsStart(t){return!!this.isValid&&+this.e===+t.s}abutsEnd(t){return!!this.isValid&&+t.e===+this.s}engulfs(t){return!!this.isValid&&this.s<=t.s&&this.e>=t.e}equals(t){return!(!this.isValid||!t.isValid)&&this.s.equals(t.s)&&this.e.equals(t.e)}intersection(t){if(!this.isValid)return this;const e=this.s>t.s?this.s:t.s,n=this.e<t.e?this.e:t.e;return e>=n?null:Bi.fromDateTimes(e,n)}union(t){if(!this.isValid)return this;const e=this.s<t.s?this.s:t.s,n=this.e>t.e?this.e:t.e;return Bi.fromDateTimes(e,n)}static merge(t){const[e,n]=t.sort((t,e)=>t.s-e.s).reduce(([t,e],n)=>e?e.overlaps(n)||e.abutsStart(n)?[t,e.union(n)]:[t.concat([e]),n]:[t,n],[[],null]);return n&&e.push(n),e}static xor(t){let e=null,n=0;const r=[],i=t.map(t=>[{time:t.s,type:"s"},{time:t.e,type:"e"}]),o=[].concat(...i).sort((t,e)=>t.time-e.time);for(const t of o)n+="s"===t.type?1:-1,1===n?e=t.time:(e&&+e!==+t.time&&r.push(Bi.fromDateTimes(e,t.time)),e=null);return Bi.merge(r)}difference(...t){return Bi.xor([this].concat(t)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:qi}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(t=Me,e={}){return this.isValid?Br.create(this.s.loc.clone(e),t).formatInterval(this):qi}toISO(t){return this.isValid?`${this.s.toISO(t)}/${this.e.toISO(t)}`:qi}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:qi}toISOTime(t){return this.isValid?`${this.s.toISOTime(t)}/${this.e.toISOTime(t)}`:qi}toFormat(t,{separator:e=" – "}={}){return this.isValid?`${this.s.toFormat(t)}${e}${this.e.toFormat(t)}`:qi}toDuration(t,e){return this.isValid?this.e.diff(this.s,t,e):Wi.invalid(this.invalidReason)}mapEndpoints(t){return Bi.fromDateTimes(t(this.s),t(this.e))}}class Hi{static hasDST(t=Fn.defaultZone){const e=Po.now().setZone(t).set({month:12});return!t.isUniversal&&e.offset!==e.set({month:6}).offset}static isValidIANAZone(t){return sn.isValidZone(t)}static normalizeZone(t){return $n(t,Fn.defaultZone)}static getStartOfWeek({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:t=null,locObj:e=null}={}){return(e||xn.create(t)).getWeekendDays().slice()}static months(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(e,n,i)).months(t)}static monthsFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||xn.create(e,n,i)).months(t,!0)}static weekdays(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(e,n,null)).weekdays(t)}static weekdaysFormat(t="long",{locale:e=null,numberingSystem:n=null,locObj:r=null}={}){return(r||xn.create(e,n,null)).weekdays(t,!0)}static meridiems({locale:t=null}={}){return xn.create(t).meridiems()}static eras(t="short",{locale:e=null}={}){return xn.create(e,null,"gregory").eras(t)}static features(){return{relative:ir(),localeWeek:or()}}}function Ui(t,e){const n=t=>t.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(e)-n(t);return Math.floor(Wi.fromMillis(r).as("days"))}function Zi(t,e=t=>t){return{regex:t,deser:([t])=>e(function(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(-1!==t[n].search(Nn.hanidec))e+=Tn.indexOf(t[n]);else for(const t in En){const[n,i]=En[t];r>=n&&r<=i&&(e+=r-n)}}return parseInt(e,10)}return e}(t))}}const Gi=`[ ${String.fromCharCode(160)}]`,Yi=new RegExp(Gi,"g");function Ji(t){return t.replace(/\./g,"\\.?").replace(Yi,Gi)}function Vi(t){return t.replace(/\./g,"").replace(Yi," ").toLowerCase()}function Qi(t,e){return null===t?null:{regex:RegExp(t.map(Ji).join("|")),deser:([n])=>t.findIndex(t=>Vi(n)===Vi(t))+e}}function Xi(t,e){return{regex:t,deser:([,t,e])=>Sr(t,e),groups:e}}function Ki(t){return{regex:t,deser:([t])=>t}}const to={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};let eo=null;function no(t,e){return[].concat(...t.map(t=>function(t,e){if(t.literal)return t;const n=oo(Br.macroTokenToFormatOpts(t.val),e);return null==n||n.includes(void 0)?t:n}(t,e)))}class ro{constructor(t,e){if(this.locale=t,this.format=e,this.tokens=no(Br.parseFormat(e),t),this.units=this.tokens.map(e=>function(t,e){const n=In(e),r=In(e,"{2}"),i=In(e,"{3}"),o=In(e,"{4}"),s=In(e,"{6}"),a=In(e,"{1,2}"),c=In(e,"{1,3}"),l=In(e,"{1,6}"),u=In(e,"{1,9}"),d=In(e,"{2,4}"),h=In(e,"{4,6}"),f=t=>{return{regex:RegExp((e=t.val,e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([t])=>t,literal:!0};var e},m=(m=>{if(t.literal)return f(m);switch(m.val){case"G":return Qi(e.eras("short"),0);case"GG":return Qi(e.eras("long"),0);case"y":return Zi(l);case"yy":case"kk":return Zi(d,xr);case"yyyy":case"kkkk":return Zi(o);case"yyyyy":return Zi(h);case"yyyyyy":return Zi(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return Zi(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return Zi(r);case"MMM":return Qi(e.months("short",!0),1);case"MMMM":return Qi(e.months("long",!0),1);case"LLL":return Qi(e.months("short",!1),1);case"LLLL":return Qi(e.months("long",!1),1);case"o":case"S":return Zi(c);case"ooo":case"SSS":return Zi(i);case"u":return Ki(u);case"uu":return Ki(a);case"uuu":case"E":case"c":return Zi(n);case"a":return Qi(e.meridiems(),0);case"EEE":return Qi(e.weekdays("short",!1),1);case"EEEE":return Qi(e.weekdays("long",!1),1);case"ccc":return Qi(e.weekdays("short",!0),1);case"cccc":return Qi(e.weekdays("long",!0),1);case"Z":case"ZZ":return Xi(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Xi(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return Ki(/[a-z_+-/]{1,256}?/i);case" ":return Ki(/[^\S\n\r]/);default:return f(m)}})(t)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return m.token=t,m}(e,t)),this.disqualifyingUnit=this.units.find(t=>t.invalidReason),!this.disqualifyingUnit){const[t,e]=function(t){const e=t.map(t=>t.regex).reduce((t,e)=>`${t}(${e.source})`,"");return[`^${e}$`,t]}(this.units);this.regex=RegExp(t,"i"),this.handlers=e}}explainFromTokens(t){if(this.isValid){const[e,n]=function(t,e,n){const r=t.match(e);if(r){const t={};let e=1;for(const i in n)if(ar(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(t[o.token.val[0]]=o.deser(r.slice(e,e+s))),e+=s}return[r,t]}return[r,{}]}(t,this.regex,this.handlers),[r,i,o]=n?function(t){let e,n=null;er(t.z)||(n=sn.create(t.z)),er(t.Z)||(n||(n=new Sn(t.Z)),e=t.Z),er(t.q)||(t.M=3*(t.q-1)+1),er(t.h)||(t.h<12&&1===t.a?t.h+=12:12===t.h&&0===t.a&&(t.h=0)),0===t.G&&t.y&&(t.y=-t.y),er(t.u)||(t.S=fr(t.u));const r=Object.keys(t).reduce((e,n)=>{const r=(t=>{switch(t){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}})(n);return r&&(e[r]=t[n]),e},{});return[r,n,e]}(n):[null,null,void 0];if(ar(n,"a")&&ar(n,"H"))throw new _e("Can't include meridiem when specifying 24-hour format");return{input:t,tokens:this.tokens,regex:this.regex,rawMatches:e,matches:n,result:r,zone:i,specificOffset:o}}return{input:t,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function io(t,e,n){return new ro(t,n).explainFromTokens(e)}function oo(t,e){if(!t)return null;const n=Br.create(e,t).dtFormatter((eo||(eo=Po.fromMillis(1555555555555)),eo)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(e=>function(t,e,n){const{type:r,value:i}=t;if("literal"===r){const t=/^\s+$/.test(i);return{literal:!t,val:t?" ":i}}const o=e[r];let s=r;"hour"===r&&(s=null!=e.hour12?e.hour12?"hour12":"hour24":null!=e.hourCycle?"h11"===e.hourCycle||"h12"===e.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=to[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(e,t,i))}const so="Invalid DateTime",ao=864e13;function co(t){return new Ln("unsupported zone",`the zone "${t.name}" is not supported`)}function lo(t){return null===t.weekData&&(t.weekData=Yn(t.c)),t.weekData}function uo(t){return null===t.localWeekData&&(t.localWeekData=Yn(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function ho(t,e){const n={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Po({...n,...e,old:n})}function fo(t,e,n){let r=t-60*e*1e3;const i=n.offset(r);if(e===i)return[r,e];r-=60*(i-e)*1e3;const o=n.offset(r);return i===o?[r,i]:[t-60*Math.min(i,o)*1e3,Math.max(i,o)]}function mo(t,e){const n=new Date(t+=60*e*1e3);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function po(t,e,n){return fo(vr(t),e,n)}function go(t,e){const n=t.o,r=t.c.year+Math.trunc(e.years),i=t.c.month+Math.trunc(e.months)+3*Math.trunc(e.quarters),o={...t.c,year:r,month:i,day:Math.min(t.c.day,yr(r,i))+Math.trunc(e.days)+7*Math.trunc(e.weeks)},s=Wi.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=vr(o);let[c,l]=fo(a,n,t.zone);return 0!==s&&(c+=s,l=t.zone.offset(c)),{ts:c,o:l}}function yo(t,e,n,r,i,o){const{setZone:s,zone:a}=n;if(t&&0!==Object.keys(t).length||e){const r=e||a,i=Po.fromObject(t,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return Po.invalid(new Ln("unparsable",`the input "${i}" can't be parsed as ${r}`))}function vo(t,e,n=!0){return t.isValid?Br.create(xn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(t,e):null}function wo(t,e,n){const r=t.c.year>9999||t.c.year<0;let i="";if(r&&t.c.year>=0&&(i+="+"),i+=ur(t.c.year,r?6:4),"year"===n)return i;if(e){if(i+="-",i+=ur(t.c.month),"month"===n)return i;i+="-"}else if(i+=ur(t.c.month),"month"===n)return i;return i+=ur(t.c.day),i}function bo(t,e,n,r,i,o,s){let a=!n||0!==t.c.millisecond||0!==t.c.second,c="";switch(s){case"day":case"month":case"year":break;default:if(c+=ur(t.c.hour),"hour"===s)break;if(e){if(c+=":",c+=ur(t.c.minute),"minute"===s)break;a&&(c+=":",c+=ur(t.c.second))}else{if(c+=ur(t.c.minute),"minute"===s)break;a&&(c+=ur(t.c.second))}if("second"===s)break;!a||r&&0===t.c.millisecond||(c+=".",c+=ur(t.c.millisecond,3))}return i&&(t.isOffsetFixed&&0===t.offset&&!o?c+="Z":t.o<0?(c+="-",c+=ur(Math.trunc(-t.o/60)),c+=":",c+=ur(Math.trunc(-t.o%60))):(c+="+",c+=ur(Math.trunc(t.o/60)),c+=":",c+=ur(Math.trunc(t.o%60)))),o&&(c+="["+t.zone.ianaName+"]"),c}const xo={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ko={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},So={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_o=["year","month","day","hour","minute","second","millisecond"],$o=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],No=["year","ordinal","hour","minute","second","millisecond"];function Eo(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new $e(t);return e}function To(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Eo(t)}}function Co(t,e){const n=$n(e.zone,Fn.defaultZone);if(!n.isValid)return Po.invalid(co(n));const r=xn.fromObject(e);let i,o;if(er(t.year))i=Fn.now();else{for(const e of _o)er(t[e])&&(t[e]=xo[e]);const e=Kn(t)||tr(t);if(e)return Po.invalid(e);const r=function(t){if(void 0===Do&&(Do=Fn.now()),"iana"!==t.type)return t.offset(Do);const e=t.name;let n=Oo.get(e);return void 0===n&&(n=t.offset(Do),Oo.set(e,n)),n}(n);[i,o]=po(t,r,n)}return new Po({ts:i,zone:n,loc:r,o:o})}function Io(t,e,n){const r=!!er(n.round)||n.round,i=er(n.rounding)?"trunc":n.rounding,o=(t,o)=>(t=mr(t,r||n.calendary?0:2,n.calendary?"round":i),e.loc.clone(n).relFormatter(n).format(t,o)),s=r=>n.calendary?e.hasSame(t,r)?0:e.startOf(r).diff(t.startOf(r),r).get(r):e.diff(t,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const t of n.units){const e=s(t);if(Math.abs(e)>=1)return o(e,t)}return o(t>e?-0:0,n.units[n.units.length-1])}function Mo(t){let e,n={};return t.length>0&&"object"==typeof t[t.length-1]?(n=t[t.length-1],e=Array.from(t).slice(0,t.length-1)):e=Array.from(t),[n,e]}let Do;const Oo=new Map;class Po{constructor(t){const e=t.zone||Fn.defaultZone;let n=t.invalid||(Number.isNaN(t.ts)?new Ln("invalid input"):null)||(e.isValid?null:co(e));this.ts=er(t.ts)?Fn.now():t.ts;let r=null,i=null;if(!n)if(t.old&&t.old.ts===this.ts&&t.old.zone.equals(e))[r,i]=[t.old.c,t.old.o];else{const o=nr(t.o)&&!t.old?t.o:e.offset(this.ts);r=mo(this.ts,o),n=Number.isNaN(r.year)?new Ln("invalid input"):null,r=n?null:r,i=n?null:o}this.ot=e,this.loc=t.loc||xn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new Po({})}static local(){const[t,e]=Mo(arguments),[n,r,i,o,s,a,c]=e;return Co({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static utc(){const[t,e]=Mo(arguments),[n,r,i,o,s,a,c]=e;return t.zone=Sn.utcInstance,Co({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:c},t)}static fromJSDate(t,e={}){const n=function(t){return"[object Date]"==={}.toString.call(t)}(t)?t.valueOf():NaN;if(Number.isNaN(n))return Po.invalid("invalid input");const r=$n(e.zone,Fn.defaultZone);return r.isValid?new Po({ts:n,zone:r,loc:xn.fromObject(e)}):Po.invalid(co(r))}static fromMillis(t,e={}){if(nr(t))return t<-ao||t>ao?Po.invalid("Timestamp out of range"):new Po({ts:t,zone:$n(e.zone,Fn.defaultZone),loc:xn.fromObject(e)});throw new Ne(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`)}static fromSeconds(t,e={}){if(nr(t))return new Po({ts:1e3*t,zone:$n(e.zone,Fn.defaultZone),loc:xn.fromObject(e)});throw new Ne("fromSeconds requires a numerical input")}static fromObject(t,e={}){t=t||{};const n=$n(e.zone,Fn.defaultZone);if(!n.isValid)return Po.invalid(co(n));const r=xn.fromObject(e),i=$r(t,To),{minDaysInFirstWeek:o,startOfWeek:s}=Xn(i,r),a=Fn.now(),c=er(e.specificOffset)?n.offset(a):e.specificOffset,l=!er(i.ordinal),u=!er(i.year),d=!er(i.month)||!er(i.day),h=u||d,f=i.weekYear||i.weekNumber;if((h||l)&&f)throw new _e("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&l)throw new _e("Can't mix ordinal dates with month/day");const m=f||i.weekday&&!h;let p,g,y=mo(a,c);m?(p=$o,g=ko,y=Yn(y,o,s)):l?(p=No,g=So,y=Vn(y)):(p=_o,g=xo);let v=!1;for(const t of p)er(i[t])?i[t]=v?g[t]:y[t]:v=!0;const w=m?function(t,e=4,n=1){const r=rr(t.weekYear),i=lr(t.weekNumber,1,br(t.weekYear,e,n)),o=lr(t.weekday,1,7);return r?i?!o&&Bn("weekday",t.weekday):Bn("week",t.weekNumber):Bn("weekYear",t.weekYear)}(i,o,s):l?function(t){const e=rr(t.year),n=lr(t.ordinal,1,gr(t.year));return e?!n&&Bn("ordinal",t.ordinal):Bn("year",t.year)}(i):Kn(i),b=w||tr(i);if(b)return Po.invalid(b);const x=m?Jn(i,o,s):l?Qn(i):i,[k,S]=po(x,c,n),_=new Po({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&t.weekday!==_.weekday?Po.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${_.toISO()}`):_.isValid?_:Po.invalid(_.invalid)}static fromISO(t,e={}){const[n,r]=function(t){return Gr(t,[wi,Si],[bi,_i],[xi,$i],[ki,Ni])}(t);return yo(n,r,e,"ISO 8601",t)}static fromRFC2822(t,e={}){const[n,r]=function(t){return Gr(function(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(t),[hi,fi])}(t);return yo(n,r,e,"RFC 2822",t)}static fromHTTP(t,e={}){const[n,r]=function(t){return Gr(t,[mi,yi],[pi,yi],[gi,vi])}(t);return yo(n,r,e,"HTTP",e)}static fromFormat(t,e,n={}){if(er(t)||er(e))throw new Ne("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,c,l]=function(t,e,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=io(t,e,n);return[r,i,o,s]}(o,t,e);return l?Po.invalid(l):yo(s,a,n,`format ${e}`,t,c)}static fromString(t,e,n={}){return Po.fromFormat(t,e,n)}static fromSQL(t,e={}){const[n,r]=function(t){return Gr(t,[Ti,Si],[Ci,Ii])}(t);return yo(n,r,e,"SQL",t)}static invalid(t,e=null){if(!t)throw new Ne("need to specify a reason the DateTime is invalid");const n=t instanceof Ln?t:new Ln(t,e);if(Fn.throwOnInvalid)throw new xe(n);return new Po({invalid:n})}static isDateTime(t){return t&&t.isLuxonDateTime||!1}static parseFormatForOpts(t,e={}){const n=oo(t,xn.fromObject(e));return n?n.map(t=>t?t.val:null).join(""):null}static expandFormat(t,e={}){return no(Br.parseFormat(t),xn.fromObject(e)).map(t=>t.val).join("")}static resetCache(){Do=void 0,Oo.clear()}get(t){return this[t]}get isValid(){return null===this.invalid}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this.ot}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?lo(this).weekYear:NaN}get weekNumber(){return this.isValid?lo(this).weekNumber:NaN}get weekday(){return this.isValid?lo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?uo(this).weekday:NaN}get localWeekNumber(){return this.isValid?uo(this).weekNumber:NaN}get localWeekYear(){return this.isValid?uo(this).weekYear:NaN}get ordinal(){return this.isValid?Vn(this.c).ordinal:NaN}get monthShort(){return this.isValid?Hi.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Hi.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Hi.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Hi.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return!this.isOffsetFixed&&(this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const t=864e5,e=6e4,n=vr(this.c),r=this.zone.offset(n-t),i=this.zone.offset(n+t),o=this.zone.offset(n-r*e),s=this.zone.offset(n-i*e);if(o===s)return[this];const a=n-o*e,c=n-s*e,l=mo(a,o),u=mo(c,s);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[ho(this,{ts:a}),ho(this,{ts:c})]:[this]}get isInLeapYear(){return pr(this.year)}get daysInMonth(){return yr(this.year,this.month)}get daysInYear(){return this.isValid?gr(this.year):NaN}get weeksInWeekYear(){return this.isValid?br(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?br(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(t={}){const{locale:e,numberingSystem:n,calendar:r}=Br.create(this.loc.clone(t),t).resolvedOptions(this);return{locale:e,numberingSystem:n,outputCalendar:r}}toUTC(t=0,e={}){return this.setZone(Sn.instance(t),e)}toLocal(){return this.setZone(Fn.defaultZone)}setZone(t,{keepLocalTime:e=!1,keepCalendarTime:n=!1}={}){if((t=$n(t,Fn.defaultZone)).equals(this.zone))return this;if(t.isValid){let r=this.ts;if(e||n){const e=t.offset(this.ts),n=this.toObject();[r]=po(n,e,t)}return ho(this,{ts:r,zone:t})}return Po.invalid(co(t))}reconfigure({locale:t,numberingSystem:e,outputCalendar:n}={}){return ho(this,{loc:this.loc.clone({locale:t,numberingSystem:e,outputCalendar:n})})}setLocale(t){return this.reconfigure({locale:t})}set(t){if(!this.isValid)return this;const e=$r(t,To),{minDaysInFirstWeek:n,startOfWeek:r}=Xn(e,this.loc),i=!er(e.weekYear)||!er(e.weekNumber)||!er(e.weekday),o=!er(e.ordinal),s=!er(e.year),a=!er(e.month)||!er(e.day),c=s||a,l=e.weekYear||e.weekNumber;if((c||o)&&l)throw new _e("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new _e("Can't mix ordinal dates with month/day");let u;i?u=Jn({...Yn(this.c,n,r),...e},n,r):er(e.ordinal)?(u={...this.toObject(),...e},er(e.day)&&(u.day=Math.min(yr(u.year,u.month),u.day))):u=Qn({...Vn(this.c),...e});const[d,h]=po(u,this.o,this.zone);return ho(this,{ts:d,o:h})}plus(t){return this.isValid?ho(this,go(this,Wi.fromDurationLike(t))):this}minus(t){return this.isValid?ho(this,go(this,Wi.fromDurationLike(t).negate())):this}startOf(t,{useLocaleWeeks:e=!1}={}){if(!this.isValid)return this;const n={},r=Wi.normalizeUnit(t);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0}if("weeks"===r)if(e){const t=this.loc.getStartOfWeek(),{weekday:e}=this;e<t&&(n.weekNumber=this.weekNumber-1),n.weekday=t}else n.weekday=1;if("quarters"===r){const t=Math.ceil(this.month/3);n.month=3*(t-1)+1}return this.set(n)}endOf(t,e){return this.isValid?this.plus({[t]:1}).startOf(t,e).minus(1):this}toFormat(t,e={}){return this.isValid?Br.create(this.loc.redefaultToEN(e)).formatDateTimeFromString(this,t):so}toLocaleString(t=Me,e={}){return this.isValid?Br.create(this.loc.clone(e),t).formatDateTime(this):so}toLocaleParts(t={}){return this.isValid?Br.create(this.loc.clone(t),t).formatDateTimeParts(this):[]}toISO({format:t="extended",suppressSeconds:e=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===t;let a=wo(this,s,o=Eo(o));return _o.indexOf(o)>=3&&(a+="T"),a+=bo(this,s,e,n,r,i,o),a}toISODate({format:t="extended",precision:e="day"}={}){return this.isValid?wo(this,"extended"===t,Eo(e)):null}toISOWeekDate(){return vo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:t=!1,suppressSeconds:e=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Eo(s),(r&&_o.indexOf(s)>=3?"T":"")+bo(this,"extended"===o,e,t,n,i,s)):null}toRFC2822(){return vo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return vo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?wo(this,!0):null}toSQLTime({includeOffset:t=!0,includeZone:e=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(e||t)&&(n&&(r+=" "),e?r+="z":t&&(r+="ZZ")),vo(this,r,!0)}toSQL(t={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(t)}`:null}toString(){return this.isValid?this.toISO():so}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(t={}){if(!this.isValid)return{};const e={...this.c};return t.includeConfig&&(e.outputCalendar=this.outputCalendar,e.numberingSystem=this.loc.numberingSystem,e.locale=this.loc.locale),e}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(t,e="milliseconds",n={}){if(!this.isValid||!t.isValid)return Wi.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=e,Array.isArray(a)?a:[a]).map(Wi.normalizeUnit),o=t.valueOf()>this.valueOf(),s=function(t,e,n,r){let[i,o,s,a]=function(t,e,n){const r=[["years",(t,e)=>e.year-t.year],["quarters",(t,e)=>e.quarter-t.quarter+4*(e.year-t.year)],["months",(t,e)=>e.month-t.month+12*(e.year-t.year)],["weeks",(t,e)=>{const n=Ui(t,e);return(n-n%7)/7}],["days",Ui]],i={},o=t;let s,a;for(const[c,l]of r)n.indexOf(c)>=0&&(s=c,i[c]=l(t,e),a=o.plus(i),a>e?(i[c]--,(t=o.plus(i))>e&&(a=t,i[c]--,t=o.plus(i))):t=a);return[t,i,a,s]}(t,e,n);const c=e-i,l=n.filter(t=>["hours","minutes","seconds","milliseconds"].indexOf(t)>=0);0===l.length&&(s<e&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+c/(s-i)));const u=Wi.fromObject(o,r);return l.length>0?Wi.fromMillis(c,r).shiftTo(...l).plus(u):u}(o?this:t,o?t:this,i,r);var a;return o?s.negate():s}diffNow(t="milliseconds",e={}){return this.diff(Po.now(),t,e)}until(t){return this.isValid?Bi.fromDateTimes(this,t):this}hasSame(t,e,n){if(!this.isValid)return!1;const r=t.valueOf(),i=this.setZone(t.zone,{keepLocalTime:!0});return i.startOf(e,n)<=r&&r<=i.endOf(e,n)}equals(t){return this.isValid&&t.isValid&&this.valueOf()===t.valueOf()&&this.zone.equals(t.zone)&&this.loc.equals(t.loc)}toRelative(t={}){if(!this.isValid)return null;const e=t.base||Po.fromObject({},{zone:this.zone}),n=t.padding?this<e?-t.padding:t.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=t.unit;return Array.isArray(t.unit)&&(r=t.unit,i=void 0),Io(e,this.plus(n),{...t,numeric:"always",units:r,unit:i})}toRelativeCalendar(t={}){return this.isValid?Io(t.base||Po.fromObject({},{zone:this.zone}),this,{...t,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...t){if(!t.every(Po.isDateTime))throw new Ne("min requires all arguments be DateTimes");return sr(t,t=>t.valueOf(),Math.min)}static max(...t){if(!t.every(Po.isDateTime))throw new Ne("max requires all arguments be DateTimes");return sr(t,t=>t.valueOf(),Math.max)}static fromFormatExplain(t,e,n={}){const{locale:r=null,numberingSystem:i=null}=n;return io(xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),t,e)}static fromStringExplain(t,e,n={}){return Po.fromFormatExplain(t,e,n)}static buildFormatParser(t,e={}){const{locale:n=null,numberingSystem:r=null}=e,i=xn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new ro(i,t)}static fromFormatParser(t,e,n={}){if(er(t)||er(e))throw new Ne("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=xn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(e.locale))throw new Ne(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${e.locale}`);const{result:s,zone:a,specificOffset:c,invalidReason:l}=e.explainFromTokens(t);return l?Po.invalid(l):yo(s,a,n,`format ${e.format}`,t,c)}static get DATE_SHORT(){return Me}static get DATE_MED(){return De}static get DATE_MED_WITH_WEEKDAY(){return Oe}static get DATE_FULL(){return Pe}static get DATE_HUGE(){return Re}static get TIME_SIMPLE(){return je}static get TIME_WITH_SECONDS(){return Ae}static get TIME_WITH_SHORT_OFFSET(){return ze}static get TIME_WITH_LONG_OFFSET(){return Fe}static get TIME_24_SIMPLE(){return Le}static get TIME_24_WITH_SECONDS(){return We}static get TIME_24_WITH_SHORT_OFFSET(){return qe}static get TIME_24_WITH_LONG_OFFSET(){return Be}static get DATETIME_SHORT(){return He}static get DATETIME_SHORT_WITH_SECONDS(){return Ue}static get DATETIME_MED(){return Ze}static get DATETIME_MED_WITH_SECONDS(){return Ge}static get DATETIME_MED_WITH_WEEKDAY(){return Ye}static get DATETIME_FULL(){return Je}static get DATETIME_FULL_WITH_SECONDS(){return Ve}static get DATETIME_HUGE(){return Qe}static get DATETIME_HUGE_WITH_SECONDS(){return Xe}}function Ro(t){if(Po.isDateTime(t))return t;if(t&&t.valueOf&&nr(t.valueOf()))return Po.fromJSDate(t);if(t&&"object"==typeof t)return Po.fromObject(t);throw new Ne(`Unknown datetime argument: ${t}, of type ${typeof t}`)}function jo({title:t,description:e,children:n,noSubscription:r,hideHeader:i}){return Et("div",{className:ce.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:re.colors.accent}),children:Et("div",{className:ce.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1"}),children:[!i&&Et("div",{className:ce.create("page-heading-wrapper",{width:"100%",marginBottom:re.spacing.lg}),children:Et(ge,{children:Et("div",{className:ce.create("page-heading-container",{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,borderRadius:re.radius.large,padding:`${re.spacing.lg} ${re.spacing.xl}`,boxShadow:re.shadow.md}),children:Et("div",{className:ce.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:re.spacing.lg}),children:Et("div",{className:ce.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Et("h1",{className:ce.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:re.colors.primaryForeground,letterSpacing:"-0.025em"}),children:t}),e&&Et("p",{className:ce.create("page-template-description",{margin:"0",marginTop:re.spacing.sm,fontSize:re.fontSize.small,lineHeight:"1.5",color:re.colors.primaryForeground,opacity:"0.85"}),children:e})]})})})})}),n]})})}function Ao({className:t,children:e}){const n=ce.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Et("div",{className:me(n,t),children:e})}function zo({message:t}){return Et(jo,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Et(ge,{children:Et(Ao,{className:ce.name("loading-container"),children:Et(pe,{size:"large"})})})})}function Fo({variant:t="primary",type:e="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const c={primary:{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,boxShadow:re.shadow.sm},outline:{border:`${re.borderWidth} solid ${re.colors.primary}`,backgroundColor:re.colors.card,color:re.colors.primary,boxShadow:re.shadow.sm}},l=ce.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:re.radius.default,cursor:"pointer",fontSize:re.fontSize.default,fontWeight:"500",transition:re.transition,fontFamily:re.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"});ce.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"}),ce.pseudoElement(`button-${t}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:re.shadow.md}),ce.pseudoElement(`button-${t}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:re.shadow.sm});const u=ce.create(`button-${t}`,{...c[t]});return Et("button",{type:e,className:me(l,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Et(pe,{size:"small"}),o]})}function Lo({error:t}){ce.create("error-fallback-container",{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"100vh",padding:"2rem",backgroundColor:re.colors.background,textAlign:"center"});const e=ce.create("error-fallback-icon",{width:"4rem",height:"4rem",color:re.colors.destructive,marginBottom:"1.5rem"}),n=ce.create("error-fallback-title",{fontSize:"2rem",fontWeight:"bold",color:re.colors.foreground,marginBottom:"1rem",lineHeight:"1.2"});ce.create("error-fallback-message",{fontSize:re.fontSize.large,color:re.colors.foreground,marginBottom:"1.5rem",maxWidth:"40rem",lineHeight:"1.5"});const r=ce.create("error-fallback-details",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,backgroundColor:re.colors.muted,padding:"1rem",borderRadius:re.radius.default,fontFamily:"monospace",marginBottom:"1.5rem",maxWidth:"40rem",wordBreak:"break-word",textAlign:"left"}),i=ce.create("error-fallback-support",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"2rem",maxWidth:"40rem",lineHeight:"1.5"}),o=ce.create("error-fallback-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"}),s=t||{severity:"critical",title:"Application Error",message:"We're unable to load the application at this time."};return Et(jo,{title:s.title,description:s.message,noSubscription:!0,children:Et(ge,{children:Et(Ao,{className:ce.name("loading-container"),children:[Et(()=>Et("svg",{className:e,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),{}),Et("h1",{className:n,children:s.title}),s.details&&Et("div",{className:r,children:[Et("strong",{children:"Error Details:"}),Et("br",{}),s.details,s.statusCode&&Et(S,{children:[Et("br",{}),Et("strong",{children:"Status Code:"})," ",s.statusCode]})]}),Et("p",{className:i,children:dt(s)}),Et("div",{className:o,children:Et(Fo,{variant:"outline",onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})}function Wo({message:t,estimatedTime:e}){const n=ce.create("maintenance-container",{maxWidth:"40rem",margin:"0 auto",textAlign:"center"}),r=ce.create("maintenance-icon",{width:"4rem",height:"4rem",color:re.colors.primary,marginBottom:"1.5rem"}),i=ce.create("maintenance-title",{fontSize:"1.875rem",fontWeight:"bold",color:re.colors.foreground,marginBottom:"0.5rem",lineHeight:"1.2"}),o=ce.create("maintenance-message",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"1.5rem",lineHeight:"1.5"}),s=ce.create("maintenance-info-box",{backgroundColor:re.colors.muted,borderRadius:re.radius.default,padding:"1rem",marginBottom:"2rem",textAlign:"left"}),a=ce.create("maintenance-info-title",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,marginBottom:"0.5rem"}),c=ce.create("maintenance-info-text",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.4"}),l=ce.create("maintenance-actions",{display:"flex",gap:"1rem",flexWrap:"wrap",justifyContent:"center"});return Et(jo,{title:"We'll be right back",description:"Scheduled maintenance in progress",noSubscription:!0,children:Et(ge,{children:Et(Ao,{children:Et("div",{className:n,children:[Et(()=>Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:r,children:Et("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),{}),Et("h1",{className:i,children:"We'll be right back"}),Et("p",{className:o,children:t||"We're performing scheduled maintenance to improve our services. Please check back in a few minutes."}),Et("div",{className:s,children:[Et("p",{className:a,children:"What's happening?"}),Et("p",{className:c,children:"We're making improvements to ensure you have the best experience. This should only take a few minutes."}),e&&Et("p",{className:c,style:{marginTop:"0.5rem"},children:[Et("strong",{children:"Estimated time:"})," ",e]})]}),Et("div",{className:l,children:Et(Fo,{onClick:()=>{window.location.reload()},children:"Refresh Page"})})]})})})})}function qo({size:t="default",style:e="normal",className:n,children:r}){const i=ce.create("text",{marginTop:"0",marginBottom:"0"}),o=ce.create("text-small",{fontSize:re.fontSize.small}),s=ce.create("text-default",{fontSize:re.fontSize.default}),a=ce.create("text-italic",{fontStyle:"italic"}),c=ce.create("text-bold",{fontWeight:"bold"}),l=ce.create("text-underline",{textDecoration:"underline"}),u=me({[a]:"italic"===e,[c]:"bold"===e,[l]:"underline"===e}),d=me({[o]:"small"===t,[s]:"default"===t});return Et("p",{className:me(i,d,u,n),children:r})}function Bo({title:t,description:e}){return Et("div",{className:ce.create("section-header",{}),children:[Et("p",{className:ce.create("section-title",{fontSize:re.fontSize.large,margin:"0",color:re.colors.foreground}),children:t}),e&&Et(qo,{className:ce.create("section-description",{color:re.colors.mutedForeground,margin:"0.25rem 0 0 0"}),children:"Choose your excess amount - the amount you'll pay if you need to make a claim"})]})}function Ho({selected:t}){return Et("div",{className:me(ce.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${re.borderWidth} solid transparent`}),t?ce.create("selected-indicator-selected",{backgroundColor:re.colors.primary}):ce.create("selected-indicator-unselected",{border:`${re.borderWidth} solid ${re.colors.border}`}))})}function Uo({excessOptions:t,selectedExcessId:e,onExcessSelect:n}){const r=[...t].sort((t,e)=>t.excess_amount-e.excess_amount);return Et("div",{className:ce.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Et(Bo,{title:"Excess Options"}),Et("div",{className:ce.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(t=>{const r=t.id===e;return Et("div",{className:me(ce.create("excess-option-card",{borderRadius:re.radius.default,width:"125px",padding:"0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?ce.create("excess-option-card-selected",{border:`2px solid ${re.colors.primary}`,backgroundColor:re.colors.accent}):ce.create("excess-option-card-unselected",{border:`2px solid ${re.colors.border}`,backgroundColor:re.colors.card})),onClick:()=>n(t.id),children:[Et(Ho,{selected:r}),Et("div",{className:ce.create("excess-amount",{color:re.colors.foreground}),children:["$",Number(t.excess_amount).toFixed(0)]})]},t.id)})})]})}function Zo(t,e="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}function Go(t){switch(t){case"one-time":return"Pay in Full";case"monthly":return"Monthly Installments";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)} Installments`}}function Yo({paymentOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=Ut(()=>{if(!n)return[];const r=t.filter(t=>t.excess_id===n&&t.amount.success).map(t=>{const n=e.find(e=>e.id===t.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${t.gateway_id}`);return{...t,gateway:n}});return r.sort((t,e)=>("one-time"===t.amount.frequency?t.amount.dueToday:t.amount.installmentAmount||0)-("one-time"===e.amount.frequency?e.amount.dueToday:e.amount.installmentAmount||0))},[t,e,n]);return n?Et(Jo,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Et("div",{className:ce.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Et(Jo,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function Jo({sortedOptions:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=t.length>0;return Et("div",{className:ce.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Et(Bo,{title:"Payment Options"}),Et("div",r?{className:ce.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:t.map(t=>Et(Vo,{option:t,selectedPaymentOption:e,onPaymentSelect:n},`${t.gateway_id}-${t.excess_id}`))}:{className:ce.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${re.colors.border}`,borderRadius:re.radius.default,backgroundColor:re.colors.muted}),children:Et(qo,{className:ce.create("placeholder-text",{color:re.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function Vo({option:t,selectedPaymentOption:e,onPaymentSelect:n}){const r=(null==e?void 0:e.gateway_id)===t.gateway_id&&(null==e?void 0:e.excess_id)===t.excess_id;return Et("div",{className:me(ce.create("payment-option-row",{borderRadius:re.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"}),r?ce.create("payment-option-row-selected",{border:`2px solid ${re.colors.primary}`,backgroundColor:re.colors.accent}):ce.create("payment-option-row-unselected",{border:`2px solid ${re.colors.border}`,backgroundColor:re.colors.card})),onClick:()=>n(t),children:[Et(Ho,{selected:r}),Et("div",{className:ce.create("payment-option-info",{display:"flex",flexDirection:"column",flex:"1"}),children:[Et("div",{className:ce.create("frequency-title",{fontSize:re.fontSize.default,fontWeight:"500",color:re.colors.foreground}),children:Go(t.amount.frequency)}),Et("div",{className:ce.create("gateway-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground}),children:["via ",t.gateway.name]})]}),Et("div",{className:ce.create("payment-option-amount",{display:"flex",flexDirection:"column"}),children:[Et(qo,{className:ce.create("amount-text",{textAlign:"right"}),children:"one-time"===t.amount.frequency?Zo(t.amount.dueToday):`${Zo(t.amount.installmentAmount||0)} x ${t.amount.numberOfInstallments}`}),Et(qo,{size:"small",className:ce.create("gateway-fee-text",{textAlign:"right",color:re.colors.mutedForeground}),children:[Zo(t.amount.gatewayFee)," fee"]})]})]})}function Qo({label:t,value:e,isTotal:n=!1,className:r}){return Et("div",{className:me(ce.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Et("span",{className:ce.create("summary-label",{color:re.colors.mutedForeground,fontSize:re.fontSize.small}),children:t}),Et("span",{className:ce.create("summary-value",{fontWeight:n?"600":"500",color:re.colors.foreground,fontSize:n?re.fontSize.large:"inherit"}),children:e})]})}function Xo({excessOptions:t,paymentGateways:e,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o}){const s=Ut(()=>n?t.find(t=>t.id===n):null,[t,n]),a=Ut(()=>r?e.find(t=>t.id===r.gateway_id):null,[e,r]);return Et("div",{className:ce.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Et(Bo,{title:"Payment Summary"}),Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Excess Amount"}),s?Et(Qo,{label:`$${Number(s.excess_amount).toFixed(0)} excess`,value:Zo(s.premium_total)}):Et(qo,{className:ce.create("summary-placeholder",{color:re.colors.mutedForeground,margin:"0",fontSize:re.fontSize.small}),children:"No excess selected"})]}),Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Payment Method"}),r&&a?Et("div",{className:ce.create("payment-method-details",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:Et("div",{className:ce.create("gateway-info",{display:"flex",flexDirection:"column",gap:"0.25rem"}),children:[Et("span",{className:ce.create("gateway-name",{fontWeight:"500",color:re.colors.foreground}),children:Go(r.amount.frequency)}),Et("span",{className:ce.create("gateway-provider",{fontSize:re.fontSize.small,color:re.colors.mutedForeground}),children:["via ",a.name]})]})}):Et(qo,{className:ce.create("summary-placeholder",{color:re.colors.mutedForeground,margin:"0",fontSize:re.fontSize.small}),children:"No payment method selected"})]}),r&&Et("div",{className:ce.create("summary-section",{paddingBottom:"1rem",borderBottom:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("summary-section-title",{fontSize:re.fontSize.default,fontWeight:"500",marginBottom:"0.5rem",color:re.colors.foreground}),children:"Payment Details"}),Et("div",{className:ce.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Et(S,{children:[Et(Qo,{label:"Total Due Today:",value:Zo(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0}),r.amount.gatewayFee>0&&Et(Qo,{label:"Gateway Fee:",value:Zo(r.amount.gatewayFee)})]}):Et(S,{children:[Et(Qo,{label:"Due Today:",value:Zo(r.amount.dueToday),isTotal:!0}),r.amount.installmentAmount&&Et(Qo,{label:"monthly"===r.amount.frequency?"Then Monthly:":"Per Installment:",value:Zo(r.amount.installmentAmount)}),r.amount.numberOfInstallments&&Et(Qo,{label:"Installments:",value:r.amount.numberOfInstallments.toString()}),r.amount.totalRepayable&&Et(S,{children:Et(Qo,{label:"Total Payable:",value:Zo(r.amount.totalRepayable),className:ce.create("total-item",{})})})]})})]}),Et(Fo,{onClick:i,disabled:!o,className:ce.create("purchase-button",{width:"100%",height:"3rem",fontSize:re.fontSize.default,fontWeight:"600"}),children:o?"Go to Payment":"Select Options to Continue"})]})}function Ko({isOpen:t,onClose:e,onSuccess:n,onError:r,paymentRequest:i}){const{fsm:o}=we(()=>({})),[s,a]=qt("initiating"),[c,l]=qt(null),[u,d]=qt(null),[h,f]=qt(null);Bt(()=>{t&&i&&m()},[t,i]);const m=async()=>{if(i)try{a("initiating"),l(null);const t={...i,returnUrl:window.location.href},e=await o.initiatePayment(t);f(e.transaction_id),a("redirecting"),window.location.href=e.gateway_acceptance_url}catch(t){l(t.message||"Failed to initiate payment"),a("failed")}},p=()=>{u&&!u.closed&&u.close(),a("initiating"),l(null),f(null),d(null),e()};return t?Et("div",{className:ce.create("modal-overlay",{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000"}),children:[Et("div",{className:ce.create("modal-content",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${re.colors.border}`}),children:[Et("div",{className:ce.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Et("div",{className:ce.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(s){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Et("h2",{className:ce.create("modal-title",{margin:"0",color:re.colors.foreground,fontSize:re.fontSize.large}),children:"Payment Processing"})]}),Et("div",{className:ce.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Et(qo,{className:ce.create("status-message",{fontSize:re.fontSize.default,color:re.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(s){case"initiating":return"Setting up your payment...";case"redirecting":return"Redirecting to payment portal...";case"processing":default:return"Processing payment...";case"polling":return"Checking payment status...";case"completed":return"Payment completed successfully!";case"cancelled":return"Payment was cancelled";case"failed":return"Payment failed"}})()}),c&&Et(qo,{className:ce.create("error-message",{color:re.colors.destructive,fontSize:re.fontSize.small,padding:"0.75rem",backgroundColor:re.colors.destructive+"10",borderRadius:re.radius.default,border:`1px solid ${re.colors.destructive}30`}),children:c}),("redirecting"===s||"initiating"===s)&&Et("div",{className:ce.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${re.colors.border}`,borderTop:`3px solid ${re.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Et("div",{className:ce.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===s||"cancelled"===s?Et(S,{children:[Et(Fo,{onClick:p,variant:"outline",children:"Close"}),"cancelled"===s&&Et(Fo,{onClick:()=>{a("initiating"),l(null),m()},children:"Try Again"})]}):Et(Fo,"completed"===s?{onClick:p,children:"Continue"}:{onClick:p,variant:"outline",disabled:"initiating"===s,children:"Cancel"})})]}),Et("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function ts({type:t,transactionId:e,isOpen:n,onClose:r}){if(!n)return null;const i=(()=>{switch(t){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.primary||"#10b981"},children:Et("path",{d:"M20 6 9 17l-5-5"})}),buttonText:"Close"};case"declined":return{title:"Payment Declined",message:"Your payment was declined by the payment processor. Please try a different payment method or contact your bank.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.destructive},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"m15 9-6 6"}),Et("path",{d:"m9 9 6 6"})]}),buttonText:"Close"};case"cancelled":return{title:"Payment Cancelled",message:"You cancelled the payment process. You can try again when you're ready.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.secondary},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"m15 9-6 6"}),Et("path",{d:"m9 9 6 6"})]}),buttonText:"Continue"};default:return{title:"Payment Error",message:"There was an issue processing your payment. Please try again or contact support if the problem persists.",icon:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{color:re.colors.destructive},children:[Et("circle",{cx:"12",cy:"12",r:"10"}),Et("path",{d:"M12 8v4"}),Et("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),o=ce.create("modal-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000",padding:"1rem"}),s=ce.create("modal-content",{backgroundColor:re.colors.background,borderRadius:re.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${re.borderWidth} solid ${re.colors.border}`}),a=ce.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),c=ce.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:re.colors.foreground,margin:"0"}),l=ce.create("modal-message",{color:re.colors.foreground,lineHeight:"1.5",margin:"0"});ce.create("transaction-info",{backgroundColor:re.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:re.radius.small,border:`${re.borderWidth} solid ${re.colors.border}`,fontSize:re.fontSize.small,color:re.colors.mutedForeground,wordBreak:"break-all"});const u=ce.create("modal-button",{backgroundColor:re.colors.primary,color:re.colors.primaryForeground,border:"none",borderRadius:re.radius.default,padding:"0.75rem 1.5rem",fontSize:re.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),d=ce.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Et("div",{className:o,onClick:r,children:Et("div",{className:s,onClick:t=>t.stopPropagation(),children:Et("div",{className:a,children:[i.icon,Et("div",{className:d,children:[Et("h2",{className:c,children:i.title}),Et("p",{className:l,children:i.message})]}),Et("button",{className:u,onClick:r,children:i.buttonText})]})})})}function es({results:t}){const{fsm:e,selectedExcessId:n,selectedPaymentOption:r,quoteIntent:i}=we(t=>({selectedExcessId:t.getSelectedExcessId(),selectedPaymentOption:t.getSelectedPaymentOption(),quoteIntent:t.getQuoteIntent()})),[o,s]=qt(!1),[a,c]=qt(null),l=t.calculations,u=t.payment_options,d=t.payment_gateways;Bt(()=>{const t=l.find(t=>t.id===n);if(t&&i){const n=u.some(t=>"monthly"===t.amount.frequency),r=e.getPageCompletionStatus(),o=Math.round(r.completedPages.length/r.totalPages*100);vt(i,t,u.length,n,o)}},[]);const h=Boolean(n&&r),f=null==i?void 0:i.payment_return,m=f&&("declined"===f.paymentStatus||"cancelled"===f.paymentStatus||"error"===f.paymentStatus);return Et(jo,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:Et(ge,{children:[Et("div",{className:ce.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:re.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Et("div",{className:ce.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:re.colors.card,boxShadow:re.shadow.sm,borderRadius:re.radius.large,display:"flex",flexDirection:"column"}),children:[Et("div",{className:ce.create("checkout-header",{paddingInline:re.spacing.xl,paddingTop:re.spacing.xl,paddingBottom:re.spacing.lg},{"(max-width: 768px)":{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingTop:re.spacing.md}}),children:[Et("h2",{className:ce.create("checkout-title",{margin:"0",marginBottom:re.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:re.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Et("p",{className:ce.create("checkout-description",{margin:"0",fontSize:re.fontSize.default,lineHeight:"1.6",color:re.colors.foreground,opacity:"0.9"}),children:"Choose your excess amount and payment option to secure your coverage."}),Et("hr",{className:ce.create("checkout-header-border",{marginTop:re.spacing.lg,borderColor:re.colors.border})})]}),Et("div",{className:ce.create("checkout-sections",{paddingInline:re.spacing.xl,paddingBottom:re.spacing.xl,display:"flex",flexDirection:"column",gap:re.spacing.lg},{"(max-width: 768px)":{paddingInline:re.spacing.lg,paddingBottom:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingBottom:re.spacing.md}}),children:[Et(Uo,{excessOptions:l,selectedExcessId:n,onExcessSelect:t=>e.setSelectedExcessId(t)}),Et(Yo,{paymentOptions:u,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPaymentSelect:t=>e.setSelectedPaymentOption(t)})]})]}),Et("div",{className:ce.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Et("div",{className:ce.create("checkout-sidebar-sticky",{position:"sticky",top:re.spacing.lg},{"(max-width: 950px)":{position:"static"}}),children:Et("div",{className:ce.create("checkout-sidebar-card",{backgroundColor:re.colors.card,borderRadius:re.radius.large,boxShadow:re.shadow.sm,padding:re.spacing.lg},{"(max-width: 768px)":{padding:re.spacing.md}}),children:Et(Xo,{excessOptions:l,paymentGateways:d,selectedExcessId:n,selectedPaymentOption:r,onPurchase:()=>{if(!n||!r)return void alert("Please select both an excess amount and payment option");const e={quoteIntentId:t.quote_intent.id,excessId:n,gatewayId:r.gateway_id,calculationId:r.calculation_id,clientDetails:{legalName:"Test"}};c(e),s(!0)},canPurchase:h})})})})]}),m&&Et(ts,{type:f.paymentStatus,transactionId:f.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{e.updateQuoteIntent({payment_return:void 0})}}),Et(Ko,{isOpen:o,onClose:()=>{s(!1),c(null)},onSuccess:()=>{s(!1),c(null),alert("Payment completed successfully!")},onError:t=>{alert("Payment failed: "+t)},paymentRequest:a})]})})}function ns({results:t}){var e,n,r;const{quoteIntent:i}=we(t=>({quoteIntent:t.getQuoteIntent()})),o=null===(e=null==i?void 0:i.organisation)||void 0===e?void 0:e.admin_email,s=null===(n=null==i?void 0:i.organisation)||void 0===n?void 0:n.phone,a=o||s,c=ce.create("referral-card",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.xl,boxShadow:re.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:re.spacing.lg},"(max-width: 480px)":{padding:re.spacing.md}}),l=ce.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:re.spacing.lg}),u=ce.create("referral-icon",{width:"4rem",height:"4rem",color:re.colors.primary}),d=ce.create("referral-header",{textAlign:"center",marginBottom:re.spacing.xl}),h=ce.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:re.colors.primary,marginBottom:re.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=ce.create("referral-subtitle",{fontSize:re.fontSize.default,color:re.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),m=ce.create("referral-process-box",{backgroundColor:re.colors.accent,borderRadius:re.radius.default,padding:re.spacing.lg,marginBottom:re.spacing.xl}),p=ce.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:re.colors.accentForeground,marginBottom:re.spacing.md,marginTop:"0"}),g=ce.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:re.spacing.sm}),y=ce.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:re.fontSize.small,color:re.colors.accentForeground,lineHeight:"1.6"}),v=ce.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:re.colors.primary,color:re.colors.primaryForeground,borderRadius:"50%",marginRight:re.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),w=ce.create("referral-contact-section",{borderTop:`1px solid ${re.colors.border}`,paddingTop:re.spacing.xl,marginTop:re.spacing.xl,textAlign:"center"}),b=ce.create("referral-contact-text",{fontSize:re.fontSize.default,color:re.colors.foreground,marginBottom:re.spacing.lg}),x=ce.create("referral-actions",{display:"flex",gap:re.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:re.spacing.lg}),k=ce.create("referral-reference",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,marginTop:re.spacing.md});return Et(jo,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Et(ge,{children:Et(Ao,{children:Et("div",{className:c,children:[Et("div",{className:l,children:Et(()=>Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:u,children:[Et("path",{d:"M7 10v12"}),Et("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),{})}),Et("div",{className:d,children:[Et("h1",{className:h,children:"Thanks for your quote request!"}),Et("p",{className:f,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Et("div",{className:m,children:[Et("h3",{className:p,children:"What happens next?"}),Et("ul",{className:g,children:[Et("li",{className:y,children:[Et("span",{className:v,children:"1"}),Et("span",{children:"Our team will review your application within 1-2 business days"})]}),Et("li",{className:y,children:[Et("span",{className:v,children:"2"}),Et("span",{children:"We'll contact you with either approval or additional requirements"})]}),Et("li",{className:y,children:[Et("span",{className:v,children:"3"}),Et("span",{children:"If approved, we'll provide you with payment options to complete your purchase"})]})]})]}),a&&Et("div",{className:w,children:[Et("p",{className:b,children:"Need to speak with someone about your quote?"}),Et("div",{className:x,children:[s&&Et(Fo,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:Et("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),o&&Et(Fo,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[Et("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Et("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(r=t.quote_intent)||void 0===r?void 0:r.id)&&Et("div",{className:k,children:["Quote Reference: ",Et("strong",{children:t.quote_intent.id.slice(0,8).toUpperCase()})]})]})]})})})})}function rs({results:t}){return"referral"===t.outcome_type?Et(ns,{results:t}):Et(es,{results:t})}function is({value:t,onChange:e,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:c,prefix:l="$"}){const u=Ht(null),[d,h]=qt("");function f(t){if(!t)return"";const e=t.replace(/[^\d.]/g,"");if(!e)return"";const n=e.split(".");let r=n[0];const i=n[1];r=r.replace(/^0+/,"")||"0";const o=r.replace(/\B(?=(\d{3})+(?!\d))/g,",");return void 0!==i?o+"."+i:o}Bt(()=>{h(null!=t&&""!==t?f(t):"")},[t]);const m=ce.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=ce.create("money-input-prefix",{position:"absolute",left:"1rem",color:re.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=ce.create("money-input-with-prefix",{paddingLeft:l?"2rem":"1rem"});return Et("div",{className:m,children:[l&&Et("span",{className:p,children:l}),Et("input",{ref:u,type:"text",inputMode:"decimal",name:n,id:r,value:d,onInput:function(t){const n=t.currentTarget,r=n.selectionStart||0,i=d,o=n.value.replace(/[^\d.]/g,""),s=f(o);h(s),e(o),requestAnimationFrame(()=>{if(u.current){const t=function(t,e,n){let r=n+(e.length-t.length);return r=Math.max(0,Math.min(r,e.length)),r}(i,s,r);u.current.setSelectionRange(t,t)}})},onBlur:function(){d&&d.includes(".")},placeholder:i,required:o,disabled:s,className:me(a,l&&g)})]})}function os(t){var e,n,r,i;const o=ce.create("input",{width:"100%",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,fontSize:re.fontSize.default,backgroundColor:re.colors.card,color:re.colors.foreground,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none"});ce.pseudoElement("input",":focus",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const s=ce.create("select",{width:"100%",boxSizing:"border-box",height:`calc(2.75rem - (${re.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"transparent",borderRight:"1rem solid transparent",fontSize:re.fontSize.default,backgroundColor:"transparent",color:re.colors.foreground}),a=ce.create("select-wrapper",{border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,backgroundColor:re.colors.card,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none",overflow:"hidden"});ce.pseudoElement("select-wrapper",":focus-within",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const{onChange:c,className:l,validation:u,errors:d,...h}=t;function f(t){c(t.currentTarget.value)}function m(t){c(t.currentTarget.value)}if("select"===t.type)return Et("div",{className:a,children:Et("select",{...h,onChange:f,className:s,children:[Et("option",{value:"",children:"Select an option"}),null===(n=null===(e=t.validation)||void 0===e?void 0:e.options)||void 0===n?void 0:n.map(t=>Et("option",{value:t.value,children:t.label},t.value))]})});if("date"===t.type)return Et("input",{...h,type:"date",min:null===(r=t.validation)||void 0===r?void 0:r.minDate,max:null===(i=t.validation)||void 0===i?void 0:i.maxDate,onInput:m,onChange:f,className:me(o,l)});if("monthyear"===t.type){function p(t){const e=t.currentTarget.value;c(e?`${e}-01`:"")}const g=t.value?t.value.substring(0,7):"";return Et("input",{...h,type:"month",value:g,onInput:p,onChange:p,className:me(o,l)})}if("year"===t.type){const y=(new Date).getFullYear();return Et("input",{...h,type:"number",min:y-100,max:y,placeholder:"YYYY",onInput:m,onChange:f,className:me(o,l)})}if("money"===t.type)return Et(is,{value:t.value,onChange:c,name:t.name,id:t.id,placeholder:t.placeholder,required:t.required,disabled:t.disabled,className:me(o,l),hasError:t.hasError});if("checkbox"===t.type){const v=!0===t.value||"true"===t.value||"true"===t.value,w=ce.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),b=ce.create("checkbox-"+(v?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${v?re.colors.primary:t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:v?re.colors.primary:re.colors.card,transition:re.transition,position:"absolute"});function x(t){t.preventDefault(),c(v?"false":"true")}return ce.pseudoElement("checkbox-"+(v?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px ${re.colors.ring}20`}),Et("div",{className:w,children:[Et("input",{type:"checkbox",id:t.id,name:t.name,checked:v,onClick:x,className:me(b,l),required:t.required,readOnly:!0}),v&&Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:re.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Et("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===t.type){const k=ce.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),S=ce.create("boolean-radio-group",{display:"flex",gap:"1rem"}),_=ce.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),$=ce.create("boolean-radio",{accentColor:re.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),N=ce.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${re.borderWidth} solid ${t.hasError?re.colors.destructive:re.colors.input}`,borderRadius:re.radius.default,fontSize:re.fontSize.default,backgroundColor:re.colors.card,color:re.colors.foreground,transition:re.transition,outline:"none",boxShadow:t.hasError?`0 0 0 3px ${re.colors.destructive}20`:"none",resize:"vertical",fontFamily:re.fontFamily});ce.pseudoElement("boolean-textarea",":focus",{borderColor:re.colors.ring,boxShadow:`0 0 0 3px ${re.colors.ring}20`});const E=!0===t.value||"true"===t.value,T=!1===t.value||"false"===t.value,C=t.answer||"",I=t.booleanConfig,M=(null==I?void 0:I.enable_details_textbox)&&("yes"===I.show_details_on&&E||"no"===I.show_details_on&&T);function D(e){c(e),(!(null==I?void 0:I.enable_details_textbox)||!("yes"===I.show_details_on&&"true"===e||"no"===I.show_details_on&&"false"===e))&&t.onAnswerChange&&t.onAnswerChange("")}return Et("div",{className:me(k,l),children:[Et("div",{className:S,children:[Et("label",{className:_,children:[Et("input",{type:"radio",name:t.name,checked:E,onChange:()=>D("true"),className:$}),Et("span",{children:"Yes"})]}),Et("label",{className:_,children:[Et("input",{type:"radio",name:t.name,checked:T,onChange:()=>D("false"),className:$}),Et("span",{children:"No"})]})]}),M&&Et("textarea",{placeholder:(null==I?void 0:I.details_placeholder)||"Please provide details",value:C,required:!0,onInput:e=>{return n=e.target.value,void(t.onAnswerChange&&t.onAnswerChange(n));var n},className:N})]})}return Et("input",{...h,onInput:m,onChange:f,className:me(o,l)})}function ss({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,lastUpdated:i,isSaving:o}=we(t=>{var e,n;return{lastUpdated:null!==(n=null===(e=t.getFormProgress())||void 0===e?void 0:e.last_updated)&&void 0!==n?n:null,isSaving:t.getIsSaving()}}),s=Ht(null),a=Ht(null);Bt(()=>{if(s.current&&a.current){const t=a.current,e=s.current,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e]);const c=Math.round((e+1)/t.length*100);return Et("div",{className:ce.create("sidebar-navigation",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.lg,boxShadow:re.shadow.sm,position:"sticky",top:re.spacing.lg,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:re.spacing.lg}),children:[Et("div",{className:ce.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:re.spacing.sm}),children:[Et("span",{className:ce.create("sidebar-progress-text",{fontSize:re.fontSize.small,fontWeight:"600",color:re.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Et("div",{className:ce.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:re.colors.muted,borderRadius:re.radius.small,overflow:"hidden"}),children:Et("div",{className:ce.create("sidebar-progress-fill",{height:"100%",backgroundColor:re.colors.primary,borderRadius:re.radius.small,transition:re.transition,width:`${c}%`})})})]}),Et("hr",{className:ce.create("sidebar-divider",{borderColor:re.colors.border})}),Et("nav",{ref:a,className:ce.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:re.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:re.spacing.sm}),children:t.map((t,i)=>{const a=i===e,c=n.includes(i),l=r.canNavigateToPage(i),u=ce.create(`sidebar-nav-item-${i}`,{display:"flex",alignItems:"flex-start",gap:re.spacing.sm,padding:`${re.spacing.sm} ${re.spacing.sm}`,borderRadius:re.radius.default,border:"none",backgroundColor:a?re.colors.accent:"transparent",color:a?re.colors.accentForeground:re.colors.foreground,cursor:l&&!o?"pointer":"not-allowed",transition:re.transition,textAlign:"left",width:"100%",fontFamily:re.fontFamily,fontSize:re.fontSize.small,opacity:l&&!o?"1":"0.5"});return l&&!a&&ce.pseudoElement(`sidebar-nav-item-${i}`,":hover",{backgroundColor:re.colors.muted}),Et("button",{ref:a?s:null,onClick:()=>{return t=i,void(r.canNavigateToPage(t)&&r.navigateToPage(t));var t},disabled:!l||o,className:u,children:[Et("div",{className:ce.create(`sidebar-indicator-${i}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:c?re.colors.primary:a?re.colors.accentForeground:re.colors.muted,color:c?re.colors.primaryForeground:a?re.colors.accent:re.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})}):i+1}),Et("div",{className:ce.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:[Et("span",{className:ce.create("sidebar-page-title",{fontWeight:a?"600":"500",fontSize:"0.875rem",lineHeight:"1.4",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.title}),t.description&&Et("span",{className:ce.create("sidebar-page-description",{fontSize:"0.75rem",opacity:"0.7",lineHeight:"1.3",wordWrap:"break-word",overflowWrap:"break-word"}),children:t.description})]})]},t.id)})}),Et("button",{onClick:()=>{confirm("Are you sure you want to reset your progress? This cannot be undone.")&&r.reset()},className:ce.create("sidebar-reset-button",{padding:`${re.spacing.sm} ${re.spacing.md}`,border:`${re.borderWidth} solid ${re.colors.border}`,borderRadius:re.radius.default,backgroundColor:"transparent",color:re.colors.mutedForeground,fontSize:re.fontSize.small,fontFamily:re.fontFamily,cursor:"pointer",transition:re.transition,textAlign:"center",width:"100%"}),children:"Reset Progress"}),i&&Et("div",{className:ce.create("sidebar-last-saved",{fontSize:"0.6875rem",color:re.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",Po.fromJSDate(new Date(i)).toFormat("T")]})]})}function as({pages:t,currentPageIndex:e,completedPages:n}){const{fsm:r,isSaving:i}=we(t=>({fsm:t,isSaving:t.getIsSaving()})),[o,s]=qt(!1),a=Math.round((e+1)/t.length*100);return Et("div",{className:ce.create("mobile-sidebar",{overflow:"hidden"}),children:[Et("button",{onClick:()=>s(!o),className:ce.create("mobile-sidebar-header",{width:"100%",padding:re.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:re.spacing.sm}),children:[Et("div",{className:ce.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Et("span",{className:ce.create("mobile-sidebar-step-text",{fontSize:re.fontSize.small,fontWeight:"600",color:re.colors.foreground}),children:["Step ",e+1," of ",t.length]}),Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:ce.create("mobile-sidebar-chevron",{transition:re.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:re.colors.mutedForeground}),children:Et("path",{d:"m6 9 6 6 6-6"})})]}),Et("div",{className:ce.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:re.colors.muted,borderRadius:re.radius.small,overflow:"hidden"}),children:Et("div",{className:ce.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:re.colors.primary,borderRadius:re.radius.small,transition:re.transition,width:`${a}%`})})})]}),Et("hr",{className:ce.create("mobile-sidebar-border",{borderColor:re.colors.border})}),o&&Et("div",{className:ce.create("mobile-sidebar-content",{padding:re.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:t.map((t,o)=>{const a=o===e,c=n.includes(o),l=r.canNavigateToPage(o);return Et("button",{onClick:()=>{return t=o,void(r.canNavigateToPage(t)&&(r.navigateToPage(t),s(!1)));var t},disabled:!l||i,className:ce.create(`mobile-sidebar-item-${o}`,{display:"flex",alignItems:"center",gap:re.spacing.sm,padding:re.spacing.sm,border:"none",borderRadius:re.radius.default,backgroundColor:a?re.colors.accent:"transparent",color:a?re.colors.accentForeground:re.colors.foreground,cursor:l&&!i?"pointer":"not-allowed",opacity:l&&!i?"1":"0.5",transition:re.transition,width:"100%",textAlign:"left",fontFamily:re.fontFamily}),children:[Et("div",{className:ce.create(`mobile-sidebar-indicator-${o}`,{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:c?re.colors.primary:a?re.colors.accentForeground:re.colors.muted,color:c?re.colors.primaryForeground:a?re.colors.accent:re.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),children:c?Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Et("span",{className:ce.create("mobile-sidebar-page-title",{fontSize:re.fontSize.small,fontWeight:a?"600":"500"}),children:t.title})]},t.id)})})]})}function cs({organisation:t}){return Et("div",{className:ce.create("welcome-card",{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},{"(max-width: 950px)":{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingTop:re.spacing.md}}),children:[Et("h2",{className:ce.create("welcome-title",{margin:"0",marginBottom:re.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:re.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:re.spacing.sm}}),children:["Thank you for choosing ",t.name,"."]}),Et("p",{className:ce.create("welcome-text",{margin:"0",fontSize:re.fontSize.default,lineHeight:"1.6",color:re.colors.foreground,opacity:"0.9"}),children:"Getting a quote online is quick and easy. Simply complete the form below with your details, and we'll provide you with a personalied quote. Our secure platform ensures your information is protected every step of the way."}),Et("hr",{className:ce.create("welcome-border",{marginTop:re.spacing.lg,borderColor:re.colors.border})})]})}function ls({title:t,description:e}){return Et(jo,{title:t,description:e,children:Et(ge,{children:Et(Ao,{className:ce.name("error-container"),children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-ban-icon lucide-ban",children:[Et("path",{d:"M4.929 4.929 19.07 19.071"}),Et("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function us({errors:t,className:e}){return t&&0!==t.length?Et("div",{className:ce.create("field-error",{color:re.colors.destructive,fontSize:re.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:t.map((t,e)=>Et("span",{className:ce.create("field-error-message",{lineHeight:"1.4"}),children:t.message},e))}):null}function ds({htmlFor:t,label:e,children:n,required:r,tooltip:i,...o}){const[s,a]=qt(!1);return Et("label",{for:t,className:ce.create("label",{display:"flex",flexDirection:"column"}),...o,children:[Et("span",{className:ce.create("label-text",{marginBottom:re.spacing.sm,fontSize:re.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:re.spacing.sm,color:re.colors.foreground}),children:[Et("span",{children:[e,r&&Et("span",{className:ce.create("label-required-indicator",{color:re.colors.destructive,marginLeft:"0.25rem"}),children:"*"})]}),i&&Et("span",{className:ce.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[Et("svg",{className:ce.create("tooltip-icon",{width:"1rem",height:"1rem",color:re.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Et("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Et("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Et("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s&&Et("span",{className:ce.create("tooltip-content",{position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"0.5rem",padding:"0.5rem 0.75rem",backgroundColor:re.colors.popover,color:re.colors.popoverForeground,fontSize:"0.875rem",borderRadius:re.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e3,minWidth:"200px",maxWidth:"300px"}),children:[i,Et("span",{className:ce.create("tooltip-arrow",{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderTop:`6px solid ${re.colors.popover}`})})]})]})]}),n]})}function hs(t){switch(null!=t?t:100){case 25:return ce.create("field-wrapper-25",{gridColumn:"span 3 / span 3"});case 33:return ce.create("field-wrapper-33",{gridColumn:"span 4 / span 4"});case 50:return ce.create("field-wrapper-50",{gridColumn:"span 6 / span 6"});case 66:return ce.create("field-wrapper-66",{gridColumn:"span 8 / span 8"});case 75:return ce.create("field-wrapper-75",{gridColumn:"span 9 / span 9"});default:return ce.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function fs(t){return t?t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,e,n)=>{const r=n.trim();return r.match(/^(https?:\/\/|mailto:)/i)?`<a href="${r}" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">${e}</a>`:t}):""}function ms({field:t,errors:e,children:n,className:r}){const i=t.code||t.id,o=(null==e?void 0:e.filter(t=>t.field===i))||[],s=ce.create("validated-field",{display:"flex",flexDirection:"column",gap:re.spacing.sm});if("checkbox"===t.type){const e=ce.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:re.spacing.sm}),a=ce.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),c=ce.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),l=ce.create("checkbox-label-text",{fontSize:re.fontSize.default,fontWeight:"600",color:re.colors.foreground,display:"flex",alignItems:"center",gap:"0.25rem"});return Et("div",{className:me(s,hs(t.width),r),children:[Et("div",{className:e,children:Et("div",{className:a,children:[Et("label",{htmlFor:i,style:{display:"flex",cursor:"pointer"},children:n}),Et("label",{htmlFor:i,className:c,children:[Et("span",{className:l,children:[t.label,t.required&&Et("span",{className:ce.create("checkbox-required-indicator",{color:re.colors.destructive}),children:"*"})]}),t.description&&Et("div",{className:ce.create("checkbox-field-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:fs(t.description)}})]})]})}),Et(us,{errors:o})]})}return Et("div",{className:me(s,hs(t.width),r),children:[Et(ds,{htmlFor:i,label:t.label,required:t.required,tooltip:t.tooltip,children:[t.description&&Et("div",{className:ce.create("field-description",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,marginBottom:re.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:fs(t.description)}}),n]}),Et(us,{errors:o})]})}function ps({error:t,onDismiss:e,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:re.colors.secondary+"08",borderColor:re.colors.secondary+"30",iconColor:re.colors.secondary,titleColor:re.colors.foreground},error:{backgroundColor:re.colors.destructive+"08",borderColor:re.colors.destructive,iconColor:re.colors.destructive,titleColor:re.colors.destructive},critical:{backgroundColor:re.colors.destructive+"10",borderColor:re.colors.destructive,iconColor:re.colors.destructive,titleColor:re.colors.destructive}}[t.severity],o=ce.create("error-card",{padding:re.spacing.md,borderRadius:re.radius.default,border:`2px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,margin:re.spacing.lg,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.06)"}),s=ce.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:"0.75rem"}),a=ce.create("error-card-icon",{width:"1.25rem",height:"1.25rem",color:i.iconColor,flexShrink:"0",marginTop:"0.125rem"}),c=ce.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),l=ce.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),u=ce.create("error-card-title",{fontSize:re.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),d=ce.create("error-card-message",{fontSize:re.fontSize.small,color:re.colors.foreground,lineHeight:"1.5",opacity:"0.9"}),h=ce.create("error-card-details",{fontSize:"0.8125rem",color:re.colors.mutedForeground,fontFamily:"monospace",backgroundColor:re.colors.muted,padding:"0.625rem",borderRadius:re.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),f=ce.create("error-card-support",{fontSize:"0.8125rem",color:re.colors.mutedForeground,lineHeight:"1.4"}),m=ce.create("error-card-dismiss",{padding:"0.25rem",border:"none",backgroundColor:"transparent",color:re.colors.mutedForeground,cursor:"pointer",borderRadius:re.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",flexShrink:"0",transition:re.transition});return ce.pseudoElement("error-card-dismiss",":hover",{backgroundColor:re.colors.muted,color:re.colors.foreground}),Et("div",{className:me(o,n),children:Et("div",{className:s,children:[Et(()=>"warning"===t.severity?Et("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}):Et("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Et("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),{}),Et("div",{className:c,children:[Et("div",{className:l,children:[Et("div",{className:u,children:t.title}),Et("div",{className:d,children:t.message}),r&&t.details&&Et("div",{className:h,children:t.details}),Et("div",{className:f,children:dt(t)})]}),e&&Et("button",{className:m,onClick:t=>{t.preventDefault(),t.stopPropagation(),e()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none"},children:[Et("path",{d:"M18 6 6 18"}),Et("path",{d:"m6 6 12 12"})]})})]})]})})}function gs(t,e){const n=e.operator,r=e.value,i=null==r?"":String(r),o=null==t?"":String(t);switch(n){case"=":return o===i;case"!=":return o!==i;case"contains":return o.includes(i);case"not_contains":return!o.includes(i);case"starts_with":return o.startsWith(i);case"ends_with":return o.endsWith(i);case"is_empty":return void 0===t||null==t||""===t||""===t.trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function ys(t,e){const n=e.operator,r=null==e.value?0:Number(e.value),i=null==t?0:Number(t.toString().replace(/,/g,"").trim());switch(n){case">":return i>r;case">=":return i>=r;case"<":return i<r;case"<=":return i<=r;case"=":return i===r;case"!=":return i!==r;case"is_empty":return void 0===t||null==t||""===t||""===t.toString().trim();case"is_not_empty":return void 0!==t&&null!=t&&""!==t&&!(""===t.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function vs(t,e){const n=e.operator;switch(e.operator){case"true":return!0===t||"true"===t||1===t;case"false":return!1===t||"false"===t||0===t||void 0===t;case"=":return Boolean(t);case"!=":return!Boolean(t);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function ws(t,e){const n=e.operator,r=e.value,i=null==r?0:Number(e.value);if(null==t||""===t.toString().trim())return"is_empty"===n;const o=t.toString().trim(),s=/^\d{4}$/.test(o)&&Number(o)>=1900&&Number(o)<=2100?new Date(Number(o),0,1).getTime():Date.parse(o),a=Math.floor((Date.now()-s)/315576e5),c=Math.floor((Date.now()-s)/864e5);switch(n){case">":return s>Date.parse(r);case">=":return s>=Date.parse(r);case"<":return s<Date.parse(r);case"<=":return s<=Date.parse(r);case"age_less_than":return a<i;case"age_less_than_or_equal":return a<=i;case"age_greater_than":return a>i;case"age_greater_than_or_equal":return a>=i;case"age_days_less_than":return c<i;case"age_days_less_than_or_equal":return c<=i;case"age_days_greater_than":return c>i;case"age_days_greater_than_or_equal":return c>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}ce.pseudoElement("sidebar-reset-button",":hover",{backgroundColor:re.colors.muted,borderColor:re.colors.primary,color:re.colors.primary});class bs{static create(t){switch(t){case"string":case"text":case"select":return gs;case"numeric":return ys;case"boolean":return vs;case"date":return ws;default:throw new Error(`Unsupported condition type: ${t}`)}}}function xs(t,e){const n=e.condition_type||"and";if(!e.conditions||0===e.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:e.conditions.map(e=>{const n={...e,matched:ks(t,e),string:`${e.field} ${e.operator}`};return e.value&&(n.string+=` ${e.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(t=>t.matched)),"or"===n&&(r.matched=r.conditions.some(t=>t.matched)),"not"===n&&(r.matched=r.conditions.every(t=>!t.matched)),r}function ks(t,e){const n=t[e.field],r=bs.create(e.type);if(!r)throw new Error(`Unsupported condition type: ${e.type}`);return r(n,e)}var Ss=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:bs,booleanMatchesCondition:vs,checkSimpleConditions:xs,dateMatchesCondition:ws,numericMatchesCondition:ys,textMatchesCondition:gs});function _s(){const{definition:t,currentPageIndex:n,totalPages:r,validationErrors:i,generalErrors:o,quoteIntent:s,isSaving:a,fsm:c}=we(t=>({definition:t.getFormDefinition(),currentPageIndex:t.getCurrentPageIndex(),totalPages:t.getTotalPages(),results:t.getCalculationResult(),validationErrors:t.getValidationErrors(),generalErrors:t.getGeneralErrors(),quoteIntent:t.getQuoteIntent(),isSaving:t.getIsSaving()})),l=t.pages[n];if(!l)return Et(ls,{title:"Unexpected Error",description:"No page available"});const u=Ht(new Map),d=(t,e)=>{var n;const r=c.getFormProgress().page_data[l.id],i=null==r?void 0:r[t];if(null!=i&&""!==i)return i;if(e&&("date"===e.type||"monthyear"===e.type)&&(null===(n=e.validation)||void 0===n?void 0:n.defaultDate)){const n=h(e.validation.defaultDate,"monthyear"===e.type);if(n)return c.updateFieldValue(l.id,t,n),n}return""},h=(t,e)=>{const n=new Date;let r=new Date;switch(t){case"today":r=n;break;case"+1week":r.setDate(n.getDate()+7);break;case"+1month":r.setMonth(n.getMonth()+1);break;case"+1year":r.setFullYear(n.getFullYear()+1);break;default:return""}const i=r.getFullYear(),o=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return e?`${i}-${o}-01`:`${i}-${o}-${s}`},f=t=>{const e=c.getFormProgress().page_data[l.id];return((null==e?void 0:e.U)||{})[t]||""},m=c.getFormProgress().page_data[l.id]||{},p=null==s?void 0:s.payment_return,g=p&&("declined"===p.paymentStatus||"cancelled"===p.paymentStatus||"error"===p.paymentStatus),y=c.getFormProgress().completed_pages||[];return Et(jo,{title:l.title,description:l.description,hideHeader:!0,children:Et("div",{children:[g&&Et(ts,{type:p.paymentStatus,transactionId:p.paymentTransactionId||void 0,isOpen:!0,onClose:()=>{c.updateQuoteIntent({payment_return:void 0})}}),Et(ge,{children:Et("div",{className:ce.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:re.spacing.lg},{"(max-width: 950px)":{gridTemplateColumns:"1fr"}}),children:[Et("div",{className:ce.create("form-content-wrapper",{minWidth:"0",backgroundColor:re.colors.card,boxShadow:re.shadow.sm,borderRadius:re.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"}),children:[Et("div",{className:ce.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Et(as,{pages:t.pages,currentPageIndex:n,completedPages:y})}),n>0&&Et("div",{className:ce.create("page-heading-container",{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},{"(max-width: 950px)":{paddingInline:re.spacing.lg,paddingTop:re.spacing.lg},"(max-width: 480px)":{paddingInline:re.spacing.md,paddingTop:re.spacing.md}}),children:[Et("div",{className:ce.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:re.spacing.lg}),children:Et("div",{className:ce.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Et("h1",{className:ce.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:re.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:l.title}),l.description&&Et("p",{className:ce.create("page-template-description",{margin:"0",marginTop:re.spacing.sm,fontSize:re.fontSize.small,lineHeight:"1.5",color:re.colors.foreground,opacity:"0.7"}),children:l.description})]})}),Et("hr",{className:ce.create("page-heading-border",{marginTop:re.spacing.lg,borderColor:re.colors.border})})]}),0===n&&(null==s?void 0:s.organisation)&&Et(cs,{organisation:s.organisation}),o.length>0&&o.map(t=>Et(ps,{error:t,onDismiss:()=>c.dismissGeneralError(t.id)},t.id)),Et("div",{className:ce.create("form-card",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.lg,boxShadow:re.shadow.sm,display:"flex",flexDirection:"column",gap:re.spacing.xl,flex:"1"},{"(max-width: 950px)":{padding:re.spacing.md,gap:re.spacing.lg},"(max-width: 480px)":{padding:re.spacing.md,gap:re.spacing.md}}),children:[Et("form",{onSubmit:t=>t.preventDefault(),className:ce.create("form-fields-container",{flex:"1"}),children:Et("div",{className:ce.create("form-content-page",{display:"grid",gap:re.spacing.md,rowGap:re.spacing.lg,gridTemplateColumns:"repeat(12, 1fr)"}),children:l.fields.map(t=>{const n=t.code||t.id;return(t=>{if(!t.visibility)return!0;const n=xs(m,{condition_type:t.visibility.condition_type,conditions:t.visibility.conditions}),r="show"===t.visibility.action?n.matched:!n.matched;return u.current.get(t.id)!==r&&(e((t.label,t.code)),e(),u.current.set(t.id,r)),r})(t)?Et(ms,{field:t,errors:i,children:Et(os,{value:d(n,t).toString(),onChange:e=>{let r=e;"boolean"!==t.type&&"checkbox"!==t.type||(r="true"===e),c.updateFieldValue(l.id,n,r)},answer:f(n),onAnswerChange:t=>{c.updateFieldAnswer(l.id,n,t)},id:n,name:n,type:t.type,placeholder:t.placeholder,validation:t.validation,booleanConfig:t.boolean_config,hasError:c.hasFieldErrors(n),errors:c.getFieldErrors(n)})},t.id):null})})}),Et("hr",{className:ce.create("form-navigation-border",{borderColor:re.colors.border})}),Et("div",{className:ce.create("form-navigation-inline",{paddingTop:re.spacing.lg,display:"flex",alignItems:"center",justifyContent:0===n?"flex-end":"space-between"}),children:[n>0&&Et(Fo,{onClick:()=>c.navigateToPreviousPage(),variant:"outline",disabled:a,children:"Go back"}),Et(Fo,{onClick:async function(){c.validateCurrentPage().length>0||(n===r-1?await c.calculateQuote():await c.navigateToNextPage())},disabled:a,loading:a,children:n===r-1?"Get Quote":"Continue"})]})]})]}),Et("div",{className:ce.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Et(ss,{pages:t.pages,currentPageIndex:n,completedPages:y})})]})})]})})}function $s(){var t,e,n;const{quoteIntent:r,fsm:i}=we(t=>({quoteIntent:t.getQuoteIntent(),fsm:t})),o=null==r?void 0:r.payment_return,s=null==o?void 0:o.paymentTransactionId,a=null==o?void 0:o.transactionStatus,c=null===(t=null==r?void 0:r.organisation)||void 0===t?void 0:t.name,l=null===(e=null==r?void 0:r.organisation)||void 0===e?void 0:e.admin_email,u=null===(n=null==r?void 0:r.organisation)||void 0===n?void 0:n.phone,d=l||u;Bt(()=>{if(s&&r){const t=null==o?void 0:o.paymentStatus,e=null==a?void 0:a.amount;"success"===t&&a?xt(r,s,e||0,a.gateway_code,e,void 0):t&&["declined","cancelled","error"].includes(t)&&kt(r,s,e,null==a?void 0:a.gateway_code,t,null==a?void 0:a.status)}const t=setTimeout(()=>{i.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(t)},[i,s,o,r]);const h=ce.create("success-card",{backgroundColor:re.colors.card,borderRadius:re.radius.large,padding:re.spacing.xl,boxShadow:re.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:re.spacing.lg},"(max-width: 480px)":{padding:re.spacing.md}}),f=ce.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:re.spacing.lg}),m=ce.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=ce.create("success-header",{textAlign:"center",marginBottom:re.spacing.xl}),g=ce.create("success-title",{margin:"0",marginBottom:re.spacing.sm,fontSize:"2rem",fontWeight:"700",color:re.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=ce.create("success-message",{fontSize:re.fontSize.default,lineHeight:"1.6",color:re.colors.foreground,opacity:"0.9",margin:"0"}),v=ce.create("success-contact-section",{borderTop:`1px solid ${re.colors.border}`,paddingTop:re.spacing.xl,marginTop:re.spacing.xl}),w=ce.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:re.colors.foreground,marginBottom:re.spacing.md,textAlign:"center"}),b=ce.create("success-contact-details",{backgroundColor:re.colors.accent,borderRadius:re.radius.default,padding:re.spacing.md,display:"flex",flexDirection:"column",gap:re.spacing.sm,marginBottom:re.spacing.lg}),x=ce.create("success-contact-item",{display:"flex",alignItems:"center",gap:re.spacing.sm,fontSize:re.fontSize.small,color:re.colors.accentForeground}),k=ce.create("success-actions",{display:"flex",gap:re.spacing.md,flexWrap:"wrap",justifyContent:"center"}),S=ce.create("success-reference",{fontSize:re.fontSize.small,color:re.colors.mutedForeground,textAlign:"center",marginTop:re.spacing.md});return Et(jo,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Et(ge,{children:Et(Ao,{children:Et("div",{className:h,children:[Et("div",{className:f,children:Et("div",{className:m,children:Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M20 6 9 17l-5-5"})})})}),Et("div",{className:p,children:[Et("h1",{className:g,children:"Payment Complete!"}),Et("p",{className:y,children:["Your payment has been processed successfully and your policy is being set up. You will receive your policy documentation by email."," ","For now, you can relax knowing you're ",c?`covered by ${c}`:"covered","."]})]}),d&&Et("div",{className:v,children:[Et("h3",{className:w,children:"Need assistance?"}),Et("div",{className:b,children:[l&&Et("div",{className:x,children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Et("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Et("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Et("span",{children:l})]}),u&&Et("div",{className:x,children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:Et("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),Et("span",{children:u})]})]}),Et("div",{className:k,children:[u&&Et(Fo,{variant:"outline",onClick:()=>window.open(`tel:${u}`),children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:Et("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),"Call Us"]}),l&&Et(Fo,{variant:"outline",onClick:()=>window.open(`mailto:${l}`),children:[Et("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{marginRight:"0.5rem"},children:[Et("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Et("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),Et("div",{className:S,children:["Quote Reference: ",Et("strong",{children:r.id.slice(0,8).toUpperCase()})]})]})]})})})})}function Ns(){const{isCalculating:t,results:e,quoteIntent:n}=we(t=>({isCalculating:t.getIsCalculating(),results:t.getCalculationResult(),quoteIntent:t.getQuoteIntent()})),r="paid"===(null==n?void 0:n.status)||"completed"===(null==n?void 0:n.status);return t?Et(zo,{message:"Processing your quote, please wait..."}):r?Et($s,{}):e?Et(rs,{results:e}):Et(_s,{})}function Es(t){return Et(ve,{...t,children:Et(Ns,{})})}class Ts extends _{constructor(t){super(t),this.state={hasError:!1}}componentDidCatch(t,n){e();try{Promise.resolve().then(function(){return hd}).then(({captureException:e,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),e(t,{componentStack:n.componentStack}))}).catch(()=>{})}catch(t){}const r=it("initialization",t,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const t=this.state.error;return ut(t)?Et(Wo,{message:t.message}):Et(Lo,{error:t})}return this.props.children}}function Cs({config:t,initializeFormContext:n}){const[r,i]=qt({type:"loading",message:"Loading application..."});return Bt(()=>{(async()=>{try{e();const r=await n(t);if(!r.formStateManager||"function"!=typeof r.formStateManager.getFormProgress)throw new Error("FormStateManager was not properly initialized");e(),i({type:"success",formContextProps:r})}catch(t){let n;e(),n=t&&"object"==typeof t&&"type"in t&&"MAINTENANCE_ERROR"===t.type||t&&"object"==typeof t&&"statusCode"in t&&503===t.statusCode||t&&"object"==typeof t&&"status"in t&&503===t.status?it("maintenance",t):it("initialization",t),e((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}})()},[t,n]),Et(Ts,{children:Et("div",{className:ce.create("root",{fontFamily:re.fontFamily,backgroundColor:re.colors.background,minHeight:"100vh",color:re.colors.foreground}),children:function(){switch(r.type){case"loading":return Et(zo,{message:r.message});case"error":return ut(r.error)?Et(Wo,{message:r.error.message}):Et(Lo,{error:r.error});case"success":return Et(Es,{...r.formContextProps});default:return Et(Lo,{})}}()})})}class Is{static async loadTheme(t){try{if(e(t.slug),e(t.theme_url),this.loadedThemes.has(t.slug))return void e(t.slug);const n=await fetch(t.theme_url,{method:"GET",headers:{Accept:"text/css"}});if(!n.ok)throw new Error(`Failed to load theme: ${n.status} ${n.statusText}`);const r=await n.text();e(r.substring(0,200));const i=this.parseCSSContent(r);e(i.mappedVariables),e(i.classRules.length),this.applyParsedTheme(t.slug,i),this.loadedThemes.add(t.slug),e(t.slug)}catch(n){throw e(t.slug),n}}static parseCSSContent(t){e();const n={},r={};let i="";const o=t.match(/:root\s*\{([^}]+)\}/);if(o){const t=o[1];e(null==t||t.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(t));){const t=`--${s[1]}`,i=s[2].trim();n[t]=i;const o=this.variableMapping[t];o?(r[o]=i,e()):e()}}else e();return i=t.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&e(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(t,n){e(),Promise.resolve().then(function(){return le}).then(({updateBaseVariables:t})=>{Object.keys(n.mappedVariables).length>0&&(e(n.mappedVariables),t(n.mappedVariables))}).catch(()=>{e()}),n.classRules&&this.applyClassRules(t,n.classRules),this.injectOriginalCSS(t,n)}static applyClassRules(t,n){const r=document.getElementById(`insure-os-theme-classes-${t}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static injectOriginalCSS(t,n){const r=document.getElementById(`insure-os-theme-original-${t}`);r&&r.remove();const i={};for(const[t,e]of Object.entries(n.variables))this.variableMapping[t]||(i[t]=e);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([t,e])=>` ${t}: ${e};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${t}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),e()}}static removeTheme(t){let n=!1;[`insure-os-theme-classes-${t}`,`insure-os-theme-original-${t}`].forEach(t=>{const e=document.getElementById(t);e&&(e.remove(),n=!0)}),n&&(this.loadedThemes.delete(t),e())}static isThemeLoaded(t){return this.loadedThemes.has(t)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}Is.loadedThemes=new Set,Is.variableMapping={"--color-primary":"--insure-os-primary","--color-primary-foreground":"--insure-os-primary-foreground","--color-secondary":"--insure-os-secondary","--color-secondary-foreground":"--insure-os-secondary-foreground","--color-accent":"--insure-os-accent","--color-accent-foreground":"--insure-os-accent-foreground","--color-background":"--insure-os-background","--color-foreground":"--insure-os-foreground","--color-card":"--insure-os-card","--color-card-foreground":"--insure-os-card-foreground","--color-popover":"--insure-os-popover","--color-popover-foreground":"--insure-os-popover-foreground","--color-muted":"--insure-os-muted","--color-muted-foreground":"--insure-os-muted-foreground","--color-destructive":"--insure-os-destructive","--color-border":"--insure-os-border","--color-input":"--insure-os-input","--color-ring":"--insure-os-ring","--font-sans":"--insure-os-font-family","--radius":"--insure-os-radius","--radius-sm":"--insure-os-radius-sm","--radius-lg":"--insure-os-radius-lg"};const Ms="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Ds=globalThis,Os="10.17.0";function Ps(){return Rs(Ds),Ds}function Rs(t){const e=t.st=t.st||{};return e.version=e.version||Os,e[Os]=e[Os]||{}}function js(t,e,n=Ds){const r=n.st=n.st||{},i=r[Os]=r[Os]||{};return i[t]||(i[t]=e())}const As=["debug","info","warn","error","log","assert","trace"],zs={};function Fs(t){if(!("console"in Ds))return t();const e=Ds.console,n={},r=Object.keys(zs);r.forEach(t=>{const r=zs[t];n[t]=e[t],e[t]=r});try{return t()}finally{r.forEach(t=>{e[t]=n[t]})}}function Ls(){return qs().enabled}function Ws(t,...e){Ms&&Ls()&&Fs(()=>{Ds.console[t](`Sentry Logger [${t}]:`,...e)})}function qs(){return Ms?js("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Bs=function(){qs().enabled=!0},Hs=function(...t){Ws("log",...t)},Us=function(...t){Ws("warn",...t)},Zs=function(...t){Ws("error",...t)},Gs="?",Ys=/\(error: (.*)\)/,Js=/captureMessage|captureException/;function Vs(...t){const e=t.sort((t,e)=>t[0]-e[0]).map(t=>t[1]);return(t,n=0,r=0)=>{const i=[],o=t.split("\n");for(let t=n;t<o.length;t++){let n=o[t];n.length>1024&&(n=n.slice(0,1024));const s=Ys.test(n)?n.replace(Ys,"$1"):n;if(!s.match(/\S*Error: /)){for(const t of e){const e=t(s);if(e){i.push(e);break}}if(i.length>=50+r)break}}return function(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Qs(e).function||"")&&e.pop(),e.reverse(),Js.test(Qs(e).function||"")&&(e.pop(),Js.test(Qs(e).function||"")&&e.pop()),e.slice(0,50).map(t=>({...t,filename:t.filename||Qs(e).filename,function:t.function||Gs}))}(i.slice(r))}}function Qs(t){return t[t.length-1]||{}}const Xs="<anonymous>";function Ks(t){try{return t&&"function"==typeof t&&t.name||Xs}catch{return Xs}}function ta(t){const e=t.exception;if(e){const t=[];try{return e.values.forEach(e=>{e.stacktrace.frames&&t.push(...e.stacktrace.frames)}),t}catch{return}}}const ea={},na={};function ra(t,e){ea[t]=ea[t]||[],ea[t].push(e)}function ia(t,e){if(!na[t]){na[t]=!0;try{e()}catch(e){Ms&&Zs(`Error while instrumenting ${t}`,e)}}}function oa(t,e){const n=t&&ea[t];if(n)for(const r of n)try{r(e)}catch(e){Ms&&Zs(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${Ks(r)}\nError:`,e)}}let sa=null;function aa(){sa=Ds.onerror,Ds.onerror=function(t,e,n,r,i){return oa("error",{column:r,error:i,line:n,msg:t,url:e}),!!sa&&sa.apply(this,arguments)},Ds.onerror.ct=!0}let ca=null;function la(){ca=Ds.onunhandledrejection,Ds.onunhandledrejection=function(t){return oa("unhandledrejection",t),!ca||ca.apply(this,arguments)},Ds.onunhandledrejection.ct=!0}const ua={}.toString;function da(t){switch(ua.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return xa(t,Error)}}function ha(t,e){return ua.call(t)===`[object ${e}]`}function fa(t){return ha(t,"ErrorEvent")}function ma(t){return ha(t,"DOMError")}function pa(t){return ha(t,"String")}function ga(t){return"object"==typeof t&&null!==t&&"lt"in t&&"ut"in t}function ya(t){return null===t||ga(t)||"object"!=typeof t&&"function"!=typeof t}function va(t){return ha(t,"Object")}function wa(t){return"undefined"!=typeof Event&&xa(t,Event)}function ba(t){return Boolean(t?.then&&"function"==typeof t.then)}function xa(t,e){try{return t instanceof e}catch{return!1}}function ka(t){return!("object"!=typeof t||null===t||!t.ht&&!t.ft)}const Sa=Ds;function _a(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let o=0,s=0;const a=" > ",c=a.length;let l;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||80;for(;n&&o++<r&&(l=$a(n,u),!("html"===l||o>1&&s+i.length*c+l.length>=d));)i.push(l),s+=l.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function $a(t,e){const n=t,r=[];if(!n?.tagName)return"";if(Sa.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e?.length?e.filter(t=>n.getAttribute(t)).map(t=>[t,n.getAttribute(t)]):null;if(i?.length)i.forEach(t=>{r.push(`[${t[0]}="${t[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const t=n.className;if(t&&pa(t)){const e=t.split(/\s+/);for(const t of e)r.push(`.${t}`)}}const o=["aria-label","type","name","title","alt"];for(const t of o){const e=n.getAttribute(t);e&&r.push(`[${t}="${e}"]`)}return r.join("")}function Na(){try{return Sa.document.location.href}catch{return""}}function Ea(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.slice(0,e)}...`}function Ta(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{ka(r)?n.push("[VueViewModel]"):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function Ca(t,e,n=!1){return!!pa(t)&&(ha(e,"RegExp")?e.test(t):!!pa(e)&&(n?t===e:t.includes(e)))}function Ia(t,e=[],n=!1){return e.some(e=>Ca(t,e,n))}function Ma(t,e,n){if(!(e in t))return;const r=t[e];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Oa(i,r);try{t[e]=i}catch{Ms&&Hs(`Failed to replace method "${e}" in object`,t)}}function Da(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Ms&&Hs(`Failed to add non-enumerable property "${e}" to object`,t)}}function Oa(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Da(t,"__sentry_original__",e)}catch{}}function Pa(t){return t.gt}function Ra(t){if(da(t))return{message:t.message,name:t.name,stack:t.stack,...Aa(t)};if(wa(t)){const e={type:t.type,target:ja(t.target),currentTarget:ja(t.currentTarget),...Aa(t)};return"undefined"!=typeof CustomEvent&&xa(t,CustomEvent)&&(e.detail=t.detail),e}return t}function ja(t){try{return"undefined"!=typeof Element&&xa(t,Element)?_a(t):{}.toString.call(t)}catch{return"<unknown>"}}function Aa(t){if("object"==typeof t&&null!==t){const e={};for(const n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function za(t=function(){const t=Ds;return t.crypto||t.msCrypto}()){let e=()=>16*Math.random();try{if(t?.randomUUID)return t.randomUUID().replace(/-/g,"");t?.getRandomValues&&(e=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,t=>(t^(15&e())>>t/4).toString(16))}function Fa(t){return t.exception?.values?.[0]}function La(t){const{message:e,event_id:n}=t;if(e)return e;const r=Fa(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Wa(t,e){const n=t.exception=t.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function qa(t,e){const n=Fa(t);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){const t={...r?.data,...e.data};n.mechanism.data=t}}function Ba(t){if(function(t){try{return t.yt}catch{}}(t))return!0;try{Da(t,"__sentry_captured__",!0)}catch{}return!1}function Ha(){return Date.now()/1e3}let Ua;function Za(){return(Ua??(Ua=function(){const{performance:t}=Ds;if(!t?.now||!t.timeOrigin)return Ha;const e=t.timeOrigin;return()=>(e+t.now())/1e3}()))()}function Ga(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Za(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:za()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Ya(t,e,n=2){if(!e||"object"!=typeof e||n<=0)return e;if(t&&0===Object.keys(e).length)return t;const r={...t};for(const t in e)({}).hasOwnProperty.call(e,t)&&(r[t]=Ya(r[t],e[t],n-1));return r}function Ja(){return za()}function Va(){return za().substring(16)}const Qa="_sentrySpan";function Xa(t,e){e?Da(t,Qa,e):delete t[Qa]}function Ka(t){return t[Qa]}class tc{constructor(){this.vt=!1,this.wt=[],this.bt=[],this.xt=[],this.kt=[],this.St={},this._t={},this.$t={},this.Nt={},this.Et={},this.Tt={traceId:Ja(),sampleRand:Math.random()}}clone(){const t=new tc;return t.xt=[...this.xt],t._t={...this._t},t.$t={...this.$t},t.Nt={...this.Nt},this.Nt.flags&&(t.Nt.flags={values:[...this.Nt.flags.values]}),t.St=this.St,t.Ct=this.Ct,t.It=this.It,t.Mt=this.Mt,t.Dt=this.Dt,t.bt=[...this.bt],t.kt=[...this.kt],t.Et={...this.Et},t.Tt={...this.Tt},t.Ot=this.Ot,t.Pt=this.Pt,Xa(t,Ka(this)),t}setClient(t){this.Ot=t}setLastEventId(t){this.Pt=t}getClient(){return this.Ot}lastEventId(){return this.Pt}addScopeListener(t){this.wt.push(t)}addEventProcessor(t){return this.bt.push(t),this}setUser(t){return this.St=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.It&&Ga(this.It,{user:t}),this.Rt(),this}getUser(){return this.St}setTags(t){return this._t={...this._t,...t},this.Rt(),this}setTag(t,e){return this._t={...this._t,[t]:e},this.Rt(),this}setExtras(t){return this.$t={...this.$t,...t},this.Rt(),this}setExtra(t,e){return this.$t={...this.$t,[t]:e},this.Rt(),this}setFingerprint(t){return this.Dt=t,this.Rt(),this}setLevel(t){return this.Ct=t,this.Rt(),this}setTransactionName(t){return this.Mt=t,this.Rt(),this}setContext(t,e){return null===e?delete this.Nt[t]:this.Nt[t]=e,this.Rt(),this}setSession(t){return t?this.It=t:delete this.It,this.Rt(),this}getSession(){return this.It}update(t){if(!t)return this;const e="function"==typeof t?t(this):t,n=e instanceof tc?e.getScopeData():va(e)?t:void 0,{tags:r,extra:i,user:o,contexts:s,level:a,fingerprint:c=[],propagationContext:l}=n||{};return this._t={...this._t,...r},this.$t={...this.$t,...i},this.Nt={...this.Nt,...s},o&&Object.keys(o).length&&(this.St=o),a&&(this.Ct=a),c.length&&(this.Dt=c),l&&(this.Tt=l),this}clear(){return this.xt=[],this._t={},this.$t={},this.St={},this.Nt={},this.Ct=void 0,this.Mt=void 0,this.Dt=void 0,this.It=void 0,Xa(this,void 0),this.kt=[],this.setPropagationContext({traceId:Ja(),sampleRand:Math.random()}),this.Rt(),this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:Ha(),...t,message:t.message?Ea(t.message,2048):t.message};return this.xt.push(r),this.xt.length>n&&(this.xt=this.xt.slice(-n),this.Ot?.recordDroppedEvent("buffer_overflow","log_item")),this.Rt(),this}getLastBreadcrumb(){return this.xt[this.xt.length-1]}clearBreadcrumbs(){return this.xt=[],this.Rt(),this}addAttachment(t){return this.kt.push(t),this}clearAttachments(){return this.kt=[],this}getScopeData(){return{breadcrumbs:this.xt,attachments:this.kt,contexts:this.Nt,tags:this._t,extra:this.$t,user:this.St,level:this.Ct,fingerprint:this.Dt||[],eventProcessors:this.bt,propagationContext:this.Tt,sdkProcessingMetadata:this.Et,transactionName:this.Mt,span:Ka(this)}}setSDKProcessingMetadata(t){return this.Et=Ya(this.Et,t,2),this}setPropagationContext(t){return this.Tt=t,this}getPropagationContext(){return this.Tt}captureException(t,e){const n=e?.event_id||za();if(!this.Ot)return Ms&&Us("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ot.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},this),n}captureMessage(t,e,n){const r=n?.event_id||za();if(!this.Ot)return Ms&&Us("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this.Ot.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},this),r}captureEvent(t,e){const n=e?.event_id||za();return this.Ot?(this.Ot.captureEvent(t,{...e,event_id:n},this),n):(Ms&&Us("No client configured on scope - will not capture event!"),n)}Rt(){this.vt||(this.vt=!0,this.wt.forEach(t=>{t(this)}),this.vt=!1)}}class ec{constructor(t,e){let n,r;n=t||new tc,r=e||new tc,this.jt=[{scope:n}],this.At=r}withScope(t){const e=this.zt();let n;try{n=t(e)}catch(t){throw this.Ft(),t}return ba(n)?n.then(t=>(this.Ft(),t),t=>{throw this.Ft(),t}):(this.Ft(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.At}getStackTop(){return this.jt[this.jt.length-1]}zt(){const t=this.getScope().clone();return this.jt.push({client:this.getClient(),scope:t}),t}Ft(){return!(this.jt.length<=1||!this.jt.pop())}}function nc(){const t=Rs(Ps());return t.stack=t.stack||new ec(js("defaultCurrentScope",()=>new tc),js("defaultIsolationScope",()=>new tc))}function rc(t){return nc().withScope(t)}function ic(t,e){const n=nc();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function oc(t){return nc().withScope(()=>t(nc().getIsolationScope()))}function sc(t){const e=Rs(t);return e.acs?e.acs:{withIsolationScope:oc,withScope:rc,withSetScope:ic,withSetIsolationScope:(t,e)=>oc(e),getCurrentScope:()=>nc().getScope(),getIsolationScope:()=>nc().getIsolationScope()}}function ac(){return sc(Ps()).getCurrentScope()}function cc(){return sc(Ps()).getIsolationScope()}function lc(...t){const e=sc(Ps());if(2===t.length){const[n,r]=t;return n?e.withSetScope(n,r):e.withScope(r)}return e.withScope(t[0])}function uc(){return ac().getClient()}function dc(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,o={trace_id:n,span_id:i||Va()};return r&&(o.parent_span_id=r),o}const hc="sentry.profile_id",fc="sentry.exclusive_time";function mc(t){if(t){if("object"==typeof t&&"deref"in t&&"function"==typeof t.deref)try{return t.deref()}catch{return}return t}}function pc(t){const e=t;return{scope:e.Lt,isolationScope:mc(e.Wt)}}const gc=/^sentry-/;function yc(t){return t.split(",").map(t=>t.split("=").map(t=>{try{return decodeURIComponent(t.trim())}catch{return}})).reduce((t,[e,n])=>(e&&n&&(t[e]=n),t),{})}const vc=/^o(\d+)\./,wc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function bc(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function xc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function kc(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=function(t){const e=t.match(vc);return e?.[1]}(n)),r}let Sc=!1;function _c(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:Tc(t).parent_span_id,o=pc(t).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||Va():e,trace_id:n}}function $c(t){return t&&t.length>0?t.map(({context:{spanId:t,traceId:e,traceFlags:n,...r},attributes:i})=>({span_id:t,trace_id:e,sampled:1===n,attributes:i,...r})):void 0}function Nc(t){return"number"==typeof t?Ec(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Ec(t.getTime()):Za()}function Ec(t){return t>9999999999?t/1e3:t}function Tc(t){if(function(t){return"function"==typeof t.getSpanJSON}(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(function(t){const e=t;return!!(e.attributes&&e.startTime&&e.name&&e.endTime&&e.status)}(t)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:c}=t;return{span_id:e,trace_id:n,data:r,description:o,parent_span_id:"parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?t.parentSpanContext?.spanId:void 0,start_timestamp:Nc(i),timestamp:Nc(s)||void 0,status:Cc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:$c(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function Cc(t){if(t&&0!==t.code)return 1===t.code?"ok":t.message||"unknown_error"}function Ic(t){return t.qt||t}function Mc(){Sc||(Fs(()=>{}),Sc=!0)}function Dc(t){Hs(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Oc(t,e){if(!e?.length||!t.description)return!1;for(const n of e){if(Rc(n)){if(Ca(t.description,n))return Ms&&Dc(t),!0;continue}if(!n.name&&!n.op)continue;const e=!n.name||Ca(t.description,n.name),r=!n.op||t.op&&Ca(t.op,n.op);if(e&&r)return Ms&&Dc(t),!0}return!1}function Pc(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const e of t)e.parent_span_id===r&&(e.parent_span_id=n)}function Rc(t){return"string"==typeof t||t instanceof RegExp}const jc="production";function Ac(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||jc,release:n.release,public_key:r,trace_id:t,org_id:kc(e)};return e.emit("createDsc",i),i}function zc(t){const e=uc();if(!e)return{};const n=Ic(t),r=Tc(n),i=r.data,o=n.spanContext().traceState,s=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function a(t){return"number"!=typeof s&&"string"!=typeof s||(t.sample_rate=`${s}`),t}const c=n.Bt;if(c)return a(c);const l=o?.get("sentry.dsc"),u=l&&function(t){const e=function(t){if(t&&(pa(t)||Array.isArray(t)))return Array.isArray(t)?t.reduce((t,e)=>{const n=yc(e);return Object.entries(n).forEach(([e,n])=>{t[e]=n}),t},{}):yc(t)}(t);if(!e)return;const n=Object.entries(e).reduce((t,[e,n])=>(e.match(gc)&&(t[e.slice(7)]=n),t),{});return Object.keys(n).length>0?n:void 0}(l);if(u)return a(u);const d=Ac(t.spanContext().traceId,e),h=i["sentry.source"],f=r.description;return"url"!==h&&f&&(d.transaction=f),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=uc()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}()&&(d.sampled=String(function(t){const{traceFlags:e}=t.spanContext();return 1===e}(n)),d.sample_rand=o?.get("sentry.sample_rand")??pc(n).scope?.getPropagationContext().sampleRand.toString()),a(d),e.emit("createDsc",d,n),d}function Fc(t,e=100,n=1/0){try{return Wc("",t,e,n)}catch(t){return{ERROR:`**non-serializable** (${t})`}}}function Lc(t,e=3,n=102400){const r=Fc(t,e);return i=r,function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(i))>n?Lc(t,e-1,n):r;var i}function Wc(t,e,n=1/0,r=1/0,i=function(){const t=new WeakSet;return[function(e){return!!t.has(e)||(t.add(e),!1)},function(e){t.delete(e)}]}()){const[o,s]=i;if(null==e||["boolean","string"].includes(typeof e)||"number"==typeof e&&Number.isFinite(e))return e;const a=function(t,e){try{if("domain"===t&&e&&"object"==typeof e&&e.Ht)return"[Domain]";if("domainEmitter"===t)return"[DomainEmitter]";if("undefined"!=typeof global&&e===global)return"[Global]";if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(ka(e))return"[VueViewModel]";if(va(n=e)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof e&&!Number.isFinite(e))return`[${e}]`;if("function"==typeof e)return`[Function: ${Ks(e)}]`;if("symbol"==typeof e)return`[${String(e)}]`;if("bigint"==typeof e)return`[BigInt: ${String(e)}]`;const r=function(t){const e=Object.getPrototypeOf(t);return e?.constructor?e.constructor.name:"null prototype"}(e);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(t){return`**non-serializable** (${t})`}var n}(t,e);if(!a.startsWith("[object "))return a;if(e.Ut)return e;const c="number"==typeof e.Zt?e.Zt:n;if(0===c)return a.replace("object ","");if(o(e))return"[Circular ~]";const l=e;if(l&&"function"==typeof l.toJSON)try{return Wc("",l.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const h=Ra(e);for(const t in h){if(!{}.hasOwnProperty.call(h,t))continue;if(d>=r){u[t]="[MaxProperties ~]";break}const e=h[t];u[t]=Wc(t,e,c-1,r,i),d++}return s(e),u}function qc(t,e=[]){return[t,e]}function Bc(t,e){const[n,r]=t;return[n,[...r,e]]}function Hc(t,e){const n=t[1];for(const t of n)if(e(t,t[0].type))return!0;return!1}function Uc(t){const e=Rs(Ds);return e.encodePolyfill?e.encodePolyfill(t):(new TextEncoder).encode(t)}function Zc(t){const[e,n]=t;let r=JSON.stringify(e);function i(t){"string"==typeof r?r="string"==typeof t?r+t:[Uc(r),t]:r.push("string"==typeof t?Uc(t):t)}for(const t of n){const[e,n]=t;if(i(`\n${JSON.stringify(e)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let t;try{t=JSON.stringify(n)}catch{t=JSON.stringify(Fc(n))}i(t)}}return"string"==typeof r?r:function(t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(r)}function Gc(t){const e="string"==typeof t.data?Uc(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const Yc={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item"};function Jc(t){return Yc[t]}function Vc(t){if(!t?.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Qc(t){return new Kc(e=>{e(t)})}function Xc(t){return new Kc((e,n)=>{n(t)})}class Kc{constructor(t){this.Gt=0,this.Yt=[],this.Jt(t)}then(t,e){return new Kc((n,r)=>{this.Yt.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this.Vt()})}catch(t){return this.then(t=>t,t)}finally(t){return new Kc((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{i?n(r):e(r)})})}Vt(){if(0===this.Gt)return;const t=this.Yt.slice();this.Yt=[],t.forEach(t=>{t[0]||(1===this.Gt&&t[1](this.Qt),2===this.Gt&&t[2](this.Qt),t[0]=!0)})}Jt(t){const e=(t,e)=>{0===this.Gt&&(ba(e)?e.then(n,r):(this.Gt=t,this.Qt=e,this.Vt()))},n=t=>{e(1,t)},r=t=>{e(2,t)};try{t(n,r)}catch(t){r(t)}}}function tl(t,e,n,r=0){try{const i=el(e,n,t,r);return ba(i)?i:Qc(i)}catch(t){return Xc(t)}}function el(t,e,n,r){const i=n[r];if(!t||!i)return t;const o=i({...t},e);return Ms&&null===o&&Hs(`Event processor "${i.id||"?"}" dropped event`),ba(o)?o.then(t=>el(t,e,n,r+1)):el(o,e,n,r+1)}function nl(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:m}=e;rl(t,"extra",n),rl(t,"tags",r),rl(t,"user",i),rl(t,"contexts",o),t.sdkProcessingMetadata=Ya(t.sdkProcessingMetadata,a,2),s&&(t.level=s),f&&(t.transactionName=f),m&&(t.span=m),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),u.length&&(t.eventProcessors=[...t.eventProcessors,...u]),d.length&&(t.attachments=[...t.attachments,...d]),t.propagationContext={...t.propagationContext,...h}}function rl(t,e,n){t[e]=Ya(t[e],n,1)}let il,ol,sl;function al(t,e,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||za(),timestamp:e.timestamp||Ha()},l=n.integrations||t.integrations.map(t=>t.name);!function(t,e){const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;t.environment=t.environment||n||jc,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i);const s=t.request;s?.url&&(s.url=Ea(s.url,o))}(c,t),function(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}(c,l),i&&i.emit("applyFrameMetadata",e),void 0===e.type&&function(t,e){const n=function(t){const e=Ds.Xt;if(!e)return{};const n=Object.keys(e);return sl&&n.length===ol||(ol=n.length,sl=n.reduce((n,r)=>{il||(il={});const i=il[r];if(i)n[i[0]]=i[1];else{const i=t(r);for(let t=i.length-1;t>=0;t--){const o=i[t],s=o?.filename,a=e[r];if(s&&a){n[s]=a,il[r]=[s,a];break}}}return n},{})),sl}(e);t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.filename&&(t.debug_id=n[t.filename])})})}(c,t.stackParser);const u=function(t,e){if(!e)return t;const n=t?t.clone():new tc;return n.update(e),n}(r,n.captureContext);n.mechanism&&qa(c,n.mechanism);const d=i?i.getEventProcessors():[],h=js("globalScope",()=>new tc).getScopeData();o&&nl(h,o.getScopeData()),u&&nl(h,u.getScopeData());const f=[...n.attachments||[],...h.attachments];return f.length&&(n.attachments=f),function(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=e;!function(t,e){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(o).length&&(t.contexts={...o,...t.contexts}),s&&(t.level=s),a&&"transaction"!==t.type&&(t.transaction=a)}(t,e),r&&function(t,e){t.contexts={trace:_c(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:zc(e),...t.sdkProcessingMetadata};const n=Tc(Ic(e)).description;n&&!t.transaction&&"transaction"===t.type&&(t.transaction=n)}(t,r),function(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}(t,n),function(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}(t,i),function(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}(t,o)}(c,h),tl([...d,...h.eventProcessors],c,n).then(t=>(t&&function(t){const e={};if(t.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(t=>{t.debug_id&&(t.abs_path?e[t.abs_path]=t.debug_id:t.filename&&(e[t.filename]=t.debug_id),delete t.debug_id)})}),0===Object.keys(e).length)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([t,e])=>{n.push({type:"sourcemap",code_file:t,debug_id:e})})}(t),"number"==typeof s&&s>0?function(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>({...t,...t.data&&{data:Fc(t.data,e,n)}}))},...t.user&&{user:Fc(t.user,e,n)},...t.contexts&&{contexts:Fc(t.contexts,e,n)},...t.extra&&{extra:Fc(t.extra,e,n)}};return t.contexts?.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Fc(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(t=>({...t,...t.data&&{data:Fc(t.data,e,n)}}))),t.contexts?.flags&&r.contexts&&(r.contexts.flags=Fc(t.contexts.flags,3,n)),r}(t,s,a):t))}function cl(t){return ac().captureException(t,void 0)}function ll(t,e){const n="string"==typeof e?e:void 0,r="string"!=typeof e?{captureContext:e}:void 0;return ac().captureMessage(t,n,r)}function ul(t,e){return ac().captureEvent(t,e)}function dl(t){const e=cc(),n=ac(),{userAgent:r}=Ds.navigator||{},i=function(t){const e=Za(),n={sid:za(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return{sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}(n)};return t&&Ga(n,t),n}({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),o=e.getSession();return"ok"===o?.status&&Ga(o,{status:"exited"}),hl(),e.setSession(i),i}function hl(){const t=cc(),e=ac().getSession()||t.getSession();e&&function(t){let e={};"ok"===t.status&&(e={status:"exited"}),Ga(t,e)}(e),fl(),t.setSession()}function fl(){const t=cc(),e=uc(),n=t.getSession();n&&e&&e.captureSession(n)}function ml(t=!1){t?hl():fl()}const pl=[];function gl(t){const e=t.defaultIntegrations||[],n=t.integrations;let r;if(e.forEach(t=>{t.isDefaultInstance=!0}),Array.isArray(n))r=[...e,...n];else if("function"==typeof n){const t=n(e);r=Array.isArray(t)?t:[t]}else r=e;return function(t){const e={};return t.forEach(t=>{const{name:n}=t,r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)}),Object.values(e)}(r)}function yl(t,e){for(const n of e)n?.afterAllSetup&&n.afterAllSetup(t)}function vl(t,e,n){if(n[e.name])Ms&&Hs(`Integration skipped because it was already installed: ${e.name}`);else{if(n[e.name]=e,-1===pl.indexOf(e.name)&&"function"==typeof e.setupOnce&&(e.setupOnce(),pl.push(e.name)),e.setup&&"function"==typeof e.setup&&e.setup(t),"function"==typeof e.preprocessEvent){const n=e.preprocessEvent.bind(e);t.on("preprocessEvent",(e,r)=>n(e,r,t))}if("function"==typeof e.processEvent){const n=e.processEvent.bind(e),r=Object.assign((e,r)=>n(e,r,t),{id:e.name});t.addEventProcessor(r)}Ms&&Hs(`Integration installed: ${e.name}`)}}function wl(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n?.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}const bl="Not capturing exception because it's already been captured.",xl="Discarded session because of missing or non-string release",kl=Symbol.for("SentryInternalError"),Sl=Symbol.for("SentryDoNotSendEventError");function _l(t){return{message:t,[kl]:!0}}function $l(t){return{message:t,[Sl]:!0}}function Nl(t){return!!t&&"object"==typeof t&&kl in t}function El(t){return!!t&&"object"==typeof t&&Sl in t}class Tl{constructor(t){if(this.Kt=t,this.te={},this.ee=0,this.ne={},this.re={},this.bt=[],t.dsn?this.ie=function(t){const e="string"==typeof t?function(t){const e=wc.exec(t);if(!e)return void Fs(()=>{});const[n,r,i="",o="",s="",a=""]=e.slice(1);let c="",l=a;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const t=l.match(/^\d+/);t&&(l=t[0])}return xc({host:o,pass:i,path:c,projectId:l,port:s,protocol:n,publicKey:r})}(t):xc(t);if(e&&function(t){if(!Ms)return!0;const{port:e,projectId:n,protocol:r}=t;return!(["protocol","publicKey","host","projectId"].find(e=>!t[e]&&(Zs(`Invalid Sentry Dsn: ${e} missing`),!0))||(n.match(/^\d+$/)?function(t){return"http"===t||"https"===t}(r)?e&&isNaN(parseInt(e,10))&&(Zs(`Invalid Sentry Dsn: Invalid port ${e}`),1):(Zs(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Zs(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(e))return e}(t.dsn):Ms&&Us("No DSN provided, client will not send events."),this.ie){const i=(e=this.ie,n=t.tunnel,r=t.oe?t.oe.sdk:void 0,n||`${function(t){return`${function(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(e)}?${function(t,e){const n={sentry_version:"7"};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}(e,r)}`);this.se=t.transport({tunnel:this.Kt.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:i})}var e,n,r}captureException(t,e,n){const r=za();if(Ba(t))return Ms&&Hs(bl),r;const i={event_id:r,...e};return this.ae(this.eventFromException(t,i).then(t=>this.ce(t,i,n))),i.event_id}captureMessage(t,e,n,r){const i={event_id:za(),...n},o=ga(t)?t:String(t),s=ya(t)?this.eventFromMessage(o,e,i):this.eventFromException(t,i);return this.ae(s.then(t=>this.ce(t,i,r))),i.event_id}captureEvent(t,e,n){const r=za();if(e?.originalException&&Ba(e.originalException))return Ms&&Hs(bl),r;const i={event_id:r,...e},o=t.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope;return this.ae(this.ce(t,i,s||n,a)),i.event_id}captureSession(t){this.sendSession(t),Ga(t,{init:!1})}getDsn(){return this.ie}getOptions(){return this.Kt}getSdkMetadata(){return this.Kt.oe}getTransport(){return this.se}async flush(t){const e=this.se;if(!e)return!0;this.emit("flush");const n=await this.le(t),r=await e.flush(t);return n&&r}async close(t){const e=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),e}getEventProcessors(){return this.bt}addEventProcessor(t){this.bt.push(t)}init(){(this.ue()||this.Kt.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this.de()}getIntegrationByName(t){return this.te[t]}addIntegration(t){const e=this.te[t.name];vl(this,t,this.te),e||yl(this,[t])}sendEvent(t,e={}){this.emit("beforeSendEvent",t,e);let n=function(t,e,n,r){const i=Vc(n),o=t.type&&"replay_event"!==t.type?t.type:"event";!function(t,e){if(!e)return t;const n=t.sdk||{};t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...t.sdk?.integrations||[],...e.integrations||[]],packages:[...t.sdk?.packages||[],...e.packages||[]],settings:t.sdk?.settings||e.settings?{...t.sdk?.settings,...e.settings}:void 0}}(t,n?.sdk);const s=function(t,e,n,r){const i=t.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:bc(r)},...i&&{trace:i}}}(t,i,r,e);return delete t.sdkProcessingMetadata,qc(s,[[{type:o},t]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);for(const t of e.attachments||[])n=Bc(n,Gc(t));this.sendEnvelope(n).then(e=>this.emit("afterSendEvent",t,e))}sendSession(t){const{release:e,environment:n=jc}=this.Kt;if("aggregates"in t){const r=t.attrs||{};if(!r.release&&!e)return void(Ms&&Us(xl));r.release=r.release||e,r.environment=r.environment||n,t.attrs=r}else{if(!t.release&&!e)return void(Ms&&Us(xl));t.release=t.release||e,t.environment=t.environment||n}this.emit("beforeSendSession",t);const r=function(t,e,n,r){const i=Vc(n);return qc({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:bc(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()]])}(t,this.ie,this.Kt.oe,this.Kt.tunnel);this.sendEnvelope(r)}recordDroppedEvent(t,e,n=1){if(this.Kt.sendClientReports){const r=`${t}:${e}`;Ms&&Hs(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.ne[r]=(this.ne[r]||0)+n}}on(t,e){const n=this.re[t]=this.re[t]||new Set,r=(...t)=>e(...t);return n.add(r),()=>{n.delete(r)}}emit(t,...e){const n=this.re[t];n&&n.forEach(t=>t(...e))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this.ue()&&this.se)try{return await this.se.send(t)}catch(t){return Ms&&Zs("Error while sending envelope:",t),{}}return Ms&&Zs("Transport disabled"),{}}de(){const{integrations:t}=this.Kt;this.te=function(t,e){const n={};return e.forEach(e=>{e&&vl(t,e,n)}),n}(this,t),yl(this,t)}he(t,e){let n="fatal"===e.level,r=!1;const i=e.exception?.values;if(i){r=!0;for(const t of i){const e=t.mechanism;if(!1===e?.handled){n=!0;break}}}const o="ok"===t.status;(o&&0===t.errors||o&&n)&&(Ga(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}async le(t){let e=0;for(;!t||e<t;){if(await new Promise(t=>setTimeout(t,1)),!this.ee)return!0;e++}return!1}ue(){return!1!==this.getOptions().enabled&&void 0!==this.se}fe(t,e,n,r){const i=this.getOptions(),o=Object.keys(this.te);return!e.integrations&&o?.length&&(e.integrations=o),this.emit("preprocessEvent",t,e),t.type||r.setLastEventId(t.event_id||e.event_id),al(i,t,e,n,this,r).then(t=>{if(null===t)return t;this.emit("postprocessEvent",t,e),t.contexts={trace:dc(n),...t.contexts};const r=function(t,e){const n=e.getPropagationContext();return n.dsc||Ac(n.traceId,t)}(this,n);return t.sdkProcessingMetadata={dynamicSamplingContext:r,...t.sdkProcessingMetadata},t})}ce(t,e={},n=ac(),r=cc()){return Ms&&Cl(t)&&Hs(`Captured error event \`${wl(t)[0]||"<unknown>"}\``),this.me(t,e,n,r).then(t=>t.event_id,t=>{Ms&&(El(t)?Hs(t.message):Nl(t)?Us(t.message):Us(t))})}me(t,e,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=Il(t),a=Cl(t),c=t.type||"error",l=`before send for type \`${c}\``,u=void 0===o?void 0:function(t){if("boolean"==typeof t)return Number(t);const e="string"==typeof t?parseFloat(t):t;return"number"!=typeof e||isNaN(e)||e<0||e>1?void 0:e}(o);if(a&&"number"==typeof u&&Math.random()>u)return this.recordDroppedEvent("sample_rate","error"),Xc($l(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d="replay_event"===c?"replay":c;return this.fe(t,e,n,r).then(t=>{if(null===t)throw this.recordDroppedEvent("event_processor",d),$l("An event processor returned `null`, will not send event.");if(e.data&&!0===e.data.pe)return t;const n=function(t,e,n,r){const{beforeSend:i,beforeSendTransaction:o,beforeSendSpan:s,ignoreSpans:a}=e;let c=n;if(Cl(c)&&i)return i(c,r);if(Il(c)){if(s||a){const e=function(t){const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=t.contexts?.trace??{};return{data:s??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:o,profile_id:s?.[hc],exclusive_time:s?.[fc],measurements:t.measurements,is_segment:!0}}(c);if(a?.length&&Oc(e,a))return null;if(s){const t=s(e);t?c=Ya(n,{type:"transaction",timestamp:(l=t).timestamp,start_timestamp:l.start_timestamp,transaction:l.description,contexts:{trace:{trace_id:l.trace_id,span_id:l.span_id,parent_span_id:l.parent_span_id,op:l.op,status:l.status,origin:l.origin,data:{...l.data,...l.profile_id&&{[hc]:l.profile_id},...l.exclusive_time&&{[fc]:l.exclusive_time}}}},measurements:l.measurements}):Mc()}if(c.spans){const e=[],n=c.spans;for(const t of n)if(a?.length&&Oc(t,a))Pc(n,t);else if(s){const n=s(t);n?e.push(n):(Mc(),e.push(t))}else e.push(t);const r=c.spans.length-e.length;r&&t.recordDroppedEvent("before_send","span",r),c.spans=e}}if(o){if(c.spans){const t=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:t}}return o(c,r)}}var l;return c}(this,i,t,e);return function(t,e){const n=`${e} must return \`null\` or a valid event.`;if(ba(t))return t.then(t=>{if(!va(t)&&null!==t)throw _l(n);return t},t=>{throw _l(`${e} rejected with ${t}`)});if(!va(t)&&null!==t)throw _l(n);return t}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const e=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",e)}throw $l(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.he(o,i),s){const t=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);t>0&&this.recordDroppedEvent("before_send","span",t)}const c=i.transaction_info;if(s&&c&&i.transaction!==t.transaction){const t="custom";i.transaction_info={...c,source:t}}return this.sendEvent(i,e),i}).then(null,t=>{if(El(t)||Nl(t))throw t;throw this.captureException(t,{mechanism:{handled:!1,type:"internal"},data:{pe:!0},originalException:t}),_l(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)})}ae(t){this.ee++,t.then(t=>(this.ee--,t),t=>(this.ee--,t))}ge(){const t=this.ne;return this.ne={},Object.entries(t).map(([t,e])=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e}})}ye(){Ms&&Hs("Flushing outcomes...");const t=this.ge();if(0===t.length)return void(Ms&&Hs("No outcomes to send"));if(!this.ie)return void(Ms&&Hs("No dsn provided, will not send outcomes"));Ms&&Hs("Sending outcomes:",t);const e=(n=t,qc((r=this.Kt.tunnel&&bc(this.ie))?{dsn:r}:{},[[{type:"client_report"},{timestamp:Ha(),discarded_events:n}]]));var n,r;this.sendEnvelope(e)}}function Cl(t){return void 0===t.type}function Il(t){return"transaction"===t.type}function Ml(t){const e=function(t){return Dl().get(t)}(t)??[];if(0===e.length)return;const n=t.getOptions(),r=function(t,e,n,r){const i={};return e?.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=bc(r)),qc(i,[(o=t,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(e,n.oe,n.tunnel,t.getDsn());Dl().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(r)}function Dl(){return js("clientToLogBufferMap",()=>new WeakMap)}const Ol=Symbol.for("SentryBufferFullError");function Pl(t,e,n=function(t=100){const e=new Set;function n(t){e.delete(t)}return{get $(){return Array.from(e)},add:function(r){if(!(e.size<t))return Xc(Ol);const i=r();return e.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(t){if(!e.size)return Qc(!0);const n=Promise.allSettled(Array.from(e)).then(()=>!0);if(!t)return n;const r=[n,new Promise(e=>setTimeout(()=>e(!1),t))];return Promise.race(r)}}}(t.bufferSize||64)){let r={};return{send:function(i){const o=[];if(Hc(i,(e,n)=>{const i=Jc(n);!function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)?o.push(e):t.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=qc(i[0],o),a=e=>{Hc(s,(n,r)=>{t.recordDroppedEvent(e,Jc(r))})};return n.add(()=>e({body:Zc(s)}).then(t=>(void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&Ms&&Us(`Sentry responded with status code ${t.statusCode} to sent event.`),r=function(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const t of o.trim().split(",")){const[e,n,,,o]=t.split(":",5),s=parseInt(e,10),a=1e3*(isNaN(s)?60:s);if(n)for(const t of n.split(";"))"metric_bucket"===t&&o&&!o.split(";").includes("custom")||(i[t]=r+a);else i.all=r+a}else s?i.all=r+function(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(s,r):429===e&&(i.all=r+6e4);return i}(r,t),t),t=>{throw a("network_error"),Ms&&Zs("Encountered error running transport request:",t),t})).then(t=>t,t=>{if(t===Ol)return Ms&&Zs("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw t})},flush:t=>n.drain(t)}}function Rl(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function jl(t){"aggregates"in t?void 0===t.attrs?.ip_address&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):void 0===t.ipAddress&&(t.ipAddress="{{auto}}")}const Al=100;function zl(t,e){const n=uc(),r=cc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Al}=n.getOptions();if(o<=0)return;const s={timestamp:Ha(),...t},a=i?Fs(()=>i(s,e)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,e),r.addBreadcrumb(a,o))}let Fl;const Ll=new WeakMap,Wl=()=>({name:"FunctionToString",setupOnce(){Fl=function(){}.toString;try{Function.prototype.toString=function(...t){const e=Pa(this),n=Ll.has(uc())&&void 0!==e?e:this;return Fl.apply(n,t)}}catch{}},setup(t){Ll.set(t,!0)}}),ql=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,'can\'t redefine non-configurable property "solana"',"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],Bl=(t={})=>{let e;return{name:"EventFilters",setup(n){const r=n.getOptions();e=Ul(t,r)},processEvent(n,r,i){if(!e){const n=i.getOptions();e=Ul(t,n)}return function(t,e){if(t.type){if("transaction"===t.type&&function(t,e){if(!e?.length)return!1;const n=t.transaction;return!!n&&Ia(n,e)}(t,e.ignoreTransactions))return Ms&&Us(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${La(t)}`),!0}else{if(function(t,e){return!!e?.length&&wl(t).some(t=>Ia(t,e))}(t,e.ignoreErrors))return Ms&&Us(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${La(t)}`),!0;if(function(t){return!!t.exception?.values?.length&&(!t.message&&!t.exception.values.some(t=>t.stacktrace||t.type&&"Error"!==t.type||t.value))}(t))return Ms&&Us(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${La(t)}`),!0;if(function(t,e){if(!e?.length)return!1;const n=Zl(t);return!!n&&Ia(n,e)}(t,e.denyUrls))return Ms&&Us(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${La(t)}.\nUrl: ${Zl(t)}`),!0;if(!function(t,e){if(!e?.length)return!0;const n=Zl(t);return!n||Ia(n,e)}(t,e.allowUrls))return Ms&&Us(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${La(t)}.\nUrl: ${Zl(t)}`),!0}return!1}(n,e)?null:n}}},Hl=(t={})=>({...Bl(t),name:"InboundFilters"});function Ul(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:ql],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Zl(t){try{const e=[...t.exception?.values??[]].reverse().find(t=>void 0===t.mechanism?.parent_id&&t.stacktrace?.frames?.length),n=e?.stacktrace?.frames;return n?function(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Ms&&Zs(`Cannot extract url for event ${La(t)}`),null}}function Gl(t,e,n,r,i,o){if(!i.exception?.values||!o||!xa(o.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=Yl(t,e,r,o.originalException,n,i.exception.values,s,0))}function Yl(t,e,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(xa(r[i],Error)){Jl(s,a);const o=t(e,r[i]),l=c.length;Vl(o,i,l,a),c=Yl(t,e,n,r[i],i,[o,...c],o,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,o)=>{if(xa(r,Error)){Jl(s,a);const l=t(e,r),u=c.length;Vl(l,`errors[${o}]`,u,a),c=Yl(t,e,n,r,i,[l,...c],l,u)}}),c}function Jl(t,e){t.mechanism={handled:!0,type:"auto.core.linked_errors",...t.mechanism,..."AggregateError"===t.type&&{is_exception_group:!0},exception_id:e}}function Vl(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function Ql(){"console"in Ds&&As.forEach(function(t){t in Ds.console&&Ma(Ds.console,t,function(e){return zs[t]=e,function(...e){oa("console",{args:e,level:t});const n=zs[t];n?.apply(Ds.console,e)}})})}const Xl=()=>{let t;return{name:"Dedupe",processEvent(e){if(e.type)return e;try{if(function(t,e){return!!e&&(!!function(t,e){const n=t.message,r=e.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!tu(t,e)&&!!Kl(t,e))))}(t,e)||!!function(t,e){const n=eu(e),r=eu(t);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!tu(t,e)&&!!Kl(t,e)))}(t,e))}(e,t))return Ms&&Us("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function Kl(t,e){let n=ta(t),r=ta(e);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let t=0;t<r.length;t++){const e=r[t],i=n[t];if(e.filename!==i.filename||e.lineno!==i.lineno||e.colno!==i.colno||e.function!==i.function)return!1}return!0}function tu(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function eu(t){return t.exception?.values?.[0]}function nu(t){return void 0===t?void 0:t>=400&&t<500?"warning":t>=500?"error":void 0}const ru=Ds;function iu(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function ou(t,e){const n="fetch";ra(n,t),ia(n,()=>function(t,e=!1){e&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in ru))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}())return!1;if(iu(ru.fetch))return!0;let t=!1;const e=ru.document;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow?.fetch&&(t=iu(n.contentWindow.fetch)),e.head.removeChild(n)}catch(t){Ms&&Us("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return t}()||Ma(Ds,"fetch",function(t){return function(...e){const n=new Error,{method:r,url:i}=function(t){if(0===t.length)return{method:"GET",url:""};if(2===t.length){const[e,n]=t;return{url:au(e),method:su(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:au(e),method:su(e,"method")?String(e.method).toUpperCase():"GET"}}(e),o={args:e,fetchData:{method:r,url:i},startTimestamp:1e3*Za(),virtualError:n,headers:cu(e)};return oa("fetch",{...o}),t.apply(Ds,e).then(async t=>(oa("fetch",{...o,endTimestamp:1e3*Za(),response:t}),t),t=>{if(oa("fetch",{...o,endTimestamp:1e3*Za(),error:t}),da(t)&&void 0===t.stack&&(t.stack=n.stack,Da(t,"framesToPop",1)),t instanceof TypeError&&("Failed to fetch"===t.message||"Load failed"===t.message||"NetworkError when attempting to fetch resource."===t.message))try{const e=new URL(o.fetchData.url);t.message=`${t.message} (${e.host})`}catch{}throw t})}})}(0,e))}function su(t,e){return!!t&&"object"==typeof t&&!!t[e]}function au(t){return"string"==typeof t?t:t?su(t,"url")?t.url:t.toString?t.toString():"":""}function cu(t){const[e,n]=t;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if("undefined"!=typeof Request&&xa(e,Request))return new Headers(e.headers)}catch{}}const lu=Ds;let uu=0;function du(){return uu>0}function hu(t,e={}){if(!function(t){return"function"==typeof t}(t))return t;try{const e=t.ve;if(e)return"function"==typeof e?e:t;if(Pa(t))return t}catch{return t}const n=function(...n){try{const r=n.map(t=>hu(t,e));return t.apply(this,r)}catch(t){throw uu++,setTimeout(()=>{uu--}),lc(r=>{r.addEventProcessor(t=>(e.mechanism&&(Wa(t,void 0),qa(t,e.mechanism)),t.extra={...t.extra,arguments:n},t)),cl(t)}),t}};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(n[e]=t[e])}catch{}Oa(n,t),Da(t,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>t.name})}catch{}return n}function fu(t,e){const n=pu(t,e),r={type:vu(e),value:wu(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function mu(t,e){return{exception:{values:[fu(t,e)]}}}function pu(t,e){const n=e.stacktrace||e.stack||"",r=function(t){return t&&gu.test(t.message)?1:0}(e),i=function(t){return"number"==typeof t.framesToPop?t.framesToPop:0}(e);try{return t(n,r,i)}catch{}return[]}const gu=/Minified React error #\d+;/i;function yu(t){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&t instanceof WebAssembly.Exception}function vu(t){const e=t?.name;return!e&&yu(t)?t.message&&Array.isArray(t.message)&&2==t.message.length?t.message[0]:"WebAssembly.Exception":e}function wu(t){const e=t?.message;return yu(t)?Array.isArray(t.message)&&2==t.message.length?t.message[1]:"wasm exception":e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function bu(t,e,n,r,i){let o;if(fa(e)&&e.error)return mu(t,e.error);if(ma(e)||ha(e,"DOMException")){const i=e;if("stack"in e)o=mu(t,e);else{const e=i.name||(ma(i)?"DOMError":"DOMException"),s=i.message?`${e}: ${i.message}`:e;o=xu(t,s,n,r),Wa(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return da(e)?mu(t,e):va(e)||wa(e)?(o=function(t,e,n,r){const i=uc(),o=i?.getOptions().normalizeDepth,s=function(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}(e),a={we:Lc(e,o)};if(s)return{exception:{values:[fu(t,s)]},extra:a};const c={exception:{values:[{type:wa(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:ku(e,{isUnhandledRejection:r})}]},extra:a};if(n){const e=pu(t,n);e.length&&(c.exception.values[0].stacktrace={frames:e})}return c}(t,e,n,i),qa(o,{synthetic:!0}),o):(o=xu(t,e,n,r),Wa(o,`${e}`),qa(o,{synthetic:!0}),o)}function xu(t,e,n,r){const i={};if(r&&n){const r=pu(t,n);r.length&&(i.exception={values:[{value:e,stacktrace:{frames:r}}]}),qa(i,{synthetic:!0})}if(ga(e)){const{lt:t,ut:n}=e;return i.logentry={message:t,params:n},i}return i.message=e,i}function ku(t,{isUnhandledRejection:e}){const n=function(t,e=40){const n=Object.keys(Ra(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Ea(r,e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:Ea(r,e)}return""}(t),r=e?"promise rejection":"exception";return fa(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:wa(t)?`Event \`${function(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Su extends Tl{constructor(t){const e=(n=t,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:lu.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(t,e,n=[e],r="npm"){const i=t.oe||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(t=>({name:`${r}:@sentry/${t}`,version:Os})),version:Os}),t.oe=i}(e,"browser",["browser"],lu.SENTRY_SDK_SOURCE||"npm"),e.oe?.sdk&&(e.oe.sdk.settings={infer_ip:e.sendDefaultPii?"auto":"never",...e.oe.sdk.settings}),super(e);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o}=this.Kt;lu.document&&(i||o)&&lu.document.addEventListener("visibilitychange",()=>{"hidden"===lu.document.visibilityState&&(i&&this.ye(),o&&Ml(this))}),o&&(this.on("flush",()=>{Ml(this)}),this.on("afterCaptureLog",()=>{this.be&&clearTimeout(this.be),this.be=setTimeout(()=>{Ml(this)},5e3)})),r&&this.on("beforeSendSession",jl)}eventFromException(t,e){return function(t,e,n,r){const i=bu(t,e,n?.syntheticException||void 0,r);return qa(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),Qc(i)}(this.Kt.stackParser,t,e,this.Kt.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){const o=xu(t,e,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),Qc(o)}(this.Kt.stackParser,t,e,n,this.Kt.attachStacktrace)}fe(t,e,n,r){return t.platform=t.platform||"javascript",super.fe(t,e,n,r)}}const _u="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,$u=Ds;let Nu,Eu,Tu,Cu;function Iu(){if(!$u.document)return;const t=oa.bind(null,"dom"),e=Mu(t,!0);$u.document.addEventListener("click",e,!1),$u.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(e=>{const n=$u,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ma(r,"addEventListener",function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.xe=this.xe||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=Mu(t);o.handler=r,e.call(this,n,r,i)}o.refCount++}catch{}return e.call(this,n,r,i)}}),Ma(r,"removeEventListener",function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{const n=this.xe||{},i=n[e];i&&(i.refCount--,i.refCount<=0&&(t.call(this,e,i.handler,r),i.handler=void 0,delete n[e]),0===Object.keys(n).length&&delete this.xe)}catch{}return t.call(this,e,n,r)}}))})}function Mu(t,e=!1){return n=>{if(!n||n.ke)return;const r=function(t){try{return t.target}catch{return null}}(n);if(function(t,e){return"keypress"===t&&(!e?.tagName||"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&!e.isContentEditable)}(n.type,r))return;Da(n,"_sentryCaptured",!0),r&&!r.Se&&Da(r,"_sentryId",za());const i="keypress"===n.type?"input":n.type;(function(t){if(t.type!==Eu)return!1;try{if(!t.target||t.target.Se!==Tu)return!1}catch{}return!0})(n)||(t({event:n,name:i,global:e}),Eu=n.type,Tu=r?r.Se:void 0),clearTimeout(Nu),Nu=$u.setTimeout(()=>{Tu=void 0,Eu=void 0},1e3)}}function Du(t){const e="history";ra(e,t),ia(e,Ou)}function Ou(){function t(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const r=Cu,i=function(t){try{return new URL(t,$u.location.origin).toString()}catch{return t}}(String(n));if(Cu=i,r===i)return t.apply(this,e);oa("history",{from:r,to:i})}return t.apply(this,e)}}$u.addEventListener("popstate",()=>{const t=$u.location.href,e=Cu;Cu=t,e!==t&&oa("history",{from:e,to:t})}),"history"in ru&&ru.history&&(Ma($u.history,"pushState",t),Ma($u.history,"replaceState",t))}const Pu={},Ru="__sentry_xhr_v3__";function ju(){if(!$u.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(t,e,n){const r=new Error,i=1e3*Za(),o=pa(n[0])?n[0].toUpperCase():void 0,s=function(t){if(pa(t))return t;try{return t.toString()}catch{}}(n[1]);if(!o||!s)return t.apply(e,n);e[Ru]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(e._e=!0);const a=()=>{const t=e[Ru];if(t&&4===e.readyState){try{t.status_code=e.status}catch{}oa("xhr",{endTimestamp:1e3*Za(),startTimestamp:i,xhr:e,virtualError:r})}};return"onreadystatechange"in e&&"function"==typeof e.onreadystatechange?e.onreadystatechange=new Proxy(e.onreadystatechange,{apply:(t,e,n)=>(a(),t.apply(e,n))}):e.addEventListener("readystatechange",a),e.setRequestHeader=new Proxy(e.setRequestHeader,{apply(t,e,n){const[r,i]=n,o=e[Ru];return o&&pa(r)&&pa(i)&&(o.request_headers[r.toLowerCase()]=i),t.apply(e,n)}}),t.apply(e,n)}}),t.send=new Proxy(t.send,{apply(t,e,n){const r=e[Ru];return r?(void 0!==n[0]&&(r.body=n[0]),oa("xhr",{startTimestamp:1e3*Za(),xhr:e}),t.apply(e,n)):t.apply(e,n)}})}function Au(t,e=function(t){const e=Pu[t];if(e)return e;let n=$u[t];if(iu(n))return Pu[t]=n.bind($u);const r=$u.document;if(r&&"function"==typeof r.createElement)try{const e=r.createElement("iframe");e.hidden=!0,r.head.appendChild(e);const i=e.contentWindow;i?.[t]&&(n=i[t]),r.head.removeChild(e)}catch(e){_u&&Us(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,e)}return n?Pu[t]=n.bind($u):n}("fetch")){let n=0,r=0;return Pl(t,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const n=await e(t.url,s);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(t){throw Pu.fetch=void 0,t}finally{n-=o,r--}})}function zu(t,e,n,r){const i={filename:t,function:"<anonymous>"===e?Gs:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const Fu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Lu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Wu=/\((\S*)(?::(\d+))(?::(\d+))\)/,qu=/at (.+?) ?\(data:(.+?),/,Bu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Hu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Uu=Vs([30,t=>{const e=t.match(qu);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=Fu.exec(t);if(n){const[,t,e,r]=n;return zu(t,Gs,+e,+r)}const r=Lu.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){const t=Wu.exec(r[2]);t&&(r[2]=t[1],r[3]=t[2],r[4]=t[3])}const[t,e]=Zu(r[1]||Gs,r[2]);return zu(e,t,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,t=>{const e=Bu.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Hu.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],n=e[1]||Gs;return[n,t]=Zu(n,t),zu(t,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]),Zu=(t,e)=>{const n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:Gs,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Gu="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Yu=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:"Breadcrumbs",setup(t){var n;e.console&&function(t){const e="console";ra(e,t),ia(e,Ql)}(function(t){return function(e){if(uc()!==t)return;const n={category:"console",data:{arguments:e.args,logger:"console"},level:(r=e.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Ta(e.args," ")};var r;if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${Ta(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}zl(n,{input:e.args,level:e.level})}}(t)),e.dom&&(n=function(t,e){return function(n){if(uc()!==t)return;let r,i,o="object"==typeof e?e.serializeAttribute:void 0,s="object"==typeof e&&"number"==typeof e.maxStringLength?e.maxStringLength:void 0;s&&s>1024&&(Gu&&Us(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${s} was configured. Sentry will use 1024 instead.`),s=1024),"string"==typeof o&&(o=[o]);try{const t=n.event,e=function(t){return!!t&&!!t.target}(t)?t.target:t;r=_a(e,{keyAttrs:o,maxStringLength:s}),i=function(t){if(!Sa.HTMLElement)return null;let e=t;for(let t=0;t<5;t++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}(e)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),zl(a,{event:n.event,name:n.name,global:n.global})}}(t,e.dom),ra("dom",n),ia("dom",Iu)),e.xhr&&function(t){ra("xhr",t),ia("xhr",ju)}(function(t){return function(e){if(uc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e,i=e.xhr[Ru];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:c}=i,l={method:o,url:s,status_code:a},u={xhr:e.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:"xhr",data:l,type:"http",level:nu(a)};t.emit("beforeOutgoingRequestBreadcrumb",d,u),zl(d,u)}}(t)),e.fetch&&ou(function(t){return function(e){if(uc()!==t)return;const{startTimestamp:n,endTimestamp:r}=e;if(r&&(!e.fetchData.url.match(/sentry_key/)||"POST"!==e.fetchData.method))if(e.error){const i=e.fetchData,o={data:e.error,input:e.args,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",s,o),zl(s,o)}else{const i=e.response,o={...e.fetchData,status_code:i?.status},s={input:e.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:nu(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",a,s),zl(a,s)}}}(t)),e.history&&Du(function(t){return function(e){if(uc()!==t)return;let n=e.from,r=e.to;const i=Rl(lu.location.href);let o=n?Rl(n):void 0;const s=Rl(r);o?.path||(o=i),i.protocol===s.protocol&&i.host===s.host&&(r=s.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),zl({category:"navigation",data:{from:n,to:r}})}}(t)),e.sentry&&t.on("beforeSendEvent",function(t){return function(e){uc()===t&&zl({category:"sentry."+("transaction"===e.type?"transaction":"event"),event_id:e.event_id,level:e.level,message:La(e)},{event:e})}}(t))}}},Ju=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],Vu=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:"BrowserApiErrors",setupOnce(){e.setTimeout&&Ma(lu,"setTimeout",Qu),e.setInterval&&Ma(lu,"setInterval",Qu),e.requestAnimationFrame&&Ma(lu,"requestAnimationFrame",Xu),e.XMLHttpRequest&&"XMLHttpRequest"in lu&&Ma(XMLHttpRequest.prototype,"send",Ku);const t=e.eventTarget;t&&(Array.isArray(t)?t:Ju).forEach(t=>function(t,e){const n=lu,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ma(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=hu(i.handleEvent,{mechanism:{data:{handler:Ks(i),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&function(t,e,n){t&&"object"==typeof t&&"removeEventListener"in t&&"function"==typeof t.removeEventListener&&t.removeEventListener(e,n)}(this,r,i),n.apply(this,[r,hu(i,{mechanism:{data:{handler:Ks(i),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Ma(r,"removeEventListener",function(t){return function(e,n,r){try{const i=n.ve;i&&t.call(this,e,i,r)}catch{}return t.call(this,e,n,r)}}))}(t,e))}}};function Qu(t){return function(...e){const n=e[0];return e[0]=hu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Ks(t)}`}}),t.apply(this,e)}}function Xu(t){return function(e){return t.apply(this,[hu(e,{mechanism:{data:{handler:Ks(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Ku(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&Ma(n,t,function(e){const n={mechanism:{data:{handler:Ks(e)},handled:!1,type:`auto.browser.browserapierrors.xhr.${t}`}},r=Pa(e);return r&&(n.mechanism.data.handler=Ks(r)),hu(e,n)})}),t.apply(this,e)}}const td=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(t){e.onerror&&(function(t){!function(){const e="error";ra(e,e=>{const{stackParser:n,attachStacktrace:r}=nd();if(uc()!==t||du())return;const{msg:i,url:o,line:s,column:a,error:c}=e,l=function(t,e,n,r){const i=t.exception=t.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},c=a.frames=a.frames||[],l=r,u=n,d=function(t){if(pa(t)&&0!==t.length){if(t.startsWith("data:")){const e=t.match(/^data:([^;]+)/);return`<data:${e?e[1]:"text/javascript"}${t.includes("base64,")?",base64":""}>`}return t.slice(0,1024)}}(e)??Na();return 0===c.length&&c.push({colno:l,filename:d,function:Gs,in_app:!0,lineno:u}),t}(bu(n,c||i,void 0,r,!1),o,s,a);l.level="error",ul(l,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ia(e,aa)}()}(t),ed("onerror")),e.onunhandledrejection&&(function(t){!function(){const e="unhandledrejection";ra(e,e=>{const{stackParser:n,attachStacktrace:r}=nd();if(uc()!==t||du())return;const i=function(t){if(ya(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}(e),o=ya(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:bu(n,i,void 0,r,!0);o.level="error",ul(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ia(e,la)}()}(t),ed("onunhandledrejection"))}}};function ed(t){Gu&&Hs(`Global Handler attached: ${t}`)}function nd(){const t=uc();return t?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const rd=(t={})=>{const e=t.limit||5,n=t.key||"cause";return{name:"LinkedErrors",preprocessEvent(t,r,i){Gl(fu,i.getOptions().stackParser,n,e,t,r)}}};let id=!1;function od(t){if(id)e();else if(t.enabled&&t.dsn)try{const n=t.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];!function(t={}){const e=!t.skipBrowserExtensionCheck&&!!function(){if(void 0===lu.window)return!1;const t=lu;if(t.nw)return!1;const e=t.chrome||t.browser;if(!e?.runtime?.id)return!1;const n=Na();return!(lu===lu.top&&["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"].some(t=>n.startsWith(`${t}://`)))}()&&(Gu&&Fs(()=>{}),!0),n={...t,enabled:!e&&t.enabled,stackParser:(r=t.stackParser||Uu,Array.isArray(r)?Vs(...r):r),integrations:gl({integrations:t.integrations,defaultIntegrations:null==t.defaultIntegrations?[Hl(),Wl(),Vu(),Yu(),td(),rd(),Xl(),{name:"HttpContext",preprocessEvent(t){if(!lu.navigator&&!lu.location&&!lu.document)return;const e=function(){const t=Na(),{referrer:e}=lu.document||{},{userAgent:n}=lu.navigator||{};return{url:t,headers:{...e&&{Referer:e},...n&&{"User-Agent":n}}}}(),n={...e.headers,...t.request?.headers};t.request={...e,...t.request,headers:n}}},{name:"BrowserSession",setupOnce(){void 0!==lu.document?(dl({ignoreDuration:!0}),ml(),Du(({from:t,to:e})=>{void 0!==t&&t!==e&&(dl({ignoreDuration:!0}),ml())})):Gu&&Us("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}]:t.defaultIntegrations}),transport:t.transport||Au};var r;!function(t,e){!0===e.debug&&(Ms?Bs():Fs(()=>{})),ac().update(e.initialScope);const n=new t(e);(function(t){ac().setClient(t)})(n),n.init()}(Su,n)}({dsn:t.dsn,environment:t.environment||"production",release:t.release,beforeSend:t=>function(t,e){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=t.exception)||void 0===n?void 0:n.values)||void 0===r?void 0:r[0])||void 0===i?void 0:i.stacktrace)||void 0===o?void 0:o.frames;if(!s||0===s.length)return!0;return s.some(t=>!!t.filename&&e.some(e=>e.test(t.filename||"")))}(t,n)?(t.tags={...t.tags,source:"insureos-widget"},e(t.exception),t):(e(t.exception),null),allowUrls:n,sampleRate:t.sampleRate||1,tracesSampleRate:t.tracesSampleRate||.1,integrations:[Yu({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Xl()],ignoreErrors:["top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","atomicFindClose","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"]}),id=!0,e()}catch(t){}else e()}function sd(t,n){if(id)try{n?lc(e=>{Object.entries(n).forEach(([t,n])=>{e.setContext(t,n)}),cl(t)}):cl(t)}catch(t){e()}}function ad(t,n="info",r){if(id)try{r?lc(e=>{Object.entries(r).forEach(([t,n])=>{e.setContext(t,n)}),ll(t,n)}):ll(t,n)}catch(t){e()}}function cd(t){if(id)try{!function(t){cc().setUser(t)}(t)}catch(t){e()}}function ld(t){if(id)try{zl(t)}catch(t){e()}}function ud(t,n){if(id)try{!function(t,e){cc().setTag(t,e)}(t,n)}catch(t){e()}}function dd(){return id}var hd=Object.freeze({__proto__:null,addBreadcrumb:ld,captureException:sd,captureMessage:ad,initializeSentry:od,isSentryInitialized:dd,setTag:ud,setUser:cd});const fd="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",md="production",pd="insureos-scripts",gd=!0,yd=1,vd=.1;class wd{constructor(t={}){var e,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(e=t.enabled)||void 0===e||e,customDataLayer:null!==(n=t.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=t.includePersonalData)&&void 0!==r&&r,debug:null!==(i=t.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const t=this.config.customDataLayer;window[t]||(window[t]=[],this.logDebug(`Created new ${t} array`)),Array.isArray(window[t])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${t}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${t}' exists but is not an array`))}catch(t){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",t)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const t=window[this.config.customDataLayer];return Array.isArray(t)?t:null}catch(t){return this.logDebug("Failed to get data layer:",t),null}}push(t){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",t.event);const e=this.getDataLayer();if(e)try{const n=this.config.includePersonalData?t:this.removePII(t);e.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(t){this.logDebug("❌ Failed to push event to data layer:",t)}else this.logDebug("⚠️ Data layer not available, skipping event:",t.event)}removePII(t){const e={...t},n=["email","phone","name","address","client_name","client_email"];for(const t of n)t in e&&delete e[t];return e}logDebug(...t){this.config.debug&&e("[Analytics]",...t)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(t){this.logDebug("Failed to clear data layer:",t)}}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},(t.customDataLayer||void 0!==t.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class bd{constructor(){this.sentryInitialized=!1,this.analyticsManager=null}initializeSentryOnce(){if(!this.sentryInitialized)try{od({dsn:fd,environment:md,release:pd,enabled:gd,sampleRate:yd,tracesSampleRate:vd}),this.sentryInitialized=!0,e()}catch(t){e()}}validateConfig(t){if(!t.orgId)throw new Error("orgId is required")}initializeAnalyticsOnce(t){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new wd({enabled:null===(n=t.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=t.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=t.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=t.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:t.debug}),ft(this.analyticsManager),e()}catch(t){e()}}async mount(t,e){e.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(e),this.initializeSentryOnce(),this.initializeAnalyticsOnce(e),function(t,e){var i,o,s;e==document&&(e=document.documentElement),r.m&&r.m(t,e),i=e.i,o=[],s=[],R(e,t=e.i=x(S,null,[t]),i||p,p,e.namespaceURI,i?null:e.firstChild?n.call(e.childNodes):null,o,i?i.v:e.firstChild,!1,s),A(o,t,s)}(x(Cs,{config:e,initializeFormContext:this.initializeFormContext.bind(this)}),t)}createHttpClient(t){var e,n,r,i,o,s,a,c,l,u;this.validateConfig(t);const d=t.apiBaseUrl||"https://api.os.insure";return new U({orgId:t.orgId,apiBaseUrl:d,timeout:(null===(e=t.httpConfig)||void 0===e?void 0:e.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=t.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=t.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=t.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(l=null===(c=t.httpConfig)||void 0===c?void 0:c.retryConfig)||void 0===l?void 0:l.retryableStatusCodes)||[429,500,502,503,504],...null===(u=t.httpConfig)||void 0===u?void 0:u.retryConfig}})}createClient(t){const e=this.createHttpClient(t);return new $t(e)}async initializeFormContext(t){const n=this.createHttpClient(t),r="sessionStorage"===t.storageType?new G:new Z;r.isAvailable()?e(r.constructor.name):e();const i=new J(r),o=new V(i),s=async()=>{e();const r=t.quoteIntentUrl?await n.getQuoteIntent(t.quoteIntentUrl):await n.createQuoteIntent(t.product);return e(),{id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_url,expires_at:new Date(r.quote_intent.expires_at).getTime(),updated_at:new Date(r.quote_intent.updated_at).getTime(),created_at:new Date(r.quote_intent.created_at).getTime(),org_id:t.orgId,product_id:r.product.id,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,organisation:r.organisation,cached_result:r.cached_result}},a=async r=>{e();const o=new URLSearchParams(window.location.search),s=o.get("transaction_id")||o.get("payment_id"),a=await n.getQuoteIntent(r);let c;if(e(),e(a.cached_result),a.cached_result?(e(),e(a.cached_result.outcome_type)):e(),s&&a.payment_transactions){e();const t=a.payment_transactions.find(t=>t.id===s);if(t){e();let n="unknown";switch(t.status){case"completed":n="success";break;case"failed":n="declined";break;case"cancelled":n="cancelled";break;default:n="error"}c={paymentTransactionId:t.id,paymentStatus:n,transactionStatus:t};const r=new URL(window.location.href);r.searchParams.delete("transaction_id"),r.searchParams.delete("payment_id"),r.searchParams.delete("payment"),r.searchParams.delete("payment_status"),r.searchParams.delete("status"),window.history.replaceState({},"",r.toString())}else e()}const l={id:a.quote_intent.id,url:a.url,calculate_url:a.calculate_url,expires_at:new Date(a.quote_intent.expires_at).getTime(),updated_at:new Date(a.quote_intent.updated_at).getTime(),created_at:new Date(a.quote_intent.created_at).getTime(),org_id:t.orgId,product_id:a.product.id,form_definition:a.product.form_definition,form_data:a.quote_intent.form_data,status:a.quote_intent.status,organisation:a.organisation,payment_return:c,cached_result:a.cached_result};return e(),c&&i.saveQuoteIntent(t.orgId,l),l};e();const c=`insure_os_quote_intent_${t.orgId}`;localStorage.getItem(c),e(),i.getQuoteIntent(t.orgId),e(),e();let l=null,u=!1;try{const n=i.getQuoteIntent(t.orgId),r=await o.getOrCreateQuoteIntent(t.orgId,s,a);e(),e(r.cached_result),r.cached_result&&e(r.cached_result.outcome_type),l=r,u=!n}catch(n){if(e(),!(n instanceof B&&404===n.statusCode))throw n;e(),o.clearQuoteIntent(t.orgId),l=await o.getOrCreateQuoteIntent(t.orgId,s,a),u=!0}if(u&&l&&pt(l),!l)throw new Error("Failed to initialize quote intent state");"1"===new URLSearchParams(window.location.search).get("clear")&&(e(),localStorage.clear());const d=new St(l,n,o,{autoSave:l.form_definition.settings.autoSave,autoSaveInterval:l.form_definition.settings.autoSaveInterval});if(l.form_data&&d.restoreFormProgress(l.form_data),e(l.cached_result),l.cached_result?(e(l.cached_result),d.restoreCalculationResult(l.cached_result),e(),e(d.hasCalculationResponse())):e(),l.organisation&&l.organisation.theme)try{await Is.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(t){e()}return await this.handleAutoCalculationIfComplete(d),{httpClient:n,stateManager:i,quoteIntent:l,quoteIntentStore:o,formStateManager:d}}async handleAutoCalculationIfComplete(t){try{const n=t.getQuoteIntent();if("paid"===n.status||"completed"===n.status)return void e();if(t.hasCalculationResponse())return void e();if(t.hasLastCalculationFailed())return void e();const r=t.getPageCompletionStatus(),{totalPages:i,completedPages:o}=r,s=o.length===i;e((o.length,t.getIsCalculating(),t.hasLastCalculationFailed())),s&&!t.getIsCalculating()&&(e(),await t.calculateQuote(),e())}catch(t){e()}}}const xd=new bd;"undefined"!=typeof window&&(window.InsureOS=xd,function(){const t=document.querySelectorAll('script[src*="insureos"]'),e=t[t.length-1];if(e&&e.src){const t=new URL(e.src),n=t.searchParams.get("orgId"),r=t.searchParams.get("productCode");if(n&&r){const e=t.searchParams.get("container"),i=e?document.getElementById(e):document.body;if(i){const t={orgId:n,product:{code:r}};i.dataset.insureosConfig=JSON.stringify(t);const e=async()=>{try{await xd.mount(i,t)}catch(t){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}}}}());class kd{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,kd.instance)return kd.instance;kd.instance=this}startMeasurement(t){this.measurements.set(t,this.now())}endMeasurement(t){const e=this.measurements.get(t);if(void 0===e)throw new Error(`No measurement started for: ${t}`);const n=this.now()-e;return this.measurements.delete(t),this.completedMeasurements.has(t)||this.completedMeasurements.set(t,[]),this.completedMeasurements.get(t).push(n),"initialization"===t&&(this.initializationTime=n),n}async measureApiCall(t,e){const n=this.now();let r,i=!1;try{const t=await e();return i=!0,t}catch(t){throw i=!1,r=t instanceof Error?t.message:"Unknown error",t}finally{const e=this.now()-n;this.apiCallMetrics.push({operation:t,duration:e,timestamp:Date.now(),success:i,error:r})}}measureMemoryUsage(){return"undefined"!=typeof performance&&"memory"in performance&&performance.memory.usedJSHeapSize||0}getDetailedMemoryInfo(){if("undefined"!=typeof performance&&"memory"in performance){const t=performance.memory;return{usedJSHeapSize:t.usedJSHeapSize||0,totalJSHeapSize:t.totalJSHeapSize||0,jsHeapSizeLimit:t.jsHeapSizeLimit||0}}return null}getMetrics(){var t;const e=this.apiCallMetrics.filter(t=>t.success).map(t=>t.duration),n=e.length>0?e.reduce((t,e)=>t+e,0)/e.length:0,r={};return this.completedMeasurements.forEach((t,e)=>{r[e]=[...t]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:e.length>0&&null!==(t=e[e.length-1])&&void 0!==t?t:0,memoryUsage:this.measureMemoryUsage(),averageApiCallTime:n,totalApiCalls:this.apiCallMetrics.length},measurements:r}}getApiCallMetrics(){return[...this.apiCallMetrics]}clearMetrics(){this.completedMeasurements.clear(),this.apiCallMetrics=[],this.initializationTime=0}generateReport(){const t=this.getMetrics(),e=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${t.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${t.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${t.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(t.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,e&&(n+="Memory Details:\n",n+=` Used Heap: ${(e.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(e.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(e.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const t=new Map;this.apiCallMetrics.forEach(e=>{t.has(e.operation)||t.set(e.operation,{count:0,totalTime:0,errors:0});const n=t.get(e.operation);n.count++,n.totalTime+=e.duration,e.success||n.errors++}),t.forEach((t,e)=>{const r=t.totalTime/t.count,i=(t.errors/t.count*100).toFixed(1);n+=` ${e}: ${t.count} calls, ${r.toFixed(2)}ms avg, ${i}% errors\n`})}return n}static async getBundleSizes(){return{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}}}now(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()}static startMeasurement(t){(new kd).startMeasurement(t)}static endMeasurement(t){return(new kd).endMeasurement(t)}static measureMemoryUsage(){return(new kd).measureMemoryUsage()}static async measureApiCall(t,e){return(new kd).measureApiCall(t,e)}static getMetrics(){return(new kd).getMetrics()}static generateReport(){return(new kd).generateReport()}}var Sd;t.VersionStrategy=void 0,(Sd=t.VersionStrategy||(t.VersionStrategy={})).FIXED="fixed",Sd.LATEST="latest";let _d=class t{constructor(e){this.headers=new Map,e&&(Array.isArray(e)?e.forEach(([t,e])=>this.set(t,e)):e instanceof t?e.forEach((t,e)=>this.set(e,t)):Object.entries(e).forEach(([t,e])=>this.set(t,e)))}append(t,e){const n=this.get(t);this.set(t,n?`${n}, ${e}`:e)}delete(t){this.headers.delete(t.toLowerCase())}get(t){return this.headers.get(t.toLowerCase())||null}has(t){return this.headers.has(t.toLowerCase())}set(t,e){this.headers.set(t.toLowerCase(),e)}forEach(t){this.headers.forEach(t)}},$d=class{constructor(t,e={}){var n;"string"==typeof t?(this.url=t,this.method=e.method||"GET",this.headers=new _d(e.headers),this.body=e.body||null,this.signal=e.signal||void 0):(this.url=t.url,this.method=e.method||t.method,this.headers=new _d(e.headers||t.headers),this.body=void 0!==e.body?e.body:t.body,this.signal=void 0!==e.signal?null!==(n=e.signal)&&void 0!==n?n:void 0:t.signal)}},Nd=class{constructor(t="",e={}){this.status=e.status||200,this.statusText=e.statusText||"OK",this.headers=new _d(e.headers),this.ok=this.status>=200&&this.status<300,this.$e=t}async text(){return this.$e}async json(){return JSON.parse(this.$e)}};var Ed=Object.freeze({__proto__:null,Headers:_d,Request:$d,Response:Nd,fetch:async function(t,e={}){return new Promise((n,r)=>{const i=new $d(t,e),o=new XMLHttpRequest;i.signal&&i.signal.addEventListener("abort",()=>{o.abort(),r(new Error("Request aborted"))}),o.open(i.method,i.url),i.headers.forEach((t,e)=>{o.setRequestHeader(e,t)}),o.onload=()=>{const t=new _d;o.getAllResponseHeaders().split("\r\n").forEach(e=>{const[n,r]=e.split(": ");n&&r&&t.set(n,r)});const e=new Nd(o.responseText,{status:o.status,statusText:o.statusText,headers:t});n(e)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class Td{constructor(t){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{t(this.resolve.bind(this),this.reject.bind(this))}catch(t){this.reject(t)}}resolve(t){"pending"===this.state&&(this.state="fulfilled",this.value=t,this.onFulfilledCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}reject(t){"pending"===this.state&&(this.state="rejected",this.reason=t,this.onRejectedCallbacks.forEach(e=>{setTimeout(()=>e(t),0)}))}then(t,e){return new Td((n,r)=>{const i=e=>{try{if(t){const i=t(e);i instanceof Td?i.then(n,r):n(i)}else n(e)}catch(t){r(t)}},o=t=>{try{if(e){const i=e(t);i instanceof Td?i.then(n,r):n(i)}else r(t)}catch(t){r(t)}};"fulfilled"===this.state?setTimeout(()=>i(this.value),0):"rejected"===this.state?setTimeout(()=>o(this.reason),0):(this.onFulfilledCallbacks.push(i),this.onRejectedCallbacks.push(o))})}catch(t){return this.then(void 0,t)}static resolve(t){return new Td(e=>e(t))}static reject(t){return new Td((e,n)=>n(t))}static all(t){return new Td((e,n)=>{if(0===t.length)return void e([]);const r=[];let i=0;t.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===t.length&&e(r)},n)})})}}var Cd=Object.freeze({__proto__:null,PromisePolyfill:Td});class Id{constructor(t){this.params=new Map,"string"==typeof t?this.parseString(t):t&&"object"==typeof t&&"forEach"in t&&"function"==typeof t.forEach?t.forEach((t,e)=>this.append(e,t)):t&&"object"==typeof t&&Object.entries(t).forEach(([t,e])=>this.set(t,e))}parseString(t){const e=t.startsWith("?")?t.slice(1):t;e&&e.split("&").forEach(t=>{if(!t)return;const e=t.indexOf("=");let n,r;-1===e?(n=t,r=""):(n=t.substring(0,e),r=t.substring(e+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(t,e){const n=this.params.get(t)||[];n.push(e),this.params.set(t,n)}delete(t){this.params.delete(t)}get(t){var e;const n=this.params.get(t);return n&&n.length>0&&null!==(e=n[0])&&void 0!==e?e:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}forEach(t){this.params.forEach((e,n)=>{e.forEach(e=>t(e,n))})}toString(){const t=[];return this.params.forEach((e,n)=>{e.forEach(e=>{t.push(`${encodeURIComponent(n)}=${encodeURIComponent(e)}`)})}),t.join("&")}}var Md=Object.freeze({__proto__:null,URLPolyfill:class{constructor(t,e){const n=this.parseUrl(t,e);this.protocol=n.protocol,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.hash=n.hash,this.host=this.port?`${this.hostname}:${this.port}`:this.hostname,this.origin=`${this.protocol}//${this.host}`,this.href=this.toString(),this.searchParams=new Id(this.search)}parseUrl(t,e){const n=document.createElement("a");if(e){const r=document.createElement("a");r.href=e,n.href=this.resolveUrl(t,r.href)}else n.href=t;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(t,e){if(t.includes("://"))return t;if(t.startsWith("/")){const n=document.createElement("a");return n.href=e,`${n.protocol}//${n.host}${t}`}return`${e.split("/").slice(0,-1).join("/")}/${t}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:Id});t.DataLayerManager=wd,t.EnhancedHttpClient=U,t.ErrorHandlingStrategy=class{handleNetworkError(e){return new B(t.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(e){if(503===e.status)return new B(t.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,e.status);const n=e.status>=500||429===e.status;return 429===e.status?new B(t.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,e.status):e.status>=400&&e.status<500?new B(t.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,e.status):e.status>=500?new B(t.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,e.status):new B(t.ErrorType.API_ERROR,`Request failed: ${e.statusText}`,n,e.status)}handleStorageError(e){return new B(t.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(t){return t.retryable}getUserFriendlyMessage(e){switch(e.type){case t.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case t.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case t.ErrorType.API_ERROR:return 429===e.statusCode?"Too many requests. Please wait a moment and try again.":e.statusCode&&e.statusCode>=400&&e.statusCode<500?"Invalid request. Please refresh the page and try again.":e.statusCode&&e.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case t.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case t.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case t.ErrorType.VALIDATION_ERROR:return e.validationErrors&&Object.keys(e.validationErrors).length>0?"There were validation errors in your form. Please check your inputs and try again.":"Invalid data provided. Please check your input and try again.";default:return"An unexpected error occurred. Please try again."}}},t.FormStateManager=St,t.InsureOS=xd,t.InsureOSClient=bd,t.InsureOSError=B,t.LocalStateManager=J,t.LocalStorageAdapter=Z,t.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(t){return this.storage.get(t)||null}set(t,e){this.storage.set(t,e)}remove(t){this.storage.delete(t)}clear(){this.storage.clear()}isAvailable(){return!0}},t.PerformanceMonitor=kd,t.PolyfillManager=class{constructor(t={}){var e,n,r;this.detectionResults=null,this.config={fetch:null===(e=t.fetch)||void 0===e||e,promise:null===(n=t.promise)||void 0===n||n,url:null===(r=t.url)||void 0===r||r}}async loadPolyfills(){this.detectionResults=this.detectFeatures(),this.config.fetch&&this.detectionResults.fetch&&await this.loadFetchPolyfill(),this.config.promise&&this.detectionResults.promise&&await this.loadPromisePolyfill(),this.config.url&&this.detectionResults.url&&await this.loadUrlPolyfill()}getDetectionResults(){return this.detectionResults}detectFeatures(){return{fetch:this.needsFetchPolyfill(),promise:this.needsPromisePolyfill(),url:this.needsUrlPolyfill()}}needsFetchPolyfill(){if("undefined"==typeof fetch)return!0;if("undefined"==typeof Headers||"undefined"==typeof Request||"undefined"==typeof Response)return!0;try{return new Headers,new Request("http://example.com"),new Response,!1}catch(t){return!0}}needsPromisePolyfill(){if("undefined"==typeof Promise)return!0;if("function"!=typeof Promise.resolve||"function"!=typeof Promise.reject||"function"!=typeof Promise.all)return!0;try{const t=Promise.resolve(42);return"function"!=typeof t.then||"function"!=typeof t.catch}catch(t){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const t=new URL("http://example.com/path?param=value#hash");if("string"!=typeof t.protocol||"string"!=typeof t.hostname||"string"!=typeof t.pathname||"string"!=typeof t.search||"string"!=typeof t.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const e=new URLSearchParams("param=value");return"function"!=typeof e.get||"function"!=typeof e.set}catch(t){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:t,Headers:e,Request:n,Response:r}=await Promise.resolve().then(function(){return Ed});void 0===globalThis.fetch&&(globalThis.fetch=t),void 0===globalThis.Headers&&(globalThis.Headers=e),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(t){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:t}=await Promise.resolve().then(function(){return Cd});void 0===globalThis.Promise&&(globalThis.Promise=t)}catch(t){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:t,URLSearchParamsPolyfill:e}=await Promise.resolve().then(function(){return Md});void 0===globalThis.URL&&(globalThis.URL=t),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=e)}catch(t){}}},t.RetryStrategy=H,t.SessionStorageAdapter=G,t.ThemeLoader=Is,t.addBreadcrumb=ld,t.captureException=sd,t.captureMessage=ad,t.createAppError=it,t.getAnalytics=function(){return ht},t.getSupportMessage=dt,t.groupErrorsByField=function(t){return t.reduce((t,e)=>(t[e.field]||(t[e.field]=[]),t[e.field].push(e),t),{})},t.initializeAnalytics=ft,t.initializeSentry=od,t.isSentryInitialized=dd,t.parseServerValidationErrors=tt,t.setTag=ud,t.setUser=cd,t.shouldShowErrorPage=function(t){return"initialization"===t.type&&"critical"===t.severity},t.shouldShowMaintenancePage=ut,t.trackFormProgress=gt,t.trackPaymentCompleted=xt,t.trackPaymentFailed=kt,t.trackPaymentInitiated=bt,t.trackQuoteAtCheckout=vt,t.trackQuoteCalculated=yt,t.trackQuoteReferred=wt,t.trackQuoteStarted=pt,t.validateField=X,t.validatePage=K});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|