@insure-os/client 0.0.88 → 0.0.90
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.d.ts +2 -0
- 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).InsureOSScripts={})}(this,function(e){"use strict";const t=()=>{globalThis.insureOSDebug};var n,r,i,o,a,s,l,c,d,u,h,m,f,p,g,y,v={},w=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function k(e,t){for(var n in t)e[n]=t[n];return e}function S(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function N(e,t,r){var i,o,a,s={};for(a in t)"key"==a?i=t[a]:"ref"==a?o=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===s[a]&&(s[a]=e.defaultProps[a]);return _(e,s,i,o,null)}function _(e,t,n,o,a){var s={type:e,props:t,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==a?++i:a,_:-1,C:0};return null==a&&null!=r.vnode&&r.vnode(s),s}function C(e){return e.children}function $(e,t){this.props=e,this.context=t}function I(e,t){if(null==t)return e.m?I(e.m,e._+1):null;for(var n;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v)return n.v;return"function"==typeof e.type?I(e):null}function T(e){if(e.I&&e.P){var t=e.N,n=t.v,i=[],o=[],a=k({},t);a.N=t.N+1,r.vnode&&r.vnode(a),L(e.I,a,t,e.R,e.I.namespaceURI,32&t.C?[n]:null,i,null==n?I(t):n,!!(32&t.C),o),a.N=t.N,a.m.i[a._]=a,q(i,a,o),t.v=t.m=null,a.v!=n&&E(a)}}function E(e){if(null!=(e=e.m)&&null!=e.k)return e.v=e.k.base=null,e.i.some(function(t){if(null!=t&&null!=t.v)return e.v=e.k.base=t.v}),E(e)}function P(e){(!e.P&&(e.P=!0)&&o.push(e)&&!R.O++||a!=r.debounceRendering)&&((a=r.debounceRendering)||s)(R)}function R(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,T(e)}finally{o.length=R.O=0}}function z(e,t,n,r,i,o,a,s,l,c,d){var u,h,m,f,p,g,y,b=r&&r.i||w,x=t.length;for(l=D(n,t,b,l,x),u=0;u<x;u++)null!=(m=n.i[u])&&(h=-1!=m._&&b[m._]||v,m._=u,g=L(e,m,h,i,o,a,s,l,c,d),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&U(h.ref,null,m),d.push(m.ref,m.k||f,m)),null==p&&null!=f&&(p=f),(y=!!(4&m.C))||h.i===m.i?(l=M(m,l,e,y),y&&h.v&&(h.v=null)):"function"==typeof m.type&&void 0!==g?l=g:f&&(l=f.nextSibling),m.C&=-7);return n.v=p,l}function D(e,t,n,r,i){var o,a,s,l,c,d=n.length,u=d,h=0;for(e.i=new Array(i),o=0;o<i;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.i[o]=_(null,a,null,null,null):x(a)?a=e.i[o]=_(C,{children:a},null,null,null):void 0===a.constructor&&a.p>0?a=e.i[o]=_(a.type,a.props,a.key,a.ref?a.ref:null,a.N):e.i[o]=a,l=o+h,a.m=e,a.p=e.p+1,s=null,-1!=(c=a._=O(a,n,l,u))&&(u--,(s=n[c])&&(s.C|=2)),null==s||null==s.N?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof a.type&&(a.C|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.C|=4))):e.i[o]=null;if(u)for(o=0;o<d;o++)null!=(s=n[o])&&!(2&s.C)&&(s.v==r&&(r=I(s)),Y(s,s));return r}function M(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=e,t=M(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function O(e,t,n,r){var i,o,a,s=e.key,l=e.type,c=t[n],d=null!=c&&!(2&c.C);if(null===c&&null==s||d&&s==c.key&&l==c.type)return n;if(r>(d?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(c=t[a=i>=0?i--:o++])&&!(2&c.C)&&s==c.key&&l==c.type)return a;return-1}function j(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,r,i){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||j(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||j(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(h,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[u]=r[u]:(n[u]=m,e.addEventListener(t,o?p:f,o)):e.removeEventListener(t,o?p:f,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function A(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[d])t[d]=m++;else if(t[d]<n[u])return;return n(r.event?r.event(t):t)}}}function L(e,t,n,i,o,a,s,l,c,d){var u,h,m,f,p,g,y,v,b,N,_,I,T,E,P,R=t.type;if(void 0!==t.constructor)return null;128&n.C&&(c=!!(32&n.C),a=[l=t.v=n.v]),(u=r.p)&&u(t);e:if("function"==typeof R)try{if(v=t.props,b=R.prototype&&R.prototype.render,N=(u=R.contextType)&&i[u.k],_=u?N?N.props.value:u.m:i,n.k?y=(h=t.k=n.k).m=h.j:(b?t.k=h=new R(v,_):(t.k=h=new $(v,_),h.constructor=R,h.render=Z),N&&N.sub(h),h.state||(h.state={}),h.R=i,m=h.P=!0,h.W=[],h.A=[]),b&&null==h.L&&(h.L=h.state),b&&null!=R.getDerivedStateFromProps&&(h.L==h.state&&(h.L=k({},h.L)),k(h.L,R.getDerivedStateFromProps(v,h.L))),f=h.props,p=h.state,h.N=t,m)b&&null==R.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.W.push(h.componentDidMount);else{if(b&&null==R.getDerivedStateFromProps&&v!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,_),t.N==n.N||!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.L,_)){t.N!=n.N&&(h.props=v,h.state=h.L,h.P=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),w.push.apply(h.W,h.A),h.A=[],h.W.length&&s.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.L,_),b&&null!=h.componentDidUpdate&&h.W.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=_,h.props=v,h.I=e,h.v=!1,I=r.O,T=0,b)h.state=h.L,h.P=!1,I&&I(t),u=h.render(h.props,h.state,h.context),w.push.apply(h.W,h.A),h.A=[];else do{h.P=!1,I&&I(t),u=h.render(h.props,h.state,h.context),h.state=h.L}while(h.P&&++T<25);h.state=h.L,null!=h.getChildContext&&(i=k(k({},i),h.getChildContext())),b&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),E=null!=u&&u.type===C&&null==u.key?F(u.props.children):u,l=z(e,x(E)?E:[E],t,n,i,o,a,s,l,c,d),h.base=t.v,t.C&=-161,h.W.length&&s.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,c||null!=a)if(e.then){for(t.C|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,t.v=l}else{for(P=a.length;P--;)S(a[P]);B(t)}else t.v=n.v,t.i=n.i,e.then||B(t);r.v(e,t,n)}else null==a&&t.N==n.N?(t.i=n.i,t.v=n.v):l=t.v=H(n.v,t,n,i,o,a,s,c,d);return(u=r.diffed)&&u(t),128&t.C?void 0:l}function B(e){e&&(e.k&&(e.k.v=!0),e.i&&e.i.some(B))}function q(e,t,n){for(var i=0;i<n.length;i++)U(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.W,t.W=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function F(e){return"object"!=typeof e||null==e||e.p>0?e:x(e)?e.map(F):k({},e)}function H(e,t,i,o,a,s,l,c,d){var u,h,m,f,p,g,y,w=i.props||v,b=t.props,k=t.type;if("svg"==k?a="http://www.w3.org/2000/svg":"math"==k?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;u<s.length;u++)if((p=s[u])&&"setAttribute"in p==!!k&&(k?p.localName==k:3==p.nodeType)){e=p,s[u]=null;break}if(null==e){if(null==k)return document.createTextNode(b);e=document.createElementNS(a,k,b.is&&b),c&&(r.B&&r.B(t,s),c=!1),s=null}if(null==k)w===b||c&&e.data==b||(e.data=b);else{if(s=s&&n.call(e.childNodes),!c&&null!=s)for(w={},u=0;u<e.attributes.length;u++)w[(p=e.attributes[u]).name]=p.value;for(u in w)p=w[u],"dangerouslySetInnerHTML"==u?m=p:"children"==u||u in b||"value"==u&&"defaultValue"in b||"checked"==u&&"defaultChecked"in b||W(e,u,null,p,a);for(u in b)p=b[u],"children"==u?f=p:"dangerouslySetInnerHTML"==u?h=p:"value"==u?g=p:"checked"==u?y=p:c&&"function"!=typeof p||w[u]===p||W(e,u,p,w[u],a);if(h)c||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),z("template"==t.type?e.content:e,x(f)?f:[f],t,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":a,s,l,s?s[0]:i.i&&I(i,0),c,d),null!=s)for(u=s.length;u--;)S(s[u]);c||(u="value","progress"==k&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[u]||"progress"==k&&!g||"option"==k&&g!=w[u])&&W(e,u,g,w[u],a),u="checked",null!=y&&y!=e[u]&&W(e,u,y,w[u],a))}return e}function U(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.C;i&&e.C(),i&&null==t||(e.C=e(t))}else e.current=t}catch(e){r.v(e,n)}}function Y(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||U(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.I=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&Y(i[o],t,n||"function"!=typeof e.type);n||S(e.v),e.k=e.m=e.v=void 0}function Z(e,t,n){return this.constructor(e,n)}n=w.slice,r={v:function(e,t,n,r){for(var i,o,a;t=t.m;)if((i=t.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=i.P),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.P),a)return i.j=i}catch(t){e=t}throw e}},i=0,$.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=k({},this.state),"function"==typeof e&&(e=e(k({},n),this.props)),e&&k(n,e),null!=e&&this.N&&(t&&this.A.push(t),P(this))},$.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.W.push(e),P(this))},$.prototype.render=C,o=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.N.p-t.N.p},R.O=0,c=Math.random().toString(8),d="__d"+c,u="__a"+c,h=/(PointerCapture)$|Capture$/i,m=0,f=A(!1),p=A(!0),g=0,e.ErrorType=void 0,(y=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",y.API_ERROR="API_ERROR",y.VALIDATION_ERROR="VALIDATION_ERROR",y.STORAGE_ERROR="STORAGE_ERROR",y.TIMEOUT_ERROR="TIMEOUT_ERROR",y.MAINTENANCE_ERROR="MAINTENANCE_ERROR",y.VERSION_INVALIDATED="VERSION_INVALIDATED";class V extends Error{constructor(e,t,n=!1,r,i,o,a,s){super(t),this.type=e,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.organisation=a,this.versionInvalidated=s,this.name="InsureOSError"}}class G{constructor(e){this.config=e}shouldRetry(e,t){return!(t>=this.config.maxRetries)&&this.isRetryableError(e)}getDelay(e,t){if(t){const e=parseInt(t,10);if(!isNaN(e))return 1e3*e}const n=this.config.baseDelay*Math.pow(2,e);return Math.min(n,this.config.maxDelay)}isRetryableError(e){return e instanceof V?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}const Q=new Map;function J(e){return Q.get(e)}function K(e){if(e)for(const t of e)(null==t?void 0:t.code)&&Q.set(t.code,{name:t.name,content:t.content})}class X{constructor(e){this.config=e,this.retryStrategy=new G(e.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:n,body:r,skipOrgHeader:i=!1,timeoutMs:o,noRetry:a=!1}){return this.executeWithRetry(a,async()=>{const a=new AbortController,s=null!=o?o:this.config.timeout,l=setTimeout(()=>a.abort(),s);try{const e={"Content-Type":"application/json"},o=t.includes("signed=");i||o||(e["X-Organisation-ID"]=this.config.orgId);const s={method:n,headers:e,signal:a.signal};r&&(s.body=JSON.stringify(r));const c=await fetch(t,s);if(clearTimeout(l),!c.ok)throw await this.handleApiError(c);const d=await c.json();return d.data||d}catch(t){if(clearTimeout(l),t instanceof V)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new V(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new V(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}async getQuoteIntent(e){const t=await this.makeRequest({url:e,method:"GET"});return K(null==t?void 0:t.documents),t}getDocument(e){const t=`${this.config.apiBaseUrl}/documents/${encodeURIComponent(e)}`;return this.makeRequest({url:t,method:"GET"})}async fetchAvailableProducts(e){var n;const r=null==e?void 0:e.includes("*"),i=!e||0===e.length,o=`${this.config.apiBaseUrl}/products`,a=await this.makeRequest({url:o,method:"GET"}),s=a.products||[],l=null===(n=a.organisation)||void 0===n?void 0:n.client_settings;let c=s;if(r)t(),c=s;else if(e&&e.length>0)c=s.filter(t=>e.includes(t.code));else if(i&&(null==l?void 0:l.products)&&l.products.length>0){const e=l.products.map(e=>e.code);c=e.map(e=>s.find(t=>t.code===e)).filter(e=>void 0!==e),t((s.length,c.length))}else i&&(t(),c=s);return{products:c,organisation:a.organisation}}async createQuoteIntent(e){const t=await this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:e});return K(null==t?void 0:t.documents),t}async updateQuoteIntent(e,t){const n=await this.makeRequest({url:e,method:"PUT",body:t});return K(null==n?void 0:n.documents),n}deleteQuoteIntent(e){return this.makeRequest({url:e,method:"DELETE"})}calculateQuoteIntent(e){return this.makeRequest({url:e,method:"POST"})}calculateQuoteIntentV2(e){return this.makeRequest({url:e,method:"POST"})}repriceQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}bindQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}deleteCalculations(e){return this.makeRequest({url:e,method:"DELETE"})}initiatePayment(e,t){const n="string"==typeof t?t:t.code;return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/initiate`,method:"POST",body:{...e,gateway_code:n},timeoutMs:9e4,noRetry:!0})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/status/${e}`,method:"GET"})}createQuotePaymentLink(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/payment-link`,method:"POST",body:t})}continueLater(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/continue-later`,method:"POST",body:{email:t}})}resumeQuoteIntent(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/resume`,method:"GET"})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}getPaymentLinkById(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}`,method:"GET"})}initiateFixedPayment(e,t,n,r){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/pay`,method:"POST",body:{gateway_code:t,client_name:n,...r?{gateway_method:r}:{}}})}validateCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}validateQuoteCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}resolvePaymentTransaction(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/${e}/resolve`,method:"POST",body:{}})}validatePromoCode(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-promo-code`,method:"POST",body:{code:t}})}async executeWithRetry(e,n){let r;const i=e?0:this.config.retryConfig.maxRetries;for(let o=0;o<=i;o++)try{return t(),await n()}catch(n){r=n;const a=!e&&this.retryStrategy.shouldRetry(r,o);if(t(n instanceof V&&(n.type,n.message)),t(),o===i||!a)throw t(),r;const s=n instanceof V?n.retryAfter:void 0,l=this.retryStrategy.getDelay(o,s);t(),await new Promise(e=>setTimeout(e,l))}throw r}async handleApiError(n){var r,i,o,a;const s=n.headers.get("retry-after"),l=await n.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(n,l),l&&!0===l.version_invalidated)return new V(e.ErrorType.VERSION_INVALIDATED,l.message||"This quote is no longer valid. Please start a new quote.",!1,n.status,void 0,void 0,void 0,{from:l.from,to:null!==(r=l.to)&&void 0!==r?r:null,quote_page_url:null!==(i=l.quote_page_url)&&void 0!==i?i:null});if(503===n.status)return new V(e.ErrorType.MAINTENANCE_ERROR,l.message||"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status,void 0,void 0,null!==(o=l.organisation)&&void 0!==o?o:null);if(429===n.status)return new V(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,s||void 0);if(n.status>=500){const t=l.message||"Service temporarily unavailable. Please try again in a moment.";return new V(e.ErrorType.API_ERROR,t,!1,n.status)}if(422===n.status)try{const t=l;return t.error&&t.error.details&&t.error.details.form_data?new V(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new V(e.ErrorType.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(a=t.error)||void 0===a?void 0:a.details)}catch(t){return new V(e.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const t=l;return t.errors?new V(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new V(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new V(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const t=l.message||"Invalid request. Please refresh the page and try again.";return new V(e.ErrorType.API_ERROR,t,!1,n.status)}return new V(e.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return Uh}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${e.status} ${e.statusText}`,category:"http",level:"error",data:{url:e.url,status:e.status,statusText:e.statusText}}),n(`API Error: ${e.status} - ${e.url}`,"error",{http:{status_code:e.status,url:e.url,method:"Unknown"},response:t}))}).catch(()=>{})}catch(e){}}}class ee{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return localStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{localStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{localStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{localStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const e="__insure_os_storage_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch(e){return!1}}}class te{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class ne{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}ne.KEY_PREFIX="insure_os_",ne.SEPARATOR="_";class re{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||re.DEFAULT_EXPIRATION_MS,namespace:t.namespace||re.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=ne.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=ne.deserialize(n);return(null==r?void 0:r.payment_transactions)&&r.payment_transactions.length,r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return ne.generateKey(this.config.namespace,e)}}re.DEFAULT_EXPIRATION_MS=864e5,re.DEFAULT_NAMESPACE="quote_intent";class ie{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class oe{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(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!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}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 ae(e,t){const n=t.operator,r=t.value,i=null==r?"":String(r),o=null==e?"":String(e);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===e||null==e||""===e||""===e.trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function se(e,t){const n=t.operator,r=null==t.value?0:Number(t.value),i=null==e?0:Number(e.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===e||null==e||""===e||""===e.toString().trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function le(e){if(!0===e||1===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"true"===t||"yes"===t}return!1}function ce(e,t){const n=t.operator;switch(t.operator){case"true":case"=":return le(e);case"false":return function(e){if(!1===e||0===e||void 0===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"false"===t||"no"===t}return!1}(e);case"!=":return!le(e);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function de(e,t){const n=t.operator,r=t.value,i=null==r?0:Number(t.value);if(null==e||""===e.toString().trim())return"is_empty"===n;const o=e.toString().trim(),a=/^\d{4}$/.test(o)&&Number(o)>=1900&&Number(o)<=2100?new Date(Number(o),0,1).getTime():Date.parse(o),s=Math.floor((Date.now()-a)/315576e5),l=Math.floor((Date.now()-a)/864e5),c=new Date(a),d=new Date,u=12*(d.getFullYear()-c.getFullYear())+(d.getMonth()-c.getMonth());switch(n){case">":return a>Date.parse(r);case">=":return a>=Date.parse(r);case"<":return a<Date.parse(r);case"<=":return a<=Date.parse(r);case"age_less_than":return s<i;case"age_less_than_or_equal":return s<=i;case"age_greater_than":return s>i;case"age_greater_than_or_equal":return s>=i;case"age_days_less_than":return l<i;case"age_days_less_than_or_equal":return l<=i;case"age_days_greater_than":return l>i;case"age_days_greater_than_or_equal":return l>=i;case"age_months_less_than":return u<i;case"age_months_less_than_or_equal":return u<=i;case"age_months_greater_than":return u>i;case"age_months_greater_than_or_equal":return u>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class ue{static create(e){switch(e){case"string":case"text":case"select":return ae;case"numeric":return se;case"boolean":return ce;case"date":return de;default:throw new Error(`Unsupported condition type: ${e}`)}}}function he(e,t){const n=t.condition_type||"and";if(!t.conditions||0===t.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:t.conditions.map(t=>{const n={...t,matched:me(e,t),string:`${t.field} ${t.operator}`};return t.value&&(n.string+=` ${t.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(e=>e.matched)),"or"===n&&(r.matched=r.conditions.some(e=>e.matched)),"not"===n&&(r.matched=r.conditions.every(e=>!e.matched)),r}function me(e,t){if("expression"===t.type)throw new Error("Expression conditions should not be evaluated through matchesCondition");if(!t.field)throw new Error("Field is required for non-expression conditions");const n=e[t.field],r=ue.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var fe=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:ue,booleanMatchesCondition:ce,checkSimpleConditions:he,dateMatchesCondition:de,numericMatchesCondition:se,textMatchesCondition:ae});function pe(e,t){var n;const r=[];if("checkbox"===e.type&&e.required&&!0!==t&&"true"!==t)return r.push({field:e.code||e.id,message:`${e.label} must be accepted`}),r;"boolean"===e.type&&(null===(n=e.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===e.boolean_config.show_details_on&&(!0===t||"true"===t)||e.boolean_config.show_details_on),"email"===e.type&&"string"==typeof t&&(t=t.trim());const i="boolean"===e.type?null==t:null==t||""===t;if(e.required&&i&&!0!==e.add_null_option)return r.push({field:e.code||e.id,message:`${e.label} is required`}),r;if(!e.required&&i)return r;const o=e.validation;if(!o)return r;const a=String(t),s="number"==typeof t?t:parseFloat(a);if(o.pattern&&("text"===e.type||"email"===e.type)){const t=new RegExp(o.pattern),n=a.trim();t.test(n)||r.push({field:e.code||e.id,message:`${e.label} format is invalid`})}if(o.minLength&&a.length<o.minLength&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.minLength} characters`}),o.maxLength&&a.length>o.maxLength&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.maxLength} characters`}),"number"!==e.type||isNaN(s)||(void 0!==o.min&&s<o.min&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.min}`}),void 0!==o.max&&s>o.max&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.max}`}),void 0!==o.step&&s%o.step!==0&&r.push({field:e.code||e.id,message:`${e.label} must be in increments of ${o.step}`})),("date"===e.type||"year"===e.type||"monthyear"===e.type)&&!1===o.canBeFuture){const t=new Date,n=t.getFullYear();let i=!1;if("year"===e.type){const e=parseInt(a,10);!isNaN(e)&&e>n&&(i=!0)}else if("date"===e.type){const e=new Date(a);if(!isNaN(e.getTime())){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());new Date(e.getFullYear(),e.getMonth(),e.getDate())>n&&(i=!0)}}else if("monthyear"===e.type){const e=a.split("-");if(2===e.length){const n=parseInt(e[0],10),r=parseInt(e[1],10)-1;isNaN(n)||isNaN(r)||new Date(n,r,1)>new Date(t.getFullYear(),t.getMonth(),1)&&(i=!0)}}i&&r.push({field:e.code||e.id,message:`${e.label} cannot be in the future`})}return"date"===e.type&&o.softMaxDate&&a&&a>o.softMaxDate&&r.push({field:e.code||e.id,message:o.softMaxMessage||`${e.label} is too far in the future`}),r}function ge(e,t){var n,r;const i=[];for(const r of e.fields){const e=r.code||r.id;let o=!0;if(r.visibility){const e=he(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});o="show"===r.visibility.action?e.matched:!e.matched}if(!o)continue;const a=t[e],s=pe(r,a);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===a||"true"===a)||"no"===r.boolean_config.show_details_on&&(!1===a||"false"===a))){const n=(t.U||{})[e];n&&""!==n.trim()||i.push({field:e,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=e.validation)||void 0===r?void 0:r.required_fields)for(const n of e.validation.required_fields){const r=e.fields.find(e=>(e.code||e.id)===n),o=t[n];if(r){const e=r.code||r.id,n=i.find(t=>t.field===e);if(n)continue;let a=!0;if(r.visibility){const e=he(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});a="show"===r.visibility.action?e.matched:!e.matched}if(!a)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:e,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&(!0===r.add_null_option||i.push({field:e,message:`${r.label} is required`}))}}return{isValid:0===i.length,errors:i}}function ye(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class ve{constructor(e,t,n){this.httpClient=e,this.definition=t,this.quoteIntentStore=n}async load(e,t){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(e)){const e=await this.httpClient.getQuoteIntent(t);if(e.quote_intent.form_data)return e.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(t)).quote_intent.form_data||this.createEmptyFormData()}async save(e,t,n,r){try{const e=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(t,e),{success:!0}}catch(e){if(e&&"object"==typeof e&&"validationErrors"in e){const t=e.validationErrors;if(t&&"object"==typeof t)return{success:!1,validationErrors:ye(t)}}throw e}}prepareSavePayload(e,t){const n=this.getCurrentPageId(e);return{current_page_index:e.current_page,current_page_id:n,page_data:e.page_data,save_type:t.saveType}}getCurrentPageId(e){const t=this.definition;if(!t||!e.page_data)return;const n=e.current_page;if(n<0||n>=t.pages.length)return;const r=t.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 we{constructor(e,t,n,r){this.formDefinition=e,this.getFormData=t,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(e){const t=this.getFormData().current_page;if(e<=t)return!0;if(this.hasActiveBlocker(t))return!1;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<e;r++)if(r!==t&&!n.includes(r))return!1;return!0}async navigateToPage(e){if(e<0||e>=this.getTotalPages())return!1;if(!this.canNavigateToPage(e))return!1;const t=this.getFormData().current_page;if(e>t)try{await this.saveCallback(!0,"page")}catch(e){return e&&"object"==typeof e&&e.isValidationError,!1}return e>t&&this.markPageCompleted(t),this.updateFormData({current_page:e,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const e=this.getFormData().current_page;return this.navigateToPage(e+1)}navigateToPrevious(){const e=this.getFormData().current_page;return this.navigateToPage(e-1)}markPageCompleted(e){const t=this.getFormData();if(!t.completed_pages.includes(e)){const n=[...t.completed_pages,e].sort((e,t)=>e-t);this.updateFormData({completed_pages:n})}}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const e=this.getFormData(),t=this.getTotalPages(),n=[...e.completed_pages];return{totalPages:t,currentPage:e.current_page,completedPages:n,percentComplete:n.length/t*100}}hasActiveBlocker(e){var t;const n=this.formDefinition.pages[e];if(!n)return!1;const r=(null===(t=this.getFormData().page_data)||void 0===t?void 0:t[n.id])||{};for(const e of n.fields)if(e.blocker)if(e.blocker.conditions&&e.blocker.conditions.length>0){if(he(r,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return!0}else if(void 0!==e.blocker.trigger_value){const t=r[e.code||e.id];if(void 0!==t&&String(t)===String(e.blocker.trigger_value))return!0}return!1}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class be{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}class xe{constructor(e){this.httpClient=e}async calculate(e){const n=await this.httpClient.calculateQuoteIntentV2(e);return t(),n}async reprice(e,n){const r={selection:n},i=await this.httpClient.repriceQuoteIntentV2(e,r);return t(),i}async bind(e,n){const r=await this.httpClient.bindQuoteIntentV2(e,n);return t(),r}}function ke(e,t,n){var r,i,o,a,s,l,c,d,u;const h=Date.now(),m=`${Math.random().toString(36).slice(2,10)}-${e}-${h}`;if(function(e,t,n){try{Promise.resolve().then(function(){return Uh}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${t}`,category:"error",level:"error",data:{errorType:t,customMessage:n}}),r(e,{errorType:t,customMessage:n}))}).catch(()=>{})}catch(e){}}(t,e,n),t&&"object"==typeof t){const f=null!==(o=null!==(r=t.organisation)&&void 0!==r?r:null===(i=t.data)||void 0===i?void 0:i.organisation)&&void 0!==o?o:null===(s=null===(a=t.response)||void 0===a?void 0:a.data)||void 0===s?void 0:s.organisation;if("statusCode"in t||"status"in t)return Se(m,e,t.statusCode||t.status||500,t.message||(null===(l=t.data)||void 0===l?void 0:l.message)||"Server error occurred",n,h,f);if("response"in t)return Se(m,e,(null===(c=t.response)||void 0===c?void 0:c.status)||500,(null===(u=null===(d=t.response)||void 0===d?void 0:d.data)||void 0===u?void 0:u.message)||t.message||"Network error occurred",n,h,f);if(t.message)return{id:m,type:e,severity:_e(e),title:Ne(e),message:n||$e(e),details:t.message,retryable:Ie(e,0),timestamp:h,trackingId:m}}const f="string"==typeof t?t:"An unexpected error occurred";return{id:m,type:e,severity:_e(e),title:Ne(e),message:n||f,retryable:Ie(e,0),timestamp:h,trackingId:m}}function Se(e,t,n,r,i,o,a){const s=n>=500?"critical":n>=400?"error":"warning",l=Ie(t,n);return{id:e,type:t,severity:s,statusCode:n,title:Ne(t,n),message:i||Ce(t,n,r),details:r,retryable:l,timestamp:o,organisation:null!=a?a:void 0}}function Ne(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Under Maintenance";if(t>=500)return"Something Went Wrong";if(t>=400)return"Invalid Request"}switch(e){case"initialization":default:return"Something Went Wrong";case"calculation":return"Calculation Error";case"network":return"Connection Problem";case"validation":return"Please Check Your Details";case"maintenance":return"Under Maintenance";case"version_invalidated":return"This Quote Needs to Be Restarted"}}function _e(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":case"version_invalidated":return"warning"}}function Ce(e,t,n){return"calculation"===e&&(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===t?"initialization"===e?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===t?"We're performing scheduled maintenance. Please check back in a few minutes.":t>=500?"calculation"===e?"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===t?"Too many requests. Please wait a moment and try again.":t>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function $e(e){switch(e){case"initialization":return"We're unable to load the application at this time. Please try again.";case"calculation":return"We couldn't complete the calculation. Please check your details and try again.";case"network":return"We're having trouble connecting. Please check your internet connection and try again.";case"validation":return"Please check your details and try again.";case"maintenance":return"We're performing scheduled maintenance. Please check back in a few minutes.";default:return"An unexpected error occurred. Please try again."}}function Ie(e,t){return"validation"!==e&&"maintenance"!==e&&404!==t&&503!==t&&!(t>=400&&t<500&&429!==t)&&("network"===e||"calculation"===e||t>=500&&503!==t||429===t)}function Te(e){return"maintenance"===e.type||503===e.statusCode}function Ee(e){return e.trackingId?`If this problem persists, please contact support and reference error ID: ${e.trackingId.slice(0,8).toUpperCase()}`:"critical"===e.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let Pe=null;function Re(e){Pe=e}function ze(e,t){var n,r;return{event:t,quote_id:e.id,organisation_slug:null===(n=e.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=e.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function De(e){var t,n;if(!(null==Pe?void 0:Pe.isEnabled()))return;const r={...ze(e,"quote_started"),quote_status:e.status,total_pages:null===(n=null===(t=e.form_definition)||void 0===t?void 0:t.pages)||void 0===n?void 0:n.length};Pe.push(r)}function Me(e,t,n,r){var i,o;if(!(null==Pe?void 0:Pe.isEnabled()))return;const a=(null===(o=null===(i=e.form_definition)||void 0===i?void 0:i.pages)||void 0===o?void 0:o.length)||0,s=a>0?Math.round(n.length/a*100):0,l={...ze(e,"quote_form_progress"),current_page:t,total_pages:a,completed_pages:n.length,completion_percentage:s,page_title:r};Pe.push(l)}function Oe(e,t){if(!(null==Pe?void 0:Pe.isEnabled()))return;const n=t.calculations||[],r=t.payment_options||[],i=n.find(e=>e.id===t.default_excess_id),o=n.map(e=>e.premium_total),a=o.length>0?Math.min(...o):void 0,s=o.length>0?Math.max(...o):void 0,l=r.some(e=>"monthly"===e.amount.frequency),c={...ze(e,"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:l,min_premium:a,max_premium:s};Pe.push(c)}function je(e,t,n,r,i){if(!(null==Pe?void 0:Pe.isEnabled()))return;const o={...ze(e,"quote_at_checkout"),excess_id:t.id,excess_amount:t.excess_amount,premium_subtotal:t.premium_subtotal,premium_total:t.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:t.fees};Pe.push(o)}function We(e,t){if(!(null==Pe?void 0:Pe.isEnabled()))return;const n=t.referrals||[],r={...ze(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Pe.push(r)}function Ae(e,t,n,r){if(!(null==Pe?void 0:Pe.isEnabled()))return;const i={...ze(e,"payment_initiated"),payment_amount:t.amount.dueToday,payment_gateway:t.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:t.amount.frequency,amount_due_today:t.amount.dueToday,installments_count:t.amount.numberOfInstallments};Pe.push(i)}function Le(e,t,n,r,i,o){if(!(null==Pe?void 0:Pe.isEnabled()))return;const a={...ze(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Pe.push(a)}function Be(e,t,n,r,i,o){if(!(null==Pe?void 0:Pe.isEnabled()))return;const a={...ze(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Pe.push(a)}class qe{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isRepricing=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.selectionV2=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=e.form_definition;this.persistenceManager=new ve(t,i,n),this.autoSaveManager=new oe(this.config,this.saveFormData.bind(this)),this.navigationManager=new we(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new be(t),this.calculationManagerV2=new xe(t),this.config.autoSave&&this.autoSaveManager.start()}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}async loadFormProgress(){var e,t;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(t=null===(e=this.formData.page_data)||void 0===e?void 0:e.Y)||void 0===t?void 0:t.lastCalculationFailed),this.config.autoSave=!1,this.autoSaveManager.stop(),this.notify(),this.formData}updatePageData(e,t){this.pendingChanges[e]={...this.pendingChanges[e],...t},this.formData.page_data={...this.formData.page_data,[e]:{...this.formData.page_data[e],...t}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(e,t,n){if(this.autoSaveManager.startTyping(),"string"==typeof n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);i&&"email"===i.type&&(n=n.trim())}this.pendingChanges[e]||(this.pendingChanges[e]={}),this.pendingChanges[e][t]=n,this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e][t]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(e,t,n),this.notify()}updateFieldAnswer(e,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e].U||(this.formData.page_data[e].U={}),this.formData.page_data[e].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[e][n]=r,t())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(e){var n;if(this.isUserTyping())return;const r=e.completed_pages||[],i=(null===(n=this.quoteIntent.form_definition)||void 0===n?void 0:n.pages.length)||0;let o=0;for(let e=0;e<i;e++)if(!r.includes(e)){o=e;break}r.length===i&&i>0&&(o=i-1),t(e.current_page),this.formData={...e,current_page:o},this.notify()}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,this.selectedExcessId=this.resolveDefaultExcessId(e),t(),this.notify(),t()}getRatingFactorCodeById(e){const n=this.getFormDefinition();for(const t of n.pages)for(const n of t.fields){if(n.rating_factor_id===e)return n.code||n.id;if(n.rating_factor_mappings)for(const t of n.rating_factor_mappings)if(t.rating_factor_id===e)return t.rating_factor_code||n.code||n.id}return t(),null}processRatingFactorMappings(e){const t=this.getFormDefinition(),n={};return t.pages.forEach(t=>{const r=e.page_data[t.id]||{};t.fields.forEach(e=>{const t=r[e.code||e.id];null!=t&&""!==t&&e.rating_factor_mappings&&e.rating_factor_mappings.length>0&&e.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(t,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${e.code||e.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){switch(t(JSON.stringify(r)),n){case"calculate_age":return this.calculateAge(e,r);case"invert_yes_no":return this.invertYesNo(e);default:return null}}invertYesNo(e){return"Yes"===e?"No":"Yes"}calculateAge(e,t){try{const n=new Date(e),r="current_date"===(null==t?void 0:t.reference_date)?new Date:new Date((null==t?void 0:t.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(e){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,V:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const e=this.formData;r.current_page===e.current_page?this.formData=o:this.formData={...o,current_page:e.current_page,completed_pages:e.completed_pages,last_updated:e.last_updated},this.notify()}}catch(e){if(e&&"object"==typeof e&&"type"in e&&"message"in e){const t=e;if(!t.validationErrors||0===Object.keys(t.validationErrors).length){const e=ke("validation",t);this.addGeneralError(e),this.notify()}}throw e}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(e){return this.navigationManager.canNavigateToPage(e)}navigateToPage(e){return this.navigationManager.navigateToPage(e)}async navigateToNextPage(){var e,t;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(t=null===(e=this.quoteIntent.form_definition)||void 0===e?void 0:e.pages[n-1])||void 0===t?void 0:t.title;Me(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}getIsRepricing(){return this.isRepricing}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}resolveDefaultExcessId(e){var t,n,r;const i=null!==(t=e.calculations)&&void 0!==t?t:[],o=e.default_excess_id;return o&&i.some(e=>e.id===o)?o:null!==(r=null===(n=i[0])||void 0===n?void 0:n.id)&&void 0!==r?r:null}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(e){this.selectedExcessId=e,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(e){this.selectedPaymentOption=e,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const e=this.getCurrentPageIndex(),t=this.getFormDefinition().pages[e];if(!t)return[];const n=ge(t,this.getAllFormDataFlattened());return this.validationErrors=n.errors,this.notify(),n.errors}validateField(e,t,n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);if(!i)return[];const o=pe(i,n);return this.validationErrors=this.validationErrors.filter(e=>e.field!==t),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(e){return this.getValidationErrors().filter(t=>t.field===e)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(e){return this.getFieldErrors(e).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(e){this.serverValidationErrors=e,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const e=this.generalErrors.filter(e=>!e.dismissed);return e.length>0?[e[e.length-1]]:[]}addGeneralError(e){this.generalErrors.push(e),this.notify()}dismissGeneralError(e){const t=this.generalErrors.find(t=>t.id===e);t&&(t.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 e=this.getFormDefinition(),t={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return fe}),r=this.getAllFormDataFlattened();e.pages.forEach(e=>{const i=this.formData.page_data[e.id]||{},o={};Object.keys(i).forEach(e=>{e.startsWith("__")&&e.endsWith("__")&&(o[e]=i[e])}),e.fields.forEach(e=>{const t=e.code||e.id,a=i[t];let s=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});s="show"===e.visibility.action?t.matched:!t.matched}s&&void 0!==a&&(o[t]=a)}),t.page_data[e.id]=o});const i=this.processRatingFactorMappings(t),o={...t,page_data:{...t.page_data,V:i}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of e.pages){const e=ge(i,r);t(i.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{if(this.isCalculating=!0,this.notify(),2===this.quoteIntent.calculator_version&&this.quoteIntent.calculate_url_v2){const e=await this.calculationManagerV2.calculate(this.quoteIntent.calculate_url_v2);if("referral"===e.outcome_type){this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null;const t=this.buildV1CompatResponseFromV2(e);return this.calculationResult=t,this.lastCalculationFailed=!1,this.persistCalculationFailureState(),We(this.quoteIntent,t),t}this.calculationResultV2=e,this.selectionV2=e.selection;const t=this.buildV1CompatResponseFromV2(e);this.calculationResult=t,this.selectedExcessId=e.selection.excess_id,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const n=this.generalErrors.filter(e=>"calculation"===e.type);return n.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===t.outcome_type?Oe(this.quoteIntent,t):"referral"===t.outcome_type&&We(this.quoteIntent,t),t}const e=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=e,this.selectedExcessId=this.resolveDefaultExcessId(e),this.lastCalculationFailed=!1,this.persistCalculationFailureState();const t=this.generalErrors.filter(e=>"calculation"===e.type);return t.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===e.outcome_type?Oe(this.quoteIntent,e):"referral"===e.outcome_type&&We(this.quoteIntent,e),e}catch(e){if(this.lastCalculationFailed=!0,this.persistCalculationFailureState(),e&&"object"==typeof e&&"type"in e&&"VERSION_INVALIDATED"===e.type)throw e;const t={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=t,t}finally{this.isCalculating=!1,this.notify()}}async clearCalculationResults(){t();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}getCalculationResultV2(){return this.calculationResultV2}getSelectionV2(){return this.selectionV2}setV2Selection(e){var t,n,r,i;if(!this.calculationResultV2||!this.selectionV2)return;const o={cover_type_id:null!==(t=e.cover_type_id)&&void 0!==t?t:this.selectionV2.cover_type_id,excess_id:null!==(n=e.excess_id)&&void 0!==n?n:this.selectionV2.excess_id,coverage_option_ids:null!==(r=e.coverage_option_ids)&&void 0!==r?r:this.selectionV2.coverage_option_ids};if(e.cover_type_id&&e.cover_type_id!==this.selectionV2.cover_type_id){const e=this.calculationResultV2.variants.filter(e=>e.cover_type_id===o.cover_type_id),t=e.some(e=>e.excess_id===o.excess_id);if(!t){const t=null!==(i=e.find(e=>e.excess_id===this.calculationResultV2.default_excess_id))&&void 0!==i?i:e[0];t&&(o.excess_id=t.excess_id)}}this.selectionV2=o,this.selectedExcessId=o.excess_id,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2),this.notify()}async toggleV2CoverageOption(e){if(!this.calculationResultV2||!this.selectionV2||!this.quoteIntent.reprice_url_v2)return;const t=this.calculationResultV2.policy_coverage_options.find(t=>t.id===e);if(!t)return;const n=this.selectionV2.coverage_option_ids,r=n.includes(e)?n.filter(t=>t!==e):[...n,e],i={...this.selectionV2,coverage_option_ids:r};try{this.isRepricing=!0,this.notify();const e=await this.calculationManagerV2.reprice(this.quoteIntent.reprice_url_v2,i);this.calculationResultV2={...this.calculationResultV2,variants:e.variants,policy_coverage_options:e.policy_coverage_options},this.selectionV2=e.selection,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2)}catch(e){}finally{this.isRepricing=!1,this.notify()}}getV2DisplayedTotal(){if(!this.calculationResultV2||!this.selectionV2)return 0;const e=this.calculationResultV2.variants.find(e=>e.cover_type_id===this.selectionV2.cover_type_id&&e.excess_id===this.selectionV2.excess_id);return e?Math.round(100*e.pricing.total_payable)/100:0}async bindV2(e){if(!this.quoteIntent.bind_url_v2||!this.selectionV2)throw new Error("v2 bind unavailable — missing bind URL or selection");const t=this.getV2DisplayedTotal();return this.calculationManagerV2.bind(this.quoteIntent.bind_url_v2,{selection:this.selectionV2,client_claimed_total:t,email:e})}buildV1CompatResponseFromV2(e){var t;const n=null!==(t=this.selectionV2)&&void 0!==t?t:e.selection,r=e.variants.filter(e=>e.cover_type_id===n.cover_type_id),i=r.map(t=>{var n;const r=e.excess_options.find(e=>e.id===t.excess_id);return{id:t.excess_id,calculation_id:e.id,excess_amount:null!==(n=null==r?void 0:r.excess_amount)&&void 0!==n?n:0,excess_label:null==r?void 0:r.excess_label,description:void 0,premium_base:t.pricing.subtotal-t.pricing.fees,premium_subtotal:t.pricing.subtotal,premium_total:t.pricing.total_payable,fees:[]}});return{quote_intent:e.quote_intent,product_name:e.product_name,default_excess_id:e.default_excess_id,default_coverage_options:n.coverage_option_ids,outcome_type:e.outcome_type,referral_reason:e.referral_reason,calculations:i,referrals:e.referrals.map(e=>({id:e.id,reason:e.reason})),clauses:e.clauses,payment_options:[],payment_gateways:e.payment_gateways}}notify(){this.subscribers.forEach(e=>e(this))}getAllFormDataFlattened(){const e={};return Object.values(this.formData.page_data).forEach(t=>{const{U:n,...r}=t;Object.assign(e,r),n&&Object.keys(n).length>0&&(e.U||(e.U={}),Object.assign(e.U,n))}),e}updateFormDataInternal(e){if(this.isUserTyping()&&e.page_data){const t={...e};delete t.page_data,this.formData={...this.formData,...t}}else this.formData={...this.formData,...e};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var e,t,n;return!!(null===(n=null===(t=null===(e=this.quoteIntent.form_data)||void 0===e?void 0:e.page_data)||void 0===t?void 0:t.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 e=new URL(window.location.href);e.searchParams.delete("url"),window.history.replaceState({},document.title,e.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(e){if(this.quoteIntentStore){const t=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,e);t&&(this.quoteIntent=t,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const a=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),s=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return a&&Ae(this.quoteIntent,a,o.name,null==s?void 0:s.excess_amount),this.notify(),t}catch(e){throw e}}async getPaymentStatus(e){var t;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(t=this.calculationResult)||void 0===t?void 0:t.payment_gateways)||[]).find(e=>e.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const t=await this.httpClient.getPaymentStatus(e,r);return this.notify(),t}catch(e){throw e}}startPaymentStatusPolling(e,t,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const a=await this.getPaymentStatus(e);t(a),"pending"!==a.status&&"initiated"!==a.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(e){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Fe{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){var t;const n=this.response.product.form_definition,r={...this.response.quote_intent.form_data};r.page_data||(r.page_data={});for(const i of n.pages){const n=r.page_data[i.id]||{};for(const r of i.fields){const i=r.code||r.id;if(e.hasOwnProperty(i)?n[i]=e[i]:("text"===r.type&&(n[i]="sample"),"number"===r.type&&(n[i]=1),"checkbox"===r.type&&(n[i]=!0)),"boolean"===r.type&&(null===(t=r.boolean_config)||void 0===t?void 0:t.enable_details_textbox)){const e="yes"===r.boolean_config.show_details_on,t=n[i];(t===e||t===String(e))&&(n.U||(n.U={}),n.U[i]=`Sample details for: ${i}`)}}r.page_data[i.id]=n}const i={current_page_index:0,save_type:"full",page_data:{...r.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,i)}async replaceFormData(e,t){var n;return await this.httpClient.updateQuoteIntent(this.response.url,{current_page_index:0,save_type:null!==(n=null==t?void 0:t.saveType)&&void 0!==n?n:"full",page_data:e})}}class He{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Fe(this.httpClient,n)}}var Ue=0;function Ye(e,t,n,i,o,a){t||(t={});var s,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?s=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:s,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Ue,_:-1,C:0,J:o,K:a};if("function"==typeof e&&(s=e.defaultProps))for(l in s)void 0===c[l]&&(c[l]=s[l]);return r.vnode&&r.vnode(d),d}var Ze,Ve,Ge,Qe,Je=0,Ke=[],Xe=r,et=Xe.p,tt=Xe.O,nt=Xe.diffed,rt=Xe.k,it=Xe.unmount,ot=Xe.m;function at(e,t){Xe.W&&Xe.W(Ve,e,Je||t),Je=0;var n=Ve.X||(Ve.X={m:[],W:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function st(e){return Je=1,function(e,t){var n=at(Ze++,2);if(n.t=e,!n.k&&(n.m=[vt(void 0,t),function(e){var t=n.ee?n.ee[0]:n.m[0],r=n.t(t,e);t!==r&&(n.ee=[r,n.m[1]],n.k.setState({}))}],n.k=Ve,!Ve.te)){var r=function(e,t,r){if(!n.k.X)return!0;var o=n.k.X.m.filter(function(e){return e.k});if(o.every(function(e){return!e.ee}))return!i||i.call(this,e,t,r);var a=n.k.props!==e;return o.some(function(e){if(e.ee){var t=e.m[0];e.m=e.ee,e.ee=void 0,t!==e.m[0]&&(a=!0)}}),i&&i.call(this,e,t,r)||a};Ve.te=!0;var i=Ve.shouldComponentUpdate,o=Ve.componentWillUpdate;Ve.componentWillUpdate=function(e,t,n){if(this.v){var a=i;i=void 0,r(e,t,n),i=a}o&&o.call(this,e,t,n)},Ve.shouldComponentUpdate=r}return n.ee||n.m}(vt,e)}function lt(e,t){var n=at(Ze++,3);!Xe.L&&yt(n.X,t)&&(n.m=e,n.u=t,Ve.X.W.push(n))}function ct(e){return Je=5,dt(function(){return{current:e}},[])}function dt(e,t){var n=at(Ze++,7);return yt(n.X,t)&&(n.m=e(),n.X=t,n.W=e),n.m}function ut(e,t){return Je=8,dt(function(){return e},t)}function ht(){for(var e;e=Ke.shift();){var t=e.X;if(e.I&&t)try{t.W.some(pt),t.W.some(gt),t.W=[]}catch(n){t.W=[],Xe.v(n,e.N)}}}Xe.p=function(e){Ve=null,et&&et(e)},Xe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),ot&&ot(e,t)},Xe.O=function(e){tt&&tt(e),Ze=0;var t=(Ve=e.k).X;t&&(Ge===Ve?(t.W=[],Ve.W=[],t.m.some(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.W.some(pt),t.W.some(gt),t.W=[],Ze=0)),Ge=Ve},Xe.diffed=function(e){nt&&nt(e);var t=e.k;t&&t.X&&(t.X.W.length&&(1!==Ke.push(t)&&Qe===Xe.requestAnimationFrame||((Qe=Xe.requestAnimationFrame)||ft)(ht)),t.X.m.some(function(e){e.u&&(e.X=e.u),e.u=void 0})),Ge=Ve=null},Xe.k=function(e,t){t.some(function(e){try{e.W.some(pt),e.W=e.W.filter(function(e){return!e.m||gt(e)})}catch(n){t.some(function(e){e.W&&(e.W=[])}),t=[],Xe.v(n,e.N)}}),rt&&rt(e,t)},Xe.unmount=function(e){it&&it(e);var t,n=e.k;n&&n.X&&(n.X.m.some(function(e){try{pt(e)}catch(e){t=e}}),n.X=void 0,t&&Xe.v(t,n.N))};var mt="function"==typeof requestAnimationFrame;function ft(e){var t,n=function(){clearTimeout(r),mt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);mt&&(t=requestAnimationFrame(n))}function pt(e){var t=Ve,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ve=t}function gt(e){var t=Ve;e.k=e.m(),Ve=t}function yt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function vt(e,t){return"function"==typeof t?t(e):t}const wt="insure-os";let bt=!1;const xt=new Map,kt={[`--${wt}-radius`]:"0.75rem",[`--${wt}-radius-sm`]:"0.5rem",[`--${wt}-radius-lg`]:"1rem",[`--${wt}-background`]:"oklch(0.955 0 0)",[`--${wt}-foreground`]:"oklch(0.145 0 0)",[`--${wt}-card`]:"oklch(1 0 0)",[`--${wt}-card-foreground`]:"oklch(0.145 0 0)",[`--${wt}-popover`]:"oklch(1 0 0)",[`--${wt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${wt}-primary`]:"oklch(0.205 0 0)",[`--${wt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${wt}-secondary`]:"oklch(0.97 0 0)",[`--${wt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${wt}-muted`]:"oklch(0.97 0 0)",[`--${wt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${wt}-accent`]:"oklch(0.97 0 0)",[`--${wt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${wt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${wt}-border`]:"oklch(0.9 0 0)",[`--${wt}-input`]:"oklch(0.9 0 0)",[`--${wt}-ring`]:"oklch(0.708 0 0)",[`--${wt}-font-family`]:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${wt}-font-size-large`]:"18px",[`--${wt}-font-size-small`]:"14px",[`--${wt}-font-size`]:"16px",[`--${wt}-border-width`]:"1px",[`--${wt}-transition-duration`]:"200ms",[`--${wt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${wt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${wt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${wt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${wt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${wt}-spacing-sm`]:"0.75rem",[`--${wt}-spacing`]:"1rem",[`--${wt}-spacing-md`]:"1.5rem",[`--${wt}-spacing-lg`]:"2rem",[`--${wt}-spacing-xl`]:"3rem"},St={colors:{background:`var(--${wt}-background)`,foreground:`var(--${wt}-foreground)`,card:`var(--${wt}-card)`,popover:`var(--${wt}-popover)`,popoverForeground:`var(--${wt}-popover-foreground)`,primary:`var(--${wt}-primary)`,primaryForeground:`var(--${wt}-primary-foreground)`,secondary:`var(--${wt}-secondary)`,muted:`var(--${wt}-muted)`,mutedForeground:`var(--${wt}-muted-foreground)`,accent:`var(--${wt}-accent)`,accentForeground:`var(--${wt}-accent-foreground)`,destructive:`var(--${wt}-destructive)`,border:`var(--${wt}-border)`,input:`var(--${wt}-input)`},fontSize:{small:`var(--${wt}-font-size-small)`,default:`var(--${wt}-font-size)`,large:`var(--${wt}-font-size-large)`},radius:{small:`var(--${wt}-radius-sm)`,default:`var(--${wt}-radius)`,large:`var(--${wt}-radius-lg)`},shadow:{sm:`var(--${wt}-shadow-sm)`,md:`var(--${wt}-shadow-md)`},spacing:{sm:`var(--${wt}-spacing-sm)`,default:`var(--${wt}-spacing)`,md:`var(--${wt}-spacing-md)`,lg:`var(--${wt}-spacing-lg)`,xl:`var(--${wt}-spacing-xl)`},fontFamily:`var(--${wt}-font-family)`,borderWidth:`var(--${wt}-border-width)`,transition:`var(--${wt}-transition-duration) var(--${wt}-transition-timing-function)`},Nt=new Set;let _t=!1;function Ct(){_t||($t(`\n/* InsureOS Style Isolation Reset */\n.${wt}-root {\n all: revert;\n /* Re-apply our base styles after reset */\n font-family: var(--${wt}-font-family);\n background-color: var(--${wt}-background);\n color: var(--${wt}-foreground);\n font-size: var(--${wt}-font-size);\n line-height: 1.5;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.${wt}-root *,\n.${wt}-root *::before,\n.${wt}-root *::after {\n box-sizing: border-box;\n}\n\n.${wt}-root img,\n.${wt}-root picture,\n.${wt}-root video,\n.${wt}-root canvas,\n.${wt}-root svg {\n display: block;\n max-width: 100%;\n}\n\n.${wt}-root button,\n.${wt}-root input,\n.${wt}-root select,\n.${wt}-root textarea {\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n}\n\n.${wt}-root button {\n cursor: pointer;\n}\n\n.${wt}-root a {\n color: inherit;\n text-decoration: inherit;\n}\n\n.${wt}-root h1,\n.${wt}-root h2,\n.${wt}-root h3,\n.${wt}-root h4,\n.${wt}-root h5,\n.${wt}-root h6 {\n font-size: inherit;\n font-weight: inherit;\n margin: 0;\n}\n\n.${wt}-root p,\n.${wt}-root ul,\n.${wt}-root ol,\n.${wt}-root blockquote,\n.${wt}-root figure {\n margin: 0;\n padding: 0;\n}\n\n.${wt}-root ul,\n.${wt}-root ol {\n list-style: none;\n}\n\n.${wt}-root table {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n.${wt}-root hr {\n margin: 0;\n border: none;\n border-top: 1px solid var(--${wt}-border);\n height: 0;\n}\n`),_t=!0,t())}function $t(e){if(!document.getElementById(`${wt}-styles`)){const e=document.createElement("style");e.id=`${wt}-styles`,document.head.appendChild(e)}document.getElementById(`${wt}-styles`).textContent+=e+"\n"}function It(e){return Object.entries(e).map(([e,t])=>{return`${n=e,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${t}`;var n}).join("; ")}function Tt(){bt||($t(`:root {\n${Object.entries(kt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),bt=!0)}const Et={name:e=>`${wt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){Tt();const r=It(t),i=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t).toString(36)}(`${e}:${r}:${n?JSON.stringify(n):""}`),o=`${e}-${i}`,a=xt.get(o);if(a)return a.fullClassName;let s=e;const l=this.name(s);return Nt.has(s)||($t(`.${l} { ${r} }`),Nt.add(s)),xt.set(o,{contentHash:i,fullClassName:l}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[s]:t})}),l},keyframes(e,t){const n=`${wt}-${e}`;return Nt.has(`keyframes-${e}`)||($t(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${It(t)} }`).join("\n")}\n}`),Nt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;$t(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${wt}-${e} { ${It(t)} }`).join("\n")}\n}`),Nt.add(n)},pseudoElement(e,t,n){let r=`${wt}-${e}`;for(const[t,n]of xt.entries())if((t.includes("-")?t.substring(0,t.lastIndexOf("-")):t)===e){r=n.fullClassName;break}const i=`${r}-${t}`;return Nt.has(i)||($t(`.${r}${t} { ${It(n)} }`),Nt.add(i)),r}};var Pt=Object.freeze({__proto__:null,baseVariables:kt,injectIsolationStyles:Ct,styles:Et,theme:St,updateBaseVariables:function(e){t(),Object.assign(kt,e);const n=document.getElementById(`${wt}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(kt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else Tt()}});function Rt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var zt,Dt={exports:{}};function Mt(){return zt||(zt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!=={}.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var o in e)t.call(e,o)&&e[o]&&(r=i(r,o));return r}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Dt)),Dt.exports}var Ot=Rt(Mt());function jt({size:e="small"}){const t=Et.create("spinner-small",{width:"16px",height:"16px"}),n=Et.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return Et.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Ye("div",{className:Et.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Ye("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:Ot(r),children:Ye("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function Wt({className:e,children:t,size:n="md"}){const r={sm:St.spacing.sm,md:St.spacing.md,lg:St.spacing.lg,xl:St.spacing.xl},i=Et.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?St.spacing.lg:"lg"===n?St.spacing.md:r[n]},"(max-width: 480px)":{padding:St.spacing.sm}});return Ye("div",{className:Ot(i,e),children:t})}const At=function(){function e(t){var n,r;return this.getChildContext||(n=new Set,(r={})[e.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.v=!0,P(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),t.children}return e.k="__cC"+g++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Lt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:a,productCodes:s,urlPromoCode:l}){return Ye(At.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:a,productCodes:s,urlPromoCode:l,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Bt(){const e=function(e){var t=Ve.context[e.k],n=at(Ze++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ve)),t.props.value):e.m}(At);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function qt(e){const t=Bt(),{formStateManager:n}=t;if(!n||"function"!=typeof n.subscribe)throw new Error("useQuoteForm can only be used in quote mode. If you're in payment link mode, use usePaymentLink instead.");const[r,i]=st(()=>e(n));return lt(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Ft extends Error{}class Ht extends Ft{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ut extends Ft{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Yt extends Ft{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Zt extends Ft{}class Vt extends Ft{constructor(e){super(`Invalid unit ${e}`)}}class Gt extends Ft{}class Qt extends Ft{constructor(){super("Zone is an abstract class")}}const Jt="numeric",Kt="short",Xt="long",en={year:Jt,month:Jt,day:Jt},tn={year:Jt,month:Kt,day:Jt},nn={year:Jt,month:Kt,day:Jt,weekday:Kt},rn={year:Jt,month:Xt,day:Jt},on={year:Jt,month:Xt,day:Jt,weekday:Xt},an={hour:Jt,minute:Jt},sn={hour:Jt,minute:Jt,second:Jt},ln={hour:Jt,minute:Jt,second:Jt,timeZoneName:Kt},cn={hour:Jt,minute:Jt,second:Jt,timeZoneName:Xt},dn={hour:Jt,minute:Jt,hourCycle:"h23"},un={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23"},hn={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23",timeZoneName:Kt},mn={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23",timeZoneName:Xt},fn={year:Jt,month:Jt,day:Jt,hour:Jt,minute:Jt},pn={year:Jt,month:Jt,day:Jt,hour:Jt,minute:Jt,second:Jt},gn={year:Jt,month:Kt,day:Jt,hour:Jt,minute:Jt},yn={year:Jt,month:Kt,day:Jt,hour:Jt,minute:Jt,second:Jt},vn={year:Jt,month:Kt,day:Jt,weekday:Kt,hour:Jt,minute:Jt},wn={year:Jt,month:Xt,day:Jt,hour:Jt,minute:Jt,timeZoneName:Kt},bn={year:Jt,month:Xt,day:Jt,hour:Jt,minute:Jt,second:Jt,timeZoneName:Kt},xn={year:Jt,month:Xt,day:Jt,weekday:Xt,hour:Jt,minute:Jt,timeZoneName:Xt},kn={year:Jt,month:Xt,day:Jt,weekday:Xt,hour:Jt,minute:Jt,second:Jt,timeZoneName:Xt};class Sn{get type(){throw new Qt}get name(){throw new Qt}get ianaName(){return this.name}get isUniversal(){throw new Qt}offsetName(e,t){throw new Qt}formatOffset(e,t){throw new Qt}offset(e){throw new Qt}equals(e){throw new Qt}get isValid(){throw new Qt}}let Nn=null;class _n extends Sn{static get instance(){return null===Nn&&(Nn=new _n),Nn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ur(e,t,n)}formatOffset(e,t){return Gr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const Cn=new Map,$n={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},In=new Map;class Tn extends Sn{static create(e){let t=In.get(e);return void 0===t&&In.set(e,t=new Tn(e)),t}static resetCache(){In.clear(),Cn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=Tn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ur(e,t,n,this.name)}formatOffset(e,t){return Gr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=function(e){let t=Cn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Cn.set(e,t)),t}(this.name);let[r,i,o,a,s,l,c]=n.formatToParts?function(e,t){const n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){const{type:t,value:i}=n[e],o=$n[t];"era"===t?r[o]=i:Nr(o)||(r[o]=parseInt(i,10))}return r}(n,t):function(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,a,s,l,c,d]=r;return[a,i,o,s,l,c,d]}(n,t);"BC"===a&&(r=1-Math.abs(r));let d=+t;const u=d%1e3;return d-=u>=0?u:1e3+u,(Br({year:r,month:i,day:o,hour:24===s?0:s,minute:l,second:c,millisecond:0})-d)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let En={};const Pn=new Map;function Rn(e,t={}){const n=JSON.stringify([e,t]);let r=Pn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),Pn.set(n,r)),r}const zn=new Map,Dn=new Map;let Mn=null;const On=new Map;function jn(e){let t=On.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),On.set(e,t)),t}const Wn=new Map;function An(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Ln{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=function(e,t={}){const n=JSON.stringify([e,t]);let r=zn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),zn.set(n,r)),r}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return zr(this.floor?Math.floor(e):jr(e,3),this.padTo)}}class Bn{constructor(e,t,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&Tn.create(n).valid?(r=n,this.dt=e):(r="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Rn(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class qn{constructor(e,t,n){this.opts={style:"long",...n},!t&&$r()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=Dn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),Dn.set(i,o)),o}(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,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(e);if("auto"===n&&o){const n="days"===e;switch(t){case 1:return n?"tomorrow":`next ${i[e][0]}`;case-1:return n?"yesterday":`last ${i[e][0]}`;case 0:return n?"today":`this ${i[e][0]}`}}const a=Object.is(t,-0)||t<0,s=Math.abs(t),l=1===s,c=i[e],d=r?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return a?`${s} ${d} ago`:`in ${s} ${d}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Fn={firstDay:1,minimalDays:4,weekend:[6,7]};class Hn{static fromOpts(e){return Hn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||lr.defaultLocale,a=o||(i?"en-US":Mn||(Mn=(new Intl.DateTimeFormat).resolvedOptions().locale,Mn)),s=t||lr.defaultNumberingSystem,l=n||lr.defaultOutputCalendar,c=Pr(r)||lr.defaultWeekSettings;return new Hn(a,s,l,c,o)}static resetCache(){Mn=null,Pn.clear(),zn.clear(),Dn.clear(),On.clear(),Wn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Hn.create(e,t,n,r)}constructor(e,t,n,r,i){const[o,a,s]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const n=e.indexOf("-u-");if(-1===n)return[e];{let t,r;try{t=Rn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=Rn(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=t;return[r,i,o]}}(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=function(e,t,n){return n||t?(e.includes("-u-")||(e+="-u"),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}(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 e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===jn(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Hn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Pr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return An(this,e,ei,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(t&=!n)?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,"month");this.monthsCache[i][e]=function(e){const t=[];for(let n=1;n<=12;n++){const r=ra.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return An(this,e,ii,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=function(e){const t=[];for(let n=1;n<=7;n++){const r=ra.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return An(this,void 0,()=>oi,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[ra.utc(2016,11,13,9),ra.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return An(this,e,ci,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[ra.utc(-40,1,1),ra.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,n){const r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Ln(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Bn(e,this.intl,t)}relFormatter(e={}){return new qn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=En[n];return r||(r=new Intl.ListFormat(e,t),En[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||jn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ir()?function(e){let t=Wn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...Fn,...t}),Wn.set(e,t)}return t}(this.locale):Fn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Un=null;class Yn extends Sn{static get utcInstance(){return null===Un&&(Un=new Yn(0)),Un}static instance(e){return 0===e?Yn.utcInstance:new Yn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Yn(Yr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Gr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Gr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Gr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class Zn extends Sn{constructor(e){super(),this.zoneName=e}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 Vn(e,t){if(Nr(e)||null===e)return t;if(e instanceof Sn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?_n.instance:"utc"===n||"gmt"===n?Yn.utcInstance:Yn.parseSpecifier(n)||Tn.create(e)}return _r(e)?Yn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Zn(e)}const Gn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Qn={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]},Jn=Gn.hanidec.replace(/[\[|\]]/g,"").split(""),Kn=new Map;function Xn({numberingSystem:e},t=""){const n=e||"latn";let r=Kn.get(n);void 0===r&&(r=new Map,Kn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Gn[n]}${t}`),r.set(t,i)),i}let er,tr=()=>Date.now(),nr="system",rr=null,ir=null,or=null,ar=60,sr=null;class lr{static get now(){return tr}static set now(e){tr=e}static set defaultZone(e){nr=e}static get defaultZone(){return Vn(nr,_n.instance)}static get defaultLocale(){return rr}static set defaultLocale(e){rr=e}static get defaultNumberingSystem(){return ir}static set defaultNumberingSystem(e){ir=e}static get defaultOutputCalendar(){return or}static set defaultOutputCalendar(e){or=e}static get defaultWeekSettings(){return sr}static set defaultWeekSettings(e){sr=Pr(e)}static get twoDigitCutoffYear(){return ar}static set twoDigitCutoffYear(e){ar=e%100}static get throwOnInvalid(){return er}static set throwOnInvalid(e){er=e}static resetCaches(){Hn.resetCache(),Tn.resetCache(),ra.resetCache(),Kn.clear()}}class cr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const dr=[0,31,59,90,120,151,181,212,243,273,304,334],ur=[0,31,60,91,121,152,182,213,244,274,305,335];function hr(e,t){return new cr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function mr(e,t,n){const r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function fr(e,t,n){return n+(Wr(e)?ur:dr)[t-1]}function pr(e,t){const n=Wr(e)?ur:dr,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function gr(e,t){return(e-t+7)%7+1}function yr(e,t=4,n=1){const{year:r,month:i,day:o}=e,a=fr(r,i,o),s=gr(mr(r,i,o),n);let l,c=Math.floor((a-s+14-t)/7);return c<1?(l=r-1,c=Fr(l,t,n)):c>Fr(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...Qr(e)}}function vr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,a=gr(mr(r,1,t),n),s=Ar(r);let l,c=7*i+o-a-7+t;c<1?(l=r-1,c+=Ar(l)):c>s?(l=r+1,c-=Ar(r)):l=r;const{month:d,day:u}=pr(l,c);return{year:l,month:d,day:u,...Qr(e)}}function wr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:fr(t,n,r),...Qr(e)}}function br(e){const{year:t,ordinal:n}=e,{month:r,day:i}=pr(t,n);return{year:t,month:r,day:i,...Qr(e)}}function xr(e,t){if(!Nr(e.localWeekday)||!Nr(e.localWeekNumber)||!Nr(e.localWeekYear)){if(!Nr(e.weekday)||!Nr(e.weekNumber)||!Nr(e.weekYear))throw new Zt("Cannot mix locale-based week fields with ISO-based week fields");return Nr(e.localWeekday)||(e.weekday=e.localWeekday),Nr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),Nr(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function kr(e){const t=Cr(e.year),n=Rr(e.month,1,12),r=Rr(e.day,1,Lr(e.year,e.month));return t?n?!r&&hr("day",e.day):hr("month",e.month):hr("year",e.year)}function Sr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Rr(t,0,23)||24===t&&0===n&&0===r&&0===i,a=Rr(n,0,59),s=Rr(r,0,59),l=Rr(i,0,999);return o?a?s?!l&&hr("millisecond",i):hr("second",r):hr("minute",n):hr("hour",t)}function Nr(e){return void 0===e}function _r(e){return"number"==typeof e}function Cr(e){return"number"==typeof e&&e%1==0}function $r(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function Ir(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function Tr(e,t,n){if(0!==e.length)return e.reduce((e,r)=>{const i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function Er(e,t){return{}.hasOwnProperty.call(e,t)}function Pr(e){if(null==e)return null;if("object"!=typeof e)throw new Gt("Week settings must be an object");if(!Rr(e.firstDay,1,7)||!Rr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Rr(e,1,7)))throw new Gt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Rr(e,t,n){return Cr(e)&&e>=t&&e<=n}function zr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function Dr(e){return Nr(e)||null===e||""===e?void 0:parseInt(e,10)}function Mr(e){return Nr(e)||null===e||""===e?void 0:parseFloat(e)}function Or(e){if(!Nr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function jr(e,t,n="round"){const r=10**t;switch(n){case"expand":return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case"trunc":return Math.trunc(e*r)/r;case"round":return Math.round(e*r)/r;case"floor":return Math.floor(e*r)/r;case"ceil":return Math.ceil(e*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function Wr(e){return e%4==0&&(e%100!=0||e%400==0)}function Ar(e){return Wr(e)?366:365}function Lr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Wr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Br(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function qr(e,t,n){return-gr(mr(e,1,t),n)+t-1}function Fr(e,t=4,n=1){const r=qr(e,t,n),i=qr(e+1,t,n);return(Ar(e)-r+i)/7}function Hr(e){return e>99?e:e>lr.twoDigitCutoffYear?1900+e:2e3+e}function Ur(e,t,n,r=null){const i=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const a={timeZoneName:t,...o},s=new Intl.DateTimeFormat(n,a).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return s?s.value:null}function Yr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Zr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Gt(`Invalid unit value ${e}`);return t}function Vr(e,t){const n={};for(const r in e)if(Er(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Zr(i)}return n}function Gr(e,t){const n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${zr(n,2)}:${zr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${zr(n,2)}${zr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Qr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Jr=["January","February","March","April","May","June","July","August","September","October","November","December"],Kr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xr=["J","F","M","A","M","J","J","A","S","O","N","D"];function ei(e){switch(e){case"narrow":return[...Xr];case"short":return[...Kr];case"long":return[...Jr];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 ti=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ni=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ri=["M","T","W","T","F","S","S"];function ii(e){switch(e){case"narrow":return[...ri];case"short":return[...ni];case"long":return[...ti];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const oi=["AM","PM"],ai=["Before Christ","Anno Domini"],si=["BC","AD"],li=["B","A"];function ci(e){switch(e){case"narrow":return[...li];case"short":return[...si];case"long":return[...ai];default:return null}}function di(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const ui={D:en,DD:tn,DDD:rn,DDDD:on,t:an,tt:sn,ttt:ln,tttt:cn,T:dn,TT:un,TTT:hn,TTTT:mn,f:fn,ff:gn,fff:wn,ffff:xn,F:pn,FF:yn,FFF:bn,FFFF:kn};class hi{static create(e,t={}){return new hi(e,t)}static parseFormat(e){let t=null,n="",r=!1;const i=[];for(let o=0;o<e.length;o++){const a=e.charAt(o);"'"===a?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),t=null,n="",r=!r):r||a===t?n+=a:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=a,t=a)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return ui[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n){if(this.opts.forceSimple)return zr(e,t);const r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(t,n)=>this.loc.extract(e,t,n),o=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",a=(t,r)=>n?function(e,t){return ei(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),s=(t,r)=>n?function(e,t){return ii(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),l=t=>{const n=hi.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},c=t=>n?function(e,t){return ci(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return di(hi.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.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 e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return n?function(e){return oi[e.hour<12?0:1]}(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.weekday);case"ccc":return s("short",!0);case"cccc":return s("long",!0);case"ccccc":return s("narrow",!0);case"EEE":return s("short",!1);case"EEEE":return s("long",!1);case"EEEEE":return s("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(t)}})}formatDurationFromString(e,t){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=e=>{switch(e[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=hi.parseFormat(t),o=i.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),a=e.shiftTo(...o.map(r).filter(e=>e));return di(i,((e,t)=>i=>{const o=r(i);if(o){const r=t.isNegativeDuration&&o!==t.largestUnit?n:1;let a;return a="negativeLargestOnly"===this.opts.signMode&&o!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(o)*r,i.length,a)}return i})(a,{isNegativeDuration:a<0,largestUnit:Object.keys(a.values)[0]}))}}const mi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function fi(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function pi(...e){return t=>e.reduce(([e,n,r],i)=>{const[o,a,s]=i(t,r);return[{...e,...o},a||n,s]},[{},null,1]).slice(0,2)}function gi(e,...t){if(null==e)return[null,null];for(const[n,r]of t){const t=n.exec(e);if(t)return r(t)}return[null,null]}function yi(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=Dr(t[n+i]);return[r,null,n+i]}}const vi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,wi=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,bi=RegExp(`${wi.source}(?:${vi.source}?(?:\\[(${mi.source})\\])?)?`),xi=RegExp(`(?:[Tt]${bi.source})?`),ki=yi("weekYear","weekNumber","weekDay"),Si=yi("year","ordinal"),Ni=RegExp(`${wi.source} ?(?:${vi.source}|(${mi.source}))?`),_i=RegExp(`(?: ${Ni.source})?`);function Ci(e,t,n){const r=e[t];return Nr(r)?n:Dr(r)}function $i(e,t){return[{hours:Ci(e,t,0),minutes:Ci(e,t+1,0),seconds:Ci(e,t+2,0),milliseconds:Or(e[t+3])},null,t+4]}function Ii(e,t){const n=!e[t]&&!e[t+1],r=Yr(e[t+1],e[t+2]);return[{},n?null:Yn.instance(r),t+3]}function Ti(e,t){return[{},e[t]?Tn.create(e[t]):null,t+1]}const Ei=RegExp(`^T?${wi.source}$`),Pi=/^-?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 Ri(e){const[t,n,r,i,o,a,s,l,c]=e,d="-"===t[0],u=l&&"-"===l[0],h=(e,t=!1)=>void 0!==e&&(t||e&&d)?-e:e;return[{years:h(Mr(n)),months:h(Mr(r)),weeks:h(Mr(i)),days:h(Mr(o)),hours:h(Mr(a)),minutes:h(Mr(s)),seconds:h(Mr(l),"-0"===l),milliseconds:h(Or(c),u)}]}const zi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Di(e,t,n,r,i,o,a){const s={year:2===t.length?Hr(Dr(t)):Dr(t),month:Kr.indexOf(n)+1,day:Dr(r),hour:Dr(i),minute:Dr(o)};return a&&(s.second=Dr(a)),e&&(s.weekday=e.length>3?ti.indexOf(e)+1:ni.indexOf(e)+1),s}const Mi=/^(?:(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 Oi(e){const[,t,n,r,i,o,a,s,l,c,d,u]=e,h=Di(t,i,r,n,o,a,s);let m;return m=l?zi[l]:c?0:Yr(d,u),[h,new Yn(m)]}const ji=/^(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$/,Wi=/^(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$/,Ai=/^(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 Li(e){const[,t,n,r,i,o,a,s]=e;return[Di(t,i,r,n,o,a,s),Yn.utcInstance]}function Bi(e){const[,t,n,r,i,o,a,s]=e;return[Di(t,s,n,r,i,o,a),Yn.utcInstance]}const qi=fi(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,xi),Fi=fi(/(\d{4})-?W(\d\d)(?:-?(\d))?/,xi),Hi=fi(/(\d{4})-?(\d{3})/,xi),Ui=fi(bi),Yi=pi(function(e,t){return[{year:Ci(e,t),month:Ci(e,t+1,1),day:Ci(e,t+2,1)},null,t+3]},$i,Ii,Ti),Zi=pi(ki,$i,Ii,Ti),Vi=pi(Si,$i,Ii,Ti),Gi=pi($i,Ii,Ti),Qi=pi($i),Ji=fi(/(\d{4})-(\d\d)-(\d\d)/,_i),Ki=fi(Ni),Xi=pi($i,Ii,Ti),eo="Invalid Duration",to={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}},no={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},...to},ro={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},...to},io=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],oo=io.slice(0).reverse();function ao(e,t,n=!1){const r={values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new uo(r)}function so(e,t){let n=t.milliseconds??0;for(const r of oo.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function lo(e,t){const n=so(e,t)<0?-1:1;io.reduceRight((r,i)=>{if(Nr(t[i]))return r;if(r){const o=t[r]*n,a=e[i][r],s=Math.floor(o/a);t[i]+=s*n,t[r]-=s*a*n}return i},null),io.reduce((n,r)=>{if(Nr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function co(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class uo{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?ro:no;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Hn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return uo.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Gt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new uo({values:Vr(e,uo.normalizeUnit),loc:Hn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(_r(e))return uo.fromMillis(e);if(uo.isDuration(e))return e;if("object"==typeof e)return uo.fromObject(e);throw new Gt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return gi(e,[Pi,Ri])}(e);return n?uo.fromObject(n,t):uo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return gi(e,[Ei,Qi])}(e);return n?uo.fromObject(n,t):uo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the Duration is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Yt(n);return new uo({invalid:n})}static normalizeUnit(e){const t={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"}[e?e.toLowerCase():e];if(!t)throw new Vt(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?hi.create(this.loc,n).formatDurationFromString(this,e):eo}toHuman(e={}){if(!this.isValid)return eo;const t=!1!==e.showZeros,n=io.map(n=>{const r=this.values[n];return Nr(r)||0===r&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=jr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},ra.fromMillis(t,{zone:"UTC"}).toISOTime(e))}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?so(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=uo.fromDurationLike(e),n={};for(const e of io)(Er(t.values,e)||Er(this.values,e))&&(n[e]=t.get(e)+this.get(e));return ao(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=uo.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Zr(e(this.values[n],n));return ao(this,{values:t},!0)}get(e){return this[uo.normalizeUnit(e)]}set(e){return this.isValid?ao(this,{values:{...this.values,...Vr(e,uo.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return ao(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return lo(this.matrix,e),ao(this,{values:e},!0)}rescale(){return this.isValid?ao(this,{values:co(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>uo.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of io)if(e.indexOf(o)>=0){i=o;let e=0;for(const t in n)e+=this.matrix[t][o]*n[t],n[t]=0;_r(r[o])&&(e+=r[o]);const a=Math.trunc(e);t[o]=a,n[o]=(1e3*e-1e3*a)/1e3}else _r(r[o])&&(n[o]=r[o]);for(const e in n)0!==n[e]&&(t[i]+=e===i?n[e]:n[e]/this.matrix[i][e]);return lo(this.matrix,t),ao(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return ao(this,{values:e},!0)}removeZeros(){return this.isValid?ao(this,{values:co(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(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const n of io)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ho="Invalid Interval";class mo{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the Interval is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Ut(n);return new mo({invalid:n})}static fromDateTimes(e,t){const n=ia(e),r=ia(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?mo.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:mo.invalid("missing or invalid end"):mo.invalid("missing or invalid start")}(n,r);return null==i?new mo({start:n,end:r}):i}static after(e,t){const n=uo.fromDurationLike(t),r=ia(e);return mo.fromDateTimes(r,r.plus(n))}static before(e,t){const n=uo.fromDurationLike(t),r=ia(e);return mo.fromDateTimes(r.minus(n),r)}static fromISO(e,t){const[n,r]=(e||"").split("/",2);if(n&&r){let e,i,o,a;try{e=ra.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=ra.fromISO(r,t),a=o.isValid}catch(r){a=!1}if(i&&a)return mo.fromDateTimes(e,o);if(i){const n=uo.fromISO(r,t);if(n.isValid)return mo.after(e,n)}else if(a){const e=uo.fromISO(n,t);if(e.isValid)return mo.before(o,e)}}return mo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.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(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&this.s<=e&&this.e>e}set({start:e,end:t}={}){return this.isValid?mo.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(ia).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const e=t[i]||this.e,o=+e>+this.e?this.e:e;n.push(mo.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=uo.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));n=+e>+this.e?this.e:e,o.push(mo.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&this.s<=e.s&&this.e>=e.e}equals(e){return!(!this.isValid||!e.isValid)&&this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:mo.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return mo.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const r=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),o=[].concat(...i).sort((e,t)=>e.time-t.time);for(const e of o)n+="s"===e.type?1:-1,1===n?t=e.time:(t&&+t!==+e.time&&r.push(mo.fromDateTimes(t,e.time)),t=null);return mo.merge(r)}difference(...e){return mo.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ho}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=en,t={}){return this.isValid?hi.create(this.s.loc.clone(t),e).formatInterval(this):ho}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ho}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ho}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ho}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ho}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):uo.invalid(this.invalidReason)}mapEndpoints(e){return mo.fromDateTimes(e(this.s),e(this.e))}}class fo{static hasDST(e=lr.defaultZone){const t=ra.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Tn.isValidZone(e)}static normalizeZone(e){return Vn(e,lr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Hn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Hn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Hn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Hn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Hn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Hn.create(t,null,"gregory").eras(e)}static features(){return{relative:$r(),localeWeek:Ir()}}}function po(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(uo.fromMillis(r).as("days"))}function go(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(-1!==e[n].search(Gn.hanidec))t+=Jn.indexOf(e[n]);else for(const e in Qn){const[n,i]=Qn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const yo=`[ ${String.fromCharCode(160)}]`,vo=new RegExp(yo,"g");function wo(e){return e.replace(/\./g,"\\.?").replace(vo,yo)}function bo(e){return e.replace(/\./g,"").replace(vo," ").toLowerCase()}function xo(e,t){return null===e?null:{regex:RegExp(e.map(wo).join("|")),deser:([n])=>e.findIndex(e=>bo(n)===bo(e))+t}}function ko(e,t){return{regex:e,deser:([,e,t])=>Yr(e,t),groups:t}}function So(e){return{regex:e,deser:([e])=>e}}const No={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 _o=null;function Co(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=To(hi.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class $o{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Co(hi.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Xn(t),r=Xn(t,"{2}"),i=Xn(t,"{3}"),o=Xn(t,"{4}"),a=Xn(t,"{6}"),s=Xn(t,"{1,2}"),l=Xn(t,"{1,3}"),c=Xn(t,"{1,6}"),d=Xn(t,"{1,9}"),u=Xn(t,"{2,4}"),h=Xn(t,"{4,6}"),m=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},f=(f=>{if(e.literal)return m(f);switch(f.val){case"G":return xo(t.eras("short"),0);case"GG":return xo(t.eras("long"),0);case"y":return go(c);case"yy":case"kk":return go(u,Hr);case"yyyy":case"kkkk":return go(o);case"yyyyy":return go(h);case"yyyyyy":return go(a);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return go(s);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return go(r);case"MMM":return xo(t.months("short",!0),1);case"MMMM":return xo(t.months("long",!0),1);case"LLL":return xo(t.months("short",!1),1);case"LLLL":return xo(t.months("long",!1),1);case"o":case"S":return go(l);case"ooo":case"SSS":return go(i);case"u":return So(d);case"uu":return So(s);case"uuu":case"E":case"c":return go(n);case"a":return xo(t.meridiems(),0);case"EEE":return xo(t.weekdays("short",!1),1);case"EEEE":return xo(t.weekdays("long",!1),1);case"ccc":return xo(t.weekdays("short",!0),1);case"cccc":return xo(t.weekdays("long",!0),1);case"Z":case"ZZ":return ko(new RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case"ZZZ":return ko(new RegExp(`([+-]${s.source})(${r.source})?`),2);case"z":return So(/[a-z_+-/]{1,256}?/i);case" ":return So(/[^\S\n\r]/);default:return m(f)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return f.token=e,f}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function(e){const t=e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"");return[`^${t}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,n]=function(e,t,n){const r=e.match(t);if(r){const e={};let t=1;for(const i in n)if(Er(n,i)){const o=n[i],a=o.groups?o.groups+1:1;!o.literal&&o.token&&(e[o.token.val[0]]=o.deser(r.slice(t,t+a))),t+=a}return[r,e]}return[r,{}]}(e,this.regex,this.handlers),[r,i,o]=n?function(e){let t,n=null;Nr(e.z)||(n=Tn.create(e.z)),Nr(e.Z)||(n||(n=new Yn(e.Z)),t=e.Z),Nr(e.q)||(e.M=3*(e.q-1)+1),Nr(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),Nr(e.u)||(e.S=Or(e.u));const r=Object.keys(e).reduce((t,n)=>{const r=(e=>{switch(e){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&&(t[r]=e[n]),t},{});return[r,n,t]}(n):[null,null,void 0];if(Er(n,"a")&&Er(n,"H"))throw new Zt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Io(e,t,n){return new $o(e,n).explainFromTokens(t)}function To(e,t){if(!e)return null;const n=hi.create(t,e).dtFormatter((_o||(_o=ra.fromMillis(1555555555555)),_o)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>function(e,t,n){const{type:r,value:i}=e;if("literal"===r){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const o=t[r];let a=r;"hour"===r&&(a=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let s=No[a];if("object"==typeof s&&(s=s[o]),s)return{literal:!1,val:s}}(t,e,i))}const Eo="Invalid DateTime",Po=864e13;function Ro(e){return new cr("unsupported zone",`the zone "${e.name}" is not supported`)}function zo(e){return null===e.weekData&&(e.weekData=yr(e.c)),e.weekData}function Do(e){return null===e.localWeekData&&(e.localWeekData=yr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Mo(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new ra({...n,...t,old:n})}function Oo(e,t,n){let r=e-60*t*1e3;const i=n.offset(r);if(t===i)return[r,t];r-=60*(i-t)*1e3;const o=n.offset(r);return i===o?[r,i]:[e-60*Math.min(i,o)*1e3,Math.max(i,o)]}function jo(e,t){const n=new Date(e+=60*t*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 Wo(e,t,n){return Oo(Br(e),t,n)}function Ao(e,t){const n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),o={...e.c,year:r,month:i,day:Math.min(e.c.day,Lr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},a=uo.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),s=Br(o);let[l,c]=Oo(s,n,e.zone);return 0!==a&&(l+=a,c=e.zone.offset(l)),{ts:l,o:c}}function Lo(e,t,n,r,i,o){const{setZone:a,zone:s}=n;if(e&&0!==Object.keys(e).length||t){const r=t||s,i=ra.fromObject(e,{...n,zone:r,specificOffset:o});return a?i:i.setZone(s)}return ra.invalid(new cr("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Bo(e,t,n=!0){return e.isValid?hi.create(Hn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function qo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=zr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=zr(e.c.month),"month"===n)return i;i+="-"}else if(i+=zr(e.c.month),"month"===n)return i;return i+=zr(e.c.day),i}function Fo(e,t,n,r,i,o,a){let s=!n||0!==e.c.millisecond||0!==e.c.second,l="";switch(a){case"day":case"month":case"year":break;default:if(l+=zr(e.c.hour),"hour"===a)break;if(t){if(l+=":",l+=zr(e.c.minute),"minute"===a)break;s&&(l+=":",l+=zr(e.c.second))}else{if(l+=zr(e.c.minute),"minute"===a)break;s&&(l+=zr(e.c.second))}if("second"===a)break;!s||r&&0===e.c.millisecond||(l+=".",l+=zr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?l+="Z":e.o<0?(l+="-",l+=zr(Math.trunc(-e.o/60)),l+=":",l+=zr(Math.trunc(-e.o%60))):(l+="+",l+=zr(Math.trunc(e.o/60)),l+=":",l+=zr(Math.trunc(e.o%60)))),o&&(l+="["+e.zone.ianaName+"]"),l}const Ho={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Uo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Yo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Zo=["year","month","day","hour","minute","second","millisecond"],Vo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Go=["year","ordinal","hour","minute","second","millisecond"];function Qo(e){const t={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"}[e.toLowerCase()];if(!t)throw new Vt(e);return t}function Jo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Qo(e)}}function Ko(e,t){const n=Vn(t.zone,lr.defaultZone);if(!n.isValid)return ra.invalid(Ro(n));const r=Hn.fromObject(t);let i,o;if(Nr(e.year))i=lr.now();else{for(const t of Zo)Nr(e[t])&&(e[t]=Ho[t]);const t=kr(e)||Sr(e);if(t)return ra.invalid(t);const r=function(e){if(void 0===ta&&(ta=lr.now()),"iana"!==e.type)return e.offset(ta);const t=e.name;let n=na.get(t);return void 0===n&&(n=e.offset(ta),na.set(t,n)),n}(n);[i,o]=Wo(e,r,n)}return new ra({ts:i,zone:n,loc:r,o:o})}function Xo(e,t,n){const r=!!Nr(n.round)||n.round,i=Nr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=jr(e,r||n.calendary?0:2,n.calendary?"round":i),t.loc.clone(n).relFormatter(n).format(e,o)),a=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return o(a(n.unit),n.unit);for(const e of n.units){const t=a(e);if(Math.abs(t)>=1)return o(t,e)}return o(e>t?-0:0,n.units[n.units.length-1])}function ea(e){let t,n={};return e.length>0&&"object"==typeof e[e.length-1]?(n=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[n,t]}let ta;const na=new Map;class ra{constructor(e){const t=e.zone||lr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new cr("invalid input"):null)||(t.isValid?null:Ro(t));this.ts=Nr(e.ts)?lr.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const o=_r(e.o)&&!e.old?e.o:t.offset(this.ts);r=jo(this.ts,o),n=Number.isNaN(r.year)?new cr("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Hn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new ra({})}static local(){const[e,t]=ea(arguments),[n,r,i,o,a,s,l]=t;return Ko({year:n,month:r,day:i,hour:o,minute:a,second:s,millisecond:l},e)}static utc(){const[e,t]=ea(arguments),[n,r,i,o,a,s,l]=t;return e.zone=Yn.utcInstance,Ko({year:n,month:r,day:i,hour:o,minute:a,second:s,millisecond:l},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return ra.invalid("invalid input");const r=Vn(t.zone,lr.defaultZone);return r.isValid?new ra({ts:n,zone:r,loc:Hn.fromObject(t)}):ra.invalid(Ro(r))}static fromMillis(e,t={}){if(_r(e))return e<-Po||e>Po?ra.invalid("Timestamp out of range"):new ra({ts:e,zone:Vn(t.zone,lr.defaultZone),loc:Hn.fromObject(t)});throw new Gt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(_r(e))return new ra({ts:1e3*e,zone:Vn(t.zone,lr.defaultZone),loc:Hn.fromObject(t)});throw new Gt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Vn(t.zone,lr.defaultZone);if(!n.isValid)return ra.invalid(Ro(n));const r=Hn.fromObject(t),i=Vr(e,Jo),{minDaysInFirstWeek:o,startOfWeek:a}=xr(i,r),s=lr.now(),l=Nr(t.specificOffset)?n.offset(s):t.specificOffset,c=!Nr(i.ordinal),d=!Nr(i.year),u=!Nr(i.month)||!Nr(i.day),h=d||u,m=i.weekYear||i.weekNumber;if((h||c)&&m)throw new Zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Zt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=jo(s,l);f?(p=Vo,g=Uo,y=yr(y,o,a)):c?(p=Go,g=Yo,y=wr(y)):(p=Zo,g=Ho);let v=!1;for(const e of p)Nr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=Cr(e.weekYear),i=Rr(e.weekNumber,1,Fr(e.weekYear,t,n)),o=Rr(e.weekday,1,7);return r?i?!o&&hr("weekday",e.weekday):hr("week",e.weekNumber):hr("weekYear",e.weekYear)}(i,o,a):c?function(e){const t=Cr(e.year),n=Rr(e.ordinal,1,Ar(e.year));return t?!n&&hr("ordinal",e.ordinal):hr("year",e.year)}(i):kr(i),b=w||Sr(i);if(b)return ra.invalid(b);const x=f?vr(i,o,a):c?br(i):i,[k,S]=Wo(x,l,n),N=new ra({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?ra.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:ra.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return gi(e,[qi,Yi],[Fi,Zi],[Hi,Vi],[Ui,Gi])}(e);return Lo(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return gi(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Mi,Oi])}(e);return Lo(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return gi(e,[ji,Li],[Wi,Li],[Ai,Bi])}(e);return Lo(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(Nr(e)||Nr(t))throw new Gt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[a,s,l,c]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:a}=Io(e,t,n);return[r,i,o,a]}(o,e,t);return c?ra.invalid(c):Lo(a,s,n,`format ${t}`,e,l)}static fromString(e,t,n={}){return ra.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return gi(e,[Ji,Yi],[Ki,Xi])}(e);return Lo(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the DateTime is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Ht(n);return new ra({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=To(e,Hn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return Co(hi.parseFormat(e),Hn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){ta=void 0,na.clear()}get(e){return this[e]}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.ie}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?zo(this).weekYear:NaN}get weekNumber(){return this.isValid?zo(this).weekNumber:NaN}get weekday(){return this.isValid?zo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Do(this).weekday:NaN}get localWeekNumber(){return this.isValid?Do(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Do(this).weekYear:NaN}get ordinal(){return this.isValid?wr(this.c).ordinal:NaN}get monthShort(){return this.isValid?fo.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?fo.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?fo.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?fo.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 e=864e5,t=6e4,n=Br(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-r*t),a=this.zone.offset(n-i*t);if(o===a)return[this];const s=n-o*t,l=n-a*t,c=jo(s,o),d=jo(l,a);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Mo(this,{ts:s}),Mo(this,{ts:l})]:[this]}get isInLeapYear(){return Wr(this.year)}get daysInMonth(){return Lr(this.year,this.month)}get daysInYear(){return this.isValid?Ar(this.year):NaN}get weeksInWeekYear(){return this.isValid?Fr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Fr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=hi.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Yn.instance(e),t)}toLocal(){return this.setZone(lr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Vn(e,lr.defaultZone)).equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||n){const t=e.offset(this.ts),n=this.toObject();[r]=Wo(n,t,e)}return Mo(this,{ts:r,zone:e})}return ra.invalid(Ro(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return Mo(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Vr(e,Jo),{minDaysInFirstWeek:n,startOfWeek:r}=xr(t,this.loc),i=!Nr(t.weekYear)||!Nr(t.weekNumber)||!Nr(t.weekday),o=!Nr(t.ordinal),a=!Nr(t.year),s=!Nr(t.month)||!Nr(t.day),l=a||s,c=t.weekYear||t.weekNumber;if((l||o)&&c)throw new Zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(s&&o)throw new Zt("Can't mix ordinal dates with month/day");let d;i?d=vr({...yr(this.c,n,r),...t},n,r):Nr(t.ordinal)?(d={...this.toObject(),...t},Nr(t.day)&&(d.day=Math.min(Lr(d.year,d.month),d.day))):d=br({...wr(this.c),...t});const[u,h]=Wo(d,this.o,this.zone);return Mo(this,{ts:u,o:h})}plus(e){return this.isValid?Mo(this,Ao(this,uo.fromDurationLike(e))):this}minus(e){return this.isValid?Mo(this,Ao(this,uo.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=uo.normalizeUnit(e);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(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;if("quarters"===r){const e=Math.ceil(this.month/3);n.month=3*(e-1)+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?hi.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Eo}toLocaleString(e=en,t={}){return this.isValid?hi.create(this.loc.clone(t),e).formatDateTime(this):Eo}toLocaleParts(e={}){return this.isValid?hi.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const a="extended"===e;let s=qo(this,a,o=Qo(o));return Zo.indexOf(o)>=3&&(s+="T"),s+=Fo(this,a,t,n,r,i,o),s}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?qo(this,"extended"===e,Qo(t)):null}toISOWeekDate(){return Bo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=Qo(a),(r&&Zo.indexOf(a)>=3?"T":"")+Fo(this,"extended"===o,t,e,n,i,a)):null}toRFC2822(){return Bo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Bo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?qo(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(n&&(r+=" "),t?r+="z":e&&(r+="ZZ")),Bo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Eo}[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(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return uo.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(s=t,Array.isArray(s)?s:[s]).map(uo.normalizeUnit),o=e.valueOf()>this.valueOf(),a=function(e,t,n,r){let[i,o,a,s]=function(e,t,n){const r=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const n=po(e,t);return(n-n%7)/7}],["days",po]],i={},o=e;let a,s;for(const[l,c]of r)n.indexOf(l)>=0&&(a=l,i[l]=c(e,t),s=o.plus(i),s>t?(i[l]--,(e=o.plus(i))>t&&(s=e,i[l]--,e=o.plus(i))):e=s);return[e,i,s,a]}(e,t,n);const l=t-i,c=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(a<t&&(a=i.plus({[s]:1})),a!==i&&(o[s]=(o[s]||0)+l/(a-i)));const d=uo.fromObject(o,r);return c.length>0?uo.fromMillis(l,r).shiftTo(...c).plus(d):d}(o?this:e,o?e:this,i,r);var s;return o?a.negate():a}diffNow(e="milliseconds",t={}){return this.diff(ra.now(),e,t)}until(e){return this.isValid?mo.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||ra.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),Xo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Xo(e.base||ra.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(ra.isDateTime))throw new Gt("min requires all arguments be DateTimes");return Tr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(ra.isDateTime))throw new Gt("max requires all arguments be DateTimes");return Tr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return Io(Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return ra.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Hn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new $o(i,e)}static fromFormatParser(e,t,n={}){if(Nr(e)||Nr(t))throw new Gt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Gt(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:a,zone:s,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?ra.invalid(c):Lo(a,s,n,`format ${t.format}`,e,l)}static get DATE_SHORT(){return en}static get DATE_MED(){return tn}static get DATE_MED_WITH_WEEKDAY(){return nn}static get DATE_FULL(){return rn}static get DATE_HUGE(){return on}static get TIME_SIMPLE(){return an}static get TIME_WITH_SECONDS(){return sn}static get TIME_WITH_SHORT_OFFSET(){return ln}static get TIME_WITH_LONG_OFFSET(){return cn}static get TIME_24_SIMPLE(){return dn}static get TIME_24_WITH_SECONDS(){return un}static get TIME_24_WITH_SHORT_OFFSET(){return hn}static get TIME_24_WITH_LONG_OFFSET(){return mn}static get DATETIME_SHORT(){return fn}static get DATETIME_SHORT_WITH_SECONDS(){return pn}static get DATETIME_MED(){return gn}static get DATETIME_MED_WITH_SECONDS(){return yn}static get DATETIME_MED_WITH_WEEKDAY(){return vn}static get DATETIME_FULL(){return wn}static get DATETIME_FULL_WITH_SECONDS(){return bn}static get DATETIME_HUGE(){return xn}static get DATETIME_HUGE_WITH_SECONDS(){return kn}}function ia(e){if(ra.isDateTime(e))return e;if(e&&e.valueOf&&_r(e.valueOf()))return ra.fromJSDate(e);if(e&&"object"==typeof e)return ra.fromObject(e);throw new Gt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function oa({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Ye("div",{className:Et.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:St.colors.accent}),children:Ye("div",{className:Et.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1",boxSizing:"border-box",overflowX:"hidden"}),children:[!i&&Ye("div",{className:Et.create("page-heading-wrapper",{width:"100%",marginBottom:St.spacing.lg}),children:Ye(Wt,{children:Ye("div",{className:Et.create("page-heading-container",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:St.radius.large,padding:`${St.spacing.lg} ${St.spacing.xl}`,boxShadow:St.shadow.md}),children:Ye("div",{className:Et.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:St.spacing.lg}),children:Ye("div",{className:Et.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Ye("h1",{className:Et.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:St.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Ye("p",{className:Et.create("page-template-description",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,lineHeight:"1.5",color:St.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function aa({title:e="Loading",message:t}){const n=Et.create("loading-container",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:St.spacing.md,minHeight:"500px"}),r=Et.create("loading-title",{margin:"0",fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,letterSpacing:"-0.01em"}),i=Et.create("loading-message",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground}),o=Et.create("loading-text-group",{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.25rem",textAlign:"center"});return Ye(oa,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:n,children:[Ye(jt,{size:"large"}),Ye("div",{className:o,children:[Ye("p",{className:r,children:e}),t&&Ye("p",{className:i,children:t})]})]})})})}function sa({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:a,...s}){const l={primary:{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,boxShadow:St.shadow.sm},outline:{border:`${St.borderWidth} solid ${St.colors.primary}`,backgroundColor:St.colors.card,color:St.colors.primary,boxShadow:St.shadow.sm}},c=Et.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:St.radius.default,cursor:"pointer",fontSize:St.fontSize.default,fontWeight:"500",transition:St.transition,fontFamily:St.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},{"(max-width: 600px)":{fontSize:"14px",paddingLeft:"1.25rem",paddingRight:"1.25rem"}}),d=Et.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"});Et.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:St.shadow.md}),Et.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:St.shadow.sm});const u=Et.create(`button-${e}`,{...l[e]});return Ye("button",{type:t,className:Ot(c,d,u,a),onClick:r||i?void 0:n,disabled:r||i,...s,children:[i&&Ye(jt,{size:"small"}),o]})}function la({className:e,children:t}){const n=Et.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Ye("div",{className:Ot(n,e),children:t})}function ca({source:e,className:t,inline:n=!1}){return e?n?Ye("span",{className:t,children:ua(e)}):Ye("div",{className:t,children:da(e)}):null}function da(e){var t;const n=e.replace(/\r\n/g,"\n").split("\n"),r=[];let i=[],o=[],a=null;const s=()=>{if(0===i.length)return;const e=i.join(" ");r.push(Ye("p",{children:ua(e)},r.length)),i=[]},l=()=>{if(0===o.length)return void(a=null);const e=o,t="ol"===a?"ol":"ul";r.push(Ye(t,{children:e.map((e,t)=>Ye("li",{children:ua(e)},t))},r.length)),o=[],a=null};for(const e of n){const n=e.trimEnd();if(""===n){s(),l();continue}const r=n.match(/^\s*[-*]\s+(.*)$/);if(r&&void 0!==r[1]){s(),a&&"ul"!==a&&l(),a="ul",o.push(r[1]);continue}const c=n.match(/^\s*\d+[.)]\s+(.*)$/);if(c&&void 0!==c[1])s(),a&&"ol"!==a&&l(),a="ol",o.push(c[1]);else{if(o.length>0){const e=o.length-1,r=null!==(t=o[e])&&void 0!==t?t:"",i=r.replace(/\s+$/,"").slice(-1);if("."!==i&&"!"!==i&&"?"!==i&&":"!==i){o[e]=`${r} ${n}`;continue}l()}i.push(n)}}return s(),l(),r}function ua(e){var t,n;const r=/\[([^\]]+)\]\((https?:\/\/[^\s)]+|mailto:[^\s)]+)\)/g,i=[];let o,a=0,s=0;for(;null!==(o=r.exec(e));){o.index>a&&i.push(Ye(C,{children:ha(e.slice(a,o.index))},s++));const r=null!==(t=o[1])&&void 0!==t?t:"",l=null!==(n=o[2])&&void 0!==n?n:"";i.push(Ye("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:ha(r)},s++)),a=o.index+o[0].length}return a<e.length&&i.push(Ye(C,{children:ha(e.slice(a))},s++)),i}function ha(e){const t=e=>ma(e,"*",e=>Ye("em",{children:e}));return ma(e,"**",e=>Ye("strong",{children:t(e)}),t)}function ma(e,t,n,r=e=>e){const i=[];let o=0,a=0;for(;o<e.length;){const s=e.indexOf(t,o);if(-1===s){i.push(Ye(C,{children:r(e.slice(o))},a++));break}const l=e.indexOf(t,s+t.length);if(-1===l){i.push(Ye(C,{children:r(e.slice(o))},a++));break}s>o&&i.push(Ye(C,{children:r(e.slice(o,s))},a++)),i.push(Ye(C,{children:n(e.slice(s+t.length,l))},a++)),o=l+t.length}return i}function fa(e,t,n){var r,i,o,a;const s=null==e?void 0:e.status_pages;if(!s)return{};const l=n?null===(r=s.per_gateway)||void 0===r?void 0:r[n]:void 0,c=null==l?void 0:l[t],d=null===(i=s.default)||void 0===i?void 0:i[t],u=null!==(o=pa(null==c?void 0:c.title))&&void 0!==o?o:pa(null==d?void 0:d.title),h=null!==(a=pa(null==c?void 0:c.body))&&void 0!==a?a:pa(null==d?void 0:d.body);let m;if("referral"===t){const e=null==c?void 0:c.steps,t=null==d?void 0:d.steps,n=e&&e.length>0?e:t;n&&n.length>0&&(m=n)}return{title:u,body:h,steps:m}}function pa(e){return"string"==typeof e&&e.length>0?e:void 0}function ga({error:e}){var t,n,r,i,o;const a=null!=e?e:{title:"Something went wrong",message:"We weren't able to load this page. Please try again in a moment.",retryable:!0},s=null!==(t=a.organisation)&&void 0!==t?t:null,l=null!==(n=null==s?void 0:s.name)&&void 0!==n?n:null,c=null!==(r=null==s?void 0:s.admin_email)&&void 0!==r?r:null,d=null!==(i=null==s?void 0:s.phone)&&void 0!==i?i:null,u=Boolean(c||d),h=fa(null==s?void 0:s.client_settings,"maintenance"),m=null!==(o=h.title)&&void 0!==o?o:a.title,f=h.body,p=Et.create("error-fallback-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),g=Et.create("error-fallback-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),y=Et.create("error-fallback-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),v=Et.create("error-fallback-header",{textAlign:"center",marginBottom:St.spacing.xl}),w=Et.create("error-fallback-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),b=Et.create("error-fallback-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),x=Et.create("error-fallback-refresh-actions",{display:"flex",justifyContent:"center",marginBottom:u?"0":St.spacing.sm}),k=Et.create("error-fallback-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),S=Et.create("error-fallback-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),N=Et.create("error-fallback-contact-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"});return Ye(oa,{title:m,noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:p,children:[Ye("div",{className:g,children:Ye(()=>Ye("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:y,children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),Ye("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),{})}),Ye("div",{className:v,children:[Ye("h1",{className:w,children:m}),f?Ye(ca,{source:f,className:b}):Ye("p",{className:b,children:a.message})]}),a.retryable&&Ye("div",{className:x,children:Ye(sa,{onClick:()=>{window.location.reload()},children:"Try Again"})}),u&&Ye("div",{className:k,children:[Ye("p",{className:S,children:l?`Need assistance? Contact ${l}`:"Need assistance? Contact us"}),Ye("div",{className:N,children:[d&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${d}`),children:[Ye(()=>Ye("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:Ye("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"]}),c&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[Ye(()=>Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),{}),"Email Us"]})]})]})]})})})})}function ya({message:e,estimatedTime:t,organisation:n}){var r;const i=(null==n?void 0:n.name)||null,o=(null==n?void 0:n.admin_email)||null,a=(null==n?void 0:n.phone)||null,s=Boolean(o||a),l=Et.create("maintenance-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),c=Et.create("maintenance-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),d=Et.create("maintenance-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),u=Et.create("maintenance-header",{textAlign:"center",marginBottom:St.spacing.xl}),h=Et.create("maintenance-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),m=Et.create("maintenance-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),f=Et.create("maintenance-estimated-time",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.sm}),p=Et.create("maintenance-refresh-actions",{display:"flex",justifyContent:"center",marginBottom:s?"0":St.spacing.sm}),g=Et.create("maintenance-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),y=Et.create("maintenance-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),v=Et.create("maintenance-contact-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),w=fa(null==n?void 0:n.client_settings,"maintenance"),b=null!==(r=w.title)&&void 0!==r?r:"We'll be right back",x=w.body;return Ye(oa,{title:b,description:"Quotes are temporarily unavailable",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:l,children:[Ye("div",{className:c,children:Ye(()=>Ye("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:d,children:Ye("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"})}),{})}),Ye("div",{className:u,children:[Ye("h1",{className:h,children:b}),x?Ye(ca,{source:x,className:m}):Ye("p",{className:m,children:e||"We're temporarily unable to issue new quotes. Please try again shortly."}),t&&Ye("p",{className:f,children:[Ye("strong",{children:"Estimated time:"})," ",t]})]}),Ye("div",{className:p,children:Ye(sa,{onClick:()=>{window.location.reload()},children:"Refresh Page"})}),s&&Ye("div",{className:g,children:[Ye("p",{className:y,children:i?`Need assistance? Contact ${i}`:"Need assistance? Contact us"}),Ye("div",{className:v,children:[a&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${a}`),children:[Ye(()=>Ye("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:Ye("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&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Ye(()=>Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),{}),"Email Us"]})]})]})]})})})})}function va({quotePageUrl:e,message:t}){const n=function(e){if(!e)return null;try{const t=new URL(e,window.location.href);return"https:"===t.protocol||"http:"===t.protocol?t.toString():null}catch(e){return null}}(e),r="#f59e0b",i="#92400e",o=Et.create("version-invalidated-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),a=Et.create("version-invalidated-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),s=Et.create("version-invalidated-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:r,color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),l=Et.create("version-invalidated-header",{textAlign:"center",marginBottom:St.spacing.xl}),c=Et.create("version-invalidated-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),d=Et.create("version-invalidated-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0 auto",maxWidth:"450px",paddingLeft:St.spacing.md,paddingRight:St.spacing.md}),u=Et.create("version-invalidated-callout-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),h=Et.create("version-invalidated-callout-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),m=Et.create("version-invalidated-callout-box",{backgroundColor:"#fef3c7",border:`1px solid ${r}`,borderRadius:St.radius.default,padding:St.spacing.md,marginBottom:St.spacing.lg,color:i}),f=Et.create("version-invalidated-callout-heading",{margin:"0",marginBottom:St.spacing.sm,fontSize:St.fontSize.default,fontWeight:"600",color:i}),p=Et.create("version-invalidated-callout-body",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.5",color:i}),g=Et.create("version-invalidated-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),y=Et.create("version-invalidated-cta",{display:"inline-block",padding:"0.75rem 1.75rem",backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:St.radius.default,textDecoration:"none",fontSize:St.fontSize.default,fontWeight:"600",border:`1px solid ${St.colors.primary}`,cursor:"pointer",transition:`background-color ${St.transition}`},{":hover":{opacity:"0.9"}});return Ye(oa,{title:"This quote needs to be restarted",description:"Start a fresh quote to get an accurate price",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:o,children:[Ye("div",{className:a,children:Ye("div",{className:s,children:Ye("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:[Ye("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),Ye("path",{d:"M21 3v5h-5"}),Ye("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),Ye("path",{d:"M3 21v-5h5"})]})})}),Ye("div",{className:l,children:[Ye("h1",{className:c,children:"This quote needs to be restarted"}),Ye("p",{className:d,children:null!=t?t:"This quote was started against an earlier version of the product. To get an accurate price, we need to start a new quote."})]}),Ye("div",{className:u,children:[Ye("h3",{className:h,children:"Before you start"}),Ye("div",{className:m,role:"alert",children:[Ye("p",{className:f,children:"Your saved answers will not carry over."}),Ye("p",{className:p,children:"When you click the button below you'll start a fresh quote and need to re-enter your details."})]}),n&&Ye("div",{className:g,children:Ye("a",{href:n,className:y,children:"Start a new quote"})})]})]})})})})}function wa({size:e="default",style:t="normal",className:n,children:r}){const i=Et.create("text",{marginTop:"0",marginBottom:"0"}),o=Et.create("text-small",{fontSize:St.fontSize.small}),a=Et.create("text-default",{fontSize:St.fontSize.default}),s=Et.create("text-italic",{fontStyle:"italic"}),l=Et.create("text-bold",{fontWeight:"bold"}),c=Et.create("text-underline",{textDecoration:"underline"}),d=Ot({[s]:"italic"===t,[l]:"bold"===t,[c]:"underline"===t}),u=Ot({[o]:"small"===e,[a]:"default"===e});return Ye("p",{className:Ot(i,u,d,n),children:r})}function ba({title:e,description:t}){return Ye("div",{className:Et.create("section-header",{}),children:[Ye("h3",{className:Et.create("section-title",{fontSize:St.fontSize.large,fontWeight:"600",margin:"0",color:St.colors.foreground}),children:e}),t&&Ye(wa,{className:Et.create("section-description",{color:St.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 xa({selected:e}){return Ye("div",{className:Ot(Et.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${St.borderWidth} solid transparent`}),e?Et.create("selected-indicator-selected",{backgroundColor:St.colors.primary}):Et.create("selected-indicator-unselected",{border:`${St.borderWidth} solid ${St.colors.border}`}))})}function ka({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount),i=e.find(e=>e.id===t);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:1===e.length?"Excess":"Excess Options"}),Ye("div",{className:Et.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Ye("div",{className:Ot(Et.create("excess-option-card",{borderRadius:St.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Et.create("excess-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("excess-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>n(e.id),children:[Ye(xa,{selected:r}),Ye("div",{className:Et.create("excess-amount",{color:St.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Ye("div",{className:Et.create("excess-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(wa,{className:Et.create("excess-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:i.description})})]})}function Sa(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function Na(e,t){return"bank_transfer"===t?"Bank Transfer":"one-time"===e?"Online Payment":"monthly"===e?"Monthly Installments":`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}function _a({paymentOptions:e,paymentGateways:t,selectedCalculationId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=dt(()=>{if(!n)return[];const r=e.filter(e=>e.calculation_id===n).map(e=>{const n=t.find(t=>t.id===e.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${e.gateway_id}`);return{...e,gateway:n}});return r.sort((e,t)=>e.amount.success!==t.amount.success?e.amount.success?-1:1:0)},[e,t,n]);return n?Ye(Ca,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Ye("div",{className:Et.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Ye(Ca,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function Ca({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Ye(ba,{title:"Payment Options"}),Ye("div",r?{className:Et.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>{var r;return Ye($a,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${null!==(r=e.gateway_method)&&void 0!==r?r:"default"}-${e.calculation_id}`)})}:{className:Et.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.muted}),children:Ye(wa,{className:Et.create("placeholder-text",{color:St.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function $a({option:e,selectedPaymentOption:t,onPaymentSelect:n}){var r,i,o,a,s,l;const c=(null!==(r=null==t?void 0:t.gateway_method)&&void 0!==r?r:null)===(null!==(i=e.gateway_method)&&void 0!==i?i:null)&&(null==t?void 0:t.gateway_id)===e.gateway_id&&(null==t?void 0:t.calculation_id)===e.calculation_id,d=e.amount.success,u=null!==(a=null!==(o=e.display_title)&&void 0!==o?o:e.gateway.display_title)&&void 0!==a?a:null,h=null!==(l=null!==(s=e.description)&&void 0!==s?s:e.gateway.description)&&void 0!==l?l:null,m=()=>d?"one-time"===e.amount.frequency?Sa(e.amount.dueToday):`${Sa(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",f=()=>h||("bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`);return Ye("div",{className:Ot(Et.create("payment-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:d?"pointer":"not-allowed",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",opacity:d?"1":"0.6"},{"(max-width: 950px)":{padding:"0.75rem",flexDirection:"column",alignItems:"stretch",gap:"0.25rem"}}),c?Et.create("payment-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("payment-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>d&&n(e),children:[Ye("div",{className:Et.create("payment-option-desktop-wrapper",{display:"flex",flexDirection:"column",flex:"1"},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("frequency-title",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:u||Na(e.amount.frequency,e.gateway.code)}),Ye("div",{className:Et.create("gateway-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:f()})]}),Ye("div",{className:Et.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 950px)":{display:"none"}}),children:[Ye(wa,{className:d?Et.create("amount-text",{textAlign:"right",color:St.colors.foreground,fontStyle:"normal"}):Et.create("amount-text-unavailable",{textAlign:"right",color:St.colors.mutedForeground,fontStyle:"italic"}),children:m()}),d&&Ye(wa,{size:"small",className:Et.create("gateway-fee-text",{textAlign:"right",color:St.colors.mutedForeground}),children:"bank_transfer"!==e.gateway.code&&e.amount.gatewayFee>0?`${Sa(e.amount.gatewayFee)} fee`:"No fees"})]}),Ye("div",{className:Et.create("payment-option-mobile-wrapper",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:"0.125rem"}}),children:[Ye("div",{className:Et.create("payment-option-title-mobile",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:u||Na(e.amount.frequency,e.gateway.code)}),Ye(wa,{className:d?Et.create("amount-text-mobile",{fontWeight:"500",color:St.colors.foreground,fontStyle:"normal"}):Et.create("amount-text-mobile-unavailable",{fontWeight:"500",color:St.colors.mutedForeground,fontStyle:"italic"}),children:[m(),d&&e.amount.gatewayFee>0&&Ye("span",{className:Et.create("gateway-fee-inline",{fontWeight:"400",fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginLeft:"0.375rem"}),children:["(",Sa(e.amount.gatewayFee)," fee)"]})]}),Ye("div",{className:Et.create("gateway-description-mobile",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:f()})]})]})}const Ia={client_full_name:e=>{const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return t?{label:"Name",value:t}:null},client_email:e=>e.email?{label:"Email",value:e.email}:null,client_phone:e=>e.phone?{label:"Phone",value:e.phone}:null,client_dob:e=>e.dob?{label:"Date of Birth",value:Ea(e.dob)}:null,client_address:e=>e.address?{label:"Address",value:e.address}:null},Ta=["client_full_name","client_email","client_phone","client_dob"],Ea=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function Pa({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o,embedded:a=!1}){var s,l,c,d,u,h;const m=dt(()=>t?e.find(e=>e.id===t):null,[e,t]),{formProgress:f,checkoutConfig:p}=qt(e=>{var t,n,r,i;return{formProgress:e.getFormProgress(),checkoutConfig:null!==(i=null===(r=null===(n=null===(t=e.getQuoteIntent())||void 0===t?void 0:t.organisation)||void 0===n?void 0:n.client_settings)||void 0===r?void 0:r.checkout)&&void 0!==i?i:null}}),g=null!=p?p:{},y=null!==(l=null===(s=null==g?void 0:g.insurance_details)||void 0===s?void 0:s.fields)&&void 0!==l?l:Ta,v=null===(d=null===(c=null==g?void 0:g.insurance_details)||void 0===c?void 0:c.show_edit_button)||void 0===d||d,w=null!==(h=null===(u=null==g?void 0:g.line_items)||void 0===u?void 0:u.visibility)&&void 0!==h?h:{},b=((null==m?void 0:m.line_item_display)||[]).filter(e=>{var t;const n=null!==(t=null==e?void 0:e.code)&&void 0!==t?t:null==e?void 0:e.line_item_code;return!n||!1!==w[n]}),x=dt(()=>{var e;const t=(null==f?void 0:f.page_data)||(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data);if(!t)return null;let n={};for(const e in t){const r=t[e];r&&"object"==typeof r&&(r.client_first_name&&(n.firstName=r.client_first_name),r.client_last_name&&(n.lastName=r.client_last_name),r.client_email&&(n.email=r.client_email),r.client_phone&&(n.phone=r.client_phone),r.client_dob&&(n.dob=r.client_dob),(r.client_address||r.client_address_line_1)&&(n.address=r.client_address||r.client_address_line_1))}return Object.keys(n).length>0?n:null},[f,o]),k=dt(()=>x?y.map(e=>{const t=Ia[e];if(!t)return null;const n=t(x);return n?{...n,code:e}:null}).filter(e=>Boolean(e)):[],[x,y]);return Ye("div",{className:Et.create(a?"cart-summary-container-embedded":"cart-summary-container",a?{}:{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm},a?{}:{"(max-width: 768px)":{padding:St.spacing.md}}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.md,color:St.colors.foreground}),children:"Insurance Details"}),k.length>0&&Ye(C,{children:[Ye("div",{className:Et.create("cart-client-details",{display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.md}),children:k.map(e=>Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e.label}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:e.value})]},e.code))}),Ye("hr",{className:Et.create("divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})})]}),Ye("div",{className:Et.create("cart-product-section",{display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),children:b.map((e,t)=>Ye("div",{className:Et.create("cart-item",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[Ye("div",{className:Et.create("cart-item-description",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground}),children:e.description}),e.show_sum_insured&&e.sum_insured&&Ye("div",{className:Et.create("cart-item-sum-insured",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:["Sum Insured: ",Sa(e.sum_insured)]})]},t))}),v&&Ye(sa,{onClick:n,disabled:r,variant:"outline",className:Et.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function Ra({clauses:e}){const[t,n]=st(!0);return 0===e.length?null:Ye("div",{className:Et.create("policy-clauses-section",{borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`,overflow:"hidden"}),children:[Ye("button",{type:"button",onClick:()=>n(!t),className:Et.create("policy-clauses-toggle",{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`${St.spacing.sm} ${St.spacing.md}`,background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",textAlign:"left"}),children:[Ye("div",{className:Et.create("policy-clauses-header",{display:"flex",alignItems:"center",gap:St.spacing.sm}),children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Ye("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Ye("polyline",{points:"14 2 14 8 20 8"}),Ye("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),Ye("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),Ye("polyline",{points:"10 9 9 9 8 9"})]}),Ye("span",{className:Et.create("policy-clauses-title",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground,opacity:"0.7"}),children:"Policy Clauses"})]}),Ye("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{transition:"transform 0.2s ease",transform:t?"rotate(180deg)":"rotate(0deg)"},children:Ye("polyline",{points:"6 9 12 15 18 9"})})]}),t&&Ye("div",{className:Et.create("policy-clauses-content",{padding:`0 ${St.spacing.md} ${St.spacing.md}`,borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.md}),children:Ye("ul",{className:Et.create("policy-clauses-list",{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:e.map((e,t)=>Ye("li",{className:Et.create("policy-clause-item",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.7",lineHeight:"1.5",paddingLeft:St.spacing.md,position:"relative"}),children:[Ye("span",{className:Et.create("policy-clause-bullet",{position:"absolute",left:"0",top:"0.6em",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:St.colors.mutedForeground,opacity:"0.5"})}),e.note||e.reference||""]},t))})})]})}function za({label:e,value:t,isTotal:n=!1,className:r}){return Ye("div",{className:Ot(Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Ye("span",{className:Et.create("summary-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e}),Ye("span",{className:Et.create("summary-value",{fontWeight:n?"600":"500",color:St.colors.foreground,fontSize:n?St.fontSize.large:"inherit"}),children:t})]})}function Da({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:a,continueLaterLoading:s=!1,showContinueLaterSuccess:l=!1}){dt(()=>n?e.find(e=>e.id===n):null,[e,n]);const c=dt(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]);return Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[r&&Ye("div",{className:Et.create("summary-section",{paddingBottom:"1rem"}),children:Ye("div",{className:Et.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Ye(C,{children:[r.amount.gatewayFee>0&&Ye(za,{label:"windcave"===(null==c?void 0:c.code)?"Credit card surcharge:":"Provider Fee:",value:Sa(r.amount.gatewayFee)}),Ye(za,{label:"Due Today:",value:Sa(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0})]}):Ye(C,{children:[r.amount.gatewayFee>0&&Ye(za,{label:"windcave"===(null==c?void 0:c.code)?"Credit card surcharge:":"Provider Fee:",value:Sa(r.amount.gatewayFee)}),r.amount.totalRepayable&&Ye(za,{label:"Total Payable:",value:Sa(Number(r.amount.totalRepayable))}),Ye(za,{label:"Due Today:",value:Sa(r.amount.dueToday)}),r.amount.installmentAmount&&r.amount.numberOfInstallments&&r.amount.numberOfInstallments>1&&Ye(za,{label:"Remaining payments:",value:`${r.amount.numberOfInstallments-1} x ${Sa(r.amount.installmentAmount)}`})]})})}),a&&Ye(sa,{onClick:a,disabled:s||l,variant:"outline",className:Et.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:St.fontSize.default,fontWeight:"500"},{"(max-width: 380px)":{fontSize:St.fontSize.small,height:"2.5rem"}}),children:l?"Email sent":s?"Sending...":"Continue Later"}),Ye(sa,{onClick:i,disabled:!o,className:Et.create("purchase-button",{width:"100%",height:"3rem",fontSize:St.fontSize.default,fontWeight:"600"},{"(max-width: 380px)":{fontSize:St.fontSize.small,height:"2.75rem"}}),children:o?"Go to Payment":n?"Select Payment Option":"Select Excess"})]})}function Ma({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Ye("div",{className:Et.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[Ye("div",{className:Et.create("success-message",{backgroundColor:St.colors.accent,border:`2px solid ${St.colors.primary}`,borderRadius:St.radius.default,padding:St.spacing.lg,textAlign:"center"}),children:[Ye("div",{className:Et.create("success-icon",{fontSize:"3rem",marginBottom:St.spacing.sm}),children:"✓"}),Ye("h3",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.primary,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Ye(wa,{className:Et.create("success-description",{margin:"0",color:St.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Ye("div",{className:Et.create("transfer-instructions",{backgroundColor:St.colors.card,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:St.spacing.lg}),children:[Ye("h4",{className:Et.create("instructions-title",{margin:"0",marginBottom:St.spacing.md,fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground}),children:"Bank Transfer Instructions"}),Ye("div",{className:Et.create("instructions-grid",{display:"grid",gap:St.spacing.md}),children:[Ye("div",{className:Et.create("detail-row-highlighted",{backgroundColor:St.colors.accent,border:`2px solid ${St.colors.primary}`,borderRadius:St.radius.default,padding:St.spacing.md}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("code",{className:Et.create("detail-value-code",{fontFamily:"monospace",fontSize:St.fontSize.large,fontWeight:"700",color:St.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Ye("button",{onClick:()=>n(e.reference,"Reference"),className:Et.create("copy-button",{background:"transparent",border:`1px solid ${St.colors.primary}`,borderRadius:St.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Ye(wa,{size:"small",className:Et.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:St.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Ye("div",{className:Et.create("detail-value",{fontSize:St.fontSize.large,fontWeight:"600",color:St.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("span",{className:Et.create("detail-value",{fontFamily:"monospace",fontSize:St.fontSize.default,color:St.colors.foreground}),children:e.bank_account_name}),Ye("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:Et.create("copy-button-small",{background:"transparent",border:`1px solid ${St.colors.border}`,borderRadius:St.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("span",{className:Et.create("detail-value",{fontFamily:"monospace",fontSize:St.fontSize.default,color:St.colors.foreground}),children:e.bank_account_number}),Ye("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:Et.create("copy-button-small",{background:"transparent",border:`1px solid ${St.colors.border}`,borderRadius:St.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Ye("div",{className:Et.create("additional-instructions",{marginTop:St.spacing.md,paddingTop:St.spacing.md,borderTop:`1px solid ${St.colors.border}`}),children:Ye("div",{className:Et.create("instructions-content",{fontSize:St.fontSize.small,color:St.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Ye("div",{className:Et.create("important-note",{backgroundColor:St.colors.muted,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:St.spacing.md}),children:Ye(wa,{size:"small",className:Et.create("note-text",{margin:"0",color:St.colors.foreground,lineHeight:"1.5"}),children:[Ye("strong",{children:"Important:"})," Your coverage will be activated once we verify receipt of your payment. This typically takes 1-2 business days. We'll send you a confirmation email once your payment is processed."]})}),Ye("div",{className:Et.create("actions",{display:"flex",justifyContent:"center"}),children:Ye(sa,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function Oa({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,onVersionInvalidated:i}){const{fsm:o}=qt(()=>({})),[a,s]=st("initiating"),[l,c]=st(null),[d,u]=st(null),[h,m]=st(null),[f,p]=st(null);lt(()=>{e&&r&&g()},[e,r]);const g=async()=>{var e,t;if(r)try{s("initiating"),c(null);const e={...r,returnUrl:window.location.href},t=await o.initiatePayment(e);if(m(t.transaction_id),t.bank_account_name&&t.reference){s("bank_transfer");const e=o.getQuoteIntent(),t=await o.httpClient.getQuoteIntent(e.url);o.updateQuoteIntent({status:t.quote_intent.status,payment_transactions:t.payment_transactions}),o.getQuoteIntent(),setTimeout(()=>{y()},500)}else{if(!t.gateway_acceptance_url)throw new Error("Invalid payment response");s("redirecting"),window.location.href=t.gateway_acceptance_url}}catch(n){if("VERSION_INVALIDATED"===(null==n?void 0:n.type)&&i)return void i({quotePageUrl:null!==(t=null===(e=null==n?void 0:n.versionInvalidated)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:null==n?void 0:n.message});c(n.message||"Failed to initiate payment"),s("failed")}},y=()=>{d&&!d.closed&&d.close(),s("initiating"),c(null),m(null),u(null),p(null),t()},v=()=>{y(),n()};return e?Ye("div","bank_transfer"===a&&f?{className:Et.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",overflowY:"auto",padding:"1rem"}),onClick:e=>{e.target===e.currentTarget&&v()},children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.background,borderRadius:St.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Ye(Ma,{details:f,onClose:v})})}:{className:Et.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:[Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`}),children:[Ye("div",{className:Et.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Ye("div",{className:Et.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(a){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Ye("h2",{className:Et.create("modal-title",{margin:"0",color:St.colors.foreground,fontSize:St.fontSize.large}),children:"Payment Processing"})]}),Ye("div",{className:Et.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Ye(wa,{className:Et.create("status-message",{fontSize:St.fontSize.default,color:St.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(a){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"}})()}),l&&Ye(wa,{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,padding:"0.75rem",backgroundColor:St.colors.destructive+"10",borderRadius:St.radius.default,border:`1px solid ${St.colors.destructive}30`}),children:l}),("redirecting"===a||"initiating"===a)&&Ye("div",{className:Et.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${St.colors.border}`,borderTop:`3px solid ${St.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Ye("div",{className:Et.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===a||"cancelled"===a?Ye(C,{children:[Ye(sa,{onClick:y,variant:"outline",children:"Close"}),"cancelled"===a&&Ye(sa,{onClick:()=>{s("initiating"),c(null),g()},children:"Try Again"})]}):Ye(sa,"completed"===a?{onClick:y,children:"Continue"}:{onClick:y,variant:"outline",disabled:"initiating"===a,children:"Cancel"})})]}),Ye("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}const ja={success:"payment_success",declined:"payment_declined",cancelled:"payment_cancelled",error:"payment_error"};function Wa({type:e,transactionId:t,isOpen:n,onClose:r,clientSettings:i,gatewayCode:o}){var a;if(!n)return null;const s=fa(i,ja[e],null!=o?o:void 0),l=(()=>{switch(e){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Ye("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:St.colors.primary||"#10b981"},children:Ye("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:Ye("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:St.colors.destructive},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"m15 9-6 6"}),Ye("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:Ye("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:St.colors.secondary},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"m15 9-6 6"}),Ye("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:Ye("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:St.colors.destructive},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"M12 8v4"}),Ye("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),c=Et.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"}),d=Et.create("modal-content",{backgroundColor:St.colors.background,borderRadius:St.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${St.borderWidth} solid ${St.colors.border}`}),u=Et.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),h=Et.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:St.colors.foreground,margin:"0"}),m=Et.create("modal-message",{color:St.colors.foreground,lineHeight:"1.5",margin:"0"});Et.create("transaction-info",{backgroundColor:St.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:St.radius.small,border:`${St.borderWidth} solid ${St.colors.border}`,fontSize:St.fontSize.small,color:St.colors.mutedForeground,wordBreak:"break-all"});const f=Et.create("modal-button",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,border:"none",borderRadius:St.radius.default,padding:"0.75rem 1.5rem",fontSize:St.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),p=Et.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Ye("div",{className:c,onClick:r,children:Ye("div",{className:d,onClick:e=>e.stopPropagation(),children:Ye("div",{className:u,children:[l.icon,Ye("div",{className:p,children:[Ye("h2",{className:h,children:null!==(a=s.title)&&void 0!==a?a:l.title}),s.body?Ye(ca,{source:s.body,className:m}):Ye("p",{className:m,children:l.message})]}),Ye("button",{className:f,onClick:r,children:l.buttonText})]})})})}function Aa({httpClient:e,transactionId:t,onResolved:n,onError:r}){const[i,o]=st(!1),a=ct(!1);return lt(()=>{if(a.current)return;a.current=!0;let i=!1;return(async()=>{var a;try{const r=await e.resolvePaymentTransaction(t);if(i)return;n(r.status,r.recovery,r.fallback)}catch(e){if(i)return;r(null!==(a=null==e?void 0:e.message)&&void 0!==a?a:"Failed to confirm payment status"),o(!0)}})(),()=>{i=!0}},[e,t]),Ye("div",{role:"status","aria-live":"polite",className:Et.create("payment-processing-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"}),children:Ye("div",{className:Et.create("payment-processing-card",{backgroundColor:St.colors.background,borderRadius:St.radius.default,border:`${St.borderWidth} solid ${St.colors.border}`,boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",padding:"2rem",maxWidth:"400px",width:"100%",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:St.spacing.md}),children:[Ye(La,{}),Ye("h2",{className:Et.create("payment-processing-title",{margin:"0",fontSize:St.fontSize.large,fontWeight:"600",color:St.colors.foreground}),children:"Payment Processing"}),Ye(wa,{children:i?"Just a moment, we're still finishing up. Hang tight, this page will update automatically.":"Hang tight, we're finalising your payment. This page will update automatically in a few seconds."})]})})}function La(){return Et.keyframes("payment-processing-spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Ye("span",{"aria-hidden":"true",className:Et.create("payment-processing-spinner",{width:"2.5rem",height:"2.5rem",borderRadius:"50%",border:`3px solid ${St.colors.border}`,borderTopColor:St.colors.primary,animation:"insure-os-payment-processing-spin 0.9s linear infinite",display:"block"})})}function Ba({isOpen:e,onClose:t,title:n,description:r,children:i,footer:o,width:a="440px"}){if(lt(()=>{if(e)return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n);function n(e){"Escape"===e.key&&t()}},[e,t]),!e)return null;const s=Et.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"}),l=Et.create("modal-content-card",{backgroundColor:St.colors.background,borderRadius:St.radius.large,boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${St.borderWidth} solid ${St.colors.border}`,width:"100%",maxWidth:a,maxHeight:"calc(100vh - 2rem)",display:"flex",flexDirection:"column",padding:St.spacing.lg,gap:St.spacing.md,overflow:"hidden"});Et.media("(max-width: 640px)",{"modal-overlay":{padding:"0.5rem"},"modal-content-card":{padding:St.spacing.md,gap:St.spacing.sm,maxHeight:"calc(100vh - 1rem)"}});const c=Et.create("modal-card-header-row",{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:St.spacing.md,flexShrink:"0"}),d=Et.create("modal-card-title",{margin:"0",fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground}),u=Et.create("modal-card-description",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.5"}),h=Et.create("modal-card-body",{display:"flex",flexDirection:"column",gap:St.spacing.sm,flex:"1 1 auto",minHeight:"0",overflowY:"auto"}),m=Et.create("modal-card-footer",{display:"flex",gap:St.spacing.sm,marginTop:St.spacing.sm,flexWrap:"wrap",justifyContent:"flex-end",flexShrink:"0"}),f=Et.create("modal-card-close",{background:"none",border:"none",padding:"0.25rem",margin:"-0.25rem -0.25rem 0 0",color:St.colors.mutedForeground,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:St.radius.default,lineHeight:"0"});Et.pseudoElement("modal-card-close",":hover",{color:St.colors.foreground,backgroundColor:St.colors.muted});const p=Et.create("modal-card-footer-close",{background:St.colors.background,border:`${St.borderWidth} solid ${St.colors.border}`,borderRadius:St.radius.default,padding:"0.5rem 1rem",fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground,cursor:"pointer"});return Et.pseudoElement("modal-card-footer-close",":hover",{backgroundColor:St.colors.muted}),Ye("div",{className:s,onClick:t,children:Ye("div",{className:l,onClick:e=>e.stopPropagation(),children:[Ye("div",{className:c,children:[Ye("h2",{className:d,children:n}),Ye("button",{type:"button",onClick:t,"aria-label":"Close",className:f,children:Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Ye("path",{d:"M18 6 6 18"}),Ye("path",{d:"m6 6 12 12"})]})})]}),Ye("div",{className:h,children:[r&&Ye("p",{className:u,children:r}),i]}),Ye("div",o?{className:m,children:o}:{className:m,children:Ye("button",{type:"button",onClick:t,className:p,children:"Close"})})]})})}function qa({isOpen:e,onClose:t,status:n,onSendEmail:r,onCopyLink:i,email:o}){const a="sending"===n.kind,s="sent"===n.kind,l=a||s,c=Et.create("continue-later-status",{margin:"0",fontSize:St.fontSize.small,color:St.colors.primary}),d=Et.create("continue-later-status-error",{margin:"0",fontSize:St.fontSize.small,color:St.colors.destructive});let u=null;return"sent"===n.kind?u=Ye("p",{className:c,children:o?`A link will be sent to ${o} shortly.`:"A link will be sent to your email shortly."}):"copied"===n.kind?u=Ye("p",{className:c,children:"Link copied to your clipboard."}):"error"===n.kind&&(u=Ye("p",{className:d,children:n.message})),Ye(Ba,{isOpen:e,onClose:t,title:"Save and continue later",description:"We'll save your progress and give you a link to come back to. Your details stay safe and only the people you share the link with can resume.",footer:Ye(C,{children:[Ye(sa,{variant:"outline",onClick:i,disabled:a,children:"Copy link"}),Ye(sa,{onClick:r,disabled:l,loading:a,children:s?"Email sent":o?"Email me a link":"Send email"})]}),children:u})}function Fa(e=0){const t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function Ha(){if("undefined"==typeof window||!window.location)return!1;const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||e.endsWith(".test")||e.endsWith(".localhost")}function Ua({results:e}){var t,n,r,i,o;const{fsm:a,selectedExcessId:s,selectedPaymentOption:l,quoteIntent:c,httpClient:d}=qt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[u,h]=st(!1),[m,f]=st(null),[p,g]=st(!1),[y,v]=st({kind:"idle"}),[w,b]=st(!1),[x,k]=st(null),S=dt(()=>{var e,t;const n=null!==(t=null===(e=null==c?void 0:c.form_data)||void 0===e?void 0:e.page_data)&&void 0!==t?t:{};for(const[e,t]of Object.entries(n))if(t&&"object"==typeof t&&t.cover_start_date)return{pageId:e,value:String(t.cover_start_date)};return null},[null==c?void 0:c.form_data]),N=null!==(t=null==S?void 0:S.value)&&void 0!==t?t:null,_=dt(()=>{if(!N)return!1;const e=new Date(N);if(Number.isNaN(e.getTime()))return!1;e.setHours(0,0,0,0);const t=new Date;return t.setHours(0,0,0,0),e<t},[N]),C=Fa(),[$,I]=st(()=>_?C:null!=N?N:C),[T,E]=st(null),[P,R]=st(null),[z,D]=st(!1),[M,O]=st(!_),[j,W]=st(!1),A=_||Ha(),L=new URLSearchParams(window.location.search),B=L.get("status"),q=L.get("transactionId")||L.get("transaction_id"),[F,H]=st(null),[U,Y]=st(null),Z="processing"===B&&!!q&&!F&&!U,V=null!=F?F:B,[G,Q]=st(!(!B||"failed"!==B&&"declined"!==B&&"cancelled"!==B)),J=e.calculations,K=e.payment_options,X=e.payment_gateways,ee=null!==(r=null===(n=J.find(e=>e.id===s))||void 0===n?void 0:n.calculation_id)&&void 0!==r?r:null;lt(()=>{const e=J.find(e=>e.id===s);if(e&&c){const t=K.some(e=>"monthly"===e.amount.frequency),n=a.getPageCompletionStatus(),r=Math.round(n.completedPages.length/n.totalPages*100);je(c,e,K.length,t,r)}},[]),lt(()=>{if(!l||!s)return;const e=J.find(e=>e.id===s);if(!e)return;if(l.calculation_id===e.calculation_id)return;const t=K.find(t=>t.gateway_id===l.gateway_id&&t.calculation_id===e.calculation_id&&t.amount.frequency===l.amount.frequency);t?a.setSelectedPaymentOption(t):a.setSelectedPaymentOption(null)},[s,l,J,K,a]);const te=async e=>{var t,n,r,i;if(!d||!(null==c?void 0:c.id))return{valid:!1,requiresRecalculation:!1};D(!0),E(null),R(null);try{const i=await d.validateQuoteCoverStartDate(c.id,e);return i.valid?(O(!0),{valid:!0,requiresRecalculation:null!==(t=i.requires_recalculation)&&void 0!==t&&t}):(O(!1),E(null!==(n=i.message)&&void 0!==n?n:"Cover start date is invalid"),R(null!==(r=i.quote_page_url)&&void 0!==r?r:null),{valid:!1,requiresRecalculation:!1})}catch(e){return O(!1),E(null!==(i=null==e?void 0:e.message)&&void 0!==i?i:"Failed to validate cover start date"),{valid:!1,requiresRecalculation:!1}}finally{D(!1)}},ne=async e=>{var t,n,r,i;if(I(e),O(!1),E(null),R(null),!e)return;const{valid:o,requiresRecalculation:s}=await te(e);if(o&&(null==S?void 0:S.pageId))try{W(s),a.updatePageData(S.pageId,{cover_start_date:e}),await a.saveFormData(!0);const o=null!==(t=null==c?void 0:c.form_data)&&void 0!==t?t:{};a.updateQuoteIntent({form_data:{...o,page_data:{...null!==(n=o.page_data)&&void 0!==n?n:{},[S.pageId]:{...null!==(i=null===(r=o.page_data)||void 0===r?void 0:r[S.pageId])&&void 0!==i?i:{},cover_start_date:e}}}}),s&&await a.calculateQuote()}catch(e){O(!1),E("Couldn't update the price for this date. Please try again.")}finally{W(!1)}};lt(()=>{_&&$&&!M&&!z&&te($)},[_,null==c?void 0:c.id]);const re=()=>{if(!s||!l)return void alert("Please select both an excess amount and payment option");if(_&&!M)return void alert("Please choose and validate a new cover start date before continuing.");const t={quoteIntentId:e.quote_intent.id,excessId:s,gatewayId:l.gateway_id,calculationId:l.calculation_id,clientDetails:{legalName:"Test"},...l.gateway_method?{gateway_method:l.gateway_method}:{},..._&&$?{coverStartDate:$}:{}};f(t),h(!0)},ie=async()=>{try{b(!0),await a.clearCalculationResults()}catch(e){alert("Failed to edit quote. Please try again.")}finally{b(!1)}},oe=()=>{const e=null==c?void 0:c.form_data;if(!(null==e?void 0:e.page_data))return null;for(const t in e.page_data){const n=e.page_data[t];if(n&&"object"==typeof n&&n.client_email)return n.client_email}return null},ae=()=>{v(e=>"sent"===e.kind?e:{kind:"idle"}),g(!0)},se=Boolean(s&&l&&(!_||M)&&!j),le=null==c?void 0:c.payment_return,ce=le&&("declined"===le.paymentStatus||"cancelled"===le.paymentStatus||"error"===le.paymentStatus)||G,de=(null==le?void 0:le.paymentStatus)||("failed"===V?"declined":"cancelled"===V?"cancelled":"error"),ue=(null==le?void 0:le.paymentTransactionId)||q||void 0,he=null===(i=null==le?void 0:le.transactionStatus)||void 0===i?void 0:i.gateway_code;return x?Ye(va,{quotePageUrl:x.quotePageUrl,message:x.message}):Ye(oa,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:[Z&&d&&q&&Ye(Aa,{httpClient:d,transactionId:q,onResolved:async e=>{const t="completed"===e?"approved":"cancelled"===e?"cancelled":"failed"===e?"declined":"error",n=new URL(window.location.href);if(n.searchParams.set("status",t),q&&n.searchParams.set("transactionId",q),window.history.replaceState({},"",n.toString()),"completed"===e&&d&&(null==c?void 0:c.url))try{const e=await d.getQuoteIntent(c.url);a.updateQuoteIntent({status:e.quote_intent.status,payment_transactions:e.payment_transactions})}catch(e){}H(t),"declined"!==t&&"cancelled"!==t&&"error"!==t||Q(!0)},onError:e=>{Y(e),Q(!0)}}),Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:J.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),(null==c?void 0:c.reference)&&Ye("p",{className:Et.create("checkout-quote-reference",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:["Quote reference: ",Ye("strong",{style:{color:St.colors.foreground,fontWeight:600},children:c.reference})]}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[e.clauses&&e.clauses.length>0&&Ye(Ra,{clauses:e.clauses}),A&&Ye(Ya,{value:$,onChange:ne,validating:z,validated:M,error:T,quotePageUrl:P,isStale:_,recalculating:j}),Ye(ka,{excessOptions:J,selectedExcessId:s,onExcessSelect:e=>a.setSelectedExcessId(e)}),Ye(_a,{paymentOptions:K,paymentGateways:X,selectedCalculationId:ee,selectedPaymentOption:l,onPaymentSelect:e=>a.setSelectedPaymentOption(e)})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{}),children:[Ye(Pa,{excessOptions:J,selectedExcessId:s,onEditQuote:ie,isEditingQuote:w,productName:e.product_name,quoteIntent:c}),Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg},{"(max-width: 950px)":{height:St.spacing.md}})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye(Da,{excessOptions:J,paymentGateways:X,selectedExcessId:s,selectedPaymentOption:l,onPurchase:re,canPurchase:se,onContinueLater:ae,continueLaterLoading:"sending"===y.kind,showContinueLaterSuccess:"sent"===y.kind})})]})})]}),Ye("div",{className:Et.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("mobile-card-summary",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye("h2",{className:Et.create("mobile-checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.5rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Ye("p",{className:Et.create("mobile-checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:J.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),Ye("hr",{className:Et.create("mobile-summary-divider",{marginTop:St.spacing.md,marginBottom:St.spacing.md,borderColor:St.colors.border})}),Ye(Pa,{excessOptions:J,selectedExcessId:s,onEditQuote:ie,isEditingQuote:w,productName:e.product_name,quoteIntent:c,embedded:!0})]}),e.clauses&&e.clauses.length>0&&Ye("div",{className:Et.create("mobile-card-clauses",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Ra,{clauses:e.clauses})}),Ye("div",{className:Et.create("mobile-card-options",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[A&&Ye(Ya,{value:$,onChange:ne,validating:z,validated:M,error:T,quotePageUrl:P,isStale:_,recalculating:j}),Ye(ka,{excessOptions:J,selectedExcessId:s,onExcessSelect:e=>a.setSelectedExcessId(e)})]}),Ye("div",{className:Et.create("mobile-card-payment",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye(_a,{paymentOptions:K,paymentGateways:X,selectedCalculationId:ee,selectedPaymentOption:l,onPaymentSelect:e=>a.setSelectedPaymentOption(e)}),Ye("hr",{className:Et.create("mobile-payment-divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})}),Ye(Da,{excessOptions:J,paymentGateways:X,selectedExcessId:s,selectedPaymentOption:l,onPurchase:re,canPurchase:se,onContinueLater:ae,continueLaterLoading:"sending"===y.kind,showContinueLaterSuccess:"sent"===y.kind})]})]}),ce&&Ye(Wa,{type:de,transactionId:ue,clientSettings:null===(o=null==c?void 0:c.organisation)||void 0===o?void 0:o.client_settings,gatewayCode:he,isOpen:!0,onClose:()=>{a.updateQuoteIntent({payment_return:void 0}),Q(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}}),Ye(Oa,{isOpen:u,onClose:()=>{h(!1),f(null)},onSuccess:()=>{h(!1),f(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},onVersionInvalidated:e=>{h(!1),f(null),k(e)},paymentRequest:m}),Ye(qa,{isOpen:p,onClose:()=>g(!1),status:y,onSendEmail:async()=>{const t=oe();if(!t)return void v({kind:"error",message:"Email address not found. Please fill in your email first."});const n=e.quote_intent.id;try{v({kind:"sending"}),await d.continueLater(n,t),v({kind:"sent"})}catch(e){v({kind:"error",message:"Failed to send link. Please try again."})}},onCopyLink:async()=>{var t;const n=(e=>{var t;const n=null===(t=null==c?void 0:c.organisation)||void 0===t?void 0:t.quote_page_url;if(n){const t=n.replace(/\/+$/,""),r=t.includes("?")?"&":"?";return`${t}${r}q=${e}`}return`${window.location.origin}${window.location.pathname}?q=${e}`})(e.quote_intent.id);try{if(null===(t=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===t?void 0:t.writeText)await navigator.clipboard.writeText(n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}v({kind:"copied"})}catch(e){v({kind:"error",message:"Could not copy link. Please copy manually."})}},email:oe()})]})]})}function Ya({value:e,onChange:t,validating:n,validated:r,error:i,quotePageUrl:o,isStale:a,recalculating:s}){const l=Fa();return Ye("div",{className:Et.create("cover-date-field",{}),children:[Ye(ba,{title:"Cover Start Date"}),Ye("div",{className:Et.create("cover-date-row",{display:"flex",alignItems:"center",gap:St.spacing.sm,marginTop:St.spacing.sm}),children:[Ye("input",{type:"date",value:e,min:l,disabled:s,onChange:e=>t(e.target.value),className:Et.create("cover-date-input",{padding:"0.5rem 1rem",border:`1px solid ${i?"#dc2626":St.colors.border}`,borderRadius:St.radius.large,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,boxSizing:"border-box",width:"auto",maxWidth:"16rem",opacity:s?"0.6":"1"})}),(n||s)&&Ye("span",{className:Et.create("cover-date-busy",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:s?"Updating price…":"Checking…"}),!n&&!s&&r&&!i&&Ye("span",{"aria-label":"Date confirmed",className:Et.create("cover-date-tick",{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",borderRadius:"9999px",backgroundColor:St.colors.primary,color:St.colors.card,flexShrink:"0"}),children:Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Ye("polyline",{points:"20 6 9 17 4 12"})})})]}),Ha()&&!a&&!i&&Ye("p",{className:Et.create("cover-date-hint",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:"Changing the cover start date re-rates this quote."}),!n&&i&&Ye("div",{className:Et.create("cover-date-error",{marginTop:St.spacing.sm}),children:[Ye("p",{className:Et.create("cover-date-error-text",{margin:"0",fontSize:St.fontSize.small,color:"#dc2626",lineHeight:"1.5"}),children:i}),o&&Ye("a",{href:o,className:Et.create("cover-date-new-quote",{display:"inline-block",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.primary,textDecoration:"underline"}),children:"Start a new quote"})]})]})}function Za({coverTypes:e,selectedCoverTypeId:t,onCoverTypeSelect:n}){const r=[...e].sort((e,t)=>e.sort_order-t.sort_order),i=e.find(e=>e.id===t);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:"Cover Type"}),Ye("div",{className:Et.create("cover-type-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Ye("div",{className:Ot(Et.create("cover-type-card",{borderRadius:St.radius.default,minWidth:"180px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Et.create("cover-type-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("cover-type-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>n(e.id),children:[Ye(xa,{selected:r}),Ye("div",{className:Et.create("cover-type-label",{color:St.colors.foreground}),children:[e.label,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Ye("div",{className:Et.create("cover-type-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(wa,{className:Et.create("cover-type-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:i.description})})]})}function Va({offers:e,selectedIds:t,onToggle:n,isCalculating:r}){if(0===e.length)return null;const i=[...e].sort((e,t)=>e.sort_order-t.sort_order);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:"Add-ons"}),Ye("div",{className:Et.create("coverage-options-grid",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:i.map(e=>{const i=t.includes(e.id),o=null!=e.delta_total;return Ye("div",{onClick:()=>!r&&n(e.id),className:Ot(Et.create("coverage-option-card",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:r?"wait":"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"1rem",opacity:r?"0.6":"1"}),i?Et.create("coverage-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("coverage-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),children:[Ye("div",{className:Et.create("coverage-option-indicator",{marginTop:"0.125rem"}),children:Ye(xa,{selected:i})}),Ye("div",{className:Et.create("coverage-option-body",{flex:"1",display:"flex",flexDirection:"column",gap:"0.25rem",minWidth:"0"}),children:[Ye("div",{className:Et.create("coverage-option-label",{fontWeight:"600",color:St.colors.foreground}),children:e.label}),e.description&&Ye(wa,{className:Et.create("coverage-option-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:e.description}),!o&&Ye(wa,{className:Et.create("coverage-option-roundtrip",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,fontStyle:"italic",margin:"0"}),children:"Price updates when you toggle this option."})]}),Ye("div",{className:Et.create("coverage-option-price",{fontWeight:"600",whiteSpace:"nowrap",color:St.colors.foreground}),children:o?`+${Sa(e.delta_total)}`:"See total"})]},e.id)})})]})}function Ga({value:e,className:t,durationMs:n=500}){const[r,i]=st(e),o=ct(e),a=ct(null);return lt(()=>{if(null!==a.current&&(cancelAnimationFrame(a.current),a.current=null),"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||o.current===e)return o.current=e,void i(e);const t=o.current,r=e,s=performance.now(),l=e=>{const c=e-s,d=Math.min(1,c/n);i(t+(r-t)*(1-(1-d)*(1-d))),d<1?a.current=requestAnimationFrame(l):(o.current=r,a.current=null)};return a.current=requestAnimationFrame(l),()=>{null!==a.current&&(cancelAnimationFrame(a.current),a.current=null)}},[e,n]),Ye("span",{className:t,children:Sa(r)})}function Qa(){var e,t,n,r,i,o,a,s,l,c,d,u,h,m;const{fsm:f,v2Result:p,selection:g,isCalculating:y,isRepricing:v,selectedExcessId:w,quoteIntent:b,calculationResult:x}=qt(e=>({v2Result:e.getCalculationResultV2(),selection:e.getSelectionV2(),isCalculating:e.getIsCalculating(),isRepricing:e.getIsRepricing(),selectedExcessId:e.getSelectedExcessId(),quoteIntent:e.getQuoteIntent(),calculationResult:e.getCalculationResult()})),[k,S]=st(null),[N,_]=st(!1),[C,$]=st(!1),I=dt(()=>{var e;return null!==(e=null==x?void 0:x.calculations)&&void 0!==e?e:[]},[x]),T=null===(t=null===(e=null==b?void 0:b.organisation)||void 0===e?void 0:e.client_settings)||void 0===t?void 0:t.checkout,E=(null===(n=null==T?void 0:T.headings)||void 0===n?void 0:n.new_business)||"Complete Your Purchase",P=null===(r=null==T?void 0:T.descriptions)||void 0===r?void 0:r.new_business;if(lt(()=>{S(null)},[null==g?void 0:g.cover_type_id,null==g?void 0:g.excess_id,null==g?void 0:g.coverage_option_ids.join(",")]),!p||!g)return Ye(oa,{title:E,description:"Choose your coverage and payment options",hideHeader:!0,children:Ye(Wt,{children:Ye("p",{style:{color:St.colors.mutedForeground},children:"Loading calculation…"})})});const R=null!==(o=null!==(i=p.product_name)&&void 0!==i?i:null==b?void 0:b.product_name)&&void 0!==o?o:"Insurance",z=p.cover_types.length>1,D=I.length>1,M=(null!==(s=null===(a=null==x?void 0:x.clauses)||void 0===a?void 0:a.length)&&void 0!==s?s:0)>0||z||D||(null!==(c=null===(l=p.policy_coverage_options)||void 0===l?void 0:l.length)&&void 0!==c?c:0)>0,O=!(!g.cover_type_id||!g.excess_id||y||v),j=async()=>{_(!0);try{const e=await f.bindV2();S(e)}catch(e){}finally{_(!1)}},W=async()=>{try{$(!0),await f.clearCalculationResults()}catch(e){}finally{$(!1)}};return Ye(oa,{title:E,description:"Choose your coverage and payment options",hideHeader:!0,children:Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Ye(Ja,{showCoverType:z,showExcess:D,checkoutHeading:E,descriptionOverride:P}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[(null==x?void 0:x.clauses)&&x.clauses.length>0&&Ye(Ra,{clauses:x.clauses}),z&&Ye(Za,{coverTypes:p.cover_types,selectedCoverTypeId:g.cover_type_id,onCoverTypeSelect:e=>f.setV2Selection({cover_type_id:e})}),D&&Ye(ka,{excessOptions:I,selectedExcessId:w,onExcessSelect:e=>f.setV2Selection({excess_id:e})}),Ye(Va,{offers:p.policy_coverage_options,selectedIds:g.coverage_option_ids,onToggle:e=>f.toggleV2CoverageOption(e),isCalculating:v}),!M&&Ye(Xa,{adminEmail:null===(d=null==b?void 0:b.organisation)||void 0===d?void 0:d.admin_email,phone:null===(u=null==b?void 0:b.organisation)||void 0===u?void 0:u.phone})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{position:"sticky",top:St.spacing.lg}),children:[Ye(Pa,{excessOptions:I,selectedExcessId:w,onEditQuote:W,isEditingQuote:C,productName:R,quoteIntent:b}),Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye(Ka,{fsm:f,onBind:j,binding:N,canContinue:O,bindOutcome:k,isRepricing:v})})]})})]}),Ye("div",{className:Et.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("mobile-card-summary",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye("h2",{className:Et.create("mobile-checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.5rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:E}),Ye("p",{className:Et.create("mobile-checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:z||D?"Choose your cover and add-ons to secure your policy.":"Review your cover and add-ons to secure your policy."}),Ye("hr",{className:Et.create("mobile-summary-divider",{marginTop:St.spacing.md,marginBottom:St.spacing.md,borderColor:St.colors.border})}),Ye(Pa,{excessOptions:I,selectedExcessId:w,onEditQuote:W,isEditingQuote:C,productName:R,quoteIntent:b,embedded:!0})]}),(null==x?void 0:x.clauses)&&x.clauses.length>0&&Ye("div",{className:Et.create("mobile-card-clauses",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Ra,{clauses:x.clauses})}),Ye("div",{className:Et.create("mobile-card-options",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[z&&Ye(Za,{coverTypes:p.cover_types,selectedCoverTypeId:g.cover_type_id,onCoverTypeSelect:e=>f.setV2Selection({cover_type_id:e})}),D&&Ye(ka,{excessOptions:I,selectedExcessId:w,onExcessSelect:e=>f.setV2Selection({excess_id:e})}),Ye(Va,{offers:p.policy_coverage_options,selectedIds:g.coverage_option_ids,onToggle:e=>f.toggleV2CoverageOption(e),isCalculating:y}),!M&&Ye(Xa,{adminEmail:null===(h=null==b?void 0:b.organisation)||void 0===h?void 0:h.admin_email,phone:null===(m=null==b?void 0:b.organisation)||void 0===m?void 0:m.phone})]}),Ye("div",{className:Et.create("mobile-card-payment",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Ka,{fsm:f,onBind:j,binding:N,canContinue:O,bindOutcome:k,isRepricing:v})})]})]})})}function Ja({showCoverType:e,showExcess:t,checkoutHeading:n,descriptionOverride:r}){let i="Review your cover and add-ons to secure your policy.";return e&&t?i="Choose your cover type, excess amount, and add-ons to secure your policy.":e?i="Choose your cover type and add-ons to secure your policy.":t&&(i="Choose your excess amount and add-ons to secure your policy."),r&&""!==r.trim()&&(i=r),Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:n}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:i}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]})}function Ka({fsm:e,onBind:t,binding:n,canContinue:r,bindOutcome:i,isRepricing:o}){const a=e.getV2DisplayedTotal();return Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:"Payment"}),Ye("div",{className:Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("summary-label",{display:"flex",alignItems:"center",gap:"0.5rem",color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:["Total payable",Ye("span",{className:Et.create("summary-label-spinner",{display:"inline-flex",color:St.colors.mutedForeground,opacity:o?"1":"0",transition:"opacity 200ms ease"}),"aria-hidden":!o,children:Ye(jt,{size:"small"})})]}),Ye(Ga,{value:a,className:Et.create("summary-value-total",{fontWeight:"600",fontSize:St.fontSize.large,color:St.colors.foreground,fontVariantNumeric:"tabular-nums"})})]}),"verified"===(null==i?void 0:i.status)&&Ye("div",{className:Et.create("verified-banner",{padding:"0.75rem 1rem",border:`1px solid ${St.colors.primary}`,borderRadius:St.radius.default,backgroundColor:St.colors.accent,fontSize:St.fontSize.small}),children:["Verified at ",Sa(i.server_total),". Payment gateway integration for v2 is pending, quote is ready."]}),"mismatch"===(null==i?void 0:i.status)&&Ye("div",{className:Et.create("mismatch-banner",{padding:"0.75rem 1rem",border:`1px solid ${St.colors.destructive}`,borderRadius:St.radius.default,color:St.colors.destructive,fontSize:St.fontSize.small}),children:[Ye("strong",{children:"Price updated."})," The server calculated ",Sa(i.server_total),". Please review and try again."]}),Ye(sa,{onClick:t,disabled:!r||n,children:n?"Verifying…":"verified"===(null==i?void 0:i.status)?"Continue to payment":"Verify & continue"}),Ye(wa,{className:Et.create("payment-footer-note",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:'Payment gateway integration for v2 products is scoped for a later phase. The "verify" step confirms your selection against the server.'})]})}function Xa({adminEmail:e,phone:t}){const n=!!e||!!t;return Ye("div",{className:Et.create("v2-no-options",{padding:St.spacing.lg,textAlign:"center",color:St.colors.foreground,border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,display:"flex",flexDirection:"column",alignItems:"center",gap:St.spacing.md}),children:[Ye("p",{className:Et.create("v2-no-options-title",{margin:"0",fontSize:St.fontSize.default,fontWeight:"600"}),children:"Sorry, there are no payment options available at this time."}),n?Ye(C,{children:[Ye("p",{className:Et.create("v2-no-options-body",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),children:"Please get in touch and we'll help you complete your purchase."}),Ye("div",{className:Et.create("v2-no-options-actions",{display:"flex",flexWrap:"wrap",gap:St.spacing.sm,justifyContent:"center"}),children:[t&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${t}`),children:"Call Us"}),e&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${e}`),children:"Email Us"})]})]}):Ye("p",{className:Et.create("v2-no-options-body-no-contact",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),children:"Please get in touch with the provider directly to complete your purchase."})]})}function es({results:e}){var t,n,r,i,o,a;const{quoteIntent:s,fsm:l}=qt(e=>({quoteIntent:null==e?void 0:e.getQuoteIntent()})),c=null===(t=null==s?void 0:s.organisation)||void 0===t?void 0:t.admin_email,d=null===(n=null==s?void 0:s.organisation)||void 0===n?void 0:n.phone,u=c||d,h=fa(null===(r=null==s?void 0:s.organisation)||void 0===r?void 0:r.client_settings,"referral"),m=null!==(i=h.steps)&&void 0!==i?i:["Our team will review your application within 1-2 business days","We'll contact you with either approval or additional requirements","If approved, we'll provide you with payment options to complete your purchase"],f=Et.create("referral-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),p=Et.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),g=Et.create("referral-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),y=Et.create("referral-header",{textAlign:"center",marginBottom:St.spacing.xl}),v=Et.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),w=Et.create("referral-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),b=Et.create("referral-process-box",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg,marginBottom:St.spacing.xl}),x=Et.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.accentForeground,marginBottom:St.spacing.md,marginTop:"0"}),k=Et.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:St.spacing.sm}),S=Et.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:St.fontSize.small,color:St.colors.accentForeground,lineHeight:"1.6"}),N=Et.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:"50%",marginRight:St.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),_=Et.create("referral-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),C=Et.create("referral-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),$=Et.create("referral-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:St.spacing.lg}),I=Et.create("referral-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.md}),T=Et.create("referral-new-request",{textAlign:"center",marginTop:St.spacing.md}),E=Et.create("referral-new-request-link",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return Ye(oa,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:f,children:[Ye("div",{className:p,children:Ye(()=>Ye("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:g,children:[Ye("path",{d:"M7 10v12"}),Ye("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"})]}),{})}),Ye("div",{className:y,children:[Ye("h1",{className:v,children:null!==(o=h.title)&&void 0!==o?o:"Thanks for your quote request!"}),h.body?Ye(ca,{source:h.body,className:w}):Ye("p",{className:w,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Ye("div",{className:b,children:[Ye("h3",{className:x,children:"What happens next?"}),Ye("ul",{className:k,children:m.map((e,t)=>Ye("li",{className:S,children:[Ye("span",{className:N,children:t+1}),Ye("span",{children:e})]},t))})]}),u&&Ye("div",{className:_,children:[Ye("p",{className:C,children:"Need to speak with someone about your quote?"}),Ye("div",{className:$,children:[d&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${d}`),children:[Ye("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:Ye("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"]}),c&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(a=e.quote_intent)||void 0===a?void 0:a.reference)&&Ye("div",{className:I,children:["Quote Reference: ",Ye("strong",{children:e.quote_intent.reference})]})]}),Ye("div",{className:T,children:Ye("button",{type:"button",className:E,onClick:()=>null==l?void 0:l.reset(),children:"Start a new quote"})})]})})})})}function ts({results:e}){const{calculationResultV2:t}=qt(e=>({calculationResultV2:e.getCalculationResultV2()}));return"referral"===e.outcome_type?Ye(es,{results:e}):t?Ye(Qa,{}):Ye(Ua,{results:e})}function ns(e,t){return n=e?.use_custom_options?t||e?.options||[]:e?.options||t||[],r=e?.options_sort,r&&"default"!==r?[...n].sort((e,t)=>e.label.localeCompare(t.label,void 0,"numerical"===r?{numeric:!0}:void 0)):[...n];var n,r}function rs({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:a,className:s,hasError:l,prefix:c="$"}){const d=ct(null),[u,h]=st("");function m(e){if(!e)return"";const t=e.replace(/[^\d.]/g,"");if(!t)return"";const n=t.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}lt(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=Et.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=Et.create("money-input-prefix",{position:"absolute",left:"1rem",color:St.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=Et.create("money-input-with-prefix",{paddingLeft:c?"2rem":"1rem"});return Ye("div",{className:f,children:[c&&Ye("span",{className:p,children:c}),Ye("input",{ref:d,type:"text",inputMode:"decimal",name:n,id:r,value:u,onInput:function(e){const n=e.currentTarget,r=n.selectionStart||0,i=u,o=n.value.replace(/[^\d.]/g,""),a=m(o);h(a),t(o),requestAnimationFrame(()=>{if(d.current){const e=function(e,t,n){let r=n+(t.length-e.length);return r=Math.max(0,Math.min(r,t.length)),r}(i,a,r);d.current.setSelectionRange(e,e)}})},onBlur:function(){u&&u.includes(".")},placeholder:i,required:o,disabled:a,className:Ot(s,c&&g)})]})}function is(e){var t,n;const r=Et.create("input",{width:"100%",maxWidth:"100%",minWidth:"0",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,transition:St.transition,outline:"none",boxShadow:"none"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"0.75rem"}}),i=Et.create("input-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),o=e.hasError?`${r} ${i}`:r,a=Et.name("input");Et.pseudoElement("input",":focus",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const s=Et.create("select",{width:"100%",minWidth:"0",boxSizing:"border-box",height:`calc(2.75rem - (${St.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"2.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",fontSize:St.fontSize.default,backgroundColor:"transparent",color:St.colors.foreground,outline:"none",WebkitAppearance:"none",appearance:"none",textOverflow:"ellipsis"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"2rem"}}),l=Et.create("select-wrapper",{position:"relative",minWidth:"0",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,backgroundColor:St.colors.card,transition:St.transition,outline:"none",boxShadow:"none"}),c=Et.create("select-wrapper-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),d=e.hasError?`${l} ${c}`:l,u=Et.name("select-wrapper");Et.pseudoElement("select-wrapper",":focus-within",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const{onChange:h,onBlur:m,onKeyDown:f,className:p,validation:g,errors:y,suffix:v,...w}=e;function b(e){h(e.currentTarget.value)}function x(e){h(e.currentTarget.value)}function k(e){m&&m(e.currentTarget.value)}if("select"===e.type){const S=e.null_option_label||"N/A",N=ns(e.validation,e.options),_=!w.value&&!e.add_null_option,C=Et.create("select-placeholder",{color:St.colors.mutedForeground}),$=Et.create("select-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:St.colors.mutedForeground});return Ye("div",{className:Ot(d,u),children:[Ye("select",{...w,onChange:b,className:Ot(s,_&&C),children:[_&&Ye("option",{value:"",disabled:!0,selected:!0,children:"Select..."}),e.add_null_option&&Ye("option",{value:"",children:S}),N.map(e=>Ye("option",{value:e.value,children:e.label},e.value))]}),Ye("svg",{className:$,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:Ye("path",{d:"M6 9l6 6 6-6"})})]})}if("radio"===e.type){const I=e.null_option_label||"N/A",T=ns(e.validation,e.options),E=Et.create(e.inline?"radio-container-inline":"radio-container",{display:"flex",flexDirection:e.inline?"row":"column",gap:e.inline?"1rem":"0.5rem",flexWrap:e.inline?"wrap":"nowrap"}),P=Et.create("radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer",fontSize:St.fontSize.default,color:St.colors.foreground}),R=Et.create("radio-input",{accentColor:St.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=Et.name("radio-input");return Et.pseudoElement("radio-input",":focus",{outline:`3px solid color-mix(in srgb, ${St.colors.primary} 30%, transparent)`,outlineOffset:"2px"}),Ye("div",{className:E,children:[e.add_null_option&&Ye("label",{className:P,children:[Ye("input",{type:"radio",name:e.name,value:"",checked:""===e.value,onChange:()=>h(""),className:Ot(R,z)}),Ye("span",{children:I})]}),T.map(t=>Ye("label",{className:P,children:[Ye("input",{type:"radio",name:e.name,value:t.value,checked:e.value===t.value,onChange:()=>h(t.value),className:Ot(R,z)}),Ye("span",{children:t.label})]},t.value))]})}if("date"===e.type){const D=Et.create("input-date",{height:"2.75rem",minHeight:"2.75rem",maxHeight:"2.75rem",WebkitAppearance:"none",appearance:"none"});return Ye("input",{...w,type:"date",min:null===(t=e.validation)||void 0===t?void 0:t.minDate,max:null===(n=e.validation)||void 0===n?void 0:n.maxDate,onInput:x,onChange:b,className:Ot(o,a,D,p)})}if("monthyear"===e.type)return Ye(as,{id:e.id,name:e.name,value:e.value,required:e.required,disabled:e.disabled,hasError:e.hasError,onChange:h,selectWrapperBaseClass:l,selectWrapperErrorClass:c,selectWrapperBaseClassName:u,selectBaseClassName:s});if("year"===e.type){const M=(new Date).getFullYear();return Ye("input",{...w,type:"number",min:M-100,max:M,placeholder:"YYYY",onInput:x,onChange:b,className:Ot(o,a,p)})}if("money"===e.type)return Ye(rs,{value:e.value,onChange:h,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Ot(o,a,p),hasError:e.hasError});if("checkbox"===e.type){const O=!0===e.value||"true"===e.value||"true"===e.value,j=Et.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),W=Et.create("checkbox-"+(O?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${O?St.colors.primary:e.hasError?St.colors.destructive:St.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:O?St.colors.primary:St.colors.card,transition:St.transition,position:"absolute"}),A=Et.name("checkbox-"+(O?"checked":"unchecked"));function L(e){e.preventDefault(),h(O?"false":"true")}return Et.pseudoElement("checkbox-"+(O?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Ye("div",{className:j,children:[Ye("input",{type:"checkbox",id:e.id,name:e.name,checked:O,onClick:L,className:Ot(W,A,p),required:e.required,readOnly:!0}),O&&Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Ye("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const B=Et.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),q=Et.create("boolean-radio-group",{display:"flex",gap:"1rem"}),F=Et.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),H=Et.create("boolean-radio",{accentColor:St.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),U=Et.name("boolean-radio");Et.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${St.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const Y=Et.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,transition:St.transition,outline:"none",boxShadow:"none",resize:"vertical",fontFamily:St.fontFamily}),Z=Et.create("boolean-textarea-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),V=e.hasError?`${Y} ${Z}`:Y,G=Et.name("boolean-textarea");Et.pseudoElement("boolean-textarea",":focus",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const Q=!0===e.value||"true"===e.value,J=!1===e.value||"false"===e.value,K=e.answer||"",X=e.booleanConfig,ee=(null==X?void 0:X.enable_details_textbox)&&("yes"===X.show_details_on&&Q||"no"===X.show_details_on&&J);function te(t){h(t),(!(null==X?void 0:X.enable_details_textbox)||!("yes"===X.show_details_on&&"true"===t||"no"===X.show_details_on&&"false"===t))&&e.onAnswerChange&&K&&e.onAnswerChange("")}return Ye("div",{className:Ot(B,p),children:[Ye("div",{className:q,children:[Ye("label",{className:F,children:[Ye("input",{type:"radio",name:e.name,checked:Q,onChange:()=>te("true"),className:Ot(H,U)}),Ye("span",{children:"Yes"})]}),Ye("label",{className:F,children:[Ye("input",{type:"radio",name:e.name,checked:J,onChange:()=>te("false"),className:Ot(H,U)}),Ye("span",{children:"No"})]})]}),ee&&Ye("textarea",{placeholder:(null==X?void 0:X.details_placeholder)||"Please provide details",value:K,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:Ot(V,G)})]})}return v?Ye("div",{className:Et.create("input-with-suffix",{display:"flex",alignItems:"center",gap:St.spacing.sm,minWidth:"0",maxWidth:"100%"}),children:[Ye("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Ot(o,a,p),style:{flex:1,minWidth:0}}),v]}):Ye("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Ot(o,a,p)})}const os=[{value:"01",label:"January"},{value:"02",label:"February"},{value:"03",label:"March"},{value:"04",label:"April"},{value:"05",label:"May"},{value:"06",label:"June"},{value:"07",label:"July"},{value:"08",label:"August"},{value:"09",label:"September"},{value:"10",label:"October"},{value:"11",label:"November"},{value:"12",label:"December"}];function as(e){const t=e.value||"",n=t.length>=7?t.substring(5,7):"",r=t.length>=4?t.substring(0,4):"",[i,o]=st(n),[a,s]=st(r),[l,c]=st(!1),[d,u]=st(!1),[h,m]=st(!(!n||!r));lt(()=>{o(n),s(r),m(!(!n||!r))},[e.value]);const f=(new Date).getFullYear(),p=[];for(let e=f;e>=f-100;e--)p.push(e);function g(t,n){if(t&&n)return m(!0),void e.onChange(`${n}-${t}-01`);h&&e.onChange("")}const y=!!i!=!!a&&l&&d&&!e.required,v=!i&&l&&(e.hasError||y),w=!a&&d&&(e.hasError||y),b=v?`${e.selectWrapperBaseClass} ${e.selectWrapperErrorClass}`:e.selectWrapperBaseClass,x=w?`${e.selectWrapperBaseClass} ${e.selectWrapperErrorClass}`:e.selectWrapperBaseClass,k=Et.create("monthyear-row",{display:"flex",gap:St.spacing.sm,minWidth:"0"}),S=Et.create("monthyear-item",{flex:"1 1 0",minWidth:"0"}),N=Et.create("monthyear-placeholder",{color:St.colors.mutedForeground}),_=Et.create("monthyear-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:St.colors.mutedForeground}),C=Et.create("monthyear-partial-error",{marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.destructive}),$=Ye("svg",{className:_,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:Ye("path",{d:"M6 9l6 6 6-6"})}),I=!i,T=!a,E=!e.required;return Ye("div",{children:[Ye("div",{className:k,children:[Ye("div",{className:Ot(b,e.selectWrapperBaseClassName,S),children:[Ye("select",{id:e.id,name:e.name,required:e.required,disabled:e.disabled,value:i,onChange:function(e){const t=e.currentTarget.value;o(t),c(!0),g(t,a)},onBlur:function(){c(!0)},className:Ot(e.selectBaseClassName,I&&N),children:[I?Ye("option",{value:"",disabled:!0,selected:!0,children:"Month"}):E&&Ye("option",{value:"",children:"— None —"}),os.map(e=>Ye("option",{value:e.value,children:e.label},e.value))]}),$]}),Ye("div",{className:Ot(x,e.selectWrapperBaseClassName,S),children:[Ye("select",{id:`${e.id}__year`,required:e.required,disabled:e.disabled,value:a,onChange:function(e){const t=e.currentTarget.value;s(t),u(!0),g(i,t)},onBlur:function(){u(!0)},className:Ot(e.selectBaseClassName,T&&N),children:[T?Ye("option",{value:"",disabled:!0,selected:!0,children:"Year"}):E&&Ye("option",{value:"",children:"— None —"}),p.map(e=>Ye("option",{value:String(e),children:e},e))]}),$]})]}),y&&Ye("div",{className:C,children:"Please select both month and year, or clear both."})]})}function ss(e,t){const{fsm:n,lastUpdated:r}=qt(e=>{var t,n;return{lastUpdated:null!==(n=null===(t=e.getFormProgress())||void 0===t?void 0:t.last_updated)&&void 0!==n?n:null}}),[i,o]=st({kind:"idle"}),a=dt(()=>{var t;for(let n=0;n<e.length;n++)if((null!==(t=e[n].fields)&&void 0!==t?t:[]).some(e=>"client_email"===e.code))return n;return-1},[e]);return{showContinueLater:a>=0&&t.includes(a),lastUpdated:r,continueLaterStatus:i,sendContinueLaterEmail:async function(){var e,t;const r=function(){const e=null==n?void 0:n.getFormProgress(),t=null==e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null}();if(!r)return void o({kind:"error",message:"Email address not found. Please fill in your email first."});const i=null===(e=null==n?void 0:n.getQuoteIntent())||void 0===e?void 0:e.id;if(i)try{o({kind:"sending"}),await(null===(t=null==n?void 0:n.httpClient)||void 0===t?void 0:t.continueLater(i,r)),o({kind:"sent"})}catch(e){o({kind:"error",message:"Failed to send link. Please try again."})}},copyContinueLaterLink:async function(){var e,t;const r=null===(e=null==n?void 0:n.getQuoteIntent())||void 0===e?void 0:e.id;if(!r)return;const i=function(e){var t,r;const i=null===(r=null===(t=null==n?void 0:n.getQuoteIntent())||void 0===t?void 0:t.organisation)||void 0===r?void 0:r.quote_page_url;if(i){const t=i.replace(/\/+$/,""),n=t.includes("?")?"&":"?";return`${t}${n}q=${e}`}return`${window.location.origin}${window.location.pathname}?q=${e}`}(r);try{if(null===(t=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===t?void 0:t.writeText)await navigator.clipboard.writeText(i);else{const e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}o({kind:"copied"})}catch(e){o({kind:"error",message:"Could not copy link. Please copy manually."})}},resetContinueLaterStatus:function(){o({kind:"idle"})},clearTransientStatus:function(){o(e=>"sent"===e.kind?e:{kind:"idle"})},confirmReset:function(){null==n||n.reset()}}}function ls({isOpen:e,onClose:t,onConfirm:n}){return Ye(Ba,{isOpen:e,onClose:t,title:"Reset your progress?",description:"This will clear everything you've entered so far and start the form over. This cannot be undone.",footer:Ye(C,{children:[Ye(sa,{variant:"outline",onClick:t,children:"Cancel"}),Ye(sa,{onClick:function(){n(),t()},children:"Reset progress"})]})})}function cs({pages:e,currentPageIndex:n,completedPages:r}){const{fsm:i,isSaving:o}=qt(e=>({isSaving:e.getIsSaving()})),{showContinueLater:a,lastUpdated:s,continueLaterStatus:l,sendContinueLaterEmail:c,copyContinueLaterLink:d,clearTransientStatus:u,confirmReset:h}=ss(e,r),[m,f]=st(!1),[p,g]=st(!1),y=ct(null),v=ct(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title})));const w=(()=>{var e;const t=null===(e=null==i?void 0:i.getFormProgress())||void 0===e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})();lt(()=>{if(y.current&&v.current){const e=v.current,t=y.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const b=Math.round((n+1)/e.length*100),x=Et.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:St.spacing.sm,padding:`${St.spacing.sm} ${St.spacing.sm}`,borderRadius:St.radius.default,border:"none",backgroundColor:"transparent",color:St.colors.foreground,cursor:"pointer",transition:St.transition,textAlign:"left",width:"100%",fontFamily:St.fontFamily,fontSize:St.fontSize.small,opacity:"1"}),k=Et.create("sidebar-nav-item-active",{backgroundColor:St.colors.accent,color:St.colors.accentForeground}),S=Et.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});Et.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:St.colors.muted}),Et.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:St.colors.accent});const N=Et.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:St.colors.muted,color:St.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),_=Et.create("sidebar-indicator-active",{backgroundColor:St.colors.accentForeground,color:St.colors.accent}),C=Et.create("sidebar-indicator-completed",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground}),$=Et.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),I=Et.create("sidebar-page-title-active",{fontWeight:"600"});return Ye("div",{className:Et.create("sidebar-navigation",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[Ye("div",{className:Et.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[Ye("span",{className:Et.create("sidebar-progress-text",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:["Step ",n+1," of ",e.length]}),Ye("div",{className:Et.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:St.colors.muted,borderRadius:St.radius.small,overflow:"hidden"}),children:Ye("div",{className:Et.create("sidebar-progress-fill",{height:"100%",backgroundColor:St.colors.primary,borderRadius:St.radius.small,transition:St.transition}),style:{width:`${b}%`}})})]}),Ye("hr",{className:Et.create("sidebar-divider",{borderColor:St.colors.border})}),Ye("nav",{ref:v,className:Et.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:St.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:St.spacing.sm}),children:e.map((e,a)=>{const s=a===n,l=r.includes(a),c=i.canNavigateToPage(a);a===n&&t(e.title);const d=[x];s&&d.push(k),c&&!o||d.push(S);const u=d.join(" "),h=[N];l?h.push(C):s&&h.push(_);const m=h.join(" ");return Ye("button",{ref:s?y:null,onClick:()=>{return e=a,void((null==i?void 0:i.canNavigateToPage(e))&&i.navigateToPage(e));var e},disabled:!c||o,className:u,children:[Ye("div",{className:m,children:l?Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})}):a+1}),Ye("div",{className:Et.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Ye("span",{className:s?`${$} ${I}`:$,children:e.title})})]},e.id)})}),s&&Ye("div",{className:Et.create("sidebar-footer",{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"}),children:[Ye("div",{className:Et.create("sidebar-last-saved",{fontSize:"0.6875rem",color:St.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",ra.fromJSDate(new Date(s)).toFormat("T")]}),Ye("button",{onClick:()=>g(!0),className:Et.create("sidebar-reset-link",{background:"none",border:"none",padding:"0",fontSize:"0.6875rem",color:St.colors.mutedForeground,opacity:"0.5",cursor:"pointer",textDecoration:"underline",fontFamily:St.fontFamily}),children:"Reset progress"})]}),a&&Ye("button",{onClick:()=>{u(),f(!0)},className:Et.create("sidebar-continue-later-button",{padding:`${St.spacing.sm} ${St.spacing.md}`,border:`${St.borderWidth} solid ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:"transparent",color:St.colors.mutedForeground,fontSize:St.fontSize.small,fontFamily:St.fontFamily,cursor:"pointer",transition:St.transition,textAlign:"center",width:"100%"}),children:"Continue Later"}),Ye(qa,{isOpen:m,onClose:()=>f(!1),status:l,onSendEmail:c,onCopyLink:d,email:w}),Ye(ls,{isOpen:p,onClose:()=>g(!1),onConfirm:h})]})}function ds({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=qt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,a]=st(!1),s=Math.round((t+1)/e.length*100),l=Et.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:St.spacing.sm,padding:St.spacing.sm,border:"none",borderRadius:St.radius.default,backgroundColor:"transparent",color:St.colors.foreground,cursor:"pointer",opacity:"1",transition:St.transition,width:"100%",textAlign:"left",fontFamily:St.fontFamily}),c=Et.create("mobile-sidebar-item-active",{backgroundColor:St.colors.accent,color:St.colors.accentForeground}),d=Et.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),u=Et.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:St.colors.muted,color:St.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=Et.create("mobile-sidebar-indicator-active",{backgroundColor:St.colors.accentForeground,color:St.colors.accent}),m=Et.create("mobile-sidebar-indicator-completed",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground}),f=Et.create("mobile-sidebar-page-title-base",{fontSize:St.fontSize.small,fontWeight:"500"}),p=Et.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Ye("div",{className:Et.create("mobile-sidebar",{overflow:"hidden"}),children:[Ye("button",{onClick:()=>a(!o),className:Et.create("mobile-sidebar-header",{width:"100%",padding:St.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[Ye("div",{className:Et.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Ye("span",{className:Et.create("mobile-sidebar-step-text",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Ye("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:Et.create("mobile-sidebar-chevron",{transition:St.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:St.colors.mutedForeground}),children:Ye("path",{d:"m6 9 6 6 6-6"})})]}),Ye("div",{className:Et.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:St.colors.muted,borderRadius:St.radius.small,overflow:"hidden"}),children:Ye("div",{className:Et.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:St.colors.primary,borderRadius:St.radius.small,transition:St.transition}),style:{width:`${s}%`}})})]}),Ye("hr",{className:Et.create("mobile-sidebar-border",{borderColor:St.colors.border})}),o&&Ye("div",{className:Et.create("mobile-sidebar-content",{padding:St.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const s=o===t,g=n.includes(o),y=r.canNavigateToPage(o),v=[l];s&&v.push(c),y&&!i||v.push(d);const w=v.join(" "),b=[u];g?b.push(m):s&&b.push(h);const x=b.join(" ");return Ye("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),a(!1)));var e},disabled:!y||i,className:w,children:[Ye("div",{className:x,children:g?Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Ye("span",{className:s?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function us({pages:e,completedPages:t}){const{fsm:n}=qt(()=>({})),{showContinueLater:r,lastUpdated:i,continueLaterStatus:o,sendContinueLaterEmail:a,copyContinueLaterLink:s,clearTransientStatus:l,confirmReset:c}=ss(e,t),[d,u]=st(!1),[h,m]=st(!1);if(!i&&!r)return null;const f=(()=>{var e;const t=null===(e=null==n?void 0:n.getFormProgress())||void 0===e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})(),p=Et.create("mobile-form-actions-container",{display:"flex",justifyContent:"center",alignItems:"center",gap:St.spacing.lg,paddingTop:St.spacing.sm,paddingBottom:St.spacing.sm}),g=Et.create("mobile-form-actions-link",{background:"none",border:"none",padding:"0",fontSize:"0.75rem",color:St.colors.mutedForeground,opacity:"0.6",cursor:"pointer",textDecoration:"underline",fontFamily:St.fontFamily});return Ye("div",{className:p,children:[i&&Ye("button",{type:"button",onClick:()=>m(!0),className:g,children:"Reset progress"}),r&&Ye("button",{type:"button",onClick:()=>{l(),u(!0)},className:g,children:"Continue later"}),Ye(qa,{isOpen:d,onClose:()=>u(!1),status:o,onSendEmail:a,onCopyLink:s,email:f}),Ye(ls,{isOpen:h,onClose:()=>m(!1),onConfirm:c})]})}function hs({organisation:e}){return Ye("div",{className:Et.create("welcome-card",{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},{"(max-width: 950px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("welcome-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:St.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Ye("p",{className:Et.create("welcome-text",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.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."}),Ye("hr",{className:Et.create("welcome-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]})}function ms({title:e,description:t}){return Ye(oa,{title:e,description:t,children:Ye(Wt,{children:Ye(la,{className:Et.name("error-container"),children:Ye("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:[Ye("path",{d:"M4.929 4.929 19.07 19.071"}),Ye("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function fs({errors:e,className:t}){return e&&0!==e.length?Ye("div",{className:Et.create("field-error",{color:St.colors.destructive,fontSize:St.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Ye("span",{className:Et.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function ps({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[a,s]=st({visible:!1,top:0,left:0,flipped:!1}),l=ct(null),c=ut(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect(),n=!(t.top>68),r=n?t.bottom+8:t.top-8,i=t.left+t.width/2;s({visible:!0,top:r,left:i,flipped:n})},[]),d=ut(()=>{s(e=>({...e,visible:!1}))},[]);return Ye("label",{for:e,className:Et.create("label",{display:"flex",flexDirection:"column",minWidth:"0"}),...o,children:[Ye("span",{className:Et.create("label-text",{marginBottom:St.spacing.sm,fontSize:St.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:St.spacing.sm,color:St.colors.foreground}),children:[Ye("span",{children:r?Ye(C,{children:[t.includes(" ")?t.substring(0,t.lastIndexOf(" ")+1):"",Ye("span",{style:{whiteSpace:"nowrap"},children:[t.includes(" ")?t.substring(t.lastIndexOf(" ")+1):t,Ye("span",{className:Et.create("label-required-indicator",{color:St.colors.destructive}),children:"*"})]})]}):t}),i&&Ye("span",{ref:l,className:Et.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:c,onMouseLeave:d,children:[Ye("svg",{className:Et.create("tooltip-icon",{width:"1rem",height:"1rem",color:St.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Ye("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Ye("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Ye("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),a.visible&&Ye("span",{style:{position:"fixed",top:`${a.top}px`,left:`${a.left}px`,transform:a.flipped?"translateX(-50%)":"translateX(-50%) translateY(-100%)",padding:"0.5rem 0.75rem",backgroundColor:St.colors.popover,color:St.colors.popoverForeground,fontSize:"0.875rem",borderRadius:St.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e4,minWidth:"200px",maxWidth:"300px",pointerEvents:"none"},children:[i,Ye("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...a.flipped?{bottom:"100%",borderBottom:`6px solid ${St.colors.popover}`}:{top:"100%",borderTop:`6px solid ${St.colors.popover}`}}})]})]})]}),n]})}function gs(e){const t={"(max-width: 600px)":{gridColumn:"span 12 / span 12"}};switch(null!=e?e:100){case 25:return Et.create("field-wrapper-25",{gridColumn:"span 3 / span 3"},t);case 33:return Et.create("field-wrapper-33",{gridColumn:"span 4 / span 4"},t);case 50:return Et.create("field-wrapper-50",{gridColumn:"span 6 / span 6"},t);case 66:return Et.create("field-wrapper-66",{gridColumn:"span 8 / span 8"},t);case 75:return Et.create("field-wrapper-75",{gridColumn:"span 9 / span 9"},t);default:return Et.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function ys(e){return e?e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,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">${t}</a>`:e}):""}function vs({code:e,isOpen:t,onClose:n}){var r,i;const{httpClient:o}=qt(e=>({httpClient:e.httpClient})),[a,s]=st(null!==(r=J(e))&&void 0!==r?r:null),[l,c]=st(null),[d,u]=st(!1);lt(()=>{if(!t)return;const n=J(e);n?s(n):(u(!0),c(null),o.getDocument(e).then(t=>{var n;const r=null!==(n=null==t?void 0:t.data)&&void 0!==n?n:t,i={name:r.name,content:r.content};!function(e,t){Q.set(e,t)}(e,i),s(i),u(!1)}).catch(e=>{c(e instanceof Error?e.message:"Unable to load document."),u(!1)}))},[t,e,o]);const h=Et.create("document-modal-body",{fontSize:St.fontSize.small,lineHeight:"1.55",color:St.colors.foreground});return Et.pseudoElement("document-modal-body"," p",{margin:"0 0 0.85em"}),Et.pseudoElement("document-modal-body"," p:last-child",{marginBottom:"0"}),Et.pseudoElement("document-modal-body"," ul",{margin:"0 0 0.85em",paddingLeft:"1.5em",listStyleType:"disc",listStylePosition:"outside"}),Et.pseudoElement("document-modal-body"," ol",{margin:"0 0 0.85em",paddingLeft:"1.75em",listStyleType:"decimal",listStylePosition:"outside"}),Et.pseudoElement("document-modal-body"," li",{marginBottom:"0.25em"}),Ye(Ba,{isOpen:t,onClose:n,title:null!==(i=null==a?void 0:a.name)&&void 0!==i?i:"Loading...",width:"720px",children:[d&&Ye("p",{style:{margin:0,color:"#6b7280"},children:"Loading…"}),l&&Ye("p",{style:{margin:0,color:"#b91c1c"},children:l}),!d&&!l&&a&&Ye("div",{className:h,children:Ye(ca,{source:a.content})})]})}function ws({field:e,errors:t,children:n,className:r}){const i=e.code||e.id,o=(null==t?void 0:t.filter(e=>e.field===i))||[],[a,s]=st(!1),l=Et.create("validated-field",{display:"flex",flexDirection:"column",gap:St.spacing.sm,minWidth:"0"});if("notice"===e.type){const t=Et.create("notice-field",{display:"flex",gap:St.spacing.sm,padding:St.spacing.md,backgroundColor:St.colors.accent,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),n=Et.create("notice-icon",{flexShrink:"0",fontSize:St.fontSize.default,lineHeight:"1.6"}),r=Et.create("notice-text",{fontSize:St.fontSize.small,color:St.colors.foreground,lineHeight:"1.6"});return Ye("div",{className:Ot(gs(e.width)),children:Ye("div",{className:t,children:[Ye("span",{className:n,children:"ⓘ"}),Ye("div",{className:r,children:[e.label&&Ye("strong",{children:e.label}),e.label&&e.description&&Ye("br",{}),e.description&&Ye("span",{children:e.description})]})]})})}if("section"===e.type){const t=Et.create("section-separator",{display:"flex",alignItems:"center",gap:St.spacing.md}),n=Et.create("section-line",{flex:"1",height:"1px",backgroundColor:St.colors.border}),r=Et.create("section-title",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.mutedForeground,whiteSpace:"nowrap"});return Ye("div",{className:Ot(gs(e.width)),children:Ye("div",{className:t,children:e.label?Ye(C,{children:[Ye("div",{className:n}),Ye("span",{className:r,children:e.label}),Ye("div",{className:n})]}):Ye("div",{className:n})})})}if("checkbox"===e.type){const t=Et.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),c=Et.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),d=Et.create("checkbox-field-control",{display:"flex",cursor:"pointer",paddingTop:"0.125rem"}),u=Et.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),h=Et.create("checkbox-label-text",{fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground,lineHeight:"1.4"});return Ye("div",{className:Ot(l,gs(e.width),r),children:[Ye("div",{className:t,children:Ye("div",{className:c,children:[Ye("label",{htmlFor:i,className:d,children:n}),Ye("label",{htmlFor:i,className:u,children:[Ye("span",{className:h,children:[e.label,e.required&&Ye(C,{children:[" ",Ye("span",{className:Et.create("checkbox-required-indicator",{color:St.colors.destructive}),children:"*"})]})]}),e.description&&Ye("div",{className:Et.create("checkbox-field-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ys(e.description)}}),e.document_code&&Ye("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),s(!0)},className:Et.create("checkbox-field-doc-link",{alignSelf:"flex-start",background:"none",border:"none",padding:0,margin:0,cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.primary,textDecoration:"underline"}),children:"View document"})]})]})}),Ye(fs,{errors:o}),e.document_code&&Ye(vs,{code:e.document_code,isOpen:a,onClose:()=>s(!1)})]})}return Ye("div",{className:Ot(l,gs(e.width),r),children:[Ye(ps,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Ye("div",{className:Et.create("field-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:St.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ys(e.description)}}),n]}),Ye(fs,{errors:o})]})}function bs({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:St.colors.muted,borderColor:St.colors.border,accentColor:St.colors.mutedForeground,titleColor:St.colors.foreground},error:{backgroundColor:St.colors.destructive+"0A",borderColor:St.colors.destructive+"30",accentColor:St.colors.destructive,titleColor:St.colors.foreground},critical:{backgroundColor:St.colors.destructive+"0A",borderColor:St.colors.destructive+"40",accentColor:St.colors.destructive,titleColor:St.colors.foreground}}[e.severity],o=Et.create("error-card",{padding:`${St.spacing.sm} ${St.spacing.md}`,borderRadius:St.radius.default,border:`1px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,marginInline:St.spacing.lg,marginBlock:St.spacing.md}),a=Et.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:St.spacing.sm}),s=Et.create("error-card-icon",{width:"1rem",height:"1rem",color:i.accentColor,flexShrink:"0",marginTop:"0.15rem"}),l=Et.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),c=Et.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),d=Et.create("error-card-title",{fontSize:St.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),u=Et.create("error-card-message",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.5"}),h=Et.create("error-card-details",{fontSize:"0.8125rem",color:St.colors.mutedForeground,fontFamily:"monospace",backgroundColor:St.colors.muted,padding:"0.625rem",borderRadius:St.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=Et.create("error-card-support",{fontSize:"0.8125rem",color:St.colors.mutedForeground,lineHeight:"1.4"}),f=Et.create("error-card-dismiss",{padding:"0.125rem",border:"none",backgroundColor:"transparent",color:St.colors.mutedForeground,cursor:"pointer",borderRadius:St.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.5rem",height:"1.5rem",flexShrink:"0",marginTop:"-0.125rem",transition:St.transition});return Et.pseudoElement("error-card-dismiss",":hover",{backgroundColor:St.colors.muted,color:St.colors.foreground}),Ye("div",{className:Ot(o,n),children:Ye("div",{className:a,children:[Ye(()=>"warning"===e.severity?Ye("svg",{className:s,fill:"currentColor",viewBox:"0 0 20 20",children:Ye("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"})}):Ye("svg",{className:s,fill:"currentColor",viewBox:"0 0 20 20",children:Ye("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"})}),{}),Ye("div",{className:l,children:[Ye("div",{className:c,children:[Ye("div",{className:d,children:e.title}),Ye("div",{className:u,children:e.message}),r&&e.details&&Ye("div",{className:h,children:e.details}),Ye("div",{className:m,children:Ee(e)})]}),t&&Ye("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Ye("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:[Ye("path",{d:"M18 6 6 18"}),Ye("path",{d:"m6 6 12 12"})]})})]})]})})}function xs(){var e,n;const{definition:r,currentPageIndex:i,totalPages:o,validationErrors:a,generalErrors:s,quoteIntent:l,isSaving:c,fsm:d}=qt(e=>({definition:e.getFormDefinition(),currentPageIndex:e.getCurrentPageIndex(),totalPages:e.getTotalPages(),results:e.getCalculationResult(),validationErrors:e.getValidationErrors(),generalErrors:e.getGeneralErrors(),quoteIntent:e.getQuoteIntent(),isSaving:e.getIsSaving()})),{httpClient:u,urlPromoCode:h}=Bt(),[m,f]=st({status:"idle"}),[p,g]=st(""),[y,v]=st(null),w=ut(async e=>{const n=null!=e?e:p;if(n&&n.trim()){if((null==l?void 0:l.id)&&u){f({status:"validating"});try{const e=await u.validatePromoCode(l.id,n.trim());e.valid?f({status:"valid",name:e.name||n}):f({status:"invalid",message:e.message})}catch(e){t(),f({status:"invalid",message:"Unable to validate promo code"})}}}else f({status:"idle"})},[null==l?void 0:l.id,u,p]),b=ut(e=>{"Enter"===e.key&&(e.preventDefault(),w())},[w]),x=ct(!1);lt(()=>{h&&!x.current&&(null==l?void 0:l.id)&&u&&(x.current=!0,g(h),(async()=>{try{const e=await u.validatePromoCode(l.id,h.trim());if(e.valid){f({status:"valid",name:e.name||h});const t=d.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));t&&d.updateFieldValue(t.id,"promo_code",h)}else{g("");const e=d.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e&&d.updateFieldValue(e.id,"promo_code","")}}catch(e){g("")}})())},[h,null==l?void 0:l.id,u]);const k=r.pages[i];if(!k)return Ye(ms,{title:"Unexpected Error",description:"No page available"});const S=ct(new Map),N=(e,t)=>{var n;const r=d.getFormProgress().page_data[k.id],i=null==r?void 0:r[e];if(null!=i&&""!==i)return i;if(t&&("date"===t.type||"monthyear"===t.type)&&(null===(n=t.validation)||void 0===n?void 0:n.defaultDate)){const n=_(t.validation.defaultDate,"monthyear"===t.type);if(n)return d.updateFieldValue(k.id,e,n),n}return""},_=(e,t)=>{var n;const r=(null===(n=null==l?void 0:l.organisation)||void 0===n?void 0:n.timezone)||"Pacific/Auckland",i=(new Date).toLocaleString("en-US",{timeZone:r}),o=new Date(i);let a=new Date(i);switch(e){case"today":a=o;break;case"+1week":a.setDate(o.getDate()+7);break;case"+1month":a.setMonth(o.getMonth()+1);break;case"+1year":a.setFullYear(o.getFullYear()+1);break;default:return""}const s=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0");return t?`${s}-${c}-01`:`${s}-${c}-${d}`},C=e=>{const t=d.getFormProgress().page_data[k.id];return((null==t?void 0:t.U)||{})[e]||""},$=d.getFormProgress(),I={};Object.values($.page_data).forEach(e=>{const{U:t,...n}=e;Object.assign(I,n),t&&Object.keys(t).length>0&&(I.U||(I.U={}),Object.assign(I.U,t))});const T=e=>{if(!e.visibility)return!0;const n=e.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(t((e.label,e.code)),t(Object.keys(I)),n.forEach(e=>{e&&t((I[e],I[e]))}));const r=he(I,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return S.current.get(e.id)!==i&&(t((e.label,e.code)),t(),S.current.set(e.id,i)),i},E=(()=>{for(const e of k.fields)if(e.blocker&&T(e))if(e.blocker.conditions&&e.blocker.conditions.length>0){if(he(I,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return{field:e,config:e.blocker}}else if(void 0!==e.blocker.trigger_value){const t=e.code||e.id,n=N(t,e);if(String(n)===String(e.blocker.trigger_value))return{field:e,config:e.blocker}}return null})();if(y)return Ye(va,{quotePageUrl:y.quotePageUrl,message:y.message});const P=null==l?void 0:l.payment_return,R=P&&("declined"===P.paymentStatus||"cancelled"===P.paymentStatus||"error"===P.paymentStatus),z=d.getFormProgress().completed_pages||[];return Ye(oa,{title:k.title,description:k.description,hideHeader:!0,children:Ye("div",{children:[R&&Ye(Wa,{type:P.paymentStatus,transactionId:P.paymentTransactionId||void 0,clientSettings:null===(e=null==l?void 0:l.organisation)||void 0===e?void 0:e.client_settings,gatewayCode:null===(n=P.transactionStatus)||void 0===n?void 0:n.gateway_code,isOpen:!0,onClose:()=>{d.updateQuoteIntent({payment_return:void 0})}}),Ye(Wt,{children:[Ye("div",{className:Et.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.sm}}),children:[Ye("div",{className:Et.create("form-content-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"},{"(max-width: 950px)":{minHeight:"auto"}}),children:[Ye("div",{className:Et.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Ye(ds,{pages:r.pages,currentPageIndex:i,completedPages:z})}),i>0&&Ye("div",{className:Et.create("page-heading-container",{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},{"(max-width: 950px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("div",{className:Et.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:St.spacing.lg}),children:Ye("div",{className:Et.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Ye("h1",{className:Et.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:St.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:k.title}),k.description&&Ye("p",{className:Et.create("page-template-description",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,lineHeight:"1.5",color:St.colors.foreground,opacity:"0.7"}),children:k.description})]})}),Ye("hr",{className:Et.create("page-heading-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),0===i&&(null==l?void 0:l.organisation)&&Ye(hs,{organisation:l.organisation}),s.length>0&&s.map(e=>Ye(bs,{error:e,onDismiss:()=>d.dismissGeneralError(e.id)},e.id)),Ye("div",{className:Et.create("form-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm,display:"flex",flexDirection:"column",gap:St.spacing.xl,flex:"1",minWidth:"0",overflow:"hidden"},{"(max-width: 950px)":{padding:St.spacing.md,gap:St.spacing.lg,flex:"initial"},"(max-width: 480px)":{padding:St.spacing.md,gap:St.spacing.md}}),children:[Ye("form",{onSubmit:e=>e.preventDefault(),className:Et.create("form-fields-container",{flex:"1"},{"(max-width: 950px)":{flex:"initial"}}),children:Ye("div",{className:Et.create("form-content-page",{display:"grid",gap:St.spacing.md,rowGap:St.spacing.lg,gridTemplateColumns:"repeat(12, minmax(0, 1fr))",minWidth:"0"},{"(max-width: 600px)":{display:"flex",flexDirection:"column"}}),children:k.fields.map(e=>{const t=e.code||e.id,n="promo_code"===t;if(!T(e))return null;if("section"===e.type)return Ye(ws,{field:e,errors:[],children:Ye("span",{})},e.id);if("notice"===e.type)return Ye(ws,{field:e,errors:[],children:Ye("span",{})},e.id);const r="validating"===m.status,i=n?Ye("button",{type:"button",onClick:()=>w(),disabled:!p.trim()||r,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:St.fontSize.small,backgroundColor:St.colors.primary,color:St.colors.primaryForeground,border:"none",borderRadius:St.radius.default,cursor:p.trim()&&!r?"pointer":"not-allowed",opacity:p.trim()&&!r?1:.5,whiteSpace:"nowrap"},children:r?Ye(jt,{size:"small"}):"Apply"}):void 0,o=!n||"valid"!==m.status&&"invalid"!==m.status?null:Ye("div",{style:{marginTop:"0.5rem"},children:["valid"===m.status&&Ye("span",{style:{color:"#22c55e",fontSize:St.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Ye("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',m.name,'" applied']}),"invalid"===m.status&&Ye("span",{style:{color:St.colors.destructive,fontSize:St.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Ye("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),m.message]})]});return Ye(ws,{field:e,errors:a,children:[Ye(is,{value:N(t,e).toString(),onChange:r=>{let i=r;"boolean"!==e.type&&"checkbox"!==e.type||(i="true"===r),d.updateFieldValue(k.id,t,i),n&&(g(r),f({status:"idle"}))},onKeyDown:n?b:void 0,answer:C(t),onAnswerChange:n=>{var r;d.updateFieldAnswer(k.id,t,n,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:t,name:t,type:e.type,placeholder:e.placeholder,required:e.required,options:e.options,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,inline:e.inline,hasError:d.hasFieldErrors(t),errors:d.getFieldErrors(t),suffix:i}),o]},e.id)})})}),E&&Ye("div",{className:Et.create("form-blocker",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg}),children:[Ye("h3",{className:Et.create("form-blocker-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.125rem",fontWeight:"600",color:St.colors.accentForeground}),children:E.config.title}),Ye("p",{className:Et.create("form-blocker-message",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.accentForeground,opacity:"0.9"}),children:E.config.message}),E.config.link&&Ye("a",{href:E.config.link.url,target:"_blank",rel:"noopener noreferrer",className:Et.create("form-blocker-link",{display:"inline-flex",alignItems:"center",gap:"0.375rem",marginTop:St.spacing.md,fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.primary,textDecoration:"none"}),children:[E.config.link.label,Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Ye("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),Ye("polyline",{points:"15 3 21 3 21 9"}),Ye("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),Ye("hr",{className:Et.create("form-navigation-border",{border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})}),Ye("div",{className:0===i?Et.create("form-navigation-inline-first",{paddingTop:St.spacing.lg,display:"flex",alignItems:"center",justifyContent:"flex-end"}):Et.create("form-navigation-inline",{paddingTop:St.spacing.lg,display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[i>0&&Ye(sa,{onClick:()=>null==d?void 0:d.navigateToPreviousPage(),variant:"outline",children:"Back"}),!E&&Ye(sa,{onClick:async function(){var e,t;if(!(d.validateCurrentPage().length>0))if(i===o-1)try{await(null==d?void 0:d.calculateQuote())}catch(n){if("VERSION_INVALIDATED"===(null==n?void 0:n.type))return void v({quotePageUrl:null!==(t=null===(e=null==n?void 0:n.versionInvalidated)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:null==n?void 0:n.message});throw n}else await(null==d?void 0:d.navigateToNextPage())},disabled:c,loading:c,children:i===o-1?"Get Quote":"Continue"})]})]})]}),Ye("div",{className:Et.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Ye(cs,{pages:r.pages,currentPageIndex:i,completedPages:z})}),Ye("div",{className:Et.create("form-mobile-actions",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Ye(us,{pages:r.pages,completedPages:z})})]}),(null==l?void 0:l.reference)&&Ye("p",{className:Et.create("form-quote-reference",{margin:"0",marginTop:St.spacing.md,textAlign:"center",fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:["Quote reference: ",Ye("strong",{style:{color:St.colors.foreground,fontWeight:600},children:l.reference})]})]})]})})}function ks(){var e,t,n,r,i,o,a;const{quoteIntent:s,fsm:l}=qt(e=>({quoteIntent:e.getQuoteIntent(),fsm:e})),c=null==s?void 0:s.payment_return,d=null==c?void 0:c.paymentTransactionId,u=null==c?void 0:c.transactionStatus,h=null===(e=null==s?void 0:s.organisation)||void 0===e?void 0:e.name,m=null===(t=null==s?void 0:s.organisation)||void 0===t?void 0:t.admin_email,f=null===(n=null==s?void 0:s.organisation)||void 0===n?void 0:n.phone,p=m||f,g=null===(r=null==s?void 0:s.payment_transactions)||void 0===r?void 0:r.find(e=>"completed"===e.status),y=null!==(i=null==u?void 0:u.gateway_code)&&void 0!==i?i:null==g?void 0:g.gateway_code,v=fa(null===(o=null==s?void 0:s.organisation)||void 0===o?void 0:o.client_settings,"payment_success",y);lt(()=>{if(d&&s){const e=null==c?void 0:c.paymentStatus,t=null==u?void 0:u.amount;"success"===e&&u?Le(s,d,t||0,u.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Be(s,d,t,null==u?void 0:u.gateway_code,e,null==u?void 0:u.status)}const e=setTimeout(()=>{null==l||l.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(e)},[l,d,c,s]);const w=Et.create("success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),b=Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),x=Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),k=Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),S=Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),N=Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0 auto",maxWidth:"450px",paddingLeft:St.spacing.md,paddingRight:St.spacing.md}),_=Et.create("success-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),C=Et.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),$=Et.create("success-contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),I=Et.create("success-contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),T=Et.create("success-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),E=Et.create("success-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textAlign:"center",marginTop:St.spacing.md});return Ye(oa,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:w,children:[Ye("div",{className:b,children:Ye("div",{className:x,children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:k,children:[Ye("h1",{className:S,children:null!==(a=v.title)&&void 0!==a?a:"Payment Complete!"}),v.body?Ye(ca,{source:v.body,className:N}):Ye("p",{className:N,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 ",h?`covered by ${h}`:"covered","."]})]}),p&&Ye("div",{className:_,children:[Ye("h3",{className:C,children:"Need assistance?"}),Ye("div",{className:$,children:[m&&Ye("div",{className:I,children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Ye("span",{children:m})]}),f&&Ye("div",{className:I,children:[Ye("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:Ye("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"})}),Ye("span",{children:f})]})]}),Ye("div",{className:T,children:[f&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${f}`),children:[Ye("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:Ye("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"]}),m&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${m}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),s.reference&&Ye("div",{className:E,children:["Quote Reference: ",Ye("strong",{children:s.reference})]})]})})})})}function Ss({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,a]=st("initiating"),[s,l]=st(null),[c,d]=st(null),[u,h]=st(null);lt(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{a("initiating"),l(null);const t={...r,returnUrl:window.location.href},n=null===(e=r.metadata)||void 0===e?void 0:e.gateway;if(!n)throw new Error("Payment gateway not found");const o=await i.initiatePayment(t,n);h(o.transaction_id),a("redirecting"),window.location.href=o.gateway_acceptance_url}catch(e){l(e.message||"Failed to initiate payment"),a("failed")}},f=()=>{c&&!c.closed&&c.close(),a("initiating"),l(null),h(null),d(null),t()};return e?Ye("div",{className:Et.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:[Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`}),children:[Ye("div",{className:Et.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Ye("div",{className:Et.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Ye("h2",{className:Et.create("modal-title",{margin:"0",color:St.colors.foreground,fontSize:St.fontSize.large}),children:"Payment Processing"})]}),Ye("div",{className:Et.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Ye(wa,{className:Et.create("status-message",{fontSize:St.fontSize.default,color:St.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){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"}})()}),s&&Ye(wa,{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,padding:"0.75rem",backgroundColor:St.colors.destructive+"10",borderRadius:St.radius.default,border:`1px solid ${St.colors.destructive}30`}),children:s}),("redirecting"===o||"initiating"===o)&&Ye("div",{className:Et.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${St.colors.border}`,borderTop:`3px solid ${St.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Ye("div",{className:Et.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Ye(C,{children:[Ye(sa,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Ye(sa,{onClick:()=>{a("initiating"),l(null),m()},children:"Try Again"})]}):Ye(sa,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Ye("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Ns({transactionId:e,organisationId:t,allowCancel:n=!0,clientSettings:r=null}){var i,o,a,s,l,c;const{httpClient:d,formStateManager:u}=Bt(),h=null!==(o=null===(i=null==u?void 0:u.getQuoteIntent)||void 0===i?void 0:i.call(u))&&void 0!==o?o:null,m=null!==(s=null!=r?r:null===(a=null==h?void 0:h.organisation)||void 0===a?void 0:a.client_settings)&&void 0!==s?s:null,f=fa(m,"bank_transfer","bank_transfer"),p=(()=>{var e,t,n,r,i,o;const a=null===(n=null===(t=null===(e=null==m?void 0:m.status_pages)||void 0===e?void 0:e.per_gateway)||void 0===t?void 0:t.bank_transfer)||void 0===n?void 0:n.bank_transfer,s=null===(i=null===(r=null==m?void 0:m.status_pages)||void 0===r?void 0:r.default)||void 0===i?void 0:i.bank_transfer;return null!==(o=null!=a?a:s)&&void 0!==o?o:{}})(),g={title:null==p?void 0:p.instructions_title,body:null==p?void 0:p.instructions_body},[y,v]=st(!0),[w,b]=st(null),[x,k]=st(null),[S,N]=st(!1),[_,$]=st(!1),[I,T]=st(!1);lt(()=>{E()},[e]);const E=async()=>{try{if(v(!0),b(null),!d)throw new Error("HTTP client not available");const n=d.getBaseUrl(),r=await fetch(`${n}/payments/bank-transfer/${e}?orgId=${t}`);if(!r.ok)throw new Error(`Failed to load bank transfer details: ${r.statusText}`);const i=await r.json(),o=i.data||i;k({bank_account_name:o.bank_account_name,bank_account_number:o.bank_account_number,instructions_html:o.instructions_html,reference:o.reference,amount:Number(o.amount),currency:o.currency})}catch(e){b(e.message||"Failed to load bank transfer details")}finally{v(!1)}};return y?Ye(aa,{message:"Loading payment details..."}):w?Ye(oa,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:Et.create("error-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg}}),children:[Ye("div",{className:Et.create("error-icon",{fontSize:"3rem",marginBottom:St.spacing.md,color:St.colors.destructive}),children:"⚠️"}),Ye("h2",{className:Et.create("error-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.foreground}),children:"Error Loading Payment Details"}),Ye("p",{className:Et.create("error-message",{color:St.colors.mutedForeground}),children:w})]})})})}):x?Ye(oa,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:[Ye(la,{children:Ye("div",{className:Et.create("bank-transfer-container",{backgroundColor:St.colors.card,borderRadius:St.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Ye("div",{style:{backgroundColor:St.colors.primary},className:Et.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Ye("h1",{className:Et.create("header-title",{fontSize:"1.75rem",fontWeight:"700",margin:"0",marginBottom:"0.5rem"},{"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:"0.25rem"}}),children:null!==(l=f.title)&&void 0!==l?l:"Bank Transfer Payment"}),f.body?Ye(ca,{source:f.body,className:Et.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:St.fontSize.small}})}):Ye("p",{className:Et.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:St.fontSize.small}}),children:"Complete your payment using the details below"})]}),Ye("div",{className:Et.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Ye("div",{className:Et.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:St.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Ye("div",{className:Et.create("detail-row-amount",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.5rem"}}),children:[Ye("span",{className:Et.create("detail-label",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Amount to Transfer"}),Ye("span",{className:Et.create("detail-value-amount",{color:St.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",x.amount.toFixed(2)," ",x.currency]})]}),Ye("div",{className:Et.create("detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-name",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Account Name"}),Ye("span",{className:Et.create("detail-value-name",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.bank_account_name})]}),Ye("div",{className:Et.create("detail-row-number",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-number",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Account Number"}),Ye("span",{className:Et.create("detail-value-number",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.bank_account_number})]}),Ye("div",{className:Et.create("detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-ref",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Payment Reference"}),Ye("span",{className:Et.create("detail-value-ref",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.reference})]})]}),Ye("div",{className:Et.create("instructions-card",{backgroundColor:St.colors.muted,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Ye("h3",{className:Et.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground}),children:null!==(c=g.title)&&void 0!==c?c:"Payment Instructions"}),g.body?Ye(ca,{source:g.body,className:Et.create("instructions-text",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground})}):Ye(C,{children:[Ye("p",{className:Et.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground}),children:[Ye("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Ye("p",{className:Et.create("instructions-text",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground}),children:"Once we receive your payment, we will process your quote and send you a confirmation email."})]})]}),Ye("div",{className:Et.create("button-wrapper",{textAlign:"center",marginBottom:"1.5rem",display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},{"(max-width: 480px)":{flexDirection:"column",gap:"0.75rem",marginBottom:"1rem"}}),children:[Ye("button",{onClick:()=>{N(!0)},style:{backgroundColor:St.colors.primary},className:Et.create("confirm-button",{color:"white",border:"none",borderRadius:St.radius.default,padding:"0.75rem 2rem",fontSize:St.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"opacity 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"I've Made the Transfer"}),n&&Ye("button",{onClick:()=>{$(!0)},className:Et.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:St.radius.default,padding:"0.75rem 2rem",fontSize:St.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Ye("p",{className:Et.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:St.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),_&&Ye("div",{className:Et.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"}),onClick:()=>!I&&$(!1),children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Ye("div",{className:Et.create("warning-icon",{fontSize:"4rem",marginBottom:St.spacing.md}),children:"⚠️"}),Ye("h3",{className:Et.create("modal-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.foreground,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Ye("p",{className:Et.create("modal-message",{margin:"0",marginBottom:St.spacing.lg,color:St.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Ye("div",{className:Et.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Ye("button",{onClick:()=>$(!1),disabled:I,className:Et.create("no-button",{backgroundColor:"#f3f4f6",color:St.colors.foreground,border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:I?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:I?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Ye("button",{onClick:async()=>{if(d)try{T(!0);const n=d.getBaseUrl();if(!(await fetch(`${n}/payments/${e}/cancel-bank-transfer?orgId=${t}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to cancel payment");window.location.reload()}catch(e){b("Failed to cancel payment. Please try again."),$(!1),T(!1)}},disabled:I,className:Et.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:I?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:I?"0.5":"1",width:"100%"}),children:I?"Cancelling...":"Yes, Cancel Payment"})]})]})}),S&&Ye("div",{className:Et.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"}),onClick:()=>N(!1),children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Ye("div",{className:Et.create("success-icon",{fontSize:"4rem",marginBottom:St.spacing.md}),children:"✓"}),Ye("h3",{className:Et.create("modal-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.primary,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Ye("p",{className:Et.create("modal-message",{margin:"0",marginBottom:St.spacing.lg,color:St.colors.foreground,lineHeight:"1.6"}),children:"We'll process your payment as soon as we receive it. You'll receive a confirmation email once your coverage is activated."}),Ye("button",{onClick:()=>N(!1),className:Et.create("close-button",{backgroundColor:St.colors.primary,color:"white",border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}Et.pseudoElement("sidebar-continue-later-button",":hover",{backgroundColor:St.colors.muted,borderColor:St.colors.primary,color:St.colors.primary});class _s{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.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();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let a;for(;null!==(a=i.exec(e));){const e=`--${a[1]}`,i=a[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return Pt}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[e,t]of Object.entries(n.variables))this.variableMapping[e]||(i[e]=t);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}_s.loadedThemes=new Set,_s.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"};var Cs=Object.freeze({__proto__:null,ThemeLoader:_s});function $s(e,t){return"windcave"!==e?"Provider Fee:":"account2account"===t?"Account2Account surcharge:":"Credit card surcharge:"}function Is(e){var t;return(null===(t=e.metadata)||void 0===t?void 0:t.gateway_method)?`${e.gateway_code}:${e.metadata.gateway_method}`:e.gateway_code}function Ts({paymentLinkId:e,signedUrl:n}){var r,i,o,a,s,l,c,d,u,h,m,f,p,g,y,v,w,b,x,k,S,N,_,$,I,T,E;const P=Bt().httpClient,[R,z]=st(null),[D,M]=st(!0),[O,j]=st(null),[W,A]=st(!1),[L,B]=st(null),[q,F]=st(null),[H,U]=st(null),[Y,Z]=st(!1),[V,G]=st(null),[Q,J]=st(null),[K,X]=st(!0),ee="undefined"!=typeof window?new URLSearchParams(window.location.search):new URLSearchParams,[te,ne]=st("processing"===ee.get("status")?ee.get("transactionId"):null),[re,ie]=st(()=>Fa()),[oe,ae]=st(null),[se,le]=st(!1),[ce,de]=st(null),[ue,he]=st(null),[me,fe]=st(null);lt(()=>{pe()},[e]);const pe=async()=>{var r,i,o;try{M(!0);const a=new URLSearchParams(window.location.search),s=a.get("transactionId"),l=a.get("status"),c=a.get("gateway_code"),d=a.get("method"),u=a.get("excess_id");s&&l&&(Z(!0),G(l),J(s)),c&&U(d?`${c}:${d}`:c);const h=n?await P.getPaymentLinkDetails(n):await P.getPaymentLinkById(e);if(h.organisation&&h.organisation.theme)try{await _s.loadTheme({slug:h.organisation.slug,theme_url:h.organisation.theme.css_url})}catch(e){t()}if("paid"===h.status&&!Y&&(!s||"completed"!==l&&"success"!==l))return z(h),void j("This payment link has already been used.");if("superseded"===h.status)return z(h),void j("This payment link has been replaced by a newer one. Please use the latest link you received.");if("confirmed"===h.status)return z(h),void he({message:"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:null===(r=h.metadata)||void 0===r?void 0:r.effective_date});if("expired"===h.status)return z(h),void j("This payment link has expired.");if("cancelled"===h.status)return z(h),void j("This payment link has been cancelled.");if("outdated"===h.status)return z(h),void j("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");const m=Array.isArray(h.payment_options)&&h.payment_options.some(e=>{var t,n;return Number(null!==(n=null===(t=e.amount)||void 0===t?void 0:t.total)&&void 0!==n?n:0)>0}),f=Array.isArray(h.calculations)&&h.calculations.some(e=>{var t;return Number(null!==(t=e.premium_payable)&&void 0!==t?t:0)>0});if(!m&&!f)return z(h),void j("This payment link is not available. Please contact support.");if("awaiting_payment"===h.status&&h.pending_bank_transfer){const e=h.pending_bank_transfer;return t(),void fe({transactionId:e.transaction_id,organisationId:(null===(i=h.organisation)||void 0===i?void 0:i.id)||""})}if(u){const e=h.calculations.find(e=>e.excess_id===u);e?F(e.id):1===h.calculations.length&&h.calculations[0]&&F(h.calculations[0].id)}else 1===h.calculations.length&&h.calculations[0]&&F(h.calculations[0].id);!c&&1===h.payment_options.length&&h.payment_options[0]&&U(Is(h.payment_options[0])),z(h),(null===(o=h.organisation)||void 0===o?void 0:o.quote_page_url)&&de(h.organisation.quote_page_url)}catch(e){j("Failed to load payment details. Please check your link.")}finally{M(!1)}},ge=dt(()=>R&&q?R.calculations.find(e=>e.id===q):null,[R,q]),ye=dt(()=>R&&H?R.payment_options.find(e=>Is(e)===H):null,[R,H]);if(me)return Ye(Ns,{transactionId:me.transactionId,organisationId:me.organisationId,allowCancel:!0,clientSettings:null!==(i=null===(r=null==R?void 0:R.organisation)||void 0===r?void 0:r.client_settings)&&void 0!==i?i:null});if(ue){const e=null==R?void 0:R.organisation,t=null==e?void 0:e.admin_email,n=null==e?void 0:e.phone,r=t||n;return Ye(oa,{title:"Renewal Confirmed",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("auto-renew-success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Ye("div",{className:Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),children:Ye("div",{className:Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),children:[Ye("h1",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Renewal Confirmed"}),Ye("p",{className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"}),children:ue.message})]}),ue.effectiveDate&&Ye("div",{className:Et.create("payment-date-box",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg,marginBottom:St.spacing.lg,textAlign:"center"}),children:[Ye("p",{className:Et.create("payment-date-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0",marginBottom:St.spacing.sm}),children:"Your first payment will be on"}),Ye("p",{className:Et.create("payment-date-value",{fontSize:"1.25rem",fontWeight:"600",color:St.colors.foreground,margin:"0"}),children:new Date(ue.effectiveDate).toLocaleDateString("en-NZ",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]}),Ye("div",{className:Et.create("info-box",{backgroundColor:St.colors.muted,borderRadius:St.radius.default,padding:St.spacing.md,marginBottom:St.spacing.lg}),children:Ye("p",{className:Et.create("info-text",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0",textAlign:"center"}),children:"No further action is required. Your monthly payments will continue as normal."})}),r&&Ye("div",{className:Et.create("contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),children:[Ye("h3",{className:Et.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Ye("div",{className:Et.create("contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[t&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Email: ",t]})}),n&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Phone: ",n]})})]})]})]})})})}if(te&&P)return Ye(oa,{title:"Payment Processing",noSubscription:!0,hideHeader:!0,children:Ye(Aa,{httpClient:P,transactionId:te,onResolved:async e=>{const t="completed"===e?"success":"cancelled"===e?"cancelled":"failed"===e?"declined":"error",n=new URL(window.location.href);n.searchParams.set("status",t),te&&n.searchParams.set("transactionId",te),window.history.replaceState({},"",n.toString()),ne(null),await pe()},onError:async()=>{const e=new URL(window.location.href);e.searchParams.set("status","error"),window.history.replaceState({},"",e.toString()),ne(null),await pe()}})});if(D)return Ye(aa,{message:"Loading payment details..."});if(O){const e=null==R?void 0:R.organisation,t=null==e?void 0:e.quote_page_url,n=null==e?void 0:e.name,r=null==e?void 0:e.admin_email,i=null==e?void 0:e.phone,o=r||i,a="paid"===(null==R?void 0:R.status),s=a?"Payment Completed":"Payment Link Unavailable",l=a?"Thank you, your payment was received.":O,c=Et.create("pl-error-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),d=Et.create("pl-error-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),u=Et.create("pl-error-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),h=Et.create("pl-error-header",{textAlign:"center",marginBottom:St.spacing.xl}),m=Et.create("pl-error-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),f=Et.create("pl-error-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),p=Et.create("pl-error-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),g=Et.create("pl-error-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),y=Et.create("pl-error-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:St.spacing.lg}),v=()=>Ye("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:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),Ye("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),w=()=>Ye("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:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("polyline",{points:"8 12.5 11 15.5 16 9.5"})]});return Ye(oa,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(la,{children:Ye("div",{className:c,children:[Ye("div",{className:d,children:Ye(a?w:v,{})}),Ye("div",{className:h,children:[Ye("h1",{className:m,children:s}),Ye("p",{className:f,children:l})]}),t&&Ye("div",{className:Et.create("pl-error-quote-action",{display:"flex",justifyContent:"center",marginBottom:o?"0":St.spacing.sm}),children:Ye(sa,{variant:"primary",onClick:()=>{window.location.href=t},children:"Start a New Quote"})}),o&&Ye("div",{className:p,children:[Ye("p",{className:g,children:n?`Need assistance? Contact ${n}`:"Need assistance? Contact us"}),Ye("div",{className:y,children:[i&&Ye(sa,{variant:"outline",onClick:()=>window.open(`tel:${i}`),children:[Ye("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:Ye("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"]}),r&&Ye(sa,{variant:"outline",onClick:()=>window.open(`mailto:${r}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]})]})})})})}if(!R)return null;const ve=new URLSearchParams(window.location.search),we=ve.get("transactionId"),be=ve.get("status"),xe=we&&be;if("paid"===R.status&&("completed"===be||"success"===be||xe||Y||"completed"===V)){const e=null===(o=R.organisation)||void 0===o?void 0:o.admin_email,t=null===(a=R.organisation)||void 0===a?void 0:a.phone,n=e||t,r=null!==(l=null!==(s=ve.get("gateway_code"))&&void 0!==s?s:null==ye?void 0:ye.gateway_code)&&void 0!==l?l:null,i=fa(null!==(d=null===(c=R.organisation)||void 0===c?void 0:c.client_settings)&&void 0!==d?d:null,"payment_success",r),m=null!==(u=i.title)&&void 0!==u?u:"Payment Complete!",f=i.body;return Ye(oa,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("payment-success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Ye("div",{className:Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),children:Ye("div",{className:Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),children:[Ye("h1",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:m}),f?Ye(ca,{source:f,className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"})}):Ye("p",{className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully! You will receive your documentation by email."})]}),n&&Ye("div",{className:Et.create("contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),children:[Ye("h3",{className:Et.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Ye("div",{className:Et.create("contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),children:[e&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Email: ",e]})}),t&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Phone: ",t]})})]}),(Q||we)&&Ye("div",{className:Et.create("reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textAlign:"center",marginTop:St.spacing.md}),children:["Transaction ID: ",Ye("strong",{children:null===(h=Q||we)||void 0===h?void 0:h.slice(0,8).toUpperCase()})]})]})]})})})}const ke=K&&xe&&("failed"===be||"declined"===be||"cancelled"===be||"failed"===V||"declined"===V||"cancelled"===V),Se="cancelled"===be||"cancelled"===V?"cancelled":"failed"===be||"declined"===be||"failed"===V||"declined"===V?"declined":"error",Ne=R.calculations,_e=Ne.length>1,Ce=Ne.length>0,$e=Ce,Ie=(null===(m=R.metadata)||void 0===m?void 0:m.product_name)||(null===(f=R.policy_details)||void 0===f?void 0:f.product_name)||"Payment",Te=Boolean(null===(p=null==R?void 0:R.metadata)||void 0===p?void 0:p.quote_intent_id),Ee=Boolean((!Ce||q)&&H&&!oe&&!se),Pe=dt(()=>{var e,t;const n=null===(e=null==R?void 0:R.metadata)||void 0===e?void 0:e.client_details;if(n)return{firstName:n.first_name,lastName:n.last_name,email:n.email,phone:n.phone};const r=null===(t=null==R?void 0:R.policy_details)||void 0===t?void 0:t.client_name;if(r){const e=r.trim().split(/\s+/);return{firstName:e[0]||r,lastName:e.slice(1).join(" ")||"",email:void 0,phone:void 0}}return null},[R]),Re=dt(()=>{var e;const t=null==R?void 0:R.policy_details;if(!t)return null;const n=e=>{if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString()},r=n(t.insured_from),i=n(t.insured_to),o=r&&i?`${r} – ${i}`:r||i||null,a=null!=t.sum_insured&&t.sum_insured>0?t.sum_insured:null,s=null!=t.excess&&t.excess>=0?t.excess:null;return t.external_policy_number||o||null!=a||null!=s?{externalPolicyNumber:null!==(e=t.external_policy_number)&&void 0!==e?e:null,insurancePeriod:o,sumInsured:a,excess:s}:null},[R]),ze=dt(()=>ge&&ge.line_item_display||null,[ge]),De=null===(g=null==R?void 0:R.metadata)||void 0===g?void 0:g.type,Me=null!==(b=null===(w=null===(v=null===(y=null==R?void 0:R.organisation)||void 0===y?void 0:y.client_settings)||void 0===v?void 0:v.checkout)||void 0===w?void 0:w.headings)&&void 0!==b?b:{},Oe="renewal"===De?"Complete Your Renewal":"endorsement"===De?"Complete Your Payment":"Complete Your Purchase",je="renewal"===De?"renewal":"endorsement"===De?"endorsement":"payment_link",We=Me[je]&&String(Me[je]).trim()||Oe;return Ye(oa,{title:We,noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column"},"(max-width: 480px)":{gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column"}),children:[Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:We}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:Ce?_e?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage.":"Choose your payment option to complete your purchase."}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[Te&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:"Cover Start Date"}),Ye("div",{className:Et.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Ye("input",{type:"date",value:re,onChange:e=>{return t=e.target.value,ie(t),void(async e=>{var t;if(R&&P&&(null===(t=R.metadata)||void 0===t?void 0:t.quote_intent_id)){le(!0),ae(null);try{const t=await P.validateCoverStartDate(R.payment_link_id,e);t.valid?ae(null):(ae(t.message||"This cover start date is not valid."),t.quote_page_url&&de(t.quote_page_url))}catch(e){ae("Failed to validate cover date. Please try again.")}finally{le(!1)}}})(t);var t},min:Fa(),disabled:se,className:Et.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:St.fontSize.default,border:`2px solid ${oe?St.colors.destructive:St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.background,color:St.colors.foreground,width:"auto",maxWidth:"200px",cursor:se?"wait":"pointer"})}),se&&Ye("p",{className:Et.create("validating-text",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:"Validating..."}),oe&&Ye("div",{className:Et.create("cover-date-error",{backgroundColor:`${St.colors.destructive}10`,border:`1px solid ${St.colors.destructive}`,borderRadius:St.radius.default,padding:"1rem"}),children:[Ye("p",{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,margin:"0",marginBottom:ce?St.spacing.md:"0"}),children:oe}),ce&&Ye("a",{href:ce,className:Et.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:St.colors.primary,fontSize:St.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Ye("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:[Ye("path",{d:"M5 12h14"}),Ye("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),$e&&Ce&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(ba,{title:1===Ne.length?"Excess":"Excess Options"}),Ye("div",{className:Et.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...Ne].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===q;return Ye("div",{className:Ot(Et.create("excess-option-card",{borderRadius:St.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?Et.create("excess-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("excess-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>F(e.id),children:[Ye(xa,{selected:t}),Ye("div",{className:Et.create("excess-amount",{color:St.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==ge?void 0:ge.description)&&Ye("div",{className:Et.create("excess-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(wa,{className:Et.create("excess-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:ge.description})})]}),R.payment_options.length>0&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Ye(ba,{title:"Payment Options"}),Ye("div",{className:Et.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:R.payment_options.map(e=>{var t,n;const r=Is(e),i=H===r,o="monthly"===e.payment_frequency,a=!!((null===(t=e.metadata)||void 0===t?void 0:t.gateway_fee)&&parseFloat(e.metadata.gateway_fee)>0),s=!0===(null===(n=e.metadata)||void 0===n?void 0:n.unavailable),l=()=>{var t;return s?"Currently Unavailable":o&&e.amount.monthly?`${Sa(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:Sa(parseFloat(e.amount.due_today))},c=()=>e.description?e.description:"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Ye("div",{title:s?"Currently Unavailable":void 0,className:Ot(Et.create("payment-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:s?"not-allowed":"pointer",opacity:s?"0.55":"1",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),i?Et.create("payment-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("payment-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>{s||U(r)},children:[Ye("div",{className:Et.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Ye(xa,{selected:i}),Ye("div",{className:Et.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Ye("div",{className:Et.create("frequency-title",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.display_title||Na(o?"monthly":"one-time",e.gateway_code)}),Ye("div",{className:Et.create("gateway-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:c()})]})]}),Ye("div",{className:Et.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Ye(wa,{className:Et.create("amount-text",{textAlign:"right",color:St.colors.foreground}),children:l()}),!s&&Ye(wa,{size:"small",className:Et.create("gateway-fee-text",{textAlign:"right",color:St.colors.mutedForeground}),children:a?`${(()=>{var t;return"bank_transfer"===e.gateway_code?null:(null===(t=e.metadata)||void 0===t?void 0:t.gateway_fee)?Sa(parseFloat(e.metadata.gateway_fee)):Sa(0)})()} fee`:"No fees"})]}),Ye("div",{className:Et.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Ye(xa,{selected:i}),Ye("div",{className:Et.create("payment-option-title-mobile",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.display_title||Na(o?"monthly":"one-time",e.gateway_code)})]}),Ye("div",{className:Et.create("payment-option-bottom-mobile",{display:"none"},{"(max-width: 480px)":{display:"flex",flex:"1 1 100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"1.5rem"}}),children:[Ye("div",{className:Et.create("gateway-description-mobile",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:c()}),Ye(wa,{className:Et.create("amount-text-mobile",{fontWeight:"500",color:St.colors.foreground}),children:l()})]})]},r)})})]})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{}),children:[(Pe||Re||ze&&ze.length>0)&&Ye("div",{className:Et.create("insurance-details-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm},{"(max-width: 768px)":{padding:St.spacing.md}}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.md,color:St.colors.foreground}),children:"Insurance Details"}),(Pe||Re||"Payment"!==Ie)&&Ye(C,{children:[Ye("div",{className:Et.create("client-details",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[(null==Pe?void 0:Pe.firstName)&&(null==Pe?void 0:Pe.lastName)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Name"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:[null==Pe?void 0:Pe.firstName," ",null==Pe?void 0:Pe.lastName]})]}),(null==Pe?void 0:Pe.email)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Email"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:null==Pe?void 0:Pe.email})]}),(null==Pe?void 0:Pe.phone)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Phone"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:null==Pe?void 0:Pe.phone})]}),"Payment"!==Ie&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Product"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Ie})]}),(null==Re?void 0:Re.externalPolicyNumber)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Policy Number"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Re.externalPolicyNumber})]}),(null==R?void 0:R.quote_reference)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Quote Reference"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:R.quote_reference})]}),null!=(null==Re?void 0:Re.sumInsured)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Sum Insured"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Sa(Re.sumInsured)})]}),null!=(null==Re?void 0:Re.excess)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Excess"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Sa(Re.excess)})]})]}),ze&&ze.length>0&&Ye("hr",{className:Et.create("divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})})]}),ze&&ze.length>0&&Ye("div",{className:Et.create("line-items-section",{display:"flex",flexDirection:"column",gap:St.spacing.md}),children:ze.map((e,t)=>Ye("div",{className:Et.create("line-item",{}),children:[Ye("div",{className:Et.create("line-item-description",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground}),children:e.description}),e.show_sum_insured&&null!=e.sum_insured&&e.sum_insured>0&&Ye("div",{className:Et.create("line-item-sum-insured",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.sm}),children:["Sum Insured: ",Sa(e.sum_insured)]})]},t))})]}),(Pe||Re||ze&&ze.length>0)&&Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg},{"(max-width: 950px)":{height:St.spacing.md}})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.sm,color:St.colors.foreground}),children:"Payment Details"}),ye&&Ye("div",{className:Et.create("summary-section",{paddingBottom:"1rem"}),children:Ye("div",{className:Et.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==ye.payment_frequency?Ye(C,{children:[(null===(x=ye.metadata)||void 0===x?void 0:x.gateway_fee)&&parseFloat(ye.metadata.gateway_fee)>0&&Ye(Es,{label:$s(ye.gateway_code,null===(k=ye.metadata)||void 0===k?void 0:k.gateway_method),value:Sa(parseFloat(ye.metadata.gateway_fee))}),Ye(Es,{label:"Total Due Today:",value:Sa(parseFloat(ye.amount.due_today)),isTotal:!0})]}):Ye(C,{children:[(null===(S=ye.metadata)||void 0===S?void 0:S.gateway_fee)&&parseFloat(ye.metadata.gateway_fee)>0&&Ye(Es,{label:$s(ye.gateway_code,null===(N=ye.metadata)||void 0===N?void 0:N.gateway_method),value:Sa(parseFloat(ye.metadata.gateway_fee))}),ye.amount.total&&Ye(Es,{label:"Total Payable:",value:Sa(parseFloat(ye.amount.total))}),Ye(Es,{label:"Due Today:",value:Sa(parseFloat(ye.amount.due_today))}),ye.amount.monthly&&(null===(_=ye.metadata)||void 0===_?void 0:_.number_of_instalments)&&ye.metadata.number_of_instalments>1&&Ye(Es,{label:"Remaining payments:",value:`${ye.metadata.number_of_instalments-1} x ${Sa(parseFloat(ye.amount.monthly))}`})]})})}),Ye(sa,{onClick:async()=>{var e,t,n,r,i,o;if(!R)return;const a=R.calculations.length>0,s=!a;if(a&&!q)return void alert("Please select an excess amount before proceeding.");if(!H)return void alert("Please select a payment method before proceeding.");const l=a?R.calculations.find(e=>e.id===q):null;if(a&&!l)return void alert("Payment configuration error. Please try again.");const c=R.payment_options.find(e=>Is(e)===H);if(!c)return void alert("Payment method not available. Please try again.");const d=c.gateway_code,u=null===(e=c.metadata)||void 0===e?void 0:e.gateway_method;let h="Customer";if(null===(t=R.metadata)||void 0===t?void 0:t.client_name)h=R.metadata.client_name;else if(null===(n=R.metadata)||void 0===n?void 0:n.client_details){const e=R.metadata.client_details;e.first_name&&(h=`${e.first_name} ${e.last_name||""}`.trim())}if(s){if(!P)return void alert("Payment service not available. Please try again.");try{M(!0);const e=await P.initiateFixedPayment(R.payment_link_id,d,h,u);if("auto_renew_confirmed"===e.status)return void he({message:e.message||"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:e.effective_date});if("bank_transfer"===d&&e.transaction_id)return void fe({transactionId:e.transaction_id,organisationId:(null===(r=R.organisation)||void 0===r?void 0:r.id)||""});e.gateway_acceptance_url?window.location.href=e.gateway_acceptance_url:alert("Payment initiated successfully")}catch(e){alert(e.message||"Failed to initiate payment")}finally{M(!1)}return}const m=null===(i=R.metadata)||void 0===i?void 0:i.quote_intent_id,f={...m?{quoteIntentId:m}:{paymentLinkId:R.payment_link_id},paymentLinkId:R.payment_link_id,excessId:(null==l?void 0:l.excess_id)||"",gatewayId:d,calculationId:q||"",clientDetails:{legalName:h},metadata:{payment_link_id:R.payment_link_id,payment_type:m?"quote":"rate",gateway_code:d,gateway:d,...u?{gateway_method:u}:{}},...Te&&re?{coverStartDate:re}:{}};if("bank_transfer"!==d)B(f),A(!0);else{if(!P)return void alert("Payment service not available. Please try again.");try{M(!0);const e={...f,returnUrl:window.location.href},t=await P.initiatePayment(e,d);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");fe({transactionId:t.transaction_id,organisationId:(null===(o=R.organisation)||void 0===o?void 0:o.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{M(!1)}}},disabled:!Ee,className:Et.create("purchase-button",{width:"100%",height:"3rem",fontSize:St.fontSize.default,fontWeight:"600"}),children:Ee?"Go to Payment":"Select Options to Continue"})]})})]})})]}),W&&L&&P&&Ye(Ss,{isOpen:W,onClose:()=>{A(!1),B(null)},onSuccess:()=>{A(!1),B(null),alert("Payment completed successfully!")},paymentRequest:L,httpClient:P}),ke&&Ye(Wa,{type:Se,transactionId:we||Q||void 0,clientSettings:null!==(I=null===($=null==R?void 0:R.organisation)||void 0===$?void 0:$.client_settings)&&void 0!==I?I:null,gatewayCode:null!==(E=null!==(T=ve.get("gateway_code"))&&void 0!==T?T:null==ye?void 0:ye.gateway_code)&&void 0!==E?E:void 0,isOpen:!0,onClose:()=>{X(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}})]})})}function Es({label:e,value:t,isTotal:n=!1,className:r}){return Ye("div",{className:Ot(Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Ye("span",{className:Et.create("summary-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e}),Ye("span",{className:Et.create("summary-value",{fontWeight:n?"600":"500",color:St.colors.foreground,fontSize:n?St.fontSize.large:"inherit"}),children:t})]})}function Ps({products:e,onSelectProduct:t}){const[n,r]=st(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Ye(oa,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Ye("div",{className:Et.create("product-selection-card",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Ye("div",{className:Et.create("product-selection-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("product-selection-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Ye("p",{className:Et.create("product-selection-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Ye("hr",{className:Et.create("product-selection-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]}),Ye("div",{className:Et.create("product-selection-content",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[0===e.length?Ye("div",{className:Et.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.muted}),children:[Ye("div",{style:{marginBottom:St.spacing.default},children:Ye("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Ye("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Ye("polyline",{points:"14 2 14 8 20 8"})]})}),Ye("p",{className:Et.create("placeholder-text",{color:St.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Ye("div",{className:Et.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Ye(Rs,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Ye("div",{className:Et.create("product-selection-actions",{marginTop:St.spacing.lg}),children:Ye(sa,{onClick:()=>{n&&t(n)},disabled:!n,className:Et.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function Rs({product:e,isSelected:t,onSelect:n}){return Ye("div",{className:Ot(Et.create("product-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem"}}),t?Et.create("product-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("product-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Ye(xa,{selected:t}),Ye("div",{className:Et.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Ye("div",{className:Et.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Ye("div",{className:Et.create("product-option-description",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.description}),Ye("div",{className:Et.create("product-option-name",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Ye("div",{className:Et.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?St.colors.primary:St.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg.replace(/^<svg(?![^>]*\bwidth\b)/,'<svg width="100%" height="100%"')}})]})]})}function zs(){var e,t;const n=Bt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Ye(Ps,{products:i,onSelectProduct:()=>{}});if(r)return Ye(Ts,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const a=new URLSearchParams(window.location.search),s=a.get("p")||a.get("pl_ref");if(s&&!o)return Ye(Ts,{paymentLinkId:s});const l=window.location.pathname,c=l.match(/\/pay\/([a-f0-9-]+)/);if(c&&c[1])return Ye(Ts,{paymentLinkId:c[1],signedUrl:window.location.href});const d=l.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),u=a.get("orgId");if(d&&d[1]&&u)return Ye(Ns,{transactionId:d[1],organisationId:u});const{isCalculating:h,results:m,quoteIntent:f}=qt(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent(),fsm:e})),p="hold"===(null==f?void 0:f.status),g=null===(e=null==f?void 0:f.payment_transactions)||void 0===e?void 0:e.find(e=>"bank_transfer"===e.gateway_code&&"pending"===e.status),y="paid"===(null==f?void 0:f.status)||"completed"===(null==f?void 0:f.status);return h?Ye(aa,{title:"Calculating premium",message:"Crunching the numbers now"}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Ye(Ns,{transactionId:g.id,organisationId:f.organisation.id,allowCancel:!0}):y?Ye(ks,{}):m?Ye(ts,{results:m}):Ye(xs,{})}function Ds(e){return Ye(Lt,{...e,children:Ye(zs,{})})}function Ms({reference:e,productName:t,firstName:n,lastUpdated:r,onContinue:i,onStartFresh:o}){const[a,s]=st(null);return Ye(oa,{title:"Resume Quote",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("resume-prompt-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Ye("div",{className:Et.create("resume-prompt-card",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Ye("div",{className:Et.create("resume-prompt-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("resume-prompt-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Existing Quote Found"}),Ye("p",{className:Et.create("resume-prompt-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:"There is a quote in progress. Would you like to continue where you left off or start a new quote?"}),(e||t||n||r)&&Ye("div",{className:Et.create("resume-prompt-details",{marginTop:St.spacing.md,padding:St.spacing.md,backgroundColor:St.colors.background,borderRadius:St.radius.default,display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[t&&Ye("div",{className:Et.create("resume-prompt-detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Product"}),Ye("span",{className:Et.create("resume-prompt-detail-value",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:t})]}),n&&Ye("div",{className:Et.create("resume-prompt-detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-name",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Client"}),Ye("span",{className:Et.create("resume-prompt-detail-value-name",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:n})]}),e&&Ye("div",{className:Et.create("resume-prompt-detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-ref",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Reference"}),Ye("span",{className:Et.create("resume-prompt-detail-value-ref",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:e})]}),r&&Ye("div",{className:Et.create("resume-prompt-detail-row-date",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-date",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Last updated"}),Ye("span",{className:Et.create("resume-prompt-detail-value-date",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:r})]})]}),Ye("hr",{className:Et.create("resume-prompt-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]}),Ye("div",{className:Et.create("resume-prompt-content",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.md},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[Ye(sa,{onClick:()=>{s("continue"),i()},loading:"continue"===a,disabled:null!==a,className:Et.create("resume-prompt-continue-btn",{width:"100%"}),children:"Continue where I left off"}),Ye(sa,{variant:"outline",onClick:()=>{s("fresh"),o()},loading:"fresh"===a,disabled:null!==a,className:Et.create("resume-prompt-fresh-btn",{width:"100%"}),children:"Start a new quote"})]})]})})})})}class Os extends ${constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return Uh}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=ke("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return Te(e)?Ye(ya,{message:e.message,organisation:e.organisation}):Ye(ga,{error:e})}return this.props.children}}function js({config:e,initializeFormContext:n}){const[r,i]=st({type:"loading",message:"Loading application..."}),o=n=>{if(n.resumePrompt)return t(),void i({type:"resume_prompt",resumeData:n.resumePrompt});const r=n.availableProducts&&n.availableProducts.length>0;if(r&&!n.formStateManager)return t(),void i({type:"product_selection",products:n.availableProducts});if(!("payment"===e.mode||n.paymentLinkConfig||r||n.formStateManager&&"function"==typeof n.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:n})},a=async(r="Loading application...")=>{var a;i({type:"loading",message:r});try{t();const r=await n(e);o(r)}catch(e){let n;if(t(),e&&"object"==typeof e&&"type"in e&&"VERSION_INVALIDATED"===e.type){const t=e.versionInvalidated,r=e.message;n=ke("version_invalidated",{...e,organisation:{quote_page_url:null!==(a=null==t?void 0:t.quote_page_url)&&void 0!==a?a:null}},r)}else n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?ke("maintenance",e):ke("initialization",e);t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}};lt(()=>{e.isolateStyles&&Ct(),a()},[e,n]);const s=async e=>{if("resume_prompt"!==r.type)return;const{onContinue:n,onStartFresh:a}=r.resumeData;i({type:"loading",message:"continue"===e?"Loading your quote...":"Starting a new quote..."});try{const t="continue"===e?await n():await a();o(t)}catch(e){t();const n=ke("initialization",e);i({type:"error",error:n})}},l=async e=>{t(e.code),localStorage.setItem("insure-os-selected-product",e.code),await a("Loading...")};return Ye(Os,{children:Ye("div",{className:Et.create("root",{fontFamily:St.fontFamily,backgroundColor:St.colors.background,minHeight:"100vh",color:St.colors.foreground,maxWidth:"100vw",overflowX:"hidden",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"}),children:function(){var e,t;switch(r.type){case"loading":return Ye(aa,{message:r.message});case"error":return Te(r.error)?Ye(ya,{message:r.error.message,organisation:r.error.organisation}):"version_invalidated"===r.error.type?Ye(va,{quotePageUrl:null!==(t=null===(e=r.error.organisation)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:r.error.message}):Ye(ga,{error:r.error});case"product_selection":return Ye(Ps,{products:r.products,onSelectProduct:l});case"resume_prompt":return Ye(Ms,{reference:r.resumeData.reference,productName:r.resumeData.productName,firstName:r.resumeData.firstName,lastUpdated:r.resumeData.lastUpdated,onContinue:()=>s("continue"),onStartFresh:()=>s("fresh")});case"success":return Ye(Ds,{...r.formContextProps});default:return Ye(ga,{})}}()})})}const Ws="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,As=globalThis,Ls="10.48.0";function Bs(){return qs(As),As}function qs(e){const t=e.oe=e.oe||{};return t.version=t.version||Ls,t[Ls]=t[Ls]||{}}function Fs(e,t,n=As){const r=n.oe=n.oe||{},i=r[Ls]=r[Ls]||{};return i[e]||(i[e]=t())}const Hs=["debug","info","warn","error","log","assert","trace"],Us={};function Ys(e){if(!("console"in As))return e();const t=As.console,n={},r=Object.keys(Us);r.forEach(e=>{const r=Us[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Zs(){return Gs().enabled}function Vs(e,...t){Ws&&Zs()&&Ys(()=>{As.console[e](`Sentry Logger [${e}]:`,...t)})}function Gs(){return Ws?Fs("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Qs=function(){Gs().enabled=!0},Js=function(...e){Vs("log",...e)},Ks=function(...e){Vs("warn",...e)},Xs=function(...e){Vs("error",...e)},el="?",tl=/\(error: (.*)\)/,nl=/captureMessage|captureException/;function rl(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{const i=[],o=e.split("\n");for(let e=n;e<o.length;e++){let n=o[e];n.length>1024&&(n=n.slice(0,1024));const a=tl.test(n)?n.replace(tl,"$1"):n;if(!a.includes("Error: ")){for(const e of t){const t=e(a);if(t){i.push(t);break}}if(i.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(il(t).function||"")&&t.pop(),t.reverse(),nl.test(il(t).function||"")&&(t.pop(),nl.test(il(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||il(t).filename,function:e.function||el}))}(i.slice(r))}}function il(e){return e[e.length-1]||{}}const ol="<anonymous>";function al(e){try{return e&&"function"==typeof e&&e.name||ol}catch{return ol}}function sl(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function ll(e){return"ae"in e&&e.ae?"[VueVNode]":"[VueViewModel]"}const cl={},dl={};function ul(e,t){cl[e]=cl[e]||[],cl[e].push(t)}function hl(e,t){if(!dl[e]){dl[e]=!0;try{t()}catch(t){Ws&&Xs(`Error while instrumenting ${e}`,t)}}}function ml(e,t){const n=e&&cl[e];if(n)for(const r of n)try{r(t)}catch(t){Ws&&Xs(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${al(r)}\nError:`,t)}}let fl=null;function pl(){fl=As.onerror,As.onerror=function(e,t,n,r,i){return ml("error",{column:r,error:i,line:n,msg:e,url:t}),!!fl&&fl.apply(this,arguments)},As.onerror.se=!0}let gl=null;function yl(){gl=As.onunhandledrejection,As.onunhandledrejection=function(e){return ml("unhandledrejection",e),!gl||gl.apply(this,arguments)},As.onunhandledrejection.se=!0}const vl={}.toString;function wl(e){switch(vl.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Tl(e,Error)}}function bl(e,t){return vl.call(e)===`[object ${t}]`}function xl(e){return bl(e,"ErrorEvent")}function kl(e){return bl(e,"DOMError")}function Sl(e){return bl(e,"String")}function Nl(e){return"object"==typeof e&&null!==e&&"le"in e&&"ce"in e}function _l(e){return null===e||Nl(e)||"object"!=typeof e&&"function"!=typeof e}function Cl(e){return bl(e,"Object")}function $l(e){return"undefined"!=typeof Event&&Tl(e,Event)}function Il(e){return Boolean(e?.then&&"function"==typeof e.then)}function Tl(e,t){try{return e instanceof t}catch{return!1}}function El(e){return!("object"!=typeof e||null===e||!(e.de||e.ue||e.ae))}function Pl(e){return"undefined"!=typeof Request&&Tl(e,Request)}const Rl=As;function zl(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,a=0;const s=" > ",l=s.length;let c;const d=Array.isArray(t)?t:t.keyAttrs,u=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=Dl(n,d),!("html"===c||o>1&&a+i.length*l+c.length>=u));)i.push(c),a+=c.length,n=n.parentNode;return i.reverse().join(s)}catch{return"<unknown>"}}function Dl(e,t){const n=e,r=[];if(!n?.tagName)return"";if(Rl.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=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&Sl(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}for(const e of["aria-label","type","name","title","alt"]){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}function Ml(){try{return Rl.document.location.href}catch{return""}}function Ol(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Wl(i,r);try{e[t]=i}catch{Ws&&Js(`Failed to replace method "${t}" in object`,e)}}function jl(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Ws&&Js(`Failed to add non-enumerable property "${t}" to object`,e)}}function Wl(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,jl(e,"__sentry_original__",t)}catch{}}function Al(e){return e.he}function Ll(e){if(wl(e))return{message:e.message,name:e.name,stack:e.stack,...ql(e)};if($l(e)){const t={type:e.type,target:Bl(e.target),currentTarget:Bl(e.currentTarget),...ql(e)};return"undefined"!=typeof CustomEvent&&Tl(e,CustomEvent)&&(t.detail=e.detail),t}return e}function Bl(e){try{return"undefined"!=typeof Element&&Tl(e,Element)?zl(e):{}.toString.call(e)}catch{return"<unknown>"}}function ql(e){return"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e)):{}}let Fl,Hl,Ul;function Yl(e){if(void 0!==Fl)return Fl?Fl(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=As;return t in n&&"function"==typeof n[t]?(Fl=n[t],Fl(e)):(Fl=null,e())}function Zl(){return Yl(()=>Math.random())}function Vl(){return Yl(()=>Date.now())}function Gl(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Ql(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{El(r)?n.push(ll(r)):n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Jl(e,t,n=!1){return!!Sl(e)&&(bl(t,"RegExp")?t.test(e):Sl(t)?n?e===t:e.includes(t):"function"==typeof t&&t(e))}function Kl(e,t=[],n=!1){return t.some(t=>Jl(e,t,n))}function Xl(e=function(){const e=As;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return Yl(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Hl||(Hl=[1e7]+1e3+4e3+8e3+1e11),Hl.replace(/[018]/g,e=>(e^(16*Zl()&15)>>e/4).toString(16))}function ec(e){return e.exception?.values?.[0]}function tc(e){const{message:t,event_id:n}=e;if(t)return t;const r=ec(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function nc(e,t){const n=e.exception=e.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function rc(e,t){const n=ec(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function ic(e){if(function(e){try{return e.me}catch{}}(e))return!0;try{jl(e,"__sentry_captured__",!0)}catch{}return!1}function oc(){return Vl()/1e3}function ac(){return(Ul??(Ul=function(){const{performance:e}=As;if(!e?.now||!e.timeOrigin)return oc;const t=e.timeOrigin;return()=>(t+Yl(()=>e.now()))/1e3}()))()}function sc(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ac(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Xl()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function lc(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=lc(r[e],t[e],n-1));return r}function cc(){return Xl()}function dc(){return Xl().substring(16)}const uc="_sentrySpan";function hc(e,t){t?jl(e,uc,t):delete e[uc]}function mc(e){return e[uc]}class fc{constructor(){this.fe=!1,this.pe=[],this.ge=[],this.ye=[],this.ve=[],this.we={},this.be={},this.xe={},this.ke={},this.Se={},this.Ne={},this._e={traceId:cc(),sampleRand:Zl()}}clone(){const e=new fc;return e.ye=[...this.ye],e.be={...this.be},e.xe={...this.xe},e.ke={...this.ke},e.Se={...this.Se},this.Se.flags&&(e.Se.flags={values:[...this.Se.flags.values]}),e.we=this.we,e.Ce=this.Ce,e.$e=this.$e,e.Ie=this.Ie,e.Te=this.Te,e.ge=[...this.ge],e.ve=[...this.ve],e.Ne={...this.Ne},e._e={...this._e},e.Ee=this.Ee,e.Pe=this.Pe,e.Re=this.Re,hc(e,mc(this)),e}setClient(e){this.Ee=e}setLastEventId(e){this.Pe=e}getClient(){return this.Ee}lastEventId(){return this.Pe}addScopeListener(e){this.pe.push(e)}addEventProcessor(e){return this.ge.push(e),this}setUser(e){return this.we=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.$e&&sc(this.$e,{user:e}),this.ze(),this}getUser(){return this.we}setConversationId(e){return this.Re=e||void 0,this.ze(),this}setTags(e){return this.be={...this.be,...e},this.ze(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this.xe={...this.xe,...e},this.ze(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this.xe&&(delete this.xe[e],this.ze()),this}setExtras(e){return this.ke={...this.ke,...e},this.ze(),this}setExtra(e,t){return this.ke={...this.ke,[e]:t},this.ze(),this}setFingerprint(e){return this.Te=e,this.ze(),this}setLevel(e){return this.Ce=e,this.ze(),this}setTransactionName(e){return this.Ie=e,this.ze(),this}setContext(e,t){return null===t?delete this.Se[e]:this.Se[e]=t,this.ze(),this}setSession(e){return e?this.$e=e:delete this.$e,this.ze(),this}getSession(){return this.$e}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof fc?t.getScopeData():Cl(t)?e:void 0,{tags:r,attributes:i,extra:o,user:a,contexts:s,level:l,fingerprint:c=[],propagationContext:d,conversationId:u}=n||{};return this.be={...this.be,...r},this.xe={...this.xe,...i},this.ke={...this.ke,...o},this.Se={...this.Se,...s},a&&Object.keys(a).length&&(this.we=a),l&&(this.Ce=l),c.length&&(this.Te=c),d&&(this._e=d),u&&(this.Re=u),this}clear(){return this.ye=[],this.be={},this.xe={},this.ke={},this.we={},this.Se={},this.Ce=void 0,this.Ie=void 0,this.Te=void 0,this.$e=void 0,this.Re=void 0,hc(this,void 0),this.ve=[],this.setPropagationContext({traceId:cc(),sampleRand:Zl()}),this.ze(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:oc(),...e,message:e.message?Gl(e.message,2048):e.message};return this.ye.push(r),this.ye.length>n&&(this.ye=this.ye.slice(-n),this.Ee?.recordDroppedEvent("buffer_overflow","log_item")),this.ze(),this}getLastBreadcrumb(){return this.ye[this.ye.length-1]}clearBreadcrumbs(){return this.ye=[],this.ze(),this}addAttachment(e){return this.ve.push(e),this}clearAttachments(){return this.ve=[],this}getScopeData(){return{breadcrumbs:this.ye,attachments:this.ve,contexts:this.Se,tags:this.be,attributes:this.xe,extra:this.ke,user:this.we,level:this.Ce,fingerprint:this.Te||[],eventProcessors:this.ge,propagationContext:this._e,sdkProcessingMetadata:this.Ne,transactionName:this.Ie,span:mc(this),conversationId:this.Re}}setSDKProcessingMetadata(e){return this.Ne=lc(this.Ne,e,2),this}setPropagationContext(e){return this._e=e,this}getPropagationContext(){return this._e}captureException(e,t){const n=t?.event_id||Xl();if(!this.Ee)return Ws&&Ks("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.Ee.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Xl();if(!this.Ee)return Ws&&Ks("No client configured on scope - will not capture message!"),r;const i=n?.syntheticException??new Error(e);return this.Ee.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=e.event_id||t?.event_id||Xl();return this.Ee?(this.Ee.captureEvent(e,{...t,event_id:n},this),n):(Ws&&Ks("No client configured on scope - will not capture event!"),n)}ze(){this.fe||(this.fe=!0,this.pe.forEach(e=>{e(this)}),this.fe=!1)}}const pc=e=>e instanceof Promise&&!e[gc],gc=Symbol("chained PromiseLike");class yc{constructor(e,t){let n,r;n=e||new fc,r=t||new fc,this.De=[{scope:n}],this.Me=r}withScope(e){const t=this.Oe();let n;try{n=e(t)}catch(e){throw this.je(),e}return Il(n)?((e,t,n)=>{const r=e.then(e=>(t(),e),e=>{throw n(),e});return pc(r)&&pc(e)?r:((e,t)=>{let n=!1;for(const r in e){if(r in t)continue;n=!0;const i=e[r];"function"==typeof i?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[gc]:!0}),t})(e,r)})(n,()=>this.je(),()=>this.je()):(this.je(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Me}getStackTop(){return this.De[this.De.length-1]}Oe(){const e=this.getScope().clone();return this.De.push({client:this.getClient(),scope:e}),e}je(){return!(this.De.length<=1||!this.De.pop())}}function vc(){const e=qs(Bs());return e.stack=e.stack||new yc(Fs("defaultCurrentScope",()=>new fc),Fs("defaultIsolationScope",()=>new fc))}function wc(e){return vc().withScope(e)}function bc(e,t){const n=vc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function xc(e){return vc().withScope(()=>e(vc().getIsolationScope()))}function kc(e){const t=qs(e);return t.acs?t.acs:{withIsolationScope:xc,withScope:wc,withSetScope:bc,withSetIsolationScope:(e,t)=>xc(t),getCurrentScope:()=>vc().getScope(),getIsolationScope:()=>vc().getIsolationScope()}}function Sc(){return kc(Bs()).getCurrentScope()}function Nc(){return kc(Bs()).getIsolationScope()}function _c(...e){const t=kc(Bs());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Cc(){return Sc().getClient()}function $c(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||dc()};return r&&(o.parent_span_id=r),o}const Ic="sentry.profile_id",Tc="sentry.exclusive_time";function Ec(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}function Pc(e){const t=e;return{scope:t.We,isolationScope:Ec(t.Ae)}}function Rc(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const zc=/^o(\d+)\./,Dc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Mc(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${a}`}function Oc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function jc(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(zc);return t?.[1]}(n)),r}let Wc=!1;function Ac(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Fc(e).parent_span_id,o=Pc(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||dc():t,trace_id:n}}function Lc(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:1===n,attributes:i,...r})):void 0}function Bc(e){return"number"==typeof e?qc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?qc(e.getTime()):ac()}function qc(e){return e>9999999999?e/1e3:e}function Fc(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:i,name:o,endTime:a,status:s,links:l}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:Hc(e),start_timestamp:Bc(i),timestamp:Bc(a)||void 0,status:Uc(s),op:r["sentry.op"],origin:r["sentry.origin"],links:Lc(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Hc(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Uc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"internal_error"}const Yc=function(e){return e.Le||e};function Zc(){Wc||(Ys(()=>{}),Wc=!0)}function Vc(e){Js(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Gc(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(Jc(n)){if(Jl(e.description,n))return Ws&&Vc(e),!0;continue}if(!n.name&&!n.op)continue;const t=!n.name||Jl(e.description,n.name),r=!n.op||e.op&&Jl(e.op,n.op);if(t&&r)return Ws&&Vc(e),!0}return!1}function Qc(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Jc(e){return"string"==typeof e||e instanceof RegExp}const Kc="production";function Xc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Kc,release:n.release,public_key:r,trace_id:e,org_id:jc(t)};return t.emit("createDsc",i),i}function ed(e){const t=Cc();if(!t)return{};const n=Yc(e),r=Fc(n),i=r.data,o=n.spanContext().traceState,a=o?.get("sentry.sample_rate")??i["sentry.sample_rate"]??i["sentry.previous_trace_sample_rate"];function s(e){return"number"!=typeof a&&"string"!=typeof a||(e.sample_rate=`${a}`),e}const l=n.Be;if(l)return s(l);const c=o?.get("sentry.dsc"),d=c&&function(e){const t=function(e){if(e&&(Sl(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Rc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Rc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.startsWith("sentry-")&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(c);if(d)return s(d);const u=Xc(e.spanContext().traceId,t),h=i["sentry.source"]??i["sentry.span.source"],m=r.description;return"url"!==h&&m&&(u.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=Cc()?.getOptions();return!(!e||null==e.tracesSampleRate&&!e.tracesSampler)}()&&(u.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(n)),u.sample_rand=o?.get("sentry.sample_rand")??Pc(n).scope?.getPropagationContext().sampleRand.toString()),s(u),t.emit("createDsc",u,n),u}function td(e,t=100,n=1/0){try{return rd("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function nd(e,t=3,n=102400){const r=td(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?nd(e,t-1,n):r;var i}function rd(e,t,n=1/0,r=1/0,i=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[o,a]=i;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t.qe)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(El(t))return ll(t);if(Cl(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n)return"[SyntheticEvent]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${al(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}var n}(e,t);if(!s.startsWith("[object "))return s;if(t.Fe)return t;const l="number"==typeof t.He?t.He:n;if(0===l)return s.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return rd("",c.toJSON(),l-1,r,i)}catch{}const d=Array.isArray(t)?[]:{};let u=0;const h=Ll(t);for(const e in h){if(!{}.hasOwnProperty.call(h,e))continue;if(u>=r){d[e]="[MaxProperties ~]";break}const t=h[e];d[e]=rd(e,t,l-1,r,i),u++}return a(t),d}function id(e,t=[]){return[e,t]}function od(e,t){const[n,r]=e;return[n,[...r,t]]}function ad(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function sd(e){const t=qs(As);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function ld(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[sd(r),e]:r.push("string"==typeof e?sd(e):e)}for(const e of n){const[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(td(n))}i(e)}}return"string"==typeof r?r:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function cd(e){const t="string"==typeof e.data?sd(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const dd={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function ud(e){return function(e){return e in dd}(e)?dd[e]:e}function hd(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function md(e,t){const{extra:n,tags:r,attributes:i,user:o,contexts:a,level:s,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:d,eventProcessors:u,attachments:h,propagationContext:m,transactionName:f,span:p}=t;fd(e,"extra",n),fd(e,"tags",r),fd(e,"attributes",i),fd(e,"user",o),fd(e,"contexts",a),e.sdkProcessingMetadata=lc(e.sdkProcessingMetadata,l,2),s&&(e.level=s),f&&(e.transactionName=f),p&&(e.span=p),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext={...e.propagationContext,...m}}function fd(e,t,n){e[t]=lc(e[t],n,1)}function pd(e,t){const n=Fs("globalScope",()=>new fc).getScopeData();return e&&md(n,e.getScopeData()),t&&md(n,t.getScopeData()),n}function gd(e){return new vd(t=>{t(e)})}function yd(e){return new vd((t,n)=>{n(e)})}class vd{constructor(e){this.Ue=0,this.Ye=[],this.Ze(e)}then(e,t){return new vd((n,r)=>{this.Ye.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this.Ve()})}catch(e){return this.then(e=>e,e)}finally(e){return new vd((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}Ve(){if(0===this.Ue)return;const e=this.Ye.slice();this.Ye=[],e.forEach(e=>{e[0]||(1===this.Ue&&e[1](this.Ge),2===this.Ue&&e[2](this.Ge),e[0]=!0)})}Ze(e){const t=(e,t)=>{0===this.Ue&&(Il(t)?t.then(n,r):(this.Ue=e,this.Ge=t,this.Ve()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function wd(e,t,n,r=0){try{const i=bd(t,n,e,r);return Il(i)?i:gd(i)}catch(e){return yd(e)}}function bd(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Ws&&null===o&&Js(`Event processor "${i.id||"?"}" dropped event`),Il(o)?o.then(e=>bd(e,t,n,r+1)):bd(o,t,n,r+1)}let xd,kd,Sd,Nd;function _d(e,t,n,r,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||n.event_id||Xl(),timestamp:t.timestamp||oc()},c=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||Kc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const a=e.request;a?.url&&o&&(a.url=Gl(a.url,o)),o&&e.exception?.values?.forEach(e=>{e.value&&(e.value=Gl(e.value,o))})}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=As.Qe,n=As.Je;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Nd&&r.length===kd&&i.length===Sd)return Nd;kd=r.length,Sd=i.length,Nd={},xd||(xd={});const o=(t,n)=>{for(const r of t){const t=n[r],i=xd?.[r];if(i&&Nd&&t)Nd[i[0]]=t,xd&&(xd[r]=[i[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const i=n[e],o=i?.filename;if(o&&Nd&&xd){Nd[o]=t,xd[r]=[o,t];break}}}}};return t&&o(r,t),n&&o(i,n),Nd}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(l,e.stackParser);const d=function(e,t){if(!t)return e;const n=e?e.clone():new fc;return n.update(t),n}(r,n.captureContext);n.mechanism&&rc(l,n.mechanism);const u=i?i.getEventProcessors():[],h=pd(o,d),m=[...n.attachments||[],...h.attachments];m.length&&(n.attachments=m),function(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),a&&(e.level=a),s&&"transaction"!==e.type&&(e.transaction=s)}(e,t),r&&function(e,t){e.contexts={trace:Ac(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:ed(t),...e.sdkProcessingMetadata};const n=Fc(Yc(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(l,h);const f=[...u,...h.eventProcessors];return(n.data&&!0===n.data.Ke?gd(l):wd(f,l,n)).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:td(e.data,t,n)}}))},...e.user&&{user:td(e.user,t,n)},...e.contexts&&{contexts:td(e.contexts,t,n)},...e.extra&&{extra:td(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=td(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:td(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=td(e.contexts.flags,3,n)),r}(e,a,s):e))}function Cd(e){return Sc().captureException(e,void 0)}function $d(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Sc().captureMessage(e,n,r)}function Id(e,t){return Sc().captureEvent(e,t)}function Td(e){const t=Nc(),{user:n}=pd(t,Sc()),{userAgent:r}=As.navigator||{},i=function(e){const t=ac(),n={sid:Xl(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&sc(n,e),n}({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&sc(o,{status:"exited"}),Ed(),t.setSession(i),i}function Ed(){const e=Nc(),t=Sc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),sc(e,t)}(t),Pd(),e.setSession()}function Pd(){const e=Nc(),t=Cc(),n=e.getSession();n&&t&&t.captureSession(n)}function Rd(e=!1){e?Ed():Pd()}const zd=[];function Dd(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach(e=>{e.isDefaultInstance=!0}),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}(r)}function Md(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Od(e,t,n){if(n[t.name])Ws&&Js(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,zd.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),zd.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}Ws&&Js(`Integration installed: ${t.name}`)}}function jd(e,t){const n=t??function(e){return Wd().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Mc(r)),id(i,[(o=e,[{type:"log",item_count:o.length,content_type:"application/vnd.sentry.items.log+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());Wd().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function Wd(){return Fs("clientToLogBufferMap",()=>new WeakMap)}function Ad(e,t){const n=t??function(e){return Ld().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=Mc(r)),id(i,[(o=e,[{type:"trace_metric",item_count:o.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:o}])]);var o}(n,r.Xe,r.tunnel,e.getDsn());Ld().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function Ld(){return Fs("clientToMetricBufferMap",()=>new WeakMap)}function Bd(e){return"object"==typeof e&&"function"==typeof e.unref&&e.unref(),e}const qd=Symbol.for("SentryBufferFullError");function Fd(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return yd(qd);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return gd(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>Bd(setTimeout(()=>t(!1),e)))];return Promise.race(r)}}}function Hd(e,t,n=Fd(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(ad(i,(t,n)=>{const i=ud(n);!function(e,t,n=Vl()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)?o.push(t):e.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const a=id(i[0],o),s=t=>{!function(e,t){return ad(e,(e,n)=>t.includes(n))}(a,["client_report"])?ad(a,(n,r)=>{e.recordDroppedEvent(t,ud(r))}):Ws&&Ks(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return n.add(()=>t({body:ld(a)}).then(e=>413===e.statusCode?(Ws&&Xs("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),s("send_error"),e):(Ws&&void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Ks(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=Vl()){const i={...e},o=n?.["x-sentry-rate-limits"],a=n?.["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(n)for(const e of n.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=r+s);else i.all=r+s}else a?i.all=r+function(e,t=Vl()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(a,r):429===t&&(i.all=r+6e4);return i}(r,e),e),e=>{throw s("network_error"),Ws&&Xs("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===qd)return Ws&&Xs("Skipped sending event because buffer is full."),s("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Ud(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const Yd="Not capturing exception because it's already been captured.",Zd="Discarded session because of missing or non-string release",Vd=Symbol.for("SentryInternalError"),Gd=Symbol.for("SentryDoNotSendEventError");function Qd(e){return{message:e,[Vd]:!0}}function Jd(e){return{message:e,[Gd]:!0}}function Kd(e){return!!e&&"object"==typeof e&&Vd in e}function Xd(e){return!!e&&"object"==typeof e&&Gd in e}function eu(e,t,n,r,i){let o,a=0,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{a+=r(t),a>=8e5?i(e):s||(s=!0,o=Bd(setTimeout(()=>{i(e)},5e3)))}),e.on("flush",()=>{i(e)})}class tu{constructor(e){if(this.et=e,this.nt={},this.rt=0,this.it={},this.ot={},this.ge=[],this.st=Fd(e.transportOptions?.bufferSize??64),e.dsn?this.lt=function(e){const t="string"==typeof e?function(e){const t=Dc.exec(e);if(!t)return void Ys(()=>{});const[n,r,i="",o="",a="",s=""]=t.slice(1);let l="",c=s;const d=c.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),c=d.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return Oc({host:o,pass:i,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(e):Oc(e);if(t&&function(e){if(!Ws)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Xs(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Xs(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Xs(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Xs(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Ws&&Ks("No DSN provided, client will not send events."),this.lt){const i=(t=this.lt,n=e.tunnel,r=e.Xe?e.Xe.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this.ct=e.transport({tunnel:this.et.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r;this.et.enableLogs=this.et.enableLogs??this.et.ut?.enableLogs,this.et.enableLogs&&eu(this,"afterCaptureLog","flushLogs",au,jd),(this.et.enableMetrics??this.et.ut?.enableMetrics??1)&&eu(this,"afterCaptureMetric","flushMetrics",ou,Ad)}captureException(e,t,n){const r=Xl();if(ic(e))return Ws&&Js(Yd),r;const i={event_id:r,...t};return this.ht(()=>this.eventFromException(e,i).then(e=>this.ft(e,i,n)).then(e=>e),"error"),i.event_id}captureMessage(e,t,n,r){const i={event_id:Xl(),...n},o=Nl(e)?e:String(e),a=_l(e),s=a?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.ht(()=>s.then(e=>this.ft(e,i,r)),a?"unknown":"error"),i.event_id}captureEvent(e,t,n){const r=Xl();if(t?.originalException&&ic(t.originalException))return Ws&&Js(Yd),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,s=o.capturedSpanIsolationScope,l=nu(e.type);return this.ht(()=>this.ft(e,i,a||n,s),l),i.event_id}captureSession(e){this.sendSession(e),sc(e,{init:!1})}getDsn(){return this.lt}getOptions(){return this.et}getSdkMetadata(){return this.et.Xe}getTransport(){return this.ct}async flush(e){const t=this.ct;if(!t)return!0;this.emit("flush");const n=await this.gt(e),r=await t.flush(e);return n&&r}async close(e){jd(this);const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.ge}addEventProcessor(e){this.ge.push(e)}init(){(this.yt()||this.et.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.vt()}getIntegrationByName(e){return this.nt[e]}addIntegration(e){const t=this.nt[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Od(this,e,this.nt),t||Md(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=hd(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const a=function(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Mc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,id(a,[[{type:o},e]])}(e,this.lt,this.et.Xe,this.et.tunnel);for(const e of t.attachments||[])n=od(n,cd(e));this.sendEnvelope(n).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Kc}=this.et;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Ws&&Ks(Zd));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Ws&&Ks(Zd));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=hd(n);return id({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Mc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.lt,this.et.Xe,this.et.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.et.sendClientReports){const r=`${e}:${t}`;Ws&&Js(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.it[r]=(this.it[r]||0)+n}}on(e,t){const n=this.ot[e]=this.ot[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.ot[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.yt()&&this.ct)try{return await this.ct.send(e)}catch(e){return Ws&&Xs("Error while sending envelope:",e),{}}return Ws&&Xs("Transport disabled"),{}}dispose(){}vt(){const{integrations:e}=this.et;this.nt=function(e,t){const n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Od(e,t,n)}),n}(this,e),Md(this,e)}wt(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0,n=!1;for(const e of i)if(!1===e.mechanism?.handled){n=!0;break}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(sc(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async gt(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.rt)return!0;t++}return!1}yt(){return!1!==this.getOptions().enabled&&void 0!==this.ct}bt(e,t,n,r){const i=this.getOptions(),o=Object.keys(this.nt);return!t.integrations&&o?.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),_d(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:{...e.contexts?.trace,...$c(n)},...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Xc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}ft(e,t={},n=Sc(),r=Nc()){return Ws&&ru(e)&&Js(`Captured error event \`${Ud(e)[0]||"<unknown>"}\``),this.xt(e,t,n,r).then(e=>e.event_id,e=>{Ws&&(Xd(e)?Js(e.message):Kd(e)?Ks(e.message):Ks(e))})}xt(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,a=iu(e),s=ru(e),l=`before send for type \`${e.type||"error"}\``,c=void 0===o?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(o);if(s&&"number"==typeof c&&Zl()>c)return this.recordDroppedEvent("sample_rate","error"),yd(Jd(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d=nu(e.type);return this.bt(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),Jd("An event processor returned `null`, will not send event.");if(!0===t.data?.Ke)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,ignoreSpans:a}=t,s=!((l=t.beforeSendSpan)&&"function"==typeof l&&"kt"in l&&l.kt)&&t.beforeSendSpan;var l;let c=n;if(ru(c)&&i)return i(c,r);if(iu(c)){if(s||a){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:a,op:s}=e.contexts?.trace??{};return{data:a??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:a?.[Ic],exclusive_time:a?.[Tc],measurements:e.measurements,is_segment:!0}}(c);if(a?.length&&Gc(t,a))return null;if(s){const e=s(t);e?c=lc(n,{type:"transaction",timestamp:(d=e).timestamp,start_timestamp:d.start_timestamp,transaction:d.description,contexts:{trace:{trace_id:d.trace_id,span_id:d.span_id,parent_span_id:d.parent_span_id,op:d.op,status:d.status,origin:d.origin,data:{...d.data,...d.profile_id&&{[Ic]:d.profile_id},...d.exclusive_time&&{[Tc]:d.exclusive_time}}}},measurements:d.measurements}):Zc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(a?.length&&Gc(e,a))Qc(n,e);else if(s){const n=s(e);n?t.push(n):(Zc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var d;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Il(e))return e.then(e=>{if(!Cl(e)&&null!==e)throw Qd(n);return e},e=>{throw Qd(`${t} rejected with ${e}`)});if(!Cl(e)&&null!==e)throw Qd(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),a){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Jd(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(s&&o&&this.wt(o,i),a){const e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=i.transaction_info;if(a&&c&&i.transaction!==e.transaction){const e="custom";i.transaction_info={...c,source:e}}return this.sendEvent(i,t),i}).then(null,e=>{if(Xd(e)||Kd(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{Ke:!0},originalException:e}),Qd(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}ht(e,t){this.rt++,this.st.add(e).then(e=>(this.rt--,e),e=>(this.rt--,e===qd&&this.recordDroppedEvent("queue_overflow",t),e))}St(){const e=this.it;return this.it={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}Nt(){Ws&&Js("Flushing outcomes...");const e=this.St();if(0===e.length)return void(Ws&&Js("No outcomes to send"));if(!this.lt)return void(Ws&&Js("No dsn provided, will not send outcomes"));Ws&&Js("Sending outcomes:",e);const t=(n=e,id((r=this.et.tunnel&&Mc(this.lt))?{dsn:r}:{},[[{type:"client_report"},{timestamp:oc(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function nu(e){return"replay_event"===e?"replay":e||"error"}function ru(e){return void 0===e.type}function iu(e){return"transaction"===e.type}function ou(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+su(e.attributes)}function au(e){let t=0;return e.message&&(t+=2*e.message.length),t+su(e.attributes)}function su(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*lu(e[0]):_l(e)?t+=lu(e):t+=100}),t}function lu(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function cu(e){return function(e){return wl(e)&&"_t"in e&&"string"==typeof e._t}(e)?`${e.message} (${e._t})`:e.message}function du(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function uu(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}const hu=100;function mu(e,t){const n=Cc(),r=Nc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=hu}=n.getOptions();if(o<=0)return;const a={timestamp:oc(),...e},s=i?Ys(()=>i(a,t)):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.addBreadcrumb(s,o))}let fu;const pu=new WeakMap,gu=()=>({name:"FunctionToString",setupOnce(){fu=function(){}.toString;try{Function.prototype.toString=function(...e){const t=Al(this),n=pu.has(Cc())&&void 0!==t?t:this;return fu.apply(n,e)}}catch{}},setup(e){pu.set(e,!0)}}),yu=[/^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/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],vu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=bu(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=bu(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&Kl(n,t)}(e,t.ignoreTransactions))return Ws&&Ks(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${tc(e)}`),!0}else{if(function(e,t){return!!t?.length&&Ud(e).some(e=>Kl(e,t))}(e,t.ignoreErrors))return Ws&&Ks(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${tc(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return Ws&&Ks(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${tc(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=xu(e);return!!n&&Kl(n,t)}(e,t.denyUrls))return Ws&&Ks(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${tc(e)}.\nUrl: ${xu(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=xu(e);return!n||Kl(n,t)}(e,t.allowUrls))return Ws&&Ks(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${tc(e)}.\nUrl: ${xu(e)}`),!0}return!1}(n,t)?null:n}}},wu=(e={})=>({...vu(e),name:"InboundFilters"});function bu(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:yu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function xu(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Ws&&Xs(`Cannot extract url for event ${tc(e)}`),null}}function ku(e,t,n,r,i,o){if(!i.exception?.values||!o||!Tl(o.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=Su(e,t,r,o.originalException,n,i.exception.values,a,0))}function Su(e,t,n,r,i,o,a,s){if(o.length>=n+1)return o;let l=[...o];if(Tl(r[i],Error)){_u(a,s,r);const o=e(t,r[i]),c=l.length;Cu(o,i,c,s),l=Su(e,t,n,r[i],i,[o,...l],o,c)}return Nu(r)&&r.errors.forEach((o,c)=>{if(Tl(o,Error)){_u(a,s,r);const d=e(t,o),u=l.length;Cu(d,`errors[${c}]`,u,s),l=Su(e,t,n,o,i,[d,...l],d,u)}}),l}function Nu(e){return Array.isArray(e.errors)}function _u(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Nu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Cu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function $u(){"console"in As&&Hs.forEach(function(e){e in As.console&&Ol(As.console,e,function(t){return Us[e]=t,function(...t){ml("console",{args:t,level:e});const n=Us[e];n?.apply(As.console,t)}})})}const Iu=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!Eu(e,t)&&!!Tu(e,t))))}(e,t)||!!function(e,t){const n=Pu(t),r=Pu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!Eu(e,t)&&!!Tu(e,t)))}(e,t))}(t,e))return Ws&&Ks("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function Tu(e,t){let n=sl(e),r=sl(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Eu(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function Pu(e){return e.exception?.values?.[0]}function Ru(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const zu=As;function Du(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Mu(e,t){const n="fetch";ul(n,e),hl(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in zu))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(Du(zu.fetch))return!0;let e=!1;const t=zu.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=Du(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Ws&&Ks("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||Ol(As,"fetch",function(e){return function(...t){const n=new Error,{method:r,url:i}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:ju(t),method:Ou(n,"method")?String(n.method).toUpperCase():Pl(t)&&Ou(t,"method")?String(t.method).toUpperCase():"GET"}}const t=e[0];return{url:ju(t),method:Ou(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*ac(),virtualError:n,headers:Wu(t)};return ml("fetch",{...o}),e.apply(As,t).then(async e=>(ml("fetch",{...o,endTimestamp:1e3*ac(),response:e}),e),e=>{ml("fetch",{...o,endTimestamp:1e3*ac(),error:e}),wl(e)&&void 0===e.stack&&(e.stack=n.stack,jl(e,"framesToPop",1));const t=Cc(),r=t?.getOptions().enhanceFetchErrorMessages??"always";if(!1!==r&&e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(o.fetchData.url).host;"always"===r?e.message=`${e.message} (${t})`:jl(e,"__sentry_fetch_url_host__",t)}catch{}throw e})}})}(0,t))}function Ou(e,t){return!!e&&"object"==typeof e&&!!e[t]}function ju(e){return"string"==typeof e?e:e?Ou(e,"url")?e.url:e.toString?e.toString():"":""}function Wu(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(Pl(t))return new Headers(t.headers)}catch{}}const Au=As;let Lu=0;function Bu(){return Lu>0}function qu(e,t={}){if(!function(e){return"function"==typeof e}(e))return e;try{const t=e.Ct;if(t)return"function"==typeof t?t:e;if(Al(e))return e}catch{return e}const n=function(...n){try{const r=n.map(e=>qu(e,t));return e.apply(this,r)}catch(e){throw Lu++,setTimeout(()=>{Lu--}),_c(r=>{r.addEventProcessor(e=>(t.mechanism&&(nc(e,void 0),rc(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Cd(e)}),e}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Wl(n,e),jl(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Fu(e,t){const n=Uu(e,t),r={type:Vu(t),value:Gu(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Hu(e,t){return{exception:{values:[Fu(e,t)]}}}function Uu(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Yu.test(e.message)?1:0}(t),i=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,i)}catch{}return[]}const Yu=/Minified React error #\d+;/i;function Zu(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Vu(e){const t=e?.name;return!t&&Zu(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Gu(e){const t=e?.message;return Zu(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?cu(t.error):cu(e):"No error message"}function Qu(e,t,n,r,i){let o;if(xl(t)&&t.error)return Hu(e,t.error);if(kl(t)||bl(t,"DOMException")){const i=t;if("stack"in t)o=Hu(e,t);else{const t=i.name||(kl(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=Ju(e,a,n,r),nc(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return wl(t)?Hu(e,t):Cl(t)||$l(t)?(o=function(e,t,n,r){const i=Cc(),o=i?.getOptions().normalizeDepth,a=(s=t,Object.values(s).find(e=>e instanceof Error));var s;const l={$t:nd(t,o)};if(a)return{exception:{values:[Fu(e,a)]},extra:l};const c={exception:{values:[{type:$l(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Ku(t,{isUnhandledRejection:r})}]},extra:l};if(n){const t=Uu(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),rc(o,{synthetic:!0}),o):(o=Ju(e,t,n,r),nc(o,`${t}`),rc(o,{synthetic:!0}),o)}function Ju(e,t,n,r){const i={};if(r&&n){const r=Uu(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),rc(i,{synthetic:!0})}if(Nl(t)){const{le:e,ce:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function Ku(e,{isUnhandledRejection:t}){const n=function(e){const t=Object.keys(Ll(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),r=t?"promise rejection":"exception";return xl(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:$l(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class Xu extends tu{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Au.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=(e.Xe=e.Xe||{}).sdk=e.Xe.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:Ls})),i.version=Ls)}(t,"browser",["browser"],Au.SENTRY_SDK_SOURCE||"npm"),t.Xe?.sdk&&(t.Xe.sdk.settings={infer_ip:t.sendDefaultPii?"auto":"never",...t.Xe.sdk.settings}),super(t);const{sendDefaultPii:r,sendClientReports:i,enableLogs:o,ut:a,enableMetrics:s}=this.et,l=s??a?.enableMetrics??!0;Au.document&&(i||o||l)&&Au.document.addEventListener("visibilitychange",()=>{"hidden"===Au.document.visibilityState&&(i&&this.Nt(),o&&jd(this),l&&Ad(this))}),r&&this.on("beforeSendSession",uu)}eventFromException(e,t){return function(e,t,n,r){const i=Qu(e,t,n?.syntheticException||void 0,r);return rc(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),gd(i)}(this.et.stackParser,e,t,this.et.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=Ju(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),gd(o)}(this.et.stackParser,e,t,n,this.et.attachStacktrace)}bt(e,t,n,r){return e.platform=e.platform||"javascript",super.bt(e,t,n,r)}}const eh="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,th=As;let nh,rh,ih,oh;function ah(){if(!th.document)return;const e=ml.bind(null,"dom"),t=sh(e,!0);th.document.addEventListener("click",t,!1),th.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=th,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ol(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this.It=this.It||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=sh(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Ol(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this.It||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this.It)}catch{}return e.call(this,t,n,r)}}))})}function sh(e,t=!1){return n=>{if(!n||n.Tt)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;jl(n,"_sentryCaptured",!0),r&&!r.Et&&jl(r,"_sentryId",Xl());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==rh)return!1;try{if(!e.target||e.target.Et!==ih)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),rh=n.type,ih=r?r.Et:void 0),clearTimeout(nh),nh=th.setTimeout(()=>{ih=void 0,rh=void 0},1e3)}}function lh(e){const t="history";ul(t,e),hl(t,ch)}function ch(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=oh,i=function(e){try{return new URL(e,th.location.origin).toString()}catch{return e}}(String(n));if(oh=i,r===i)return e.apply(this,t);ml("history",{from:r,to:i})}return e.apply(this,t)}}th.addEventListener("popstate",()=>{const e=th.location.href,t=oh;oh=e,t!==e&&ml("history",{from:t,to:e})}),"history"in zu&&zu.history&&(Ol(th.history,"pushState",e),Ol(th.history,"replaceState",e))}const dh={},uh="__sentry_xhr_v3__";function hh(){if(!th.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*ac(),o=Sl(n[0])?n[0].toUpperCase():void 0,a=function(e){if(Sl(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!a)return e.apply(t,n);t[uh]={method:o,url:a,request_headers:{}},"POST"===o&&a.match(/sentry_key/)&&(t.Pt=!0);const s=()=>{const e=t[uh];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}ml("xhr",{endTimestamp:1e3*ac(),startTimestamp:i,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(s(),e.apply(t,n))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,i]=n,o=t[uh];return o&&Sl(r)&&Sl(i)&&(o.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[uh];return r?(void 0!==n[0]&&(r.body=n[0]),ml("xhr",{startTimestamp:1e3*ac(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function mh(e,t=function(e){const t=dh[e];if(t)return t;let n=th[e];if(Du(n))return dh[e]=n.bind(th);const r=th.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){eh&&Ks(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?dh[e]=n.bind(th):n}("fetch")){let n=0,r=0;return Hd(e,async function(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.url,a);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}}catch(e){throw dh.fetch=void 0,e}finally{n-=o,r--}},Fd(e.bufferSize||40))}const fh="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function ph(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?el:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const gh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yh=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vh=/\((\S*)(?::(\d+))(?::(\d+))\)/,wh=/at (.+?) ?\(data:(.+?),/,bh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kh=rl([30,e=>{const t=e.match(wh);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=gh.exec(e);if(n){const[,e,t,r]=n;return ph(e,el,+t,+r)}const r=yh.exec(e);if(r){if(0===r[2]?.indexOf("eval")){const e=vh.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Sh(r[1]||el,r[2]);return ph(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=bh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=xh.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||el;return[n,e]=Sh(n,e),ph(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Sh=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:el,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Nh=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";ul(t,e),hl(t,$u)}(function(e){return function(t){if(Cc()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:(r=t.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Ql(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Ql(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}mu(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Cc()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>1024&&(fh&&Ks(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=1024),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=zl(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!Rl.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),mu(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),ul("dom",n),hl("dom",ah)),t.xhr&&function(e){ul("xhr",e),hl("xhr",hh)}(function(e){return function(t){if(Cc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[uh];if(!n||!r||!i)return;const{method:o,url:a,status_code:s,body:l}=i,c={method:o,url:a,status_code:s},d={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},u={category:"xhr",data:c,type:"http",level:Ru(s)};e.emit("beforeOutgoingRequestBreadcrumb",u,d),mu(u,d)}}(e)),t.fetch&&Mu(function(e){return function(t){if(Cc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},o={category:"fetch",data:t.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,i),mu(o,i)}else{const i=t.response,o={...t.fetchData,status_code:i?.status},a={input:t.args,response:i,startTimestamp:n,endTimestamp:r},s={category:"fetch",data:o,type:"http",level:Ru(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",s,a),mu(s,a)}}}(e)),t.history&&lh(function(e){return function(t){if(Cc()!==e)return;let n=t.from,r=t.to;const i=du(Au.location.href);let o=n?du(n):void 0;const a=du(r);o?.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),mu({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Cc()===e&&mu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:tc(t)},{event:t})}}(e))}}},_h="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".split(","),Ch=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&Ol(Au,"setTimeout",$h),t.setInterval&&Ol(Au,"setInterval",$h),t.requestAnimationFrame&&Ol(Au,"requestAnimationFrame",Ih),t.XMLHttpRequest&&"XMLHttpRequest"in Au&&Ol(XMLHttpRequest.prototype,"send",Th);const e=t.eventTarget;e&&(Array.isArray(e)?e:_h).forEach(e=>function(e,t){const n=Au,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Ol(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=qu(i.handleEvent,{mechanism:{data:{handler:al(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,qu(i,{mechanism:{data:{handler:al(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),Ol(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.Ct;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function $h(e){return function(...t){const n=t[0];return t[0]=qu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${al(e)}`}}),e.apply(this,t)}}function Ih(e){return function(t){return e.apply(this,[qu(t,{mechanism:{data:{handler:al(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Th(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&Ol(n,e,function(t){const n={mechanism:{data:{handler:al(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Al(t);return r&&(n.mechanism.data.handler=al(r)),qu(t,n)})}),e.apply(this,t)}}const Eh=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(void 0===Au.document)return void(fh&&Ks("Using the `browserSessionIntegration` in non-browser environments is not supported."));Td({ignoreDuration:!0}),Rd();const e=Nc();let n=e.getUser();e.addScopeListener(e=>{const t=e.getUser();n?.id===t?.id&&n?.ip_address===t?.ip_address||(Rd(),n=t)}),"route"===t&&lh(({from:e,to:t})=>{e!==t&&(Td({ignoreDuration:!0}),Rd())})}}},Ph=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";ul(t,t=>{const{stackParser:n,attachStacktrace:r}=zh();if(Cc()!==e||Bu())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=function(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[];return 0===l.length&&l.push({colno:r,lineno:n,filename:Dh(t)??Ml(),function:el,in_app:!0}),e}(Qu(n,l||i,void 0,r,!1),o,a,s);c.level="error",Id(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),hl(t,pl)}()}(e),Rh("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";ul(t,t=>{const{stackParser:n,attachStacktrace:r}=zh();if(Cc()!==e||Bu())return;const i=function(e){if(_l(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),o=_l(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:Qu(n,i,void 0,r,!0);o.level="error",Id(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),hl(t,yl)}()}(e),Rh("onunhandledrejection"))}}};function Rh(e){fh&&Js(`Global Handler attached: ${e}`)}function zh(){const e=Cc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function Dh(e){if(Sl(e)&&0!==e.length)return e.startsWith("data:")?`<${function(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(",");let a="";if(t&&-1!==o){const t=e.slice(o+1);a=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?",base64":""}${a?`,${a}`:""}`}return e}(e,!1)}>`:e}const Mh=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){ku(Fu,i.getOptions().stackParser,n,t,e,r)}}};function Oh(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===Au.window)return!1;const e=Au;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Ml();return!(Au===Au.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}()&&(fh&&Ys(()=>{}),!0);let n=null==e.defaultIntegrations?[wu(),gu(),{name:"ConversationId",setup(e){e.on("spanStart",e=>{const t=Sc().getScopeData(),n=Nc().getScopeData(),r=t.conversationId||n.conversationId;r&&e.setAttribute("gen_ai.conversation.id",r)})}},Ch(),Nh(),Ph(),Mh(),Iu(),{name:"HttpContext",preprocessEvent(e){if(!Au.navigator&&!Au.location&&!Au.document)return;const t=function(){const e=Ml(),{referrer:t}=Au.document||{},{userAgent:n}=Au.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}},{name:"CultureContext",preprocessEvent(e){const t=function(){try{const e=Au.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}},Eh()]:e.defaultIntegrations;const r={...e,enabled:!t&&e.enabled,stackParser:(i=e.stackParser||kh,Array.isArray(i)?rl(...i):i),integrations:Dd({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||mh};var i;return function(e,t){!0===t.debug&&(Ws?Qs():Ys(()=>{})),Sc().update(t.initialScope);const n=new e(t);return function(e){Sc().setClient(e)}(n),n.init(),n}(Xu,r)}let jh=!1;function Wh(e){if(jh)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];Oh({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(e,t){var n,r,i,o;const a=null===(o=null===(i=null===(r=null===(n=e.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(!a||0===a.length)return!0;return a.some(e=>!!e.filename&&t.some(t=>t.test(e.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[Nh({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Iu()],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"]}),jh=!0,t()}catch(e){}else t()}function Ah(e,n){if(jh)try{n?_c(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),Cd(e)}):Cd(e)}catch(e){t()}}function Lh(e,n="info",r){if(jh)try{r?_c(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),$d(e,n)}):$d(e,n)}catch(e){t()}}function Bh(e){if(jh)try{!function(e){Nc().setUser(e)}(e)}catch(e){t()}}function qh(e){if(jh)try{mu(e)}catch(e){t()}}function Fh(e,n){if(jh)try{!function(e,t){Nc().setTag(e,t)}(e,n)}catch(e){t()}}function Hh(){return jh}var Uh=Object.freeze({__proto__:null,addBreadcrumb:qh,captureException:Ah,captureMessage:Lh,initializeSentry:Wh,isSentryInitialized:Hh,setTag:Fh,setUser:Bh});const Yh="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",Zh="production",Vh="insureos-scripts",Gh=!0,Qh=1,Jh=.1;class Kh{constructor(e={}){var t,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(t=e.enabled)||void 0===t||t,customDataLayer:null!==(n=e.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=e.includePersonalData)&&void 0!==r&&r,debug:null!==(i=e.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const e=this.config.customDataLayer;window[e]||(window[e]=[],this.logDebug(`Created new ${e} array`)),Array.isArray(window[e])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${e}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${e}' exists but is not an array`))}catch(e){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",e)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const e=window[this.config.customDataLayer];return Array.isArray(e)?e:null}catch(e){return this.logDebug("Failed to get data layer:",e),null}}push(e){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",e.event);const t=this.getDataLayer();if(t)try{const n=this.config.includePersonalData?e:this.removePII(e);t.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(e){this.logDebug("❌ Failed to push event to data layer:",e)}else this.logDebug("⚠️ Data layer not available, skipping event:",e.event)}removePII(e){const t={...e},n=["email","phone","name","address","client_name","client_email"];for(const e of n)e in t&&delete t[e];return t}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(e){this.logDebug("Failed to clear data layer:",e)}}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},(e.customDataLayer||void 0!==e.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class Xh{constructor(){this.sentryInitialized=!1,this.analyticsManager=null,this.pendingPromoCodes=new Map}initializeSentryOnce(){if(!this.sentryInitialized)try{Wh({dsn:Yh,environment:Zh,release:Vh,enabled:Gh,sampleRate:Qh,tracesSampleRate:Jh}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode&&!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'")}initializeAnalyticsOnce(e){var n,r,i,o,a;if(!this.analyticsManager)try{this.analyticsManager=new Kh({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(a=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==a?a:e.debug}),Re(this.analyticsManager),t()}catch(e){t()}}async mount(e,t){t.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(t),this.initializeSentryOnce(),this.initializeAnalyticsOnce(t),function(e,t){var i,o,a;t==document&&(t=document.documentElement),r.m&&r.m(e,t),i=t.i,o=[],a=[],L(t,e=t.i=N(C,null,[e]),i||v,v,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,a),q(o,e,a)}(N(js,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,a,s,l,c,d;if(!e.orgId)throw new Error("orgId is required");const u=e.apiBaseUrl||"https://api.os.insure";return new X({orgId:e.orgId,apiBaseUrl:u,timeout:(null===(t=e.httpConfig)||void 0===t?void 0:t.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=e.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=e.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(s=null===(a=e.httpConfig)||void 0===a?void 0:a.retryConfig)||void 0===s?void 0:s.maxDelay)||1e4,retryableStatusCodes:(null===(c=null===(l=e.httpConfig)||void 0===l?void 0:l.retryConfig)||void 0===c?void 0:c.retryableStatusCodes)||[429,500,502,503,504],...null===(d=e.httpConfig)||void 0===d?void 0:d.retryConfig}})}createClient(e){const t=this.createHttpClient(e);return new He(t)}clearQuoteStateForOrg(e){try{if(window.localStorage){window.localStorage.removeItem("insure-os-selected-product"),window.localStorage.removeItem(`insure_os_quote_intent_${e}`),window.localStorage.removeItem(`insure-os-pending-promo-${e}`);for(let t=window.localStorage.length-1;t>=0;t--){const n=window.localStorage.key(t);n&&n.startsWith("insure_os_")&&n.endsWith(e)&&window.localStorage.removeItem(n)}}window.sessionStorage&&window.sessionStorage.removeItem(`insure_os_quote_intent_${e}`)}catch(e){}}async initializeFormContext(e){var n,r,i,o,a;const s=this.createHttpClient(e),l=new URLSearchParams(window.location.search),c=l.get("p")||l.get("pl_ref");if(c)return t(),this.clearQuoteStateForOrg(e.orgId),{httpClient:s,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:c,signedUrl:void 0}};const d=l.get("q")||l.get("qi");if(d){t();try{const e=await s.resumeQuoteIntent(d);if("redirect"===(null==e?void 0:e.mode)&&e.payment_link_short_code){const n=window.location.pathname+`?p=${encodeURIComponent(e.payment_link_short_code)}`;return t(),window.location.replace(n),new Promise(()=>{})}}catch(e){t(null==e||e.message)}e.quoteIntentUrl=`${e.apiBaseUrl}/quote-intents/${d}`,this.clearQuoteStateForOrg(e.orgId)}if("payment"===e.mode)return t(),{httpClient:s,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const u="sessionStorage"===e.storageType?new te:new ee;u.isAvailable()?t(u.constructor.name):t();const h=new re(u),m=new ie(h),f=e.products,p=null==f?void 0:f.includes("*"),g=!f||0===f.length,y=g||p||f&&f.length>1,v=f&&1===f.length&&!p,w=localStorage.getItem("insure-os-selected-product"),b=new URLSearchParams(window.location.search),x=!!(b.get("transactionId")||b.get("transaction_id")||b.get("payment_id")),k=b.get("code");if("1"===b.get("clear")){t(),localStorage.clear(),b.delete("clear");const e=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}const S=`insure-os-pending-promo-${e.orgId}`,N="skipPendingPromoCode"in e&&!0===e.skipPendingPromoCode;if(k&&!x&&!N){const n={code:k,ts:Date.now()};localStorage.setItem(S,JSON.stringify(n)),this.pendingPromoCodes.set(e.orgId,k),t(),b.delete("code");const r=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",r)}const _="promoCode"in e?e.promoCode:void 0;let C=null;if(!N)try{const e=localStorage.getItem(S);if(e){const t=JSON.parse(e);"object"==typeof t&&t.code&&Date.now()-t.ts<36e5?C=t.code:"string"==typeof t?C=t:localStorage.removeItem(S)}}catch(e){localStorage.removeItem(S)}const $=N?void 0:this.pendingPromoCodes.get(e.orgId),I=k||_||C||$||null;if(t(),I&&!x){const i=h.getQuoteIntent(e.orgId);if(null===(n=null==i?void 0:i.form_data)||void 0===n?void 0:n.page_data){const n=i.form_data.page_data,o=null===(r=Object.values(n).find(e=>e&&"object"==typeof e&&"promo_code"in e))||void 0===r?void 0:r.promo_code;o&&o!==I&&(t(),m.clearQuoteIntent(e.orgId))}}const T=async n=>{var r;t(n.id);const i=new qe(n,s,m,{autoSave:!1,autoSaveInterval:n.form_definition.settings.autoSaveInterval});if("prefillFormData"in e&&e.prefillFormData){const o=(null===(r=n.form_definition)||void 0===r?void 0:r.pages.length)||0,a=Array.from({length:o},(e,t)=>t);i.restoreFormProgress({page_data:e.prefillFormData,current_page:o-1,completed_pages:a,last_updated:(new Date).toISOString()}),t()}else n.form_data&&i.restoreFormProgress(n.form_data);if(I){const e=i.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e?(i.updateFieldValue(e.id,"promo_code",I),t(e.id)):t()}if(n.cached_result&&(t(),i.restoreCalculationResult(n.cached_result)),n.organisation&&n.organisation.theme)try{await _s.loadTheme({slug:n.organisation.slug,theme_url:n.organisation.theme.css_url})}catch(e){t()}const o="skipAutoCalculation"in e&&!!e.skipAutoCalculation;return await this.handleAutoCalculationIfComplete(i,o),{httpClient:s,stateManager:h,quoteIntent:n,quoteIntentStore:m,formStateManager:i,urlPromoCode:I||void 0}};if(y&&!e.quoteIntentUrl&&!w){const n=x?null:h.getQuoteIntent(e.orgId);if(n)try{const r=await s.getQuoteIntent(n.url),l={id:r.quote_intent.id,url:r.url,calculate_url:r.calculate_url,delete_calculations_url:r.delete_calculations_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:e.orgId,product_id:r.product.id,product_name:r.product.description||r.product.name,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,reference:r.quote_intent.reference,organisation:r.organisation,cached_result:r.cached_result};if(h.saveQuoteIntent(e.orgId,l),null===(o=null===(i=l.form_data)||void 0===i?void 0:i.completed_pages)||void 0===o?void 0:o.length){if(t(),null===(a=l.organisation)||void 0===a?void 0:a.theme)try{await _s.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(e){t()}const{firstName:n,lastUpdated:r}=(e=>{var t;const n=["client_first_name","first_name","firstName","fname","given_name"],r=null===(t=e.form_data)||void 0===t?void 0:t.page_data;let i=null;if(r)for(const e of Object.values(r)){if(!e||"object"!=typeof e)continue;const t=e;for(const e of n)if(t[e]){i=String(t[e]);break}if(i)break}return{firstName:i,lastUpdated:e.updated_at?new Date(e.updated_at).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):null}})(l);return{httpClient:s,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,resumePrompt:{reference:l.reference||null,productName:l.product_name||null,firstName:n,lastUpdated:r,onContinue:async()=>T(l),onStartFresh:async()=>{m.clearQuoteIntent(e.orgId);const t=await s.fetchAvailableProducts(g?void 0:f);return{httpClient:s,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:t.products,productCodes:f}}}}}}catch(n){t(),m.clearQuoteIntent(e.orgId)}t();const r=await s.fetchAvailableProducts(g?void 0:f);if(t(),r.organisation&&r.organisation.theme)try{const e=await Promise.resolve().then(function(){return Cs}).then(e=>e.ThemeLoader);await e.loadTheme({slug:r.organisation.slug,theme_url:r.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:s,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:r.products,productCodes:f}}let E;w?(t(),E=w,localStorage.removeItem("insure-os-selected-product")):v&&(E=f[0]);const P=async()=>{t();const n=e.quoteIntentUrl?await s.getQuoteIntent(e.quoteIntentUrl):await s.createQuoteIntent({code:E,...e.dealerOrganisationId&&{dealer_organisation_id:e.dealerOrganisationId}});return t(),{id:n.quote_intent.id,url:n.url,calculate_url:n.calculate_url,delete_calculations_url:n.delete_calculations_url,calculate_url_v2:n.calculate_url_v2,reprice_url_v2:n.reprice_url_v2,bind_url_v2:n.bind_url_v2,calculator_version:n.product.calculator_version,expires_at:new Date(n.quote_intent.expires_at).getTime(),updated_at:new Date(n.quote_intent.updated_at).getTime(),created_at:new Date(n.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:n.product.id,product_name:n.product.description||n.product.name,form_definition:n.product.form_definition,form_data:n.quote_intent.form_data,status:n.quote_intent.status,reference:n.quote_intent.reference,organisation:n.organisation,payment_transactions:n.payment_transactions,cached_result:n.cached_result}},R=async t=>{var n;const r=new URLSearchParams(window.location.search),i=r.get("transaction_id")||r.get("payment_id")||r.get("transactionId"),o=await s.getQuoteIntent(t);let a;const l=r.get("status");if(i&&"processing"!==l){const e=null===(n=o.payment_transactions)||void 0===n?void 0:n.find(e=>e.id===i);if(e){let t="unknown";switch(e.status){case"completed":t="success";break;case"failed":t="declined";break;case"cancelled":t="cancelled";break;default:t="error"}a={paymentTransactionId:e.id,paymentStatus:t,transactionStatus:e}}else if(l){let e="error";switch(l.toLowerCase()){case"success":case"completed":e="success";break;case"failed":case"declined":e="declined";break;case"cancelled":case"canceled":e="cancelled";break;default:e="error"}a={paymentTransactionId:i,paymentStatus:e,transactionStatus:void 0}}}const c={id:o.quote_intent.id,url:o.url,calculate_url:o.calculate_url,delete_calculations_url:o.delete_calculations_url,calculate_url_v2:o.calculate_url_v2,reprice_url_v2:o.reprice_url_v2,bind_url_v2:o.bind_url_v2,calculator_version:o.product.calculator_version,expires_at:new Date(o.quote_intent.expires_at).getTime(),updated_at:new Date(o.quote_intent.updated_at).getTime(),created_at:new Date(o.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:o.product.id,product_name:o.product.description||o.product.name,form_definition:o.product.form_definition,form_data:o.quote_intent.form_data,status:o.quote_intent.status,reference:o.quote_intent.reference,organisation:o.organisation,payment_return:a,payment_transactions:o.payment_transactions,cached_result:o.cached_result};return a&&h.saveQuoteIntent(e.orgId,c),c};return(async()=>{let t=null,n=!1;try{const r=h.getQuoteIntent(e.orgId),i=await m.getOrCreateQuoteIntent(e.orgId,P,R);i.payment_return&&h.saveQuoteIntent(e.orgId,i),t=i,n=!r}catch(r){if(!(r instanceof V&&404===r.statusCode))throw r;m.clearQuoteIntent(e.orgId),t=await m.getOrCreateQuoteIntent(e.orgId,P,R),n=!0}if(n&&t&&De(t),!t)throw new Error("Failed to initialize quote intent state");return T(t)})()}async handleAutoCalculationIfComplete(e,n=!1){try{if(n)return void t();const r=e.getQuoteIntent();if("paid"===r.status||"completed"===r.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const i=e.getPageCompletionStatus(),{totalPages:o,completedPages:a}=i,s=a.length===o;t((a.length,e.getIsCalculating(),e.hasLastCalculationFailed())),s&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const em=new Xh;"undefined"!=typeof window&&(window.InsureOS=em,function(){const e=document.querySelectorAll('script[src*="insureos"]'),t=e[e.length-1];if(t&&t.src){const e=new URL(t.src),n=e.searchParams.get("orgId"),r=e.searchParams.get("productCode"),i=e.searchParams.get("productCodes"),o=i?i.split(","):r?[r]:null;if(n&&o){const t=e.searchParams.get("container"),r=t?document.getElementById(t):document.body;if(r){const e={orgId:n,products:o};r.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await em.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class tm{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,tm.instance)return tm.instance;tm.instance=this}startMeasurement(e){this.measurements.set(e,this.now())}endMeasurement(e){const t=this.measurements.get(e);if(void 0===t)throw new Error(`No measurement started for: ${e}`);const n=this.now()-t;return this.measurements.delete(e),this.completedMeasurements.has(e)||this.completedMeasurements.set(e,[]),this.completedMeasurements.get(e).push(n),"initialization"===e&&(this.initializationTime=n),n}async measureApiCall(e,t){const n=this.now();let r,i=!1;try{const e=await t();return i=!0,e}catch(e){throw i=!1,r=e instanceof Error?e.message:"Unknown error",e}finally{const t=this.now()-n;this.apiCallMetrics.push({operation:e,duration:t,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 e=performance.memory;return{usedJSHeapSize:e.usedJSHeapSize||0,totalJSHeapSize:e.totalJSHeapSize||0,jsHeapSizeLimit:e.jsHeapSizeLimit||0}}return null}getMetrics(){var e;const t=this.apiCallMetrics.filter(e=>e.success).map(e=>e.duration),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:0,r={};return this.completedMeasurements.forEach((e,t)=>{r[t]=[...e]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:t.length>0&&null!==(e=t[t.length-1])&&void 0!==e?e: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 e=this.getMetrics(),t=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${e.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${e.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${e.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(e.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,t&&(n+="Memory Details:\n",n+=` Used Heap: ${(t.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(t.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(t.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const e=new Map;this.apiCallMetrics.forEach(t=>{e.has(t.operation)||e.set(t.operation,{count:0,totalTime:0,errors:0});const n=e.get(t.operation);n.count++,n.totalTime+=t.duration,t.success||n.errors++}),e.forEach((e,t)=>{const r=e.totalTime/e.count,i=(e.errors/e.count*100).toFixed(1);n+=` ${t}: ${e.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(e){(new tm).startMeasurement(e)}static endMeasurement(e){return(new tm).endMeasurement(e)}static measureMemoryUsage(){return(new tm).measureMemoryUsage()}static async measureApiCall(e,t){return(new tm).measureApiCall(e,t)}static getMetrics(){return(new tm).getMetrics()}static generateReport(){return(new tm).generateReport()}}let nm=class e{constructor(t){this.headers=new Map,t&&(Array.isArray(t)?t.forEach(([e,t])=>this.set(e,t)):t instanceof e?t.forEach((e,t)=>this.set(t,e)):Object.entries(t).forEach(([e,t])=>this.set(e,t)))}append(e,t){const n=this.get(e);this.set(e,n?`${n}, ${t}`:t)}delete(e){this.headers.delete(e.toLowerCase())}get(e){return this.headers.get(e.toLowerCase())||null}has(e){return this.headers.has(e.toLowerCase())}set(e,t){this.headers.set(e.toLowerCase(),t)}forEach(e){this.headers.forEach(e)}},rm=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new nm(t.headers),this.body=t.body||null,this.signal=t.signal||void 0):(this.url=e.url,this.method=t.method||e.method,this.headers=new nm(t.headers||e.headers),this.body=void 0!==t.body?t.body:e.body,this.signal=void 0!==t.signal?null!==(n=t.signal)&&void 0!==n?n:void 0:e.signal)}},im=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new nm(t.headers),this.ok=this.status>=200&&this.status<300,this.Rt=e}async text(){return this.Rt}async json(){return JSON.parse(this.Rt)}};var om=Object.freeze({__proto__:null,Headers:nm,Request:rm,Response:im,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new rm(e,t),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((e,t)=>{o.setRequestHeader(t,e)}),o.onload=()=>{const e=new nm;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new im(o.responseText,{status:o.status,statusText:o.statusText,headers:e});n(t)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class am{constructor(e){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{e(this.resolve.bind(this),this.reject.bind(this))}catch(e){this.reject(e)}}resolve(e){"pending"===this.state&&(this.state="fulfilled",this.value=e,this.onFulfilledCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}reject(e){"pending"===this.state&&(this.state="rejected",this.reason=e,this.onRejectedCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}then(e,t){return new am((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof am?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof am?i.then(n,r):n(i)}else r(e)}catch(e){r(e)}};"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(e){return this.then(void 0,e)}static resolve(e){return new am(t=>t(e))}static reject(e){return new am((t,n)=>n(e))}static all(e){return new am((t,n)=>{if(0===e.length)return void t([]);const r=[];let i=0;e.forEach((o,a)=>{o.then(n=>{r[a]=n,i++,i===e.length&&t(r)},n)})})}}var sm=Object.freeze({__proto__:null,PromisePolyfill:am});class lm{constructor(e){this.params=new Map,"string"==typeof e?this.parseString(e):e&&"object"==typeof e&&"forEach"in e&&"function"==typeof e.forEach?e.forEach((e,t)=>this.append(t,e)):e&&"object"==typeof e&&Object.entries(e).forEach(([e,t])=>this.set(e,t))}parseString(e){const t=e.startsWith("?")?e.slice(1):e;t&&t.split("&").forEach(e=>{if(!e)return;const t=e.indexOf("=");let n,r;-1===t?(n=e,r=""):(n=e.substring(0,t),r=e.substring(t+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(e,t){const n=this.params.get(e)||[];n.push(t),this.params.set(e,n)}delete(e){this.params.delete(e)}get(e){var t;const n=this.params.get(e);return n&&n.length>0&&null!==(t=n[0])&&void 0!==t?t:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}forEach(e){this.params.forEach((t,n)=>{t.forEach(t=>e(t,n))})}toString(){const e=[];return this.params.forEach((t,n)=>{t.forEach(t=>{e.push(`${encodeURIComponent(n)}=${encodeURIComponent(t)}`)})}),e.join("&")}}var cm=Object.freeze({__proto__:null,URLPolyfill:class{constructor(e,t){const n=this.parseUrl(e,t);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 lm(this.search)}parseUrl(e,t){const n=document.createElement("a");if(t){const r=document.createElement("a");r.href=t,n.href=this.resolveUrl(e,r.href)}else n.href=e;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(e,t){if(e.includes("://"))return e;if(e.startsWith("/")){const n=document.createElement("a");return n.href=t,`${n.protocol}//${n.host}${e}`}return`${t.split("/").slice(0,-1).join("/")}/${e}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:lm});e.DataLayerManager=Kh,e.EnhancedHttpClient=X,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new V(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new V(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const n=t.status>=500||429===t.status;return 429===t.status?new V(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new V(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new V(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new V(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new V(e.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(t){switch(t.type){case e.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case e.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case e.ErrorType.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case e.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case e.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case e.ErrorType.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.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."}}},e.FormStateManager=qe,e.InsureOS=em,e.InsureOSClient=Xh,e.InsureOSError=V,e.LocalStateManager=re,e.LocalStorageAdapter=ee,e.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},e.PerformanceMonitor=tm,e.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.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(e){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 e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return om});void 0===globalThis.fetch&&(globalThis.fetch=e),void 0===globalThis.Headers&&(globalThis.Headers=t),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(e){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:e}=await Promise.resolve().then(function(){return sm});void 0===globalThis.Promise&&(globalThis.Promise=e)}catch(e){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:e,URLSearchParamsPolyfill:t}=await Promise.resolve().then(function(){return cm});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=G,e.SessionStorageAdapter=te,e.ThemeLoader=_s,e.addBreadcrumb=qh,e.captureException=Ah,e.captureMessage=Lh,e.createAppError=ke,e.getAnalytics=function(){return Pe},e.getSupportMessage=Ee,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=Re,e.initializeSentry=Wh,e.isSentryInitialized=Hh,e.parseServerValidationErrors=ye,e.setTag=Fh,e.setUser=Bh,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=Te,e.trackFormProgress=Me,e.trackPaymentCompleted=Le,e.trackPaymentFailed=Be,e.trackPaymentInitiated=Ae,e.trackQuoteAtCheckout=je,e.trackQuoteCalculated=Oe,e.trackQuoteReferred=We,e.trackQuoteStarted=De,e.validateField=pe,e.validatePage=ge});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).InsureOSScripts={})}(this,function(e){"use strict";const t=()=>{globalThis.insureOSDebug};var n,r,i,o,s,a,l,c,d,u,h,m,f,p,g,y,v={},w=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function k(e,t){for(var n in t)e[n]=t[n];return e}function S(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function N(e,t,r){var i,o,s,a={};for(s in t)"key"==s?i=t[s]:"ref"==s?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?n.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return _(e,a,i,o,null)}function _(e,t,n,o,s){var a={type:e,props:t,key:n,ref:o,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:null==s?++i:s,_:-1,C:0};return null==s&&null!=r.vnode&&r.vnode(a),a}function C(e){return e.children}function $(e,t){this.props=e,this.context=t}function I(e,t){if(null==t)return e.m?I(e.m,e._+1):null;for(var n;t<e.i.length;t++)if(null!=(n=e.i[t])&&null!=n.v)return n.v;return"function"==typeof e.type?I(e):null}function T(e){if(e.I&&e.P){var t=e.N,n=t.v,i=[],o=[],s=k({},t);s.N=t.N+1,r.vnode&&r.vnode(s),L(e.I,s,t,e.R,e.I.namespaceURI,32&t.C?[n]:null,i,null==n?I(t):n,!!(32&t.C),o),s.N=t.N,s.m.i[s._]=s,q(i,s,o),t.v=t.m=null,s.v!=n&&E(s)}}function E(e){if(null!=(e=e.m)&&null!=e.k)return e.v=e.k.base=null,e.i.some(function(t){if(null!=t&&null!=t.v)return e.v=e.k.base=t.v}),E(e)}function P(e){(!e.P&&(e.P=!0)&&o.push(e)&&!R.O++||s!=r.debounceRendering)&&((s=r.debounceRendering)||a)(R)}function R(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,T(e)}finally{o.length=R.O=0}}function z(e,t,n,r,i,o,s,a,l,c,d){var u,h,m,f,p,g,y,b=r&&r.i||w,x=t.length;for(l=D(n,t,b,l,x),u=0;u<x;u++)null!=(m=n.i[u])&&(h=-1!=m._&&b[m._]||v,m._=u,g=L(e,m,h,i,o,s,a,l,c,d),f=m.v,m.ref&&h.ref!=m.ref&&(h.ref&&U(h.ref,null,m),d.push(m.ref,m.k||f,m)),null==p&&null!=f&&(p=f),(y=!!(4&m.C))||h.i===m.i?(l=M(m,l,e,y),y&&h.v&&(h.v=null)):"function"==typeof m.type&&void 0!==g?l=g:f&&(l=f.nextSibling),m.C&=-7);return n.v=p,l}function D(e,t,n,r,i){var o,s,a,l,c,d=n.length,u=d,h=0;for(e.i=new Array(i),o=0;o<i;o++)null!=(s=t[o])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.i[o]=_(null,s,null,null,null):x(s)?s=e.i[o]=_(C,{children:s},null,null,null):void 0===s.constructor&&s.p>0?s=e.i[o]=_(s.type,s.props,s.key,s.ref?s.ref:null,s.N):e.i[o]=s,l=o+h,s.m=e,s.p=e.p+1,a=null,-1!=(c=s._=O(s,n,l,u))&&(u--,(a=n[c])&&(a.C|=2)),null==a||null==a.N?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof s.type&&(s.C|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,s.C|=4))):e.i[o]=null;if(u)for(o=0;o<d;o++)null!=(a=n[o])&&!(2&a.C)&&(a.v==r&&(r=I(a)),Y(a,a));return r}function M(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.i,o=0;i&&o<i.length;o++)i[o]&&(i[o].m=e,t=M(i[o],t,n,r));return t}e.v!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=I(e)),n.insertBefore(e.v,t||null)),t=e.v);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function O(e,t,n,r){var i,o,s,a=e.key,l=e.type,c=t[n],d=null!=c&&!(2&c.C);if(null===c&&null==a||d&&a==c.key&&l==c.type)return n;if(r>(d?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(c=t[s=i>=0?i--:o++])&&!(2&c.C)&&a==c.key&&l==c.type)return s;return-1}function j(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function W(e,t,n,r,i){var o,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||j(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||j(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(h,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[u]=r[u]:(n[u]=m,e.addEventListener(t,o?p:f,o)):e.removeEventListener(t,o?p:f,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function A(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[d])t[d]=m++;else if(t[d]<n[u])return;return n(r.event?r.event(t):t)}}}function L(e,t,n,i,o,s,a,l,c,d){var u,h,m,f,p,g,y,v,b,N,_,I,T,E,P,R=t.type;if(void 0!==t.constructor)return null;128&n.C&&(c=!!(32&n.C),s=[l=t.v=n.v]),(u=r.p)&&u(t);e:if("function"==typeof R)try{if(v=t.props,b=R.prototype&&R.prototype.render,N=(u=R.contextType)&&i[u.k],_=u?N?N.props.value:u.m:i,n.k?y=(h=t.k=n.k).m=h.j:(b?t.k=h=new R(v,_):(t.k=h=new $(v,_),h.constructor=R,h.render=Z),N&&N.sub(h),h.state||(h.state={}),h.R=i,m=h.P=!0,h.W=[],h.A=[]),b&&null==h.L&&(h.L=h.state),b&&null!=R.getDerivedStateFromProps&&(h.L==h.state&&(h.L=k({},h.L)),k(h.L,R.getDerivedStateFromProps(v,h.L))),f=h.props,p=h.state,h.N=t,m)b&&null==R.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),b&&null!=h.componentDidMount&&h.W.push(h.componentDidMount);else{if(b&&null==R.getDerivedStateFromProps&&v!==f&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(v,_),t.N==n.N||!h.v&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(v,h.L,_)){t.N!=n.N&&(h.props=v,h.state=h.L,h.P=!1),t.v=n.v,t.i=n.i,t.i.some(function(e){e&&(e.m=t)}),w.push.apply(h.W,h.A),h.A=[],h.W.length&&a.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(v,h.L,_),b&&null!=h.componentDidUpdate&&h.W.push(function(){h.componentDidUpdate(f,p,g)})}if(h.context=_,h.props=v,h.I=e,h.v=!1,I=r.O,T=0,b)h.state=h.L,h.P=!1,I&&I(t),u=h.render(h.props,h.state,h.context),w.push.apply(h.W,h.A),h.A=[];else do{h.P=!1,I&&I(t),u=h.render(h.props,h.state,h.context),h.state=h.L}while(h.P&&++T<25);h.state=h.L,null!=h.getChildContext&&(i=k(k({},i),h.getChildContext())),b&&!m&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(f,p)),E=null!=u&&u.type===C&&null==u.key?F(u.props.children):u,l=z(e,x(E)?E:[E],t,n,i,o,s,a,l,c,d),h.base=t.v,t.C&=-161,h.W.length&&a.push(h),y&&(h.j=h.m=null)}catch(e){if(t.N=null,c||null!=s)if(e.then){for(t.C|=c?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,t.v=l}else{for(P=s.length;P--;)S(s[P]);B(t)}else t.v=n.v,t.i=n.i,e.then||B(t);r.v(e,t,n)}else null==s&&t.N==n.N?(t.i=n.i,t.v=n.v):l=t.v=H(n.v,t,n,i,o,s,a,c,d);return(u=r.diffed)&&u(t),128&t.C?void 0:l}function B(e){e&&(e.k&&(e.k.v=!0),e.i&&e.i.some(B))}function q(e,t,n){for(var i=0;i<n.length;i++)U(n[i],n[++i],n[++i]);r.k&&r.k(t,e),e.some(function(t){try{e=t.W,t.W=[],e.some(function(e){e.call(t)})}catch(e){r.v(e,t.N)}})}function F(e){return"object"!=typeof e||null==e||e.p>0?e:x(e)?e.map(F):void 0!==e.constructor?null:k({},e)}function H(e,t,i,o,s,a,l,c,d){var u,h,m,f,p,g,y,w=i.props||v,b=t.props,k=t.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(u=0;u<a.length;u++)if((p=a[u])&&"setAttribute"in p==!!k&&(k?p.localName==k:3==p.nodeType)){e=p,a[u]=null;break}if(null==e){if(null==k)return document.createTextNode(b);e=document.createElementNS(s,k,b.is&&b),c&&(r.B&&r.B(t,a),c=!1),a=null}if(null==k)w===b||c&&e.data==b||(e.data=b);else{if(a="textarea"==k&&null!=b.defaultValue?null:a&&n.call(e.childNodes),!c&&null!=a)for(w={},u=0;u<e.attributes.length;u++)w[(p=e.attributes[u]).name]=p.value;for(u in w)p=w[u],"dangerouslySetInnerHTML"==u?m=p:"children"==u||u in b||"value"==u&&"defaultValue"in b||"checked"==u&&"defaultChecked"in b||W(e,u,null,p,s);for(u in b)p=b[u],"children"==u?f=p:"dangerouslySetInnerHTML"==u?h=p:"value"==u?g=p:"checked"==u?y=p:c&&"function"!=typeof p||w[u]===p||W(e,u,p,w[u],s);if(h)c||m&&(h.H==m.H||h.H==e.innerHTML)||(e.innerHTML=h.H),t.i=[];else if(m&&(e.innerHTML=""),z("template"==t.type?e.content:e,x(f)?f:[f],t,i,o,"foreignObject"==k?"http://www.w3.org/1999/xhtml":s,a,l,a?a[0]:i.i&&I(i,0),c,d),null!=a)for(u=a.length;u--;)S(a[u]);c&&"textarea"!=k||(u="value","progress"==k&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[u]||"progress"==k&&!g||"option"==k&&g!=w[u])&&W(e,u,g,w[u],s),u="checked",null!=y&&y!=e[u]&&W(e,u,y,w[u],s))}return e}function U(e,t,n){try{if("function"==typeof e){var i="function"==typeof e.C;i&&e.C(),i&&null==t||(e.C=e(t))}else e.current=t}catch(e){r.v(e,n)}}function Y(e,t,n){var i,o;if(r.unmount&&r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.v||U(i,null,t)),null!=(i=e.k)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){r.v(e,t)}i.base=i.I=null}if(i=e.i)for(o=0;o<i.length;o++)i[o]&&Y(i[o],t,n||"function"!=typeof e.type);n||S(e.v),e.k=e.m=e.v=void 0}function Z(e,t,n){return this.constructor(e,n)}n=w.slice,r={v:function(e,t,n,r){for(var i,o,s;t=t.m;)if((i=t.k)&&!i.m)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.P),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.P),s)return i.j=i}catch(t){e=t}throw e}},i=0,$.prototype.setState=function(e,t){var n;n=null!=this.L&&this.L!=this.state?this.L:this.L=k({},this.state),"function"==typeof e&&(e=e(k({},n),this.props)),e&&k(n,e),null!=e&&this.N&&(t&&this.A.push(t),P(this))},$.prototype.forceUpdate=function(e){this.N&&(this.v=!0,e&&this.W.push(e),P(this))},$.prototype.render=C,o=[],a="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.N.p-t.N.p},R.O=0,c=Math.random().toString(8),d="__d"+c,u="__a"+c,h=/(PointerCapture)$|Capture$/i,m=0,f=A(!1),p=A(!0),g=0,e.ErrorType=void 0,(y=e.ErrorType||(e.ErrorType={})).NETWORK_ERROR="NETWORK_ERROR",y.API_ERROR="API_ERROR",y.VALIDATION_ERROR="VALIDATION_ERROR",y.STORAGE_ERROR="STORAGE_ERROR",y.TIMEOUT_ERROR="TIMEOUT_ERROR",y.MAINTENANCE_ERROR="MAINTENANCE_ERROR",y.VERSION_INVALIDATED="VERSION_INVALIDATED";class V extends Error{constructor(e,t,n=!1,r,i,o,s,a){super(t),this.type=e,this.retryable=n,this.statusCode=r,this.retryAfter=i,this.validationErrors=o,this.organisation=s,this.versionInvalidated=a,this.name="InsureOSError"}}class G{constructor(e){this.config=e}shouldRetry(e,t){return!(t>=this.config.maxRetries)&&this.isRetryableError(e)}getDelay(e,t){if(t){const e=parseInt(t,10);if(!isNaN(e))return 1e3*e}const n=this.config.baseDelay*Math.pow(2,e);return Math.min(n,this.config.maxDelay)}isRetryableError(e){return e instanceof V?e.retryable:!("TypeError"!==e.name||!e.message.includes("fetch"))||"AbortError"===e.name}}const Q=new Map;function J(e){return Q.get(e)}function K(e){if(e)for(const t of e)(null==t?void 0:t.code)&&Q.set(t.code,{name:t.name,content:t.content})}class X{constructor(e){this.config=e,this.retryStrategy=new G(e.retryConfig)}getBaseUrl(){return this.config.apiBaseUrl||"https://api.os.insure"}async makeRequest({url:t,method:n,body:r,skipOrgHeader:i=!1,timeoutMs:o,noRetry:s=!1}){return this.executeWithRetry(s,async()=>{const s=new AbortController,a=null!=o?o:this.config.timeout,l=setTimeout(()=>s.abort(),a);try{const e={"Content-Type":"application/json"},o=t.includes("signed=");i||o||(e["X-Organisation-ID"]=this.config.orgId);const a={method:n,headers:e,signal:s.signal};r&&(a.body=JSON.stringify(r));const c=await fetch(t,a);if(clearTimeout(l),!c.ok)throw await this.handleApiError(c);const d=await c.json();return d.data||d}catch(t){if(clearTimeout(l),t instanceof V)throw t;if(t instanceof Error&&"AbortError"===t.name)throw new V(e.ErrorType.TIMEOUT_ERROR,"Request timed out",!0);if(t instanceof TypeError&&t.message.includes("fetch"))throw new V(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0);throw t}})}async getQuoteIntent(e){const t=await this.makeRequest({url:e,method:"GET"});return K(null==t?void 0:t.documents),t}getDocument(e){const t=`${this.config.apiBaseUrl}/documents/${encodeURIComponent(e)}`;return this.makeRequest({url:t,method:"GET"})}async fetchAvailableProducts(e){var n;const r=null==e?void 0:e.includes("*"),i=!e||0===e.length,o=`${this.config.apiBaseUrl}/products`,s=await this.makeRequest({url:o,method:"GET"}),a=s.products||[],l=null===(n=s.organisation)||void 0===n?void 0:n.client_settings;let c=a;if(r)t(),c=a;else if(e&&e.length>0)c=a.filter(t=>e.includes(t.code));else if(i&&(null==l?void 0:l.products)&&l.products.length>0){const e=l.products.map(e=>e.code);c=e.map(e=>a.find(t=>t.code===e)).filter(e=>void 0!==e),t((a.length,c.length))}else i&&(t(),c=a);return{products:c,organisation:s.organisation}}async createQuoteIntent(e){const t=await this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents`,method:"POST",body:e});return K(null==t?void 0:t.documents),t}async updateQuoteIntent(e,t){const n=await this.makeRequest({url:e,method:"PUT",body:t});return K(null==n?void 0:n.documents),n}deleteQuoteIntent(e){return this.makeRequest({url:e,method:"DELETE"})}calculateQuoteIntent(e){return this.makeRequest({url:e,method:"POST"})}calculateQuoteIntentV2(e){return this.makeRequest({url:e,method:"POST"})}repriceQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}bindQuoteIntentV2(e,t){return this.makeRequest({url:e,method:"POST",body:t})}deleteCalculations(e){return this.makeRequest({url:e,method:"DELETE"})}initiatePayment(e,t){const n="string"==typeof t?t:t.code;return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/initiate`,method:"POST",body:{...e,gateway_code:n},timeoutMs:9e4,noRetry:!0})}getPaymentStatus(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/status/${e}`,method:"GET"})}createQuotePaymentLink(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/payment-link`,method:"POST",body:t})}continueLater(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/continue-later`,method:"POST",body:{email:t}})}resumeQuoteIntent(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/resume`,method:"GET"})}getPaymentLinkDetails(e){return this.makeRequest({url:e,method:"GET",skipOrgHeader:!0})}getPaymentLinkById(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}`,method:"GET"})}initiateFixedPayment(e,t,n,r){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/pay`,method:"POST",body:{gateway_code:t,client_name:n,...r?{gateway_method:r}:{}}})}validateCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/payment-links/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}validateQuoteCoverStartDate(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-cover-date`,method:"POST",body:{cover_start_date:t}})}resolvePaymentTransaction(e){return this.makeRequest({url:`${this.config.apiBaseUrl}/payments/${e}/resolve`,method:"POST",body:{}})}validatePromoCode(e,t){return this.makeRequest({url:`${this.config.apiBaseUrl}/quote-intents/${e}/validate-promo-code`,method:"POST",body:{code:t}})}async executeWithRetry(e,n){let r;const i=e?0:this.config.retryConfig.maxRetries;for(let o=0;o<=i;o++)try{return t(),await n()}catch(n){r=n;const s=!e&&this.retryStrategy.shouldRetry(r,o);if(t(n instanceof V&&(n.type,n.message)),t(),o===i||!s)throw t(),r;const a=n instanceof V?n.retryAfter:void 0,l=this.retryStrategy.getDelay(o,a);t(),await new Promise(e=>setTimeout(e,l))}throw r}async handleApiError(n){var r,i,o,s;const a=n.headers.get("retry-after"),l=await n.json().catch(()=>({}));if(t(),this.captureApiErrorToSentry(n,l),l&&!0===l.version_invalidated)return new V(e.ErrorType.VERSION_INVALIDATED,l.message||"This quote is no longer valid. Please start a new quote.",!1,n.status,void 0,void 0,void 0,{from:l.from,to:null!==(r=l.to)&&void 0!==r?r:null,quote_page_url:null!==(i=l.quote_page_url)&&void 0!==i?i:null});if(503===n.status)return new V(e.ErrorType.MAINTENANCE_ERROR,l.message||"We're performing scheduled maintenance. Please check back in a few minutes.",!1,n.status,void 0,void 0,null!==(o=l.organisation)&&void 0!==o?o:null);if(429===n.status)return new V(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!1,n.status,a||void 0);if(n.status>=500){const t=l.message||"Service temporarily unavailable. Please try again in a moment.";return new V(e.ErrorType.API_ERROR,t,!1,n.status)}if(422===n.status)try{const t=l;return t.error&&t.error.details&&t.error.details.form_data?new V(e.ErrorType.VALIDATION_ERROR,"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.error.details):new V(e.ErrorType.VALIDATION_ERROR,t.message||"Validation failed. Please check your inputs.",!1,n.status,void 0,null===(s=t.error)||void 0===s?void 0:s.details)}catch(t){return new V(e.ErrorType.VALIDATION_ERROR,"Validation failed. Please check your inputs.",!1,n.status)}if(400===n.status)try{const t=l;return t.errors?new V(e.ErrorType.VALIDATION_ERROR,t.message||"Form validation failed. Please check your inputs.",!1,n.status,void 0,t.errors):new V(e.ErrorType.API_ERROR,t.message||"Invalid request. Please check your input and try again.",!1,n.status)}catch(t){return new V(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,n.status)}if(n.status>=400&&n.status<500){const t=l.message||"Invalid request. Please refresh the page and try again.";return new V(e.ErrorType.API_ERROR,t,!1,n.status)}return new V(e.ErrorType.API_ERROR,`Request failed: ${n.statusText}`,this.config.retryConfig.retryableStatusCodes.includes(n.status),n.status)}captureApiErrorToSentry(e,t){try{(e.status>=500||429===e.status)&&Promise.resolve().then(function(){return rm}).then(({captureMessage:n,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:`API Error: ${e.status} ${e.statusText}`,category:"http",level:"error",data:{url:e.url,status:e.status,statusText:e.statusText}}),n(`API Error: ${e.status} - ${e.url}`,"error",{http:{status_code:e.status,url:e.url,method:"Unknown"},response:t}))}).catch(()=>{})}catch(e){}}}class ee{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return localStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{localStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{localStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{localStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.localStorage)return!1;const e="__insure_os_storage_test__";return localStorage.setItem(e,"test"),localStorage.removeItem(e),!0}catch(e){return!1}}}class te{constructor(){this.available=this.checkAvailability()}get(e){if(!this.available)return null;try{return sessionStorage.getItem(e)}catch(e){return null}}set(e,t){if(this.available)try{sessionStorage.setItem(e,t)}catch(e){}}remove(e){if(this.available)try{sessionStorage.removeItem(e)}catch(e){}}clear(){if(this.available)try{sessionStorage.clear()}catch(e){}}isAvailable(){return this.available}checkAvailability(){try{if("undefined"==typeof window||!window.sessionStorage)return!1;const e="__insure_os_storage_test__";return sessionStorage.setItem(e,"test"),sessionStorage.removeItem(e),!0}catch(e){return!1}}}class ne{static generateKey(e,t,n){const r=[this.KEY_PREFIX+e,t];return n&&r.push(n),r.join(this.SEPARATOR)}static serialize(e){try{return JSON.stringify({data:e,timestamp:Date.now(),version:"1.0"})}catch(e){throw new Error(`Failed to serialize data: ${e}`)}}static deserialize(e){try{const t=JSON.parse(e);return t&&"object"==typeof t&&t.data?t.data:null}catch(e){return null}}static getTimestamp(e){try{return JSON.parse(e).timestamp||null}catch(e){return null}}static isExpired(e,t){const n=this.getTimestamp(e);return!n||Date.now()-n>t}}ne.KEY_PREFIX="insure_os_",ne.SEPARATOR="_";class re{constructor(e,t={}){this.storageAdapter=e,this.config={defaultExpirationMs:t.defaultExpirationMs||re.DEFAULT_EXPIRATION_MS,namespace:t.namespace||re.DEFAULT_NAMESPACE}}saveQuoteIntent(e,t){if(this.storageAdapter.isAvailable())try{t.payment_transactions&&t.payment_transactions.length;const n=this.generateStorageKey(e),r=ne.serialize(t);this.storageAdapter.set(n,r)}catch(e){}}getQuoteIntent(e){if(!this.storageAdapter.isAvailable())return null;try{const t=this.generateStorageKey(e),n=this.storageAdapter.get(t);if(!n)return null;const r=ne.deserialize(n);return(null==r?void 0:r.payment_transactions)&&r.payment_transactions.length,r&&this.isQuoteIntentValid(r)?r:(this.removeQuoteIntent(e),null)}catch(e){return null}}removeQuoteIntent(e){if(this.storageAdapter.isAvailable())try{const t=this.generateStorageKey(e);this.storageAdapter.remove(t)}catch(e){}}isQuoteIntentValid(e){if(!e||"object"!=typeof e)return!1;if(!e.id||!e.url||!e.org_id)return!1;const t=Date.now();return!(e.expires_at&&t>e.expires_at||e.created_at&&t-e.created_at>this.config.defaultExpirationMs)}getAllQuoteIntents(){return{}}cleanupExpiredQuoteIntents(){}isStorageAvailable(){return this.storageAdapter.isAvailable()}generateStorageKey(e){return ne.generateKey(this.config.namespace,e)}}re.DEFAULT_EXPIRATION_MS=864e5,re.DEFAULT_NAMESPACE="quote_intent";class ie{constructor(e){this.stateManager=e}async getOrCreateQuoteIntent(e,t,n){const r=this.stateManager.getQuoteIntent(e);if(r&&this.stateManager.isQuoteIntentValid(r)){const t=await n(r.url);return this.stateManager.saveQuoteIntent(e,t),t}try{const n=await t();return this.stateManager.saveQuoteIntent(e,n),n}catch(t){throw r&&this.stateManager.removeQuoteIntent(e),t}}updateQuoteIntent(e,t){const n=this.stateManager.getQuoteIntent(e);if(!n)return null;const r={...n,...t};return this.stateManager.saveQuoteIntent(e,r),r}clearQuoteIntent(e){this.stateManager.removeQuoteIntent(e)}clearExpiredQuoteIntents(){this.stateManager.cleanupExpiredQuoteIntents()}hasValidQuoteIntent(e){const t=this.stateManager.getQuoteIntent(e);return null!==t&&this.stateManager.isQuoteIntentValid(t)}getQuoteIntentUrl(e){const t=this.stateManager.getQuoteIntent(e);return(null==t?void 0:t.url)||null}isStorageAvailable(){return this.stateManager.isStorageAvailable()}}class oe{constructor(e,t){this.saveCallback=t,this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.isUserTyping=!1,this.config=e}start(){this.intervalId&&this.stop(),this.isPaused=!1,this.consecutiveFailures=0,this.lastErrorTime=0,this.config.autoSave&&(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!!this.config.autoSave&&(0===this.lastErrorTime||Date.now()-this.lastErrorTime>=this.config.retryDelay*Math.pow(2,this.consecutiveFailures-1))}handleSaveError(e){this.lastErrorTime=Date.now(),this.consecutiveFailures++,this.consecutiveFailures>=3&&(this.pause(),this.dispatchErrorEvent(e))}dispatchErrorEvent(e){if("undefined"!=typeof window){const t=new CustomEvent("form-autosave-error",{detail:{error:e,message:"Auto-save has been paused due to repeated failures."}});window.dispatchEvent(t)}}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 se(e,t){const n=t.operator,r=t.value,i=null==r?"":String(r),o=null==e?"":String(e);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===e||null==e||""===e||""===e.trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.trim());default:throw new Error(`Unsupported text operator: ${n}`)}}function ae(e,t){const n=t.operator,r=null==t.value?0:Number(t.value),i=null==e?0:Number(e.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===e||null==e||""===e||""===e.toString().trim();case"is_not_empty":return void 0!==e&&null!=e&&""!==e&&!(""===e.toString().trim());default:throw new Error(`Unsupported numeric operator: ${n}`)}}function le(e){if(!0===e||1===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"true"===t||"yes"===t}return!1}function ce(e,t){const n=t.operator;switch(t.operator){case"true":case"=":return le(e);case"false":return function(e){if(!1===e||0===e||void 0===e)return!0;if("string"==typeof e){const t=e.toLowerCase();return"false"===t||"no"===t}return!1}(e);case"!=":return!le(e);default:throw new Error(`Unsupported boolean operator: ${n}`)}}function de(e,t){const n=t.operator,r=t.value,i=null==r?0:Number(t.value);if(null==e||""===e.toString().trim())return"is_empty"===n;const o=e.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),l=Math.floor((Date.now()-s)/864e5),c=new Date(s),d=new Date,u=12*(d.getFullYear()-c.getFullYear())+(d.getMonth()-c.getMonth());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 l<i;case"age_days_less_than_or_equal":return l<=i;case"age_days_greater_than":return l>i;case"age_days_greater_than_or_equal":return l>=i;case"age_months_less_than":return u<i;case"age_months_less_than_or_equal":return u<=i;case"age_months_greater_than":return u>i;case"age_months_greater_than_or_equal":return u>=i;default:throw new Error(`Unsupported date operator: ${n}`)}}class ue{static create(e){switch(e){case"string":case"text":case"select":return se;case"numeric":return ae;case"boolean":return ce;case"date":return de;default:throw new Error(`Unsupported condition type: ${e}`)}}}function he(e,t){const n=t.condition_type||"and";if(!t.conditions||0===t.conditions.length)return{matched:!0,conditions:[]};const r={matched:!1,conditions:t.conditions.map(t=>{const n={...t,matched:me(e,t),string:`${t.field} ${t.operator}`};return t.value&&(n.string+=` ${t.value}`),n})};return"none"===n&&(r.matched=!0),"and"===n&&(r.matched=r.conditions.every(e=>e.matched)),"or"===n&&(r.matched=r.conditions.some(e=>e.matched)),"not"===n&&(r.matched=r.conditions.every(e=>!e.matched)),r}function me(e,t){if("expression"===t.type)throw new Error("Expression conditions should not be evaluated through matchesCondition");if(!t.field)throw new Error("Field is required for non-expression conditions");const n=e[t.field],r=ue.create(t.type);if(!r)throw new Error(`Unsupported condition type: ${t.type}`);return r(n,t)}var fe=Object.freeze({__proto__:null,TypeConditionEvaluatorFactory:ue,booleanMatchesCondition:ce,checkSimpleConditions:he,dateMatchesCondition:de,numericMatchesCondition:ae,textMatchesCondition:se});function pe(e,t){var n;const r=[];if("checkbox"===e.type&&e.required&&!0!==t&&"true"!==t)return r.push({field:e.code||e.id,message:`${e.label} must be accepted`}),r;"boolean"===e.type&&(null===(n=e.boolean_config)||void 0===n?void 0:n.enable_details_textbox)&&("yes"===e.boolean_config.show_details_on&&(!0===t||"true"===t)||e.boolean_config.show_details_on),"email"===e.type&&"string"==typeof t&&(t=t.trim());const i="boolean"===e.type?null==t:null==t||""===t;if(e.required&&i&&!0!==e.add_null_option)return r.push({field:e.code||e.id,message:`${e.label} is required`}),r;if(!e.required&&i)return r;const o=e.validation;if(!o)return r;const s=String(t),a="number"==typeof t?t:parseFloat(s);if(o.pattern&&("text"===e.type||"email"===e.type)){const t=new RegExp(o.pattern),n=s.trim();t.test(n)||r.push({field:e.code||e.id,message:`${e.label} format is invalid`})}if(o.minLength&&s.length<o.minLength&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.minLength} characters`}),o.maxLength&&s.length>o.maxLength&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.maxLength} characters`}),"number"!==e.type||isNaN(a)||(void 0!==o.min&&a<o.min&&r.push({field:e.code||e.id,message:`${e.label} must be at least ${o.min}`}),void 0!==o.max&&a>o.max&&r.push({field:e.code||e.id,message:`${e.label} must be no more than ${o.max}`}),void 0!==o.step&&a%o.step!==0&&r.push({field:e.code||e.id,message:`${e.label} must be in increments of ${o.step}`})),("date"===e.type||"year"===e.type||"monthyear"===e.type)&&!1===o.canBeFuture){const t=new Date,n=t.getFullYear();let i=!1;if("year"===e.type){const e=parseInt(s,10);!isNaN(e)&&e>n&&(i=!0)}else if("date"===e.type){const e=new Date(s);if(!isNaN(e.getTime())){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate());new Date(e.getFullYear(),e.getMonth(),e.getDate())>n&&(i=!0)}}else if("monthyear"===e.type){const e=s.split("-");if(2===e.length){const n=parseInt(e[0],10),r=parseInt(e[1],10)-1;isNaN(n)||isNaN(r)||new Date(n,r,1)>new Date(t.getFullYear(),t.getMonth(),1)&&(i=!0)}}i&&r.push({field:e.code||e.id,message:`${e.label} cannot be in the future`})}return"date"===e.type&&o.softMaxDate&&s&&s>o.softMaxDate&&r.push({field:e.code||e.id,message:o.softMaxMessage||`${e.label} is too far in the future`}),r}function ge(e,t){var n,r;const i=[];for(const r of e.fields){const e=r.code||r.id;let o=!0;if(r.visibility){const e=he(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});o="show"===r.visibility.action?e.matched:!e.matched}if(!o)continue;const s=t[e],a=pe(r,s);if(i.push(...a),"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===s||"true"===s)||"no"===r.boolean_config.show_details_on&&(!1===s||"false"===s))){const n=(t.U||{})[e];n&&""!==n.trim()||i.push({field:e,message:r.boolean_config.details_label||"Please provide details"})}}if(null===(r=e.validation)||void 0===r?void 0:r.required_fields)for(const n of e.validation.required_fields){const r=e.fields.find(e=>(e.code||e.id)===n),o=t[n];if(r){const e=r.code||r.id,n=i.find(t=>t.field===e);if(n)continue;let s=!0;if(r.visibility){const e=he(t,{condition_type:r.visibility.condition_type,conditions:r.visibility.conditions});s="show"===r.visibility.action?e.matched:!e.matched}if(!s)continue;if("checkbox"===r.type){!0!==o&&"true"!==o&&i.push({field:e,message:`${r.label} must be accepted`});continue}("boolean"===r.type?null==o:null==o||""===o)&&(!0===r.add_null_option||i.push({field:e,message:`${r.label} is required`}))}}return{isValid:0===i.length,errors:i}}function ye(e){const t=[];let n;if("object"==typeof e&&null!==e&&("validation_errors"in e&&e.validation_errors&&"object"==typeof e.validation_errors?n=e.validation_errors:"errors"in e&&e.errors&&"object"==typeof e.errors?n=e.errors:"message"in e||"validation_errors"in e||"errors"in e||(n=e)),n)for(const[e,r]of Object.entries(n))if(Array.isArray(r))for(const n of r)t.push({field:e,message:n});return t}class ve{constructor(e,t,n){this.httpClient=e,this.definition=t,this.quoteIntentStore=n}async load(e,t){if(this.quoteIntentStore&&this.quoteIntentStore.getQuoteIntentUrl(e)){const e=await this.httpClient.getQuoteIntent(t);if(e.quote_intent.form_data)return e.quote_intent.form_data}return(await this.httpClient.getQuoteIntent(t)).quote_intent.form_data||this.createEmptyFormData()}async save(e,t,n,r){try{const e=this.prepareSavePayload(n,r);return await this.httpClient.updateQuoteIntent(t,e),{success:!0}}catch(e){if(e&&"object"==typeof e&&"validationErrors"in e){const t=e.validationErrors;if(t&&"object"==typeof t)return{success:!1,validationErrors:ye(t)}}throw e}}prepareSavePayload(e,t){const n=this.getCurrentPageId(e);return{current_page_index:e.current_page,current_page_id:n,page_data:e.page_data,save_type:t.saveType}}getCurrentPageId(e){const t=this.definition;if(!t||!e.page_data)return;const n=e.current_page;if(n<0||n>=t.pages.length)return;const r=t.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 we{constructor(e,t,n,r){this.formDefinition=e,this.getFormData=t,this.updateFormData=n,this.saveCallback=r}canNavigateToPage(e){const t=this.getFormData().current_page;if(e<=t)return!0;if(this.hasActiveBlocker(t))return!1;if(this.isStagingEnvironment())return!0;const n=this.getFormData().completed_pages;for(let r=0;r<e;r++)if(r!==t&&!n.includes(r))return!1;return!0}async navigateToPage(e){if(e<0||e>=this.getTotalPages())return!1;if(!this.canNavigateToPage(e))return!1;const t=this.getFormData().current_page;if(e>t)try{await this.saveCallback(!0,"page")}catch(e){return e&&"object"==typeof e&&e.isValidationError,!1}return e>t&&this.markPageCompleted(t),this.updateFormData({current_page:e,last_updated:(new Date).toISOString()}),!0}navigateToNext(){const e=this.getFormData().current_page;return this.navigateToPage(e+1)}navigateToPrevious(){const e=this.getFormData().current_page;return this.navigateToPage(e-1)}markPageCompleted(e){var t;const n=this.getFormData(),r={};n.completed_pages.includes(e)||(r.completed_pages=[...n.completed_pages,e].sort((e,t)=>e-t));const i=n.incomplete_pages;if(Array.isArray(i)&&i.length>0){const n=null===(t=this.formDefinition.pages[e])||void 0===t?void 0:t.id;n&&i.includes(n)&&(r.incomplete_pages=i.filter(e=>e!==n))}Object.keys(r).length>0&&this.updateFormData(r)}getTotalPages(){return this.formDefinition.pages.length}getCompletionStatus(){const e=this.getFormData(),t=this.getTotalPages(),n=[...e.completed_pages];return{totalPages:t,currentPage:e.current_page,completedPages:n,percentComplete:n.length/t*100}}hasActiveBlocker(e){var t;const n=this.formDefinition.pages[e];if(!n)return!1;const r=(null===(t=this.getFormData().page_data)||void 0===t?void 0:t[n.id])||{};for(const e of n.fields)if(e.blocker)if(e.blocker.conditions&&e.blocker.conditions.length>0){if(he(r,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return!0}else if(void 0!==e.blocker.trigger_value){const t=r[e.code||e.id];if(void 0!==t&&String(t)===String(e.blocker.trigger_value))return!0}return!1}isStagingEnvironment(){const e=window.location.hostname;return"localhost"===e||e.endsWith(".test")||e.includes("staging")}}class be{constructor(e){this.httpClient=e}async calculateQuote(e){const n=await this.httpClient.calculateQuoteIntent(e);return t(),n}}class xe{constructor(e){this.httpClient=e}async calculate(e){const n=await this.httpClient.calculateQuoteIntentV2(e);return t(),n}async reprice(e,n){const r={selection:n},i=await this.httpClient.repriceQuoteIntentV2(e,r);return t(),i}async bind(e,n){const r=await this.httpClient.bindQuoteIntentV2(e,n);return t(),r}}function ke(e,t,n){var r,i,o,s,a,l,c,d,u;const h=Date.now(),m=`${Math.random().toString(36).slice(2,10)}-${e}-${h}`;if(function(e,t,n){try{Promise.resolve().then(function(){return rm}).then(({captureException:r,addBreadcrumb:i,isSentryInitialized:o})=>{o()&&(i({message:`Error occurred: ${t}`,category:"error",level:"error",data:{errorType:t,customMessage:n}}),r(e,{errorType:t,customMessage:n}))}).catch(()=>{})}catch(e){}}(t,e,n),t&&"object"==typeof t){const f=null!==(o=null!==(r=t.organisation)&&void 0!==r?r:null===(i=t.data)||void 0===i?void 0:i.organisation)&&void 0!==o?o:null===(a=null===(s=t.response)||void 0===s?void 0:s.data)||void 0===a?void 0:a.organisation;if("statusCode"in t||"status"in t)return Se(m,e,t.statusCode||t.status||500,t.message||(null===(l=t.data)||void 0===l?void 0:l.message)||"Server error occurred",n,h,f);if("response"in t)return Se(m,e,(null===(c=t.response)||void 0===c?void 0:c.status)||500,(null===(u=null===(d=t.response)||void 0===d?void 0:d.data)||void 0===u?void 0:u.message)||t.message||"Network error occurred",n,h,f);if(t.message)return{id:m,type:e,severity:_e(e),title:Ne(e),message:n||$e(e),details:t.message,retryable:Ie(e,0),timestamp:h,trackingId:m}}const f="string"==typeof t?t:"An unexpected error occurred";return{id:m,type:e,severity:_e(e),title:Ne(e),message:n||f,retryable:Ie(e,0),timestamp:h,trackingId:m}}function Se(e,t,n,r,i,o,s){const a=n>=500?"critical":n>=400?"error":"warning",l=Ie(t,n);return{id:e,type:t,severity:a,statusCode:n,title:Ne(t,n),message:i||Ce(t,n,r),details:r,retryable:l,timestamp:o,organisation:null!=s?s:void 0}}function Ne(e,t){if(t){if(404===t)return"Not Found";if(503===t)return"Under Maintenance";if(t>=500)return"Something Went Wrong";if(t>=400)return"Invalid Request"}switch(e){case"initialization":default:return"Something Went Wrong";case"calculation":return"Calculation Error";case"network":return"Connection Problem";case"validation":return"Please Check Your Details";case"maintenance":return"Under Maintenance";case"version_invalidated":return"This Quote Needs to Be Restarted"}}function _e(e){switch(e){case"initialization":case"maintenance":return"critical";case"calculation":case"network":default:return"error";case"validation":case"version_invalidated":return"warning"}}function Ce(e,t,n){return"calculation"===e&&(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===t?"initialization"===e?"The requested form could not be found. Please check the URL or contact support.":"The requested resource was not found.":503===t?"We're performing scheduled maintenance. Please check back in a few minutes.":t>=500?"calculation"===e?"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===t?"Too many requests. Please wait a moment and try again.":t>=400?"There was an issue with your request. Please adjust your details and re-submit.":"An unexpected error occurred. Please try again."}function $e(e){switch(e){case"initialization":return"We're unable to load the application at this time. Please try again.";case"calculation":return"We couldn't complete the calculation. Please check your details and try again.";case"network":return"We're having trouble connecting. Please check your internet connection and try again.";case"validation":return"Please check your details and try again.";case"maintenance":return"We're performing scheduled maintenance. Please check back in a few minutes.";default:return"An unexpected error occurred. Please try again."}}function Ie(e,t){return"validation"!==e&&"maintenance"!==e&&404!==t&&503!==t&&!(t>=400&&t<500&&429!==t)&&("network"===e||"calculation"===e||t>=500&&503!==t||429===t)}function Te(e){return"maintenance"===e.type||503===e.statusCode}function Ee(e){return e.trackingId?`If this problem persists, please contact support and reference error ID: ${e.trackingId.slice(0,8).toUpperCase()}`:"critical"===e.severity?"If this problem persists, please contact support with the error details.":"If you continue to experience issues, please contact support."}let Pe=null;function Re(e){Pe=e}function ze(e,t){var n,r;return{event:t,quote_id:e.id,organisation_slug:null===(n=e.organisation)||void 0===n?void 0:n.slug,organisation_name:null===(r=e.organisation)||void 0===r?void 0:r.name,timestamp:(new Date).toISOString()}}function De(e){var t,n;if(!(null==Pe?void 0:Pe.isEnabled()))return;const r={...ze(e,"quote_started"),quote_status:e.status,total_pages:null===(n=null===(t=e.form_definition)||void 0===t?void 0:t.pages)||void 0===n?void 0:n.length};Pe.push(r)}function Me(e,t,n,r){var i,o;if(!(null==Pe?void 0:Pe.isEnabled()))return;const s=(null===(o=null===(i=e.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,l={...ze(e,"quote_form_progress"),current_page:t,total_pages:s,completed_pages:n.length,completion_percentage:a,page_title:r};Pe.push(l)}function Oe(e,t){if(!(null==Pe?void 0:Pe.isEnabled()))return;const n=t.calculations||[],r=t.payment_options||[],i=n.find(e=>e.id===t.default_excess_id),o=n.map(e=>e.premium_total),s=o.length>0?Math.min(...o):void 0,a=o.length>0?Math.max(...o):void 0,l=r.some(e=>"monthly"===e.amount.frequency),c={...ze(e,"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:l,min_premium:s,max_premium:a};Pe.push(c)}function je(e,t,n,r,i){if(!(null==Pe?void 0:Pe.isEnabled()))return;const o={...ze(e,"quote_at_checkout"),excess_id:t.id,excess_amount:t.excess_amount,premium_subtotal:t.premium_subtotal,premium_total:t.premium_total,payment_options_count:n,has_installments:r,form_completion:i,fees:t.fees};Pe.push(o)}function We(e,t){if(!(null==Pe?void 0:Pe.isEnabled()))return;const n=t.referrals||[],r={...ze(e,"quote_referred"),referral_reason:t.referral_reason,referrals_count:n.length,referral_ids:n.map(e=>e.id)};Pe.push(r)}function Ae(e,t,n,r){if(!(null==Pe?void 0:Pe.isEnabled()))return;const i={...ze(e,"payment_initiated"),payment_amount:t.amount.dueToday,payment_gateway:t.gateway_id,payment_gateway_name:n,excess_amount:r||0,payment_frequency:t.amount.frequency,amount_due_today:t.amount.dueToday,installments_count:t.amount.numberOfInstallments};Pe.push(i)}function Le(e,t,n,r,i,o){if(!(null==Pe?void 0:Pe.isEnabled()))return;const s={...ze(e,"payment_completed"),transaction_id:t,payment_amount:n,payment_gateway:r,premium_total:i||n,excess_amount:o||0};Pe.push(s)}function Be(e,t,n,r,i,o){if(!(null==Pe?void 0:Pe.isEnabled()))return;const s={...ze(e,"payment_failed"),transaction_id:t,payment_amount:n,payment_gateway:r,payment_status:i,failure_reason:o};Pe.push(s)}class qe{constructor(e,t,n,r={}){this.quoteIntent=e,this.httpClient=t,this.subscribers=new Set,this.pendingChanges={},this.isCalculating=!1,this.isRepricing=!1,this.isSaving=!1,this.selectedExcessId=null,this.selectedPaymentOption=null,this.selectionV2=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=e.form_definition;this.persistenceManager=new ve(t,i,n),this.autoSaveManager=new oe(this.config,this.saveFormData.bind(this)),this.navigationManager=new we(i,this.getFormProgress.bind(this),this.updateFormDataInternal.bind(this),this.saveFormData.bind(this)),this.calculationManager=new be(t),this.calculationManagerV2=new xe(t),this.config.autoSave&&this.autoSaveManager.start()}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}async loadFormProgress(){var e,t;return this.formData=await this.persistenceManager.load(this.quoteIntent.id,this.quoteIntent.url),this.lastCalculationFailed=!0===(null===(t=null===(e=this.formData.page_data)||void 0===e?void 0:e.Y)||void 0===t?void 0:t.lastCalculationFailed),this.config.autoSave=!1,this.autoSaveManager.stop(),this.notify(),this.formData}updatePageData(e,t){this.pendingChanges[e]={...this.pendingChanges[e],...t},this.formData.page_data={...this.formData.page_data,[e]:{...this.formData.page_data[e],...t}},this.formData.last_updated=(new Date).toISOString(),this.notify()}updateFieldValue(e,t,n){if(this.autoSaveManager.startTyping(),"string"==typeof n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);i&&"email"===i.type&&(n=n.trim())}this.pendingChanges[e]||(this.pendingChanges[e]={}),this.pendingChanges[e][t]=n,this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e][t]=n,this.formData.last_updated=(new Date).toISOString(),this.validateField(e,t,n),this.notify()}updateFieldAnswer(e,n,r,i){if(this.autoSaveManager.startTyping(),this.formData.page_data[e]||(this.formData.page_data[e]={}),this.formData.page_data[e].U||(this.formData.page_data[e].U={}),this.formData.page_data[e].U[n]=r,i){const n=this.getRatingFactorCodeById(i);n&&(this.formData.page_data[e][n]=r,t())}this.formData.last_updated=(new Date).toISOString(),this.notify()}restoreFormProgress(e){var n;if(this.isUserTyping())return;const r=e.completed_pages||[],i=(null===(n=this.quoteIntent.form_definition)||void 0===n?void 0:n.pages.length)||0;let o=0;for(let e=0;e<i;e++)if(!r.includes(e)){o=e;break}r.length===i&&i>0&&(o=i-1),t(e.current_page),this.formData={...e,current_page:o},this.notify()}restoreCalculationResult(e){t(),t(e.outcome_type),this.calculationResult=e,this.selectedExcessId=this.resolveDefaultExcessId(e),t(),this.notify(),t()}getRatingFactorCodeById(e){const n=this.getFormDefinition();for(const t of n.pages)for(const n of t.fields){if(n.rating_factor_id===e)return n.code||n.id;if(n.rating_factor_mappings)for(const t of n.rating_factor_mappings)if(t.rating_factor_id===e)return t.rating_factor_code||n.code||n.id}return t(),null}processRatingFactorMappings(e){const t=this.getFormDefinition(),n={};return t.pages.forEach(t=>{const r=e.page_data[t.id]||{};t.fields.forEach(e=>{const t=r[e.code||e.id];null!=t&&""!==t&&e.rating_factor_mappings&&e.rating_factor_mappings.length>0&&e.rating_factor_mappings.forEach(r=>{if("derived"===r.type&&r.derivation_rule){const i=this.applyDerivationRule(t,r.derivation_rule,r.metadata),o=r.rating_factor_code||`${e.code||e.id}_${r.derivation_rule}`;n[o]=i}})})}),n}applyDerivationRule(e,n,r){switch(t(JSON.stringify(r)),n){case"calculate_age":return this.calculateAge(e,r);case"invert_yes_no":return this.invertYesNo(e);default:return null}}invertYesNo(e){return"Yes"===e?"No":"Yes"}calculateAge(e,t){try{const n=new Date(e),r="current_date"===(null==t?void 0:t.reference_date)?new Date:new Date((null==t?void 0:t.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(e){return null}}async saveFormData(e=!1,n="auto-save"){if(!e&&0===Object.keys(this.pendingChanges).length)return;this.isSaving=!0,this.notify();const r={...this.formData},i=this.processRatingFactorMappings(this.formData);t();const o={...this.formData,page_data:{...this.formData.page_data,V:i}};try{const t=await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:e,saveType:n});if(!t.success){if(t.validationErrors){this.setServerValidationErrors(t.validationErrors),this.notify();const e=new Error("Validation failed");throw e.isValidationError=!0,e}throw new Error("Failed to save form data")}{this.pendingChanges={},this.autoSaveManager.onSaveSuccess(),this.clearServerValidationErrors(),this.clearGeneralErrors();const e=this.formData;r.current_page===e.current_page?this.formData=o:this.formData={...o,current_page:e.current_page,completed_pages:e.completed_pages,last_updated:e.last_updated},this.notify()}}catch(e){if(e&&"object"==typeof e&&"type"in e&&"message"in e){const t=e;if(!t.validationErrors||0===Object.keys(t.validationErrors).length){const e=ke("validation",t);this.addGeneralError(e),this.notify()}}throw e}finally{this.isSaving=!1,this.notify()}}canNavigateToPage(e){return this.navigationManager.canNavigateToPage(e)}navigateToPage(e){return this.navigationManager.navigateToPage(e)}async navigateToNextPage(){var e,t;const n=await this.navigationManager.navigateToNext();if(n){const n=this.formData.current_page,r=this.formData.completed_pages||[],i=null===(t=null===(e=this.quoteIntent.form_definition)||void 0===e?void 0:e.pages[n-1])||void 0===t?void 0:t.title;Me(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}getIsRepricing(){return this.isRepricing}getIsSaving(){return this.isSaving}hasCalculationResponse(){return Boolean(this.calculationResult)}getCalculationResult(){return this.calculationResult}getConsecutiveFailures(){return this.autoSaveManager.status.consecutiveFailures}resolveDefaultExcessId(e){var t,n,r;const i=null!==(t=e.calculations)&&void 0!==t?t:[],o=e.default_excess_id;return o&&i.some(e=>e.id===o)?o:null!==(r=null===(n=i[0])||void 0===n?void 0:n.id)&&void 0!==r?r:null}getSelectedExcessId(){return this.selectedExcessId}setSelectedExcessId(e){this.selectedExcessId=e,this.selectedPaymentOption=null,this.notify()}getSelectedPaymentOption(){return this.selectedPaymentOption}setSelectedPaymentOption(e){this.selectedPaymentOption=e,this.notify()}hasPendingChanges(){return Object.keys(this.pendingChanges).length>0}validateCurrentPage(){const e=this.getCurrentPageIndex(),t=this.getFormDefinition().pages[e];if(!t)return[];const n=ge(t,this.getAllFormDataFlattened());return this.validationErrors=n.errors,this.notify(),n.errors}validateField(e,t,n){const r=this.getFormDefinition().pages.find(t=>t.id===e),i=null==r?void 0:r.fields.find(e=>(e.code||e.id)===t);if(!i)return[];const o=pe(i,n);return this.validationErrors=this.validationErrors.filter(e=>e.field!==t),this.validationErrors.push(...o),this.notify(),o}getValidationErrors(){return[...this.validationErrors,...this.serverValidationErrors]}getFieldErrors(e){return this.getValidationErrors().filter(t=>t.field===e)}hasErrors(){return this.validationErrors.length>0||this.serverValidationErrors.length>0}hasFieldErrors(e){return this.getFieldErrors(e).length>0}clearValidationErrors(){this.validationErrors=[],this.notify()}setServerValidationErrors(e){this.serverValidationErrors=e,this.notify()}clearServerValidationErrors(){this.serverValidationErrors=[],this.notify()}getGeneralErrors(){const e=this.generalErrors.filter(e=>!e.dismissed);return e.length>0?[e[e.length-1]]:[]}addGeneralError(e){this.generalErrors.push(e),this.notify()}dismissGeneralError(e){const t=this.generalErrors.find(t=>t.id===e);t&&(t.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 e=this.getFormDefinition(),t={...this.formData},{checkSimpleConditions:n}=await Promise.resolve().then(function(){return fe}),r=this.getAllFormDataFlattened();e.pages.forEach(e=>{const i=this.formData.page_data[e.id]||{},o={};Object.keys(i).forEach(e=>{e.startsWith("__")&&e.endsWith("__")&&(o[e]=i[e])}),e.fields.forEach(e=>{const t=e.code||e.id,s=i[t];let a=!0;if(e.visibility){const t=n(r,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions});a="show"===e.visibility.action?t.matched:!t.matched}a&&void 0!==s&&(o[t]=s)}),t.page_data[e.id]=o});const i=this.processRatingFactorMappings(t),o={...t,page_data:{...t.page_data,V:i}};await this.persistenceManager.save(this.quoteIntent.id,this.quoteIntent.url,o,{force:!0,saveType:"full"})}async calculateQuote(){t();const e=this.getFormDefinition(),n=[],r=this.getAllFormDataFlattened();for(const i of e.pages){const e=ge(i,r);t(i.title,e.errors.length>0&&e.errors),n.push(...e.errors)}if(n.length>0)throw t(),this.validationErrors=n,this.notify(),new Error("Form validation failed");t(),await this.filterHiddenFieldsAndSave();try{if(this.isCalculating=!0,this.notify(),2===this.quoteIntent.calculator_version&&this.quoteIntent.calculate_url_v2){const e=await this.calculationManagerV2.calculate(this.quoteIntent.calculate_url_v2);if("referral"===e.outcome_type){this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null;const t=this.buildV1CompatResponseFromV2(e);return this.calculationResult=t,this.lastCalculationFailed=!1,this.persistCalculationFailureState(),We(this.quoteIntent,t),t}this.calculationResultV2=e,this.selectionV2=e.selection;const t=this.buildV1CompatResponseFromV2(e);this.calculationResult=t,this.selectedExcessId=e.selection.excess_id,this.lastCalculationFailed=!1,this.persistCalculationFailureState();const n=this.generalErrors.filter(e=>"calculation"===e.type);return n.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===t.outcome_type?Oe(this.quoteIntent,t):"referral"===t.outcome_type&&We(this.quoteIntent,t),t}const e=await this.calculationManager.calculateQuote(this.quoteIntent.calculate_url);this.calculationResult=e,this.selectedExcessId=this.resolveDefaultExcessId(e),this.lastCalculationFailed=!1,this.persistCalculationFailureState();const t=this.generalErrors.filter(e=>"calculation"===e.type);return t.forEach(e=>this.dismissGeneralError(e.id)),"calculation"===e.outcome_type?Oe(this.quoteIntent,e):"referral"===e.outcome_type&&We(this.quoteIntent,e),e}catch(e){if(this.lastCalculationFailed=!0,this.persistCalculationFailureState(),e&&"object"==typeof e&&"type"in e&&"VERSION_INVALIDATED"===e.type)throw e;const t={outcome_type:"referral",referral_reason:"Your quote requires further review.",quote_intent:this.quoteIntent};return this.calculationResult=t,t}finally{this.isCalculating=!1,this.notify()}}async clearCalculationResults(){t();try{await this.httpClient.deleteCalculations(this.quoteIntent.delete_calculations_url),this.calculationResult=void 0,this.calculationResultV2=void 0,this.selectionV2=null,this.selectedExcessId=null,this.selectedPaymentOption=null,this.notify(),t()}catch(e){throw t(),e}}getCalculationResultV2(){return this.calculationResultV2}getSelectionV2(){return this.selectionV2}setV2Selection(e){var t,n,r,i;if(!this.calculationResultV2||!this.selectionV2)return;const o={cover_type_id:null!==(t=e.cover_type_id)&&void 0!==t?t:this.selectionV2.cover_type_id,excess_id:null!==(n=e.excess_id)&&void 0!==n?n:this.selectionV2.excess_id,coverage_option_ids:null!==(r=e.coverage_option_ids)&&void 0!==r?r:this.selectionV2.coverage_option_ids};if(e.cover_type_id&&e.cover_type_id!==this.selectionV2.cover_type_id){const e=this.calculationResultV2.variants.filter(e=>e.cover_type_id===o.cover_type_id),t=e.some(e=>e.excess_id===o.excess_id);if(!t){const t=null!==(i=e.find(e=>e.excess_id===this.calculationResultV2.default_excess_id))&&void 0!==i?i:e[0];t&&(o.excess_id=t.excess_id)}}this.selectionV2=o,this.selectedExcessId=o.excess_id,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2),this.notify()}async toggleV2CoverageOption(e){if(!this.calculationResultV2||!this.selectionV2||!this.quoteIntent.reprice_url_v2)return;const t=this.calculationResultV2.policy_coverage_options.find(t=>t.id===e);if(!t)return;const n=this.selectionV2.coverage_option_ids,r=n.includes(e)?n.filter(t=>t!==e):[...n,e],i={...this.selectionV2,coverage_option_ids:r};try{this.isRepricing=!0,this.notify();const e=await this.calculationManagerV2.reprice(this.quoteIntent.reprice_url_v2,i);this.calculationResultV2={...this.calculationResultV2,variants:e.variants,policy_coverage_options:e.policy_coverage_options},this.selectionV2=e.selection,this.calculationResult=this.buildV1CompatResponseFromV2(this.calculationResultV2)}catch(e){}finally{this.isRepricing=!1,this.notify()}}getV2DisplayedTotal(){if(!this.calculationResultV2||!this.selectionV2)return 0;const e=this.calculationResultV2.variants.find(e=>e.cover_type_id===this.selectionV2.cover_type_id&&e.excess_id===this.selectionV2.excess_id);return e?Math.round(100*e.pricing.total_payable)/100:0}async bindV2(e){if(!this.quoteIntent.bind_url_v2||!this.selectionV2)throw new Error("v2 bind unavailable — missing bind URL or selection");const t=this.getV2DisplayedTotal();return this.calculationManagerV2.bind(this.quoteIntent.bind_url_v2,{selection:this.selectionV2,client_claimed_total:t,email:e})}buildV1CompatResponseFromV2(e){var t;const n=null!==(t=this.selectionV2)&&void 0!==t?t:e.selection,r=e.variants.filter(e=>e.cover_type_id===n.cover_type_id),i=r.map(t=>{var n;const r=e.excess_options.find(e=>e.id===t.excess_id);return{id:t.excess_id,calculation_id:e.id,excess_amount:null!==(n=null==r?void 0:r.excess_amount)&&void 0!==n?n:0,excess_label:null==r?void 0:r.excess_label,description:void 0,premium_base:t.pricing.subtotal-t.pricing.fees,premium_subtotal:t.pricing.subtotal,premium_total:t.pricing.total_payable,fees:[]}});return{quote_intent:e.quote_intent,product_name:e.product_name,default_excess_id:e.default_excess_id,default_coverage_options:n.coverage_option_ids,outcome_type:e.outcome_type,referral_reason:e.referral_reason,calculations:i,referrals:e.referrals.map(e=>({id:e.id,reason:e.reason})),clauses:e.clauses,payment_options:[],payment_gateways:e.payment_gateways}}notify(){this.subscribers.forEach(e=>e(this))}getAllFormDataFlattened(){const e={};return Object.values(this.formData.page_data).forEach(t=>{const{U:n,...r}=t;Object.assign(e,r),n&&Object.keys(n).length>0&&(e.U||(e.U={}),Object.assign(e.U,n))}),e}updateFormDataInternal(e){if(this.isUserTyping()&&e.page_data){const t={...e};delete t.page_data,this.formData={...this.formData,...t}}else this.formData={...this.formData,...e};this.notify()}createEmptyFormData(){return{current_page:0,completed_pages:[],page_data:{},last_updated:(new Date).toISOString()}}getPersistedCalculationFailureState(){var e,t,n;return!!(null===(n=null===(t=null===(e=this.quoteIntent.form_data)||void 0===e?void 0:e.page_data)||void 0===t?void 0:t.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 e=new URL(window.location.href);e.searchParams.delete("url"),window.history.replaceState({},document.title,e.toString()),window.location.reload()}getQuoteIntent(){return this.quoteIntent}updateQuoteIntent(e){if(this.quoteIntentStore){const t=this.quoteIntentStore.updateQuoteIntent(this.quoteIntent.org_id,e);t&&(this.quoteIntent=t,this.notify())}}clearStoredQuoteIntent(){this.quoteIntentStore&&this.quoteIntentStore.clearQuoteIntent(this.quoteIntent.org_id)}async initiatePayment(e){var n,r,i;const o=((null===(n=this.calculationResult)||void 0===n?void 0:n.payment_gateways)||[]).find(t=>t.id===e.gatewayId);if(!o)throw new Error("Selected payment gateway not found in calculation response");t();const s=((null===(r=this.calculationResult)||void 0===r?void 0:r.payment_options)||[]).find(t=>t.gateway_id===e.gatewayId&&t.calculation_id===e.calculationId),a=((null===(i=this.calculationResult)||void 0===i?void 0:i.calculations)||[]).find(t=>t.id===e.calculationId);try{const t=await this.httpClient.initiatePayment(e,o);return s&&Ae(this.quoteIntent,s,o.name,null==a?void 0:a.excess_amount),this.notify(),t}catch(e){throw e}}async getPaymentStatus(e){var t;const n=this.getSelectedPaymentOption();if(!n)throw new Error("No payment option selected");const r=((null===(t=this.calculationResult)||void 0===t?void 0:t.payment_gateways)||[]).find(e=>e.id===n.gateway_id);if(!r)throw new Error("Selected payment gateway not found in calculation response");try{const t=await this.httpClient.getPaymentStatus(e,r);return this.notify(),t}catch(e){throw e}}startPaymentStatusPolling(e,t,n=30){let r=0,i=!1;const o=async()=>{if(!(i||r>=n))try{const s=await this.getPaymentStatus(e);t(s),"pending"!==s.status&&"initiated"!==s.status||(r++,r<n&&!i&&setTimeout(o,1e4))}catch(e){r++,r<n&&!i&&setTimeout(o,1e4)}};return o(),()=>{i=!0}}}class Fe{constructor(e,t){this.httpClient=e,this.response=t}async get(){return await this.httpClient.getQuoteIntent(this.response.url)}async update(e){var t;const n=this.response.product.form_definition,r={...this.response.quote_intent.form_data};r.page_data||(r.page_data={});for(const i of n.pages){const n=r.page_data[i.id]||{};for(const r of i.fields){const i=r.code||r.id;if(e.hasOwnProperty(i)?n[i]=e[i]:("text"===r.type&&(n[i]="sample"),"number"===r.type&&(n[i]=1),"checkbox"===r.type&&(n[i]=!0)),"boolean"===r.type&&(null===(t=r.boolean_config)||void 0===t?void 0:t.enable_details_textbox)){const e="yes"===r.boolean_config.show_details_on,t=n[i];(t===e||t===String(e))&&(n.U||(n.U={}),n.U[i]=`Sample details for: ${i}`)}}r.page_data[i.id]=n}const i={current_page_index:0,save_type:"full",page_data:{...r.page_data}};return await this.httpClient.updateQuoteIntent(this.response.url,i)}async replaceFormData(e,t){var n;return await this.httpClient.updateQuoteIntent(this.response.url,{current_page_index:0,save_type:null!==(n=null==t?void 0:t.saveType)&&void 0!==n?n:"full",page_data:e})}}class He{constructor(e){this.httpClient=e}async createQuoteIntent(e,t){const n=await this.httpClient.createQuoteIntent({code:e,...t});return new Fe(this.httpClient,n)}}var Ue=0;function Ye(e,t,n,i,o,s){t||(t={});var a,l,c=t;if("ref"in c)for(l in c={},t)"ref"==l?a=t[l]:c[l]=t[l];var d={type:e,props:c,key:n,ref:a,i:null,m:null,p:0,v:null,k:null,constructor:void 0,N:--Ue,_:-1,C:0,J:o,K:s};if("function"==typeof e&&(a=e.defaultProps))for(l in a)void 0===c[l]&&(c[l]=a[l]);return r.vnode&&r.vnode(d),d}var Ze,Ve,Ge,Qe,Je=0,Ke=[],Xe=r,et=Xe.p,tt=Xe.O,nt=Xe.diffed,rt=Xe.k,it=Xe.unmount,ot=Xe.m;function st(e,t){Xe.W&&Xe.W(Ve,e,Je||t),Je=0;var n=Ve.X||(Ve.X={m:[],W:[]});return e>=n.m.length&&n.m.push({}),n.m[e]}function at(e){return Je=1,function(e,t){var n=st(Ze++,2);if(n.t=e,!n.k&&(n.m=[vt(void 0,t),function(e){var t=n.ee?n.ee[0]:n.m[0],r=n.t(t,e);t!==r&&(n.ee=[r,n.m[1]],n.k.setState({}))}],n.k=Ve,!Ve.te)){var r=function(e,t,r){if(!n.k.X)return!0;var o=n.k.X.m.filter(function(e){return e.k});if(o.every(function(e){return!e.ee}))return!i||i.call(this,e,t,r);var s=n.k.props!==e;return o.some(function(e){if(e.ee){var t=e.m[0];e.m=e.ee,e.ee=void 0,t!==e.m[0]&&(s=!0)}}),i&&i.call(this,e,t,r)||s};Ve.te=!0;var i=Ve.shouldComponentUpdate,o=Ve.componentWillUpdate;Ve.componentWillUpdate=function(e,t,n){if(this.v){var s=i;i=void 0,r(e,t,n),i=s}o&&o.call(this,e,t,n)},Ve.shouldComponentUpdate=r}return n.ee||n.m}(vt,e)}function lt(e,t){var n=st(Ze++,3);!Xe.L&&yt(n.X,t)&&(n.m=e,n.u=t,Ve.X.W.push(n))}function ct(e){return Je=5,dt(function(){return{current:e}},[])}function dt(e,t){var n=st(Ze++,7);return yt(n.X,t)&&(n.m=e(),n.X=t,n.W=e),n.m}function ut(e,t){return Je=8,dt(function(){return e},t)}function ht(){for(var e;e=Ke.shift();){var t=e.X;if(e.I&&t)try{t.W.some(pt),t.W.some(gt),t.W=[]}catch(n){t.W=[],Xe.v(n,e.N)}}}Xe.p=function(e){Ve=null,et&&et(e)},Xe.m=function(e,t){e&&t.i&&t.i.B&&(e.B=t.i.B),ot&&ot(e,t)},Xe.O=function(e){tt&&tt(e),Ze=0;var t=(Ve=e.k).X;t&&(Ge===Ve?(t.W=[],Ve.W=[],t.m.some(function(e){e.ee&&(e.m=e.ee),e.u=e.ee=void 0})):(t.W.some(pt),t.W.some(gt),t.W=[],Ze=0)),Ge=Ve},Xe.diffed=function(e){nt&&nt(e);var t=e.k;t&&t.X&&(t.X.W.length&&(1!==Ke.push(t)&&Qe===Xe.requestAnimationFrame||((Qe=Xe.requestAnimationFrame)||ft)(ht)),t.X.m.some(function(e){e.u&&(e.X=e.u),e.u=void 0})),Ge=Ve=null},Xe.k=function(e,t){t.some(function(e){try{e.W.some(pt),e.W=e.W.filter(function(e){return!e.m||gt(e)})}catch(n){t.some(function(e){e.W&&(e.W=[])}),t=[],Xe.v(n,e.N)}}),rt&&rt(e,t)},Xe.unmount=function(e){it&&it(e);var t,n=e.k;n&&n.X&&(n.X.m.some(function(e){try{pt(e)}catch(e){t=e}}),n.X=void 0,t&&Xe.v(t,n.N))};var mt="function"==typeof requestAnimationFrame;function ft(e){var t,n=function(){clearTimeout(r),mt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);mt&&(t=requestAnimationFrame(n))}function pt(e){var t=Ve,n=e.k;"function"==typeof n&&(e.k=void 0,n()),Ve=t}function gt(e){var t=Ve;e.k=e.m(),Ve=t}function yt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function vt(e,t){return"function"==typeof t?t(e):t}const wt="insure-os";let bt=!1;const xt=new Map,kt={[`--${wt}-radius`]:"0.75rem",[`--${wt}-radius-sm`]:"0.5rem",[`--${wt}-radius-lg`]:"1rem",[`--${wt}-background`]:"oklch(0.955 0 0)",[`--${wt}-foreground`]:"oklch(0.145 0 0)",[`--${wt}-card`]:"oklch(1 0 0)",[`--${wt}-card-foreground`]:"oklch(0.145 0 0)",[`--${wt}-popover`]:"oklch(1 0 0)",[`--${wt}-popover-foreground`]:"oklch(0.145 0 0)",[`--${wt}-primary`]:"oklch(0.205 0 0)",[`--${wt}-primary-foreground`]:"oklch(0.985 0 0)",[`--${wt}-secondary`]:"oklch(0.97 0 0)",[`--${wt}-secondary-foreground`]:"oklch(0.205 0 0)",[`--${wt}-muted`]:"oklch(0.97 0 0)",[`--${wt}-muted-foreground`]:"oklch(0.556 0 0)",[`--${wt}-accent`]:"oklch(0.97 0 0)",[`--${wt}-accent-foreground`]:"oklch(0.205 0 0)",[`--${wt}-destructive`]:"oklch(0.577 0.245 27.325)",[`--${wt}-border`]:"oklch(0.9 0 0)",[`--${wt}-input`]:"oklch(0.9 0 0)",[`--${wt}-ring`]:"oklch(0.708 0 0)",[`--${wt}-font-family`]:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",[`--${wt}-font-size-large`]:"18px",[`--${wt}-font-size-small`]:"14px",[`--${wt}-font-size`]:"16px",[`--${wt}-border-width`]:"1px",[`--${wt}-transition-duration`]:"200ms",[`--${wt}-transition-timing-function`]:"cubic-bezier(0.4, 0, 0.2, 1)",[`--${wt}-shadow-sm`]:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",[`--${wt}-shadow`]:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",[`--${wt}-shadow-md`]:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",[`--${wt}-shadow-lg`]:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",[`--${wt}-spacing-sm`]:"0.75rem",[`--${wt}-spacing`]:"1rem",[`--${wt}-spacing-md`]:"1.5rem",[`--${wt}-spacing-lg`]:"2rem",[`--${wt}-spacing-xl`]:"3rem"},St={colors:{background:`var(--${wt}-background)`,foreground:`var(--${wt}-foreground)`,card:`var(--${wt}-card)`,popover:`var(--${wt}-popover)`,popoverForeground:`var(--${wt}-popover-foreground)`,primary:`var(--${wt}-primary)`,primaryForeground:`var(--${wt}-primary-foreground)`,secondary:`var(--${wt}-secondary)`,muted:`var(--${wt}-muted)`,mutedForeground:`var(--${wt}-muted-foreground)`,accent:`var(--${wt}-accent)`,accentForeground:`var(--${wt}-accent-foreground)`,destructive:`var(--${wt}-destructive)`,border:`var(--${wt}-border)`,input:`var(--${wt}-input)`},fontSize:{small:`var(--${wt}-font-size-small)`,default:`var(--${wt}-font-size)`,large:`var(--${wt}-font-size-large)`},radius:{small:`var(--${wt}-radius-sm)`,default:`var(--${wt}-radius)`,large:`var(--${wt}-radius-lg)`},shadow:{sm:`var(--${wt}-shadow-sm)`,md:`var(--${wt}-shadow-md)`},spacing:{sm:`var(--${wt}-spacing-sm)`,default:`var(--${wt}-spacing)`,md:`var(--${wt}-spacing-md)`,lg:`var(--${wt}-spacing-lg)`,xl:`var(--${wt}-spacing-xl)`},fontFamily:`var(--${wt}-font-family)`,borderWidth:`var(--${wt}-border-width)`,transition:`var(--${wt}-transition-duration) var(--${wt}-transition-timing-function)`},Nt=new Set;let _t=!1;function Ct(){_t||($t(`\n/* InsureOS Style Isolation Reset */\n.${wt}-root {\n all: revert;\n /* Re-apply our base styles after reset */\n font-family: var(--${wt}-font-family);\n background-color: var(--${wt}-background);\n color: var(--${wt}-foreground);\n font-size: var(--${wt}-font-size);\n line-height: 1.5;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.${wt}-root *,\n.${wt}-root *::before,\n.${wt}-root *::after {\n box-sizing: border-box;\n}\n\n.${wt}-root img,\n.${wt}-root picture,\n.${wt}-root video,\n.${wt}-root canvas,\n.${wt}-root svg {\n display: block;\n max-width: 100%;\n}\n\n.${wt}-root button,\n.${wt}-root input,\n.${wt}-root select,\n.${wt}-root textarea {\n font: inherit;\n color: inherit;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n}\n\n.${wt}-root button {\n cursor: pointer;\n}\n\n.${wt}-root a {\n color: inherit;\n text-decoration: inherit;\n}\n\n.${wt}-root h1,\n.${wt}-root h2,\n.${wt}-root h3,\n.${wt}-root h4,\n.${wt}-root h5,\n.${wt}-root h6 {\n font-size: inherit;\n font-weight: inherit;\n margin: 0;\n}\n\n.${wt}-root p,\n.${wt}-root ul,\n.${wt}-root ol,\n.${wt}-root blockquote,\n.${wt}-root figure {\n margin: 0;\n padding: 0;\n}\n\n.${wt}-root ul,\n.${wt}-root ol {\n list-style: none;\n}\n\n.${wt}-root table {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n.${wt}-root hr {\n margin: 0;\n border: none;\n border-top: 1px solid var(--${wt}-border);\n height: 0;\n}\n`),_t=!0,t())}function $t(e){if(!document.getElementById(`${wt}-styles`)){const e=document.createElement("style");e.id=`${wt}-styles`,document.head.appendChild(e)}document.getElementById(`${wt}-styles`).textContent+=e+"\n"}function It(e){return Object.entries(e).map(([e,t])=>{return`${n=e,n.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase()}: ${t}`;var n}).join("; ")}function Tt(){bt||($t(`:root {\n${Object.entries(kt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`),bt=!0)}const Et={name:e=>`${wt}-${e}`,selector(e){return`.${this.name(e)}`},create(e,t,n){Tt();const r=It(t),i=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t).toString(36)}(`${e}:${r}:${n?JSON.stringify(n):""}`),o=`${e}-${i}`,s=xt.get(o);if(s)return s.fullClassName;let a=e;const l=this.name(a);return Nt.has(a)||($t(`.${l} { ${r} }`),Nt.add(a)),xt.set(o,{contentHash:i,fullClassName:l}),n&&Object.entries(n).forEach(([e,t])=>{this.media(e,{[a]:t})}),l},keyframes(e,t){const n=`${wt}-${e}`;return Nt.has(`keyframes-${e}`)||($t(`@keyframes ${n} {\n${Object.entries(t).map(([e,t])=>` ${e} { ${It(t)} }`).join("\n")}\n}`),Nt.add(`keyframes-${e}`)),n},media(e,t){const n=`media-${e}`;$t(`@media ${e} {\n${Object.entries(t).map(([e,t])=>` .${wt}-${e} { ${It(t)} }`).join("\n")}\n}`),Nt.add(n)},pseudoElement(e,t,n){let r=`${wt}-${e}`;for(const[t,n]of xt.entries())if((t.includes("-")?t.substring(0,t.lastIndexOf("-")):t)===e){r=n.fullClassName;break}const i=`${r}-${t}`;return Nt.has(i)||($t(`.${r}${t} { ${It(n)} }`),Nt.add(i)),r}};var Pt=Object.freeze({__proto__:null,baseVariables:kt,injectIsolationStyles:Ct,styles:Et,theme:St,updateBaseVariables:function(e){t(),Object.assign(kt,e);const n=document.getElementById(`${wt}-styles`);if(n){const e=n.textContent||"",r=`:root {\n${Object.entries(kt).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,i=e.includes(":root {")?e.replace(/:root\s*\{[^}]*\}/g,r):r+"\n"+e;n.textContent=i,t()}else Tt()}});function Rt(e){return e&&e.ne&&{}.hasOwnProperty.call(e,"default")?e.default:e}var zt,Dt={exports:{}};function Mt(){return zt||(zt=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!=={}.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var r="";for(var o in e)t.call(e,o)&&e[o]&&(r=i(r,o));return r}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(Dt)),Dt.exports}var Ot=Rt(Mt());function jt({size:e="small"}){const t=Et.create("spinner-small",{width:"16px",height:"16px"}),n=Et.create("spinner-large",{width:"64px",height:"64px"}),r="small"===e?t:n;return Et.keyframes("spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Ye("div",{className:Et.create("loading-spinner",{display:"flex",justifyContent:"center",alignItems:"center",animation:"insure-os-spin 1s linear infinite"}),children:Ye("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:Ot(r),children:Ye("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})}function Wt({className:e,children:t,size:n="md"}){const r={sm:St.spacing.sm,md:St.spacing.md,lg:St.spacing.lg,xl:St.spacing.xl},i=Et.create(`padding-${n}`,{padding:r[n]},{"(max-width: 950px)":{padding:"xl"===n?St.spacing.lg:"lg"===n?St.spacing.md:r[n]},"(max-width: 480px)":{padding:St.spacing.sm}});return Ye("div",{className:Ot(i,e),children:t})}const At=function(){function e(t){var n,r;return this.getChildContext||(n=new Set,(r={})[e.k]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.v=!0,P(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),t.children}return e.k="__cC"+g++,e.m=null,e.Provider=e.re=(e.Consumer=function(e,t){return e.children(t)}).contextType=e,e}();function Lt({children:e,httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l}){return Ye(At.Provider,{value:{httpClient:t,stateManager:n,quoteIntentStore:r,formStateManager:i,paymentLinkConfig:o,availableProducts:s,productCodes:a,urlPromoCode:l,currentRetryAttempt:0,maxRetryAttempts:3},children:e})}function Bt(){const e=function(e){var t=Ve.context[e.k],n=st(Ze++,9);return n.c=e,t?(null==n.m&&(n.m=!0,t.sub(Ve)),t.props.value):e.m}(At);if(!e)throw new Error("useFormContext must be used within a FormContext provider");return e}function qt(e){const t=Bt(),{formStateManager:n}=t;if(!n||"function"!=typeof n.subscribe)throw new Error("useQuoteForm can only be used in quote mode. If you're in payment link mode, use usePaymentLink instead.");const[r,i]=at(()=>e(n));return lt(()=>n.subscribe(()=>{i(e(n))}),[n,e]),{...r,fsm:n}}class Ft extends Error{}class Ht extends Ft{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Ut extends Ft{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Yt extends Ft{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class Zt extends Ft{}class Vt extends Ft{constructor(e){super(`Invalid unit ${e}`)}}class Gt extends Ft{}class Qt extends Ft{constructor(){super("Zone is an abstract class")}}const Jt="numeric",Kt="short",Xt="long",en={year:Jt,month:Jt,day:Jt},tn={year:Jt,month:Kt,day:Jt},nn={year:Jt,month:Kt,day:Jt,weekday:Kt},rn={year:Jt,month:Xt,day:Jt},on={year:Jt,month:Xt,day:Jt,weekday:Xt},sn={hour:Jt,minute:Jt},an={hour:Jt,minute:Jt,second:Jt},ln={hour:Jt,minute:Jt,second:Jt,timeZoneName:Kt},cn={hour:Jt,minute:Jt,second:Jt,timeZoneName:Xt},dn={hour:Jt,minute:Jt,hourCycle:"h23"},un={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23"},hn={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23",timeZoneName:Kt},mn={hour:Jt,minute:Jt,second:Jt,hourCycle:"h23",timeZoneName:Xt},fn={year:Jt,month:Jt,day:Jt,hour:Jt,minute:Jt},pn={year:Jt,month:Jt,day:Jt,hour:Jt,minute:Jt,second:Jt},gn={year:Jt,month:Kt,day:Jt,hour:Jt,minute:Jt},yn={year:Jt,month:Kt,day:Jt,hour:Jt,minute:Jt,second:Jt},vn={year:Jt,month:Kt,day:Jt,weekday:Kt,hour:Jt,minute:Jt},wn={year:Jt,month:Xt,day:Jt,hour:Jt,minute:Jt,timeZoneName:Kt},bn={year:Jt,month:Xt,day:Jt,hour:Jt,minute:Jt,second:Jt,timeZoneName:Kt},xn={year:Jt,month:Xt,day:Jt,weekday:Xt,hour:Jt,minute:Jt,timeZoneName:Xt},kn={year:Jt,month:Xt,day:Jt,weekday:Xt,hour:Jt,minute:Jt,second:Jt,timeZoneName:Xt};class Sn{get type(){throw new Qt}get name(){throw new Qt}get ianaName(){return this.name}get isUniversal(){throw new Qt}offsetName(e,t){throw new Qt}formatOffset(e,t){throw new Qt}offset(e){throw new Qt}equals(e){throw new Qt}get isValid(){throw new Qt}}let Nn=null;class _n extends Sn{static get instance(){return null===Nn&&(Nn=new _n),Nn}get type(){return"system"}get name(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ur(e,t,n)}formatOffset(e,t){return Gr(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return"system"===e.type}get isValid(){return!0}}const Cn=new Map,$n={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6},In=new Map;class Tn extends Sn{static create(e){let t=In.get(e);return void 0===t&&In.set(e,t=new Tn(e)),t}static resetCache(){In.clear(),Cn.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}}constructor(e){super(),this.zoneName=e,this.valid=Tn.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Ur(e,t,n,this.name)}formatOffset(e,t){return Gr(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=function(e){let t=Cn.get(e);return void 0===t&&(t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Cn.set(e,t)),t}(this.name);let[r,i,o,s,a,l,c]=n.formatToParts?function(e,t){const n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){const{type:t,value:i}=n[e],o=$n[t];"era"===t?r[o]=i:Nr(o)||(r[o]=parseInt(i,10))}return r}(n,t):function(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n),[,i,o,s,a,l,c,d]=r;return[s,i,o,a,l,c,d]}(n,t);"BC"===s&&(r=1-Math.abs(r));let d=+t;const u=d%1e3;return d-=u>=0?u:1e3+u,(Br({year:r,month:i,day:o,hour:24===a?0:a,minute:l,second:c,millisecond:0})-d)/6e4}equals(e){return"iana"===e.type&&e.name===this.name}get isValid(){return this.valid}}let En={};const Pn=new Map;function Rn(e,t={}){const n=JSON.stringify([e,t]);let r=Pn.get(n);return void 0===r&&(r=new Intl.DateTimeFormat(e,t),Pn.set(n,r)),r}const zn=new Map,Dn=new Map;let Mn=null;const On=new Map;function jn(e){let t=On.get(e);return void 0===t&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),On.set(e,t)),t}const Wn=new Map;function An(e,t,n,r){const i=e.listingMode();return"error"===i?null:"en"===i?n(t):r(t)}class Ln{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...o}=n;if(!t||Object.keys(o).length>0){const t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=function(e,t={}){const n=JSON.stringify([e,t]);let r=zn.get(n);return void 0===r&&(r=new Intl.NumberFormat(e,t),zn.set(n,r)),r}(e,t)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}return zr(this.floor?Math.floor(e):jr(e,3),this.padTo)}}class Bn{constructor(e,t,n){let r;if(this.opts=n,this.originalZone=void 0,this.opts.timeZone)this.dt=e;else if("fixed"===e.zone.type){const t=e.offset/60*-1,n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;0!==e.offset&&Tn.create(n).valid?(r=n,this.dt=e):(r="UTC",this.dt=0===e.offset?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else"system"===e.zone.type?this.dt=e:"iana"===e.zone.type?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Rn(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if("timeZoneName"===e.type){const t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class qn{constructor(e,t,n){this.opts={style:"long",...n},!t&&$r()&&(this.rtf=function(e,t={}){const{base:n,...r}=t,i=JSON.stringify([e,r]);let o=Dn.get(i);return void 0===o&&(o=new Intl.RelativeTimeFormat(e,t),Dn.set(i,o)),o}(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):function(e,t,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(e);if("auto"===n&&o){const n="days"===e;switch(t){case 1:return n?"tomorrow":`next ${i[e][0]}`;case-1:return n?"yesterday":`last ${i[e][0]}`;case 0:return n?"today":`this ${i[e][0]}`}}const s=Object.is(t,-0)||t<0,a=Math.abs(t),l=1===a,c=i[e],d=r?l?c[1]:c[2]||c[1]:l?i[e][0]:e;return s?`${a} ${d} ago`:`in ${a} ${d}`}(t,e,this.opts.numeric,"long"!==this.opts.style)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Fn={firstDay:1,minimalDays:4,weekend:[6,7]};class Hn{static fromOpts(e){return Hn.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const o=e||lr.defaultLocale,s=o||(i?"en-US":Mn||(Mn=(new Intl.DateTimeFormat).resolvedOptions().locale,Mn)),a=t||lr.defaultNumberingSystem,l=n||lr.defaultOutputCalendar,c=Pr(r)||lr.defaultWeekSettings;return new Hn(s,a,l,c,o)}static resetCache(){Mn=null,Pn.clear(),zn.clear(),Dn.clear(),On.clear(),Wn.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return Hn.create(e,t,n,r)}constructor(e,t,n,r,i){const[o,s,a]=function(e){const t=e.indexOf("-x-");-1!==t&&(e=e.substring(0,t));const n=e.indexOf("-u-");if(-1===n)return[e];{let t,r;try{t=Rn(e).resolvedOptions(),r=e}catch(i){const o=e.substring(0,n);t=Rn(o).resolvedOptions(),r=o}const{numberingSystem:i,calendar:o}=t;return[r,i,o]}}(e);this.locale=o,this.numberingSystem=t||s||null,this.outputCalendar=n||a||null,this.weekSettings=r,this.intl=function(e,t,n){return n||t?(e.includes("-u-")||(e+="-u"),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}(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 e;return null==this.fastNumbersCached&&(this.fastNumbersCached=(!(e=this).numberingSystem||"latn"===e.numberingSystem)&&("latn"===e.numberingSystem||!e.locale||e.locale.startsWith("en")||"latn"===jn(e.locale).numberingSystem)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=!(null!==this.numberingSystem&&"latn"!==this.numberingSystem||null!==this.outputCalendar&&"gregory"!==this.outputCalendar);return e&&t?"en":"intl"}clone(e){return e&&0!==Object.getOwnPropertyNames(e).length?Hn.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Pr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1):this}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return An(this,e,ei,()=>{const n="ja"===this.intl||this.intl.startsWith("ja-"),r=(t&=!n)?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,"month");this.monthsCache[i][e]=function(e){const t=[];for(let n=1;n<=12;n++){const r=rs.utc(2009,n,1);t.push(e(r))}return t}(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return An(this,e,ii,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=function(e){const t=[];for(let n=1;n<=7;n++){const r=rs.utc(2016,11,13+n);t.push(e(r))}return t}(e=>this.extract(e,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return An(this,void 0,()=>oi,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[rs.utc(2016,11,13,9),rs.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return An(this,e,ci,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[rs.utc(-40,1,1),rs.utc(2017,1,1)].map(e=>this.extract(e,t,"era"))),this.eraCache[e]})}extract(e,t,n){const r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Ln(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Bn(e,this.intl,t)}relFormatter(e={}){return new qn(this.intl,this.isEnglish(),e)}listFormatter(e={}){return function(e,t={}){const n=JSON.stringify([e,t]);let r=En[n];return r||(r=new Intl.ListFormat(e,t),En[n]=r),r}(this.intl,e)}isEnglish(){return"en"===this.locale||"en-us"===this.locale.toLowerCase()||jn(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Ir()?function(e){let t=Wn.get(e);if(!t){const n=new Intl.Locale(e);t="getWeekInfo"in n?n.getWeekInfo():n.weekInfo,"minimalDays"in t||(t={...Fn,...t}),Wn.set(e,t)}return t}(this.locale):Fn}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let Un=null;class Yn extends Sn{static get utcInstance(){return null===Un&&(Un=new Yn(0)),Un}static instance(e){return 0===e?Yn.utcInstance:new Yn(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new Yn(Yr(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return 0===this.fixed?"UTC":`UTC${Gr(this.fixed,"narrow")}`}get ianaName(){return 0===this.fixed?"Etc/UTC":`Etc/GMT${Gr(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Gr(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return"fixed"===e.type&&e.fixed===this.fixed}get isValid(){return!0}}class Zn extends Sn{constructor(e){super(),this.zoneName=e}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 Vn(e,t){if(Nr(e)||null===e)return t;if(e instanceof Sn)return e;if(function(e){return"string"==typeof e}(e)){const n=e.toLowerCase();return"default"===n?t:"local"===n||"system"===n?_n.instance:"utc"===n||"gmt"===n?Yn.utcInstance:Yn.parseSpecifier(n)||Tn.create(e)}return _r(e)?Yn.instance(e):"object"==typeof e&&"offset"in e&&"function"==typeof e.offset?e:new Zn(e)}const Gn={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Qn={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]},Jn=Gn.hanidec.replace(/[\[|\]]/g,"").split(""),Kn=new Map;function Xn({numberingSystem:e},t=""){const n=e||"latn";let r=Kn.get(n);void 0===r&&(r=new Map,Kn.set(n,r));let i=r.get(t);return void 0===i&&(i=new RegExp(`${Gn[n]}${t}`),r.set(t,i)),i}let er,tr=()=>Date.now(),nr="system",rr=null,ir=null,or=null,sr=60,ar=null;class lr{static get now(){return tr}static set now(e){tr=e}static set defaultZone(e){nr=e}static get defaultZone(){return Vn(nr,_n.instance)}static get defaultLocale(){return rr}static set defaultLocale(e){rr=e}static get defaultNumberingSystem(){return ir}static set defaultNumberingSystem(e){ir=e}static get defaultOutputCalendar(){return or}static set defaultOutputCalendar(e){or=e}static get defaultWeekSettings(){return ar}static set defaultWeekSettings(e){ar=Pr(e)}static get twoDigitCutoffYear(){return sr}static set twoDigitCutoffYear(e){sr=e%100}static get throwOnInvalid(){return er}static set throwOnInvalid(e){er=e}static resetCaches(){Hn.resetCache(),Tn.resetCache(),rs.resetCache(),Kn.clear()}}class cr{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const dr=[0,31,59,90,120,151,181,212,243,273,304,334],ur=[0,31,60,91,121,152,182,213,244,274,305,335];function hr(e,t){return new cr("unit out of range",`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function mr(e,t,n){const r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const i=r.getUTCDay();return 0===i?7:i}function fr(e,t,n){return n+(Wr(e)?ur:dr)[t-1]}function pr(e,t){const n=Wr(e)?ur:dr,r=n.findIndex(e=>e<t);return{month:r+1,day:t-n[r]}}function gr(e,t){return(e-t+7)%7+1}function yr(e,t=4,n=1){const{year:r,month:i,day:o}=e,s=fr(r,i,o),a=gr(mr(r,i,o),n);let l,c=Math.floor((s-a+14-t)/7);return c<1?(l=r-1,c=Fr(l,t,n)):c>Fr(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:a,...Qr(e)}}function vr(e,t=4,n=1){const{weekYear:r,weekNumber:i,weekday:o}=e,s=gr(mr(r,1,t),n),a=Ar(r);let l,c=7*i+o-s-7+t;c<1?(l=r-1,c+=Ar(l)):c>a?(l=r+1,c-=Ar(r)):l=r;const{month:d,day:u}=pr(l,c);return{year:l,month:d,day:u,...Qr(e)}}function wr(e){const{year:t,month:n,day:r}=e;return{year:t,ordinal:fr(t,n,r),...Qr(e)}}function br(e){const{year:t,ordinal:n}=e,{month:r,day:i}=pr(t,n);return{year:t,month:r,day:i,...Qr(e)}}function xr(e,t){if(!Nr(e.localWeekday)||!Nr(e.localWeekNumber)||!Nr(e.localWeekYear)){if(!Nr(e.weekday)||!Nr(e.weekNumber)||!Nr(e.weekYear))throw new Zt("Cannot mix locale-based week fields with ISO-based week fields");return Nr(e.localWeekday)||(e.weekday=e.localWeekday),Nr(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),Nr(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}return{minDaysInFirstWeek:4,startOfWeek:1}}function kr(e){const t=Cr(e.year),n=Rr(e.month,1,12),r=Rr(e.day,1,Lr(e.year,e.month));return t?n?!r&&hr("day",e.day):hr("month",e.month):hr("year",e.year)}function Sr(e){const{hour:t,minute:n,second:r,millisecond:i}=e,o=Rr(t,0,23)||24===t&&0===n&&0===r&&0===i,s=Rr(n,0,59),a=Rr(r,0,59),l=Rr(i,0,999);return o?s?a?!l&&hr("millisecond",i):hr("second",r):hr("minute",n):hr("hour",t)}function Nr(e){return void 0===e}function _r(e){return"number"==typeof e}function Cr(e){return"number"==typeof e&&e%1==0}function $r(){try{return"undefined"!=typeof Intl&&!!Intl.RelativeTimeFormat}catch(e){return!1}}function Ir(){try{return"undefined"!=typeof Intl&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch(e){return!1}}function Tr(e,t,n){if(0!==e.length)return e.reduce((e,r)=>{const i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function Er(e,t){return{}.hasOwnProperty.call(e,t)}function Pr(e){if(null==e)return null;if("object"!=typeof e)throw new Gt("Week settings must be an object");if(!Rr(e.firstDay,1,7)||!Rr(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!Rr(e,1,7)))throw new Gt("Invalid week settings");return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function Rr(e,t,n){return Cr(e)&&e>=t&&e<=n}function zr(e,t=2){let n;return n=e<0?"-"+(""+-e).padStart(t,"0"):(""+e).padStart(t,"0"),n}function Dr(e){return Nr(e)||null===e||""===e?void 0:parseInt(e,10)}function Mr(e){return Nr(e)||null===e||""===e?void 0:parseFloat(e)}function Or(e){if(!Nr(e)&&null!==e&&""!==e){const t=1e3*parseFloat("0."+e);return Math.floor(t)}}function jr(e,t,n="round"){const r=10**t;switch(n){case"expand":return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case"trunc":return Math.trunc(e*r)/r;case"round":return Math.round(e*r)/r;case"floor":return Math.floor(e*r)/r;case"ceil":return Math.ceil(e*r)/r;default:throw new RangeError(`Value rounding ${n} is out of range`)}}function Wr(e){return e%4==0&&(e%100!=0||e%400==0)}function Ar(e){return Wr(e)?366:365}function Lr(e,t){const n=(r=t-1)-12*Math.floor(r/12)+1;var r;return 2===n?Wr(e+(t-n)/12)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Br(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function qr(e,t,n){return-gr(mr(e,1,t),n)+t-1}function Fr(e,t=4,n=1){const r=qr(e,t,n),i=qr(e+1,t,n);return(Ar(e)-r+i)/7}function Hr(e){return e>99?e:e>lr.twoDigitCutoffYear?1900+e:2e3+e}function Ur(e,t,n,r=null){const i=new Date(e),o={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(o.timeZone=r);const s={timeZoneName:t,...o},a=new Intl.DateTimeFormat(n,s).formatToParts(i).find(e=>"timezonename"===e.type.toLowerCase());return a?a.value:null}function Yr(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);const r=parseInt(t,10)||0;return 60*n+(n<0||Object.is(n,-0)?-r:r)}function Zr(e){const t=Number(e);if("boolean"==typeof e||""===e||!Number.isFinite(t))throw new Gt(`Invalid unit value ${e}`);return t}function Vr(e,t){const n={};for(const r in e)if(Er(e,r)){const i=e[r];if(null==i)continue;n[t(r)]=Zr(i)}return n}function Gr(e,t){const n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?"+":"-";switch(t){case"short":return`${i}${zr(n,2)}:${zr(r,2)}`;case"narrow":return`${i}${n}${r>0?`:${r}`:""}`;case"techie":return`${i}${zr(n,2)}${zr(r,2)}`;default:throw new RangeError(`Value format ${t} is out of range for property format`)}}function Qr(e){return function(e){return["hour","minute","second","millisecond"].reduce((t,n)=>(t[n]=e[n],t),{})}(e)}const Jr=["January","February","March","April","May","June","July","August","September","October","November","December"],Kr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Xr=["J","F","M","A","M","J","J","A","S","O","N","D"];function ei(e){switch(e){case"narrow":return[...Xr];case"short":return[...Kr];case"long":return[...Jr];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 ti=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ni=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ri=["M","T","W","T","F","S","S"];function ii(e){switch(e){case"narrow":return[...ri];case"short":return[...ni];case"long":return[...ti];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const oi=["AM","PM"],si=["Before Christ","Anno Domini"],ai=["BC","AD"],li=["B","A"];function ci(e){switch(e){case"narrow":return[...li];case"short":return[...ai];case"long":return[...si];default:return null}}function di(e,t){let n="";for(const r of e)r.literal?n+=r.val:n+=t(r.val);return n}const ui={D:en,DD:tn,DDD:rn,DDDD:on,t:sn,tt:an,ttt:ln,tttt:cn,T:dn,TT:un,TTT:hn,TTTT:mn,f:fn,ff:gn,fff:wn,ffff:xn,F:pn,FF:yn,FFF:bn,FFFF:kn};class hi{static create(e,t={}){return new hi(e,t)}static parseFormat(e){let t=null,n="",r=!1;const i=[];for(let o=0;o<e.length;o++){const s=e.charAt(o);"'"===s?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:""===n?"'":n}),t=null,n="",r=!r):r||s===t?n+=s:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=s,t=s)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return ui[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return null===this.systemLoc&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n){if(this.opts.forceSimple)return zr(e,t);const r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const n="en"===this.loc.listingMode(),r=this.loc.outputCalendar&&"gregory"!==this.loc.outputCalendar,i=(t,n)=>this.loc.extract(e,t,n),o=t=>e.isOffsetFixed&&0===e.offset&&t.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,t.format):"",s=(t,r)=>n?function(e,t){return ei(t)[e.month-1]}(e,t):i(r?{month:t}:{month:t,day:"numeric"},"month"),a=(t,r)=>n?function(e,t){return ii(t)[e.weekday-1]}(e,t):i(r?{weekday:t}:{weekday:t,month:"long",day:"numeric"},"weekday"),l=t=>{const n=hi.macroTokenToFormatOpts(t);return n?this.formatWithSystemDefault(e,n):t},c=t=>n?function(e,t){return ci(t)[e.year<0?0:1]}(e,t):i({era:t},"era");return di(hi.parseFormat(t),t=>{switch(t){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12==0?12:e.hour%12);case"hh":return this.num(e.hour%12==0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.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 e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return n?function(e){return oi[e.hour<12?0:1]}(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod");case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":case"E":return this.num(e.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(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.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(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.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(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return l(t)}})}formatDurationFromString(e,t){const n="negativeLargestOnly"===this.opts.signMode?-1:1,r=e=>{switch(e[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=hi.parseFormat(t),o=i.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),s=e.shiftTo(...o.map(r).filter(e=>e));return di(i,((e,t)=>i=>{const o=r(i);if(o){const r=t.isNegativeDuration&&o!==t.largestUnit?n:1;let s;return s="negativeLargestOnly"===this.opts.signMode&&o!==t.largestUnit?"never":"all"===this.opts.signMode?"always":"auto",this.num(e.get(o)*r,i.length,s)}return i})(s,{isNegativeDuration:s<0,largestUnit:Object.keys(s.values)[0]}))}}const mi=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function fi(...e){const t=e.reduce((e,t)=>e+t.source,"");return RegExp(`^${t}$`)}function pi(...e){return t=>e.reduce(([e,n,r],i)=>{const[o,s,a]=i(t,r);return[{...e,...o},s||n,a]},[{},null,1]).slice(0,2)}function gi(e,...t){if(null==e)return[null,null];for(const[n,r]of t){const t=n.exec(e);if(t)return r(t)}return[null,null]}function yi(...e){return(t,n)=>{const r={};let i;for(i=0;i<e.length;i++)r[e[i]]=Dr(t[n+i]);return[r,null,n+i]}}const vi=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,wi=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,bi=RegExp(`${wi.source}(?:${vi.source}?(?:\\[(${mi.source})\\])?)?`),xi=RegExp(`(?:[Tt]${bi.source})?`),ki=yi("weekYear","weekNumber","weekDay"),Si=yi("year","ordinal"),Ni=RegExp(`${wi.source} ?(?:${vi.source}|(${mi.source}))?`),_i=RegExp(`(?: ${Ni.source})?`);function Ci(e,t,n){const r=e[t];return Nr(r)?n:Dr(r)}function $i(e,t){return[{hours:Ci(e,t,0),minutes:Ci(e,t+1,0),seconds:Ci(e,t+2,0),milliseconds:Or(e[t+3])},null,t+4]}function Ii(e,t){const n=!e[t]&&!e[t+1],r=Yr(e[t+1],e[t+2]);return[{},n?null:Yn.instance(r),t+3]}function Ti(e,t){return[{},e[t]?Tn.create(e[t]):null,t+1]}const Ei=RegExp(`^T?${wi.source}$`),Pi=/^-?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 Ri(e){const[t,n,r,i,o,s,a,l,c]=e,d="-"===t[0],u=l&&"-"===l[0],h=(e,t=!1)=>void 0!==e&&(t||e&&d)?-e:e;return[{years:h(Mr(n)),months:h(Mr(r)),weeks:h(Mr(i)),days:h(Mr(o)),hours:h(Mr(s)),minutes:h(Mr(a)),seconds:h(Mr(l),"-0"===l),milliseconds:h(Or(c),u)}]}const zi={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Di(e,t,n,r,i,o,s){const a={year:2===t.length?Hr(Dr(t)):Dr(t),month:Kr.indexOf(n)+1,day:Dr(r),hour:Dr(i),minute:Dr(o)};return s&&(a.second=Dr(s)),e&&(a.weekday=e.length>3?ti.indexOf(e)+1:ni.indexOf(e)+1),a}const Mi=/^(?:(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 Oi(e){const[,t,n,r,i,o,s,a,l,c,d,u]=e,h=Di(t,i,r,n,o,s,a);let m;return m=l?zi[l]:c?0:Yr(d,u),[h,new Yn(m)]}const ji=/^(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$/,Wi=/^(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$/,Ai=/^(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 Li(e){const[,t,n,r,i,o,s,a]=e;return[Di(t,i,r,n,o,s,a),Yn.utcInstance]}function Bi(e){const[,t,n,r,i,o,s,a]=e;return[Di(t,a,n,r,i,o,s),Yn.utcInstance]}const qi=fi(/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,xi),Fi=fi(/(\d{4})-?W(\d\d)(?:-?(\d))?/,xi),Hi=fi(/(\d{4})-?(\d{3})/,xi),Ui=fi(bi),Yi=pi(function(e,t){return[{year:Ci(e,t),month:Ci(e,t+1,1),day:Ci(e,t+2,1)},null,t+3]},$i,Ii,Ti),Zi=pi(ki,$i,Ii,Ti),Vi=pi(Si,$i,Ii,Ti),Gi=pi($i,Ii,Ti),Qi=pi($i),Ji=fi(/(\d{4})-(\d\d)-(\d\d)/,_i),Ki=fi(Ni),Xi=pi($i,Ii,Ti),eo="Invalid Duration",to={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}},no={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},...to},ro={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},...to},io=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],oo=io.slice(0).reverse();function so(e,t,n=!1){const r={values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix};return new uo(r)}function ao(e,t){let n=t.milliseconds??0;for(const r of oo.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function lo(e,t){const n=ao(e,t)<0?-1:1;io.reduceRight((r,i)=>{if(Nr(t[i]))return r;if(r){const o=t[r]*n,s=e[i][r],a=Math.floor(o/s);t[i]+=a*n,t[r]-=a*s*n}return i},null),io.reduce((n,r)=>{if(Nr(t[r]))return n;if(n){const i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function co(e){const t={};for(const[n,r]of Object.entries(e))0!==r&&(t[n]=r);return t}class uo{constructor(e){const t="longterm"===e.conversionAccuracy||!1;let n=t?ro:no;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Hn.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return uo.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(null==e||"object"!=typeof e)throw new Gt("Duration.fromObject: argument expected to be an object, got "+(null===e?"null":typeof e));return new uo({values:Vr(e,uo.normalizeUnit),loc:Hn.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(_r(e))return uo.fromMillis(e);if(uo.isDuration(e))return e;if("object"==typeof e)return uo.fromObject(e);throw new Gt(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=function(e){return gi(e,[Pi,Ri])}(e);return n?uo.fromObject(n,t):uo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=function(e){return gi(e,[Ei,Qi])}(e);return n?uo.fromObject(n,t):uo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the Duration is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Yt(n);return new uo({invalid:n})}static normalizeUnit(e){const t={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"}[e?e.toLowerCase():e];if(!t)throw new Vt(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const n={...t,floor:!1!==t.round&&!1!==t.floor};return this.isValid?hi.create(this.loc,n).formatDurationFromString(this,e):eo}toHuman(e={}){if(!this.isValid)return eo;const t=!1!==e.showZeros,n=io.map(n=>{const r=this.values[n];return Nr(r)||0===r&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return 0!==this.years&&(e+=this.years+"Y"),0===this.months&&0===this.quarters||(e+=this.months+3*this.quarters+"M"),0!==this.weeks&&(e+=this.weeks+"W"),0!==this.days&&(e+=this.days+"D"),0===this.hours&&0===this.minutes&&0===this.seconds&&0===this.milliseconds||(e+="T"),0!==this.hours&&(e+=this.hours+"H"),0!==this.minutes&&(e+=this.minutes+"M"),0===this.seconds&&0===this.milliseconds||(e+=jr(this.seconds+this.milliseconds/1e3,3)+"S"),"P"===e&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},rs.fromMillis(t,{zone:"UTC"}).toISOTime(e))}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?ao(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=uo.fromDurationLike(e),n={};for(const e of io)(Er(t.values,e)||Er(this.values,e))&&(n[e]=t.get(e)+this.get(e));return so(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=uo.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Zr(e(this.values[n],n));return so(this,{values:t},!0)}get(e){return this[uo.normalizeUnit(e)]}set(e){return this.isValid?so(this,{values:{...this.values,...Vr(e,uo.normalizeUnit)}}):this}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){return so(this,{loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n})}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return lo(this.matrix,e),so(this,{values:e},!0)}rescale(){return this.isValid?so(this,{values:co(this.normalize().shiftToAll().toObject())},!0):this}shiftTo(...e){if(!this.isValid)return this;if(0===e.length)return this;e=e.map(e=>uo.normalizeUnit(e));const t={},n={},r=this.toObject();let i;for(const o of io)if(e.indexOf(o)>=0){i=o;let e=0;for(const t in n)e+=this.matrix[t][o]*n[t],n[t]=0;_r(r[o])&&(e+=r[o]);const s=Math.trunc(e);t[o]=s,n[o]=(1e3*e-1e3*s)/1e3}else _r(r[o])&&(n[o]=r[o]);for(const e in n)0!==n[e]&&(t[i]+=e===i?n[e]:n[e]/this.matrix[i][e]);return lo(this.matrix,t),so(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=0===this.values[t]?0:-this.values[t];return so(this,{values:e},!0)}removeZeros(){return this.isValid?so(this,{values:co(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(e){if(!this.isValid||!e.isValid)return!1;if(!this.loc.equals(e.loc))return!1;function t(e,t){return void 0===e||0===e?void 0===t||0===t:e===t}for(const n of io)if(!t(this.values[n],e.values[n]))return!1;return!0}}const ho="Invalid Interval";class mo{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the Interval is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Ut(n);return new mo({invalid:n})}static fromDateTimes(e,t){const n=is(e),r=is(t),i=function(e,t){return e&&e.isValid?t&&t.isValid?t<e?mo.invalid("end before start",`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null:mo.invalid("missing or invalid end"):mo.invalid("missing or invalid start")}(n,r);return null==i?new mo({start:n,end:r}):i}static after(e,t){const n=uo.fromDurationLike(t),r=is(e);return mo.fromDateTimes(r,r.plus(n))}static before(e,t){const n=uo.fromDurationLike(t),r=is(e);return mo.fromDateTimes(r.minus(n),r)}static fromISO(e,t){const[n,r]=(e||"").split("/",2);if(n&&r){let e,i,o,s;try{e=rs.fromISO(n,t),i=e.isValid}catch(r){i=!1}try{o=rs.fromISO(r,t),s=o.isValid}catch(r){s=!1}if(i&&s)return mo.fromDateTimes(e,o);if(i){const n=uo.fromISO(r,t);if(n.isValid)return mo.after(e,n)}else if(s){const e=uo.fromISO(n,t);if(e.isValid)return mo.before(o,e)}}return mo.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.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(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const n=this.start.startOf(e,t);let r;return r=t?.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return!!this.isValid&&(this.isEmpty()||this.e.minus(1).hasSame(this.s,e))}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return!!this.isValid&&this.s>e}isBefore(e){return!!this.isValid&&this.e<=e}contains(e){return!!this.isValid&&this.s<=e&&this.e>e}set({start:e,end:t}={}){return this.isValid?mo.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(is).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),n=[];let{s:r}=this,i=0;for(;r<this.e;){const e=t[i]||this.e,o=+e>+this.e?this.e:e;n.push(mo.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=uo.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];let n,{s:r}=this,i=1;const o=[];for(;r<this.e;){const e=this.start.plus(t.mapUnits(e=>e*i));n=+e>+this.e?this.e:e,o.push(mo.fromDateTimes(r,n)),r=n,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return!!this.isValid&&+this.e===+e.s}abutsEnd(e){return!!this.isValid&&+e.e===+this.s}engulfs(e){return!!this.isValid&&this.s<=e.s&&this.e>=e.e}equals(e){return!(!this.isValid||!e.isValid)&&this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,n=this.e<e.e?this.e:e.e;return t>=n?null:mo.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,n=this.e>e.e?this.e:e.e;return mo.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const r=[],i=e.map(e=>[{time:e.s,type:"s"},{time:e.e,type:"e"}]),o=[].concat(...i).sort((e,t)=>e.time-t.time);for(const e of o)n+="s"===e.type?1:-1,1===n?t=e.time:(t&&+t!==+e.time&&r.push(mo.fromDateTimes(t,e.time)),t=null);return mo.merge(r)}difference(...e){return mo.xor([this].concat(e)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ho}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=en,t={}){return this.isValid?hi.create(this.s.loc.clone(t),e).formatInterval(this):ho}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ho}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ho}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ho}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ho}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):uo.invalid(this.invalidReason)}mapEndpoints(e){return mo.fromDateTimes(e(this.s),e(this.e))}}class fo{static hasDST(e=lr.defaultZone){const t=rs.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Tn.isValidZone(e)}static normalizeZone(e){return Vn(e,lr.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||Hn.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Hn.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||Hn.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Hn.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||Hn.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Hn.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Hn.create(t,null,"gregory").eras(e)}static features(){return{relative:$r(),localeWeek:Ir()}}}function po(e,t){const n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=n(t)-n(e);return Math.floor(uo.fromMillis(r).as("days"))}function go(e,t=e=>e){return{regex:e,deser:([e])=>t(function(e){let t=parseInt(e,10);if(isNaN(t)){t="";for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(-1!==e[n].search(Gn.hanidec))t+=Jn.indexOf(e[n]);else for(const e in Qn){const[n,i]=Qn[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}return t}(e))}}const yo=`[ ${String.fromCharCode(160)}]`,vo=new RegExp(yo,"g");function wo(e){return e.replace(/\./g,"\\.?").replace(vo,yo)}function bo(e){return e.replace(/\./g,"").replace(vo," ").toLowerCase()}function xo(e,t){return null===e?null:{regex:RegExp(e.map(wo).join("|")),deser:([n])=>e.findIndex(e=>bo(n)===bo(e))+t}}function ko(e,t){return{regex:e,deser:([,e,t])=>Yr(e,t),groups:t}}function So(e){return{regex:e,deser:([e])=>e}}const No={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 _o=null;function Co(e,t){return[].concat(...e.map(e=>function(e,t){if(e.literal)return e;const n=To(hi.macroTokenToFormatOpts(e.val),t);return null==n||n.includes(void 0)?e:n}(e,t)))}class $o{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Co(hi.parseFormat(t),e),this.units=this.tokens.map(t=>function(e,t){const n=Xn(t),r=Xn(t,"{2}"),i=Xn(t,"{3}"),o=Xn(t,"{4}"),s=Xn(t,"{6}"),a=Xn(t,"{1,2}"),l=Xn(t,"{1,3}"),c=Xn(t,"{1,6}"),d=Xn(t,"{1,9}"),u=Xn(t,"{2,4}"),h=Xn(t,"{4,6}"),m=e=>{return{regex:RegExp((t=e.val,t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"))),deser:([e])=>e,literal:!0};var t},f=(f=>{if(e.literal)return m(f);switch(f.val){case"G":return xo(t.eras("short"),0);case"GG":return xo(t.eras("long"),0);case"y":return go(c);case"yy":case"kk":return go(u,Hr);case"yyyy":case"kkkk":return go(o);case"yyyyy":return go(h);case"yyyyyy":return go(s);case"M":case"L":case"d":case"H":case"h":case"m":case"q":case"s":case"W":return go(a);case"MM":case"LL":case"dd":case"HH":case"hh":case"mm":case"qq":case"ss":case"WW":return go(r);case"MMM":return xo(t.months("short",!0),1);case"MMMM":return xo(t.months("long",!0),1);case"LLL":return xo(t.months("short",!1),1);case"LLLL":return xo(t.months("long",!1),1);case"o":case"S":return go(l);case"ooo":case"SSS":return go(i);case"u":return So(d);case"uu":return So(a);case"uuu":case"E":case"c":return go(n);case"a":return xo(t.meridiems(),0);case"EEE":return xo(t.weekdays("short",!1),1);case"EEEE":return xo(t.weekdays("long",!1),1);case"ccc":return xo(t.weekdays("short",!0),1);case"cccc":return xo(t.weekdays("long",!0),1);case"Z":case"ZZ":return ko(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return ko(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return So(/[a-z_+-/]{1,256}?/i);case" ":return So(/[^\S\n\r]/);default:return m(f)}})(e)||{invalidReason:"missing Intl.DateTimeFormat.formatToParts support"};return f.token=e,f}(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){const[e,t]=function(e){const t=e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,"");return[`^${t}$`,e]}(this.units);this.regex=RegExp(e,"i"),this.handlers=t}}explainFromTokens(e){if(this.isValid){const[t,n]=function(e,t,n){const r=e.match(t);if(r){const e={};let t=1;for(const i in n)if(Er(n,i)){const o=n[i],s=o.groups?o.groups+1:1;!o.literal&&o.token&&(e[o.token.val[0]]=o.deser(r.slice(t,t+s))),t+=s}return[r,e]}return[r,{}]}(e,this.regex,this.handlers),[r,i,o]=n?function(e){let t,n=null;Nr(e.z)||(n=Tn.create(e.z)),Nr(e.Z)||(n||(n=new Yn(e.Z)),t=e.Z),Nr(e.q)||(e.M=3*(e.q-1)+1),Nr(e.h)||(e.h<12&&1===e.a?e.h+=12:12===e.h&&0===e.a&&(e.h=0)),0===e.G&&e.y&&(e.y=-e.y),Nr(e.u)||(e.S=Or(e.u));const r=Object.keys(e).reduce((t,n)=>{const r=(e=>{switch(e){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&&(t[r]=e[n]),t},{});return[r,n,t]}(n):[null,null,void 0];if(Er(n,"a")&&Er(n,"H"))throw new Zt("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Io(e,t,n){return new $o(e,n).explainFromTokens(t)}function To(e,t){if(!e)return null;const n=hi.create(t,e).dtFormatter((_o||(_o=rs.fromMillis(1555555555555)),_o)),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>function(e,t,n){const{type:r,value:i}=e;if("literal"===r){const e=/^\s+$/.test(i);return{literal:!e,val:e?" ":i}}const o=t[r];let s=r;"hour"===r&&(s=null!=t.hour12?t.hour12?"hour12":"hour24":null!=t.hourCycle?"h11"===t.hourCycle||"h12"===t.hourCycle?"hour12":"hour24":n.hour12?"hour12":"hour24");let a=No[s];if("object"==typeof a&&(a=a[o]),a)return{literal:!1,val:a}}(t,e,i))}const Eo="Invalid DateTime",Po=864e13;function Ro(e){return new cr("unsupported zone",`the zone "${e.name}" is not supported`)}function zo(e){return null===e.weekData&&(e.weekData=yr(e.c)),e.weekData}function Do(e){return null===e.localWeekData&&(e.localWeekData=yr(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Mo(e,t){const n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new rs({...n,...t,old:n})}function Oo(e,t,n){let r=e-60*t*1e3;const i=n.offset(r);if(t===i)return[r,t];r-=60*(i-t)*1e3;const o=n.offset(r);return i===o?[r,i]:[e-60*Math.min(i,o)*1e3,Math.max(i,o)]}function jo(e,t){const n=new Date(e+=60*t*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 Wo(e,t,n){return Oo(Br(e),t,n)}function Ao(e,t){const n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+3*Math.trunc(t.quarters),o={...e.c,year:r,month:i,day:Math.min(e.c.day,Lr(r,i))+Math.trunc(t.days)+7*Math.trunc(t.weeks)},s=uo.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as("milliseconds"),a=Br(o);let[l,c]=Oo(a,n,e.zone);return 0!==s&&(l+=s,c=e.zone.offset(l)),{ts:l,o:c}}function Lo(e,t,n,r,i,o){const{setZone:s,zone:a}=n;if(e&&0!==Object.keys(e).length||t){const r=t||a,i=rs.fromObject(e,{...n,zone:r,specificOffset:o});return s?i:i.setZone(a)}return rs.invalid(new cr("unparsable",`the input "${i}" can't be parsed as ${r}`))}function Bo(e,t,n=!0){return e.isValid?hi.create(Hn.create("en-US"),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function qo(e,t,n){const r=e.c.year>9999||e.c.year<0;let i="";if(r&&e.c.year>=0&&(i+="+"),i+=zr(e.c.year,r?6:4),"year"===n)return i;if(t){if(i+="-",i+=zr(e.c.month),"month"===n)return i;i+="-"}else if(i+=zr(e.c.month),"month"===n)return i;return i+=zr(e.c.day),i}function Fo(e,t,n,r,i,o,s){let a=!n||0!==e.c.millisecond||0!==e.c.second,l="";switch(s){case"day":case"month":case"year":break;default:if(l+=zr(e.c.hour),"hour"===s)break;if(t){if(l+=":",l+=zr(e.c.minute),"minute"===s)break;a&&(l+=":",l+=zr(e.c.second))}else{if(l+=zr(e.c.minute),"minute"===s)break;a&&(l+=zr(e.c.second))}if("second"===s)break;!a||r&&0===e.c.millisecond||(l+=".",l+=zr(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&0===e.offset&&!o?l+="Z":e.o<0?(l+="-",l+=zr(Math.trunc(-e.o/60)),l+=":",l+=zr(Math.trunc(-e.o%60))):(l+="+",l+=zr(Math.trunc(e.o/60)),l+=":",l+=zr(Math.trunc(e.o%60)))),o&&(l+="["+e.zone.ianaName+"]"),l}const Ho={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Uo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Yo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Zo=["year","month","day","hour","minute","second","millisecond"],Vo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Go=["year","ordinal","hour","minute","second","millisecond"];function Qo(e){const t={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"}[e.toLowerCase()];if(!t)throw new Vt(e);return t}function Jo(e){switch(e.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Qo(e)}}function Ko(e,t){const n=Vn(t.zone,lr.defaultZone);if(!n.isValid)return rs.invalid(Ro(n));const r=Hn.fromObject(t);let i,o;if(Nr(e.year))i=lr.now();else{for(const t of Zo)Nr(e[t])&&(e[t]=Ho[t]);const t=kr(e)||Sr(e);if(t)return rs.invalid(t);const r=function(e){if(void 0===ts&&(ts=lr.now()),"iana"!==e.type)return e.offset(ts);const t=e.name;let n=ns.get(t);return void 0===n&&(n=e.offset(ts),ns.set(t,n)),n}(n);[i,o]=Wo(e,r,n)}return new rs({ts:i,zone:n,loc:r,o:o})}function Xo(e,t,n){const r=!!Nr(n.round)||n.round,i=Nr(n.rounding)?"trunc":n.rounding,o=(e,o)=>(e=jr(e,r||n.calendary?0:2,n.calendary?"round":i),t.loc.clone(n).relFormatter(n).format(e,o)),s=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return o(s(n.unit),n.unit);for(const e of n.units){const t=s(e);if(Math.abs(t)>=1)return o(t,e)}return o(e>t?-0:0,n.units[n.units.length-1])}function es(e){let t,n={};return e.length>0&&"object"==typeof e[e.length-1]?(n=e[e.length-1],t=Array.from(e).slice(0,e.length-1)):t=Array.from(e),[n,t]}let ts;const ns=new Map;class rs{constructor(e){const t=e.zone||lr.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new cr("invalid input"):null)||(t.isValid?null:Ro(t));this.ts=Nr(e.ts)?lr.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const o=_r(e.o)&&!e.old?e.o:t.offset(this.ts);r=jo(this.ts,o),n=Number.isNaN(r.year)?new cr("invalid input"):null,r=n?null:r,i=n?null:o}this.ie=t,this.loc=e.loc||Hn.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new rs({})}static local(){const[e,t]=es(arguments),[n,r,i,o,s,a,l]=t;return Ko({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static utc(){const[e,t]=es(arguments),[n,r,i,o,s,a,l]=t;return e.zone=Yn.utcInstance,Ko({year:n,month:r,day:i,hour:o,minute:s,second:a,millisecond:l},e)}static fromJSDate(e,t={}){const n=function(e){return"[object Date]"==={}.toString.call(e)}(e)?e.valueOf():NaN;if(Number.isNaN(n))return rs.invalid("invalid input");const r=Vn(t.zone,lr.defaultZone);return r.isValid?new rs({ts:n,zone:r,loc:Hn.fromObject(t)}):rs.invalid(Ro(r))}static fromMillis(e,t={}){if(_r(e))return e<-Po||e>Po?rs.invalid("Timestamp out of range"):new rs({ts:e,zone:Vn(t.zone,lr.defaultZone),loc:Hn.fromObject(t)});throw new Gt(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(_r(e))return new rs({ts:1e3*e,zone:Vn(t.zone,lr.defaultZone),loc:Hn.fromObject(t)});throw new Gt("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=Vn(t.zone,lr.defaultZone);if(!n.isValid)return rs.invalid(Ro(n));const r=Hn.fromObject(t),i=Vr(e,Jo),{minDaysInFirstWeek:o,startOfWeek:s}=xr(i,r),a=lr.now(),l=Nr(t.specificOffset)?n.offset(a):t.specificOffset,c=!Nr(i.ordinal),d=!Nr(i.year),u=!Nr(i.month)||!Nr(i.day),h=d||u,m=i.weekYear||i.weekNumber;if((h||c)&&m)throw new Zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&c)throw new Zt("Can't mix ordinal dates with month/day");const f=m||i.weekday&&!h;let p,g,y=jo(a,l);f?(p=Vo,g=Uo,y=yr(y,o,s)):c?(p=Go,g=Yo,y=wr(y)):(p=Zo,g=Ho);let v=!1;for(const e of p)Nr(i[e])?i[e]=v?g[e]:y[e]:v=!0;const w=f?function(e,t=4,n=1){const r=Cr(e.weekYear),i=Rr(e.weekNumber,1,Fr(e.weekYear,t,n)),o=Rr(e.weekday,1,7);return r?i?!o&&hr("weekday",e.weekday):hr("week",e.weekNumber):hr("weekYear",e.weekYear)}(i,o,s):c?function(e){const t=Cr(e.year),n=Rr(e.ordinal,1,Ar(e.year));return t?!n&&hr("ordinal",e.ordinal):hr("year",e.year)}(i):kr(i),b=w||Sr(i);if(b)return rs.invalid(b);const x=f?vr(i,o,s):c?br(i):i,[k,S]=Wo(x,l,n),N=new rs({ts:k,zone:n,o:S,loc:r});return i.weekday&&h&&e.weekday!==N.weekday?rs.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${N.toISO()}`):N.isValid?N:rs.invalid(N.invalid)}static fromISO(e,t={}){const[n,r]=function(e){return gi(e,[qi,Yi],[Fi,Zi],[Hi,Vi],[Ui,Gi])}(e);return Lo(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=function(e){return gi(function(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}(e),[Mi,Oi])}(e);return Lo(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=function(e){return gi(e,[ji,Li],[Wi,Li],[Ai,Bi])}(e);return Lo(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(Nr(e)||Nr(t))throw new Gt("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,o=Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[s,a,l,c]=function(e,t,n){const{result:r,zone:i,specificOffset:o,invalidReason:s}=Io(e,t,n);return[r,i,o,s]}(o,e,t);return c?rs.invalid(c):Lo(s,a,n,`format ${t}`,e,l)}static fromString(e,t,n={}){return rs.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=function(e){return gi(e,[Ji,Yi],[Ki,Xi])}(e);return Lo(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new Gt("need to specify a reason the DateTime is invalid");const n=e instanceof cr?e:new cr(e,t);if(lr.throwOnInvalid)throw new Ht(n);return new rs({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=To(e,Hn.fromObject(t));return n?n.map(e=>e?e.val:null).join(""):null}static expandFormat(e,t={}){return Co(hi.parseFormat(e),Hn.fromObject(t)).map(e=>e.val).join("")}static resetCache(){ts=void 0,ns.clear()}get(e){return this[e]}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.ie}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?zo(this).weekYear:NaN}get weekNumber(){return this.isValid?zo(this).weekNumber:NaN}get weekday(){return this.isValid?zo(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Do(this).weekday:NaN}get localWeekNumber(){return this.isValid?Do(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Do(this).weekYear:NaN}get ordinal(){return this.isValid?wr(this.c).ordinal:NaN}get monthShort(){return this.isValid?fo.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?fo.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?fo.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?fo.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 e=864e5,t=6e4,n=Br(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),o=this.zone.offset(n-r*t),s=this.zone.offset(n-i*t);if(o===s)return[this];const a=n-o*t,l=n-s*t,c=jo(a,o),d=jo(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[Mo(this,{ts:a}),Mo(this,{ts:l})]:[this]}get isInLeapYear(){return Wr(this.year)}get daysInMonth(){return Lr(this.year,this.month)}get daysInYear(){return this.isValid?Ar(this.year):NaN}get weeksInWeekYear(){return this.isValid?Fr(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Fr(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=hi.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(Yn.instance(e),t)}toLocal(){return this.setZone(lr.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if((e=Vn(e,lr.defaultZone)).equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||n){const t=e.offset(this.ts),n=this.toObject();[r]=Wo(n,t,e)}return Mo(this,{ts:r,zone:e})}return rs.invalid(Ro(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){return Mo(this,{loc:this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n})})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Vr(e,Jo),{minDaysInFirstWeek:n,startOfWeek:r}=xr(t,this.loc),i=!Nr(t.weekYear)||!Nr(t.weekNumber)||!Nr(t.weekday),o=!Nr(t.ordinal),s=!Nr(t.year),a=!Nr(t.month)||!Nr(t.day),l=s||a,c=t.weekYear||t.weekNumber;if((l||o)&&c)throw new Zt("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new Zt("Can't mix ordinal dates with month/day");let d;i?d=vr({...yr(this.c,n,r),...t},n,r):Nr(t.ordinal)?(d={...this.toObject(),...t},Nr(t.day)&&(d.day=Math.min(Lr(d.year,d.month),d.day))):d=br({...wr(this.c),...t});const[u,h]=Wo(d,this.o,this.zone);return Mo(this,{ts:u,o:h})}plus(e){return this.isValid?Mo(this,Ao(this,uo.fromDurationLike(e))):this}minus(e){return this.isValid?Mo(this,Ao(this,uo.fromDurationLike(e).negate())):this}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=uo.normalizeUnit(e);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(t){const e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;if("quarters"===r){const e=Math.ceil(this.month/3);n.month=3*(e-1)+1}return this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?hi.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Eo}toLocaleString(e=en,t={}){return this.isValid?hi.create(this.loc.clone(t),e).formatDateTime(this):Eo}toLocaleParts(e={}){return this.isValid?hi.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;const s="extended"===e;let a=qo(this,s,o=Qo(o));return Zo.indexOf(o)>=3&&(a+="T"),a+=Fo(this,s,t,n,r,i,o),a}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?qo(this,"extended"===e,Qo(t)):null}toISOWeekDate(){return Bo(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:s="milliseconds"}={}){return this.isValid?(s=Qo(s),(r&&Zo.indexOf(s)>=3?"T":"")+Fo(this,"extended"===o,t,e,n,i,s)):null}toRFC2822(){return Bo(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Bo(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?qo(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(n&&(r+=" "),t?r+="z":e&&(r+="ZZ")),Bo(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Eo}[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(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",n={}){if(!this.isValid||!e.isValid)return uo.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=(a=t,Array.isArray(a)?a:[a]).map(uo.normalizeUnit),o=e.valueOf()>this.valueOf(),s=function(e,t,n,r){let[i,o,s,a]=function(e,t,n){const r=[["years",(e,t)=>t.year-e.year],["quarters",(e,t)=>t.quarter-e.quarter+4*(t.year-e.year)],["months",(e,t)=>t.month-e.month+12*(t.year-e.year)],["weeks",(e,t)=>{const n=po(e,t);return(n-n%7)/7}],["days",po]],i={},o=e;let s,a;for(const[l,c]of r)n.indexOf(l)>=0&&(s=l,i[l]=c(e,t),a=o.plus(i),a>t?(i[l]--,(e=o.plus(i))>t&&(a=e,i[l]--,e=o.plus(i))):e=a);return[e,i,a,s]}(e,t,n);const l=t-i,c=n.filter(e=>["hours","minutes","seconds","milliseconds"].indexOf(e)>=0);0===c.length&&(s<t&&(s=i.plus({[a]:1})),s!==i&&(o[a]=(o[a]||0)+l/(s-i)));const d=uo.fromObject(o,r);return c.length>0?uo.fromMillis(l,r).shiftTo(...c).plus(d):d}(o?this:e,o?e:this,i,r);var a;return o?s.negate():s}diffNow(e="milliseconds",t={}){return this.diff(rs.now(),e,t)}until(e){return this.isValid?mo.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||rs.fromObject({},{zone:this.zone}),n=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),Xo(t,this.plus(n),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?Xo(e.base||rs.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(rs.isDateTime))throw new Gt("min requires all arguments be DateTimes");return Tr(e,e=>e.valueOf(),Math.min)}static max(...e){if(!e.every(rs.isDateTime))throw new Gt("max requires all arguments be DateTimes");return Tr(e,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n;return Io(Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(e,t,n={}){return rs.fromFormatExplain(e,t,n)}static buildFormatParser(e,t={}){const{locale:n=null,numberingSystem:r=null}=t,i=Hn.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0});return new $o(i,e)}static fromFormatParser(e,t,n={}){if(Nr(e)||Nr(t))throw new Gt("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=n,o=Hn.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new Gt(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:s,zone:a,specificOffset:l,invalidReason:c}=t.explainFromTokens(e);return c?rs.invalid(c):Lo(s,a,n,`format ${t.format}`,e,l)}static get DATE_SHORT(){return en}static get DATE_MED(){return tn}static get DATE_MED_WITH_WEEKDAY(){return nn}static get DATE_FULL(){return rn}static get DATE_HUGE(){return on}static get TIME_SIMPLE(){return sn}static get TIME_WITH_SECONDS(){return an}static get TIME_WITH_SHORT_OFFSET(){return ln}static get TIME_WITH_LONG_OFFSET(){return cn}static get TIME_24_SIMPLE(){return dn}static get TIME_24_WITH_SECONDS(){return un}static get TIME_24_WITH_SHORT_OFFSET(){return hn}static get TIME_24_WITH_LONG_OFFSET(){return mn}static get DATETIME_SHORT(){return fn}static get DATETIME_SHORT_WITH_SECONDS(){return pn}static get DATETIME_MED(){return gn}static get DATETIME_MED_WITH_SECONDS(){return yn}static get DATETIME_MED_WITH_WEEKDAY(){return vn}static get DATETIME_FULL(){return wn}static get DATETIME_FULL_WITH_SECONDS(){return bn}static get DATETIME_HUGE(){return xn}static get DATETIME_HUGE_WITH_SECONDS(){return kn}}function is(e){if(rs.isDateTime(e))return e;if(e&&e.valueOf&&_r(e.valueOf()))return rs.fromJSDate(e);if(e&&"object"==typeof e)return rs.fromObject(e);throw new Gt(`Unknown datetime argument: ${e}, of type ${typeof e}`)}function os({title:e,description:t,children:n,noSubscription:r,hideHeader:i}){return Ye("div",{className:Et.create("page-container",{minHeight:"100vh",display:"flex",flexDirection:"column",backgroundColor:St.colors.accent}),children:Ye("div",{className:Et.create("page-content-container",{maxWidth:"1200px",margin:"0 auto",width:"100%",flex:"1",boxSizing:"border-box",overflowX:"hidden"}),children:[!i&&Ye("div",{className:Et.create("page-heading-wrapper",{width:"100%",marginBottom:St.spacing.lg}),children:Ye(Wt,{children:Ye("div",{className:Et.create("page-heading-container",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:St.radius.large,padding:`${St.spacing.lg} ${St.spacing.xl}`,boxShadow:St.shadow.md}),children:Ye("div",{className:Et.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:St.spacing.lg}),children:Ye("div",{className:Et.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Ye("h1",{className:Et.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:St.colors.primaryForeground,letterSpacing:"-0.025em"}),children:e}),t&&Ye("p",{className:Et.create("page-template-description",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,lineHeight:"1.5",color:St.colors.primaryForeground,opacity:"0.85"}),children:t})]})})})})}),n]})})}function ss({title:e="Loading",message:t}){const n=Et.create("loading-container",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:St.spacing.md,minHeight:"500px"}),r=Et.create("loading-title",{margin:"0",fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,letterSpacing:"-0.01em"}),i=Et.create("loading-message",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground}),o=Et.create("loading-text-group",{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.25rem",textAlign:"center"});return Ye(os,{title:"Loading",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:n,children:[Ye(jt,{size:"large"}),Ye("div",{className:o,children:[Ye("p",{className:r,children:e}),t&&Ye("p",{className:i,children:t})]})]})})})}function as({variant:e="primary",type:t="button",onClick:n,disabled:r,loading:i=!1,children:o,className:s,...a}){const l={primary:{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,boxShadow:St.shadow.sm},outline:{border:`${St.borderWidth} solid ${St.colors.primary}`,backgroundColor:St.colors.card,color:St.colors.primary,boxShadow:St.shadow.sm}},c=Et.create("button",{height:"2.75rem",paddingLeft:"1.5rem",paddingRight:"1.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",borderRadius:St.radius.default,cursor:"pointer",fontSize:St.fontSize.default,fontWeight:"500",transition:St.transition,fontFamily:St.fontFamily,display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem"},{"(max-width: 600px)":{fontSize:"14px",paddingLeft:"1.25rem",paddingRight:"1.25rem"}}),d=Et.pseudoElement("button",":disabled",{opacity:"50%",cursor:"not-allowed"});Et.pseudoElement(`button-${e}`,":hover:not(:disabled)",{transform:"translateY(-1px)",boxShadow:St.shadow.md}),Et.pseudoElement(`button-${e}`,":active:not(:disabled)",{transform:"translateY(0)",boxShadow:St.shadow.sm});const u=Et.create(`button-${e}`,{...l[e]});return Ye("button",{type:t,className:Ot(c,d,u,s),onClick:r||i?void 0:n,disabled:r||i,...a,children:[i&&Ye(jt,{size:"small"}),o]})}function ls({className:e,children:t}){const n=Et.create("center",{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",minHeight:"500px"});return Ye("div",{className:Ot(n,e),children:t})}function cs({source:e,className:t,inline:n=!1}){return e?n?Ye("span",{className:t,children:us(e)}):Ye("div",{className:t,children:ds(e)}):null}function ds(e){var t;const n=e.replace(/\r\n/g,"\n").split("\n"),r=[];let i=[],o=[],s=null;const a=()=>{if(0===i.length)return;const e=i.join(" ");r.push(Ye("p",{children:us(e)},r.length)),i=[]},l=()=>{if(0===o.length)return void(s=null);const e=o,t="ol"===s?"ol":"ul";r.push(Ye(t,{children:e.map((e,t)=>Ye("li",{children:us(e)},t))},r.length)),o=[],s=null};for(const e of n){const n=e.trimEnd();if(""===n){a(),l();continue}const r=n.match(/^\s*[-*]\s+(.*)$/);if(r&&void 0!==r[1]){a(),s&&"ul"!==s&&l(),s="ul",o.push(r[1]);continue}const c=n.match(/^\s*\d+[.)]\s+(.*)$/);if(c&&void 0!==c[1])a(),s&&"ol"!==s&&l(),s="ol",o.push(c[1]);else{if(o.length>0){const e=o.length-1,r=null!==(t=o[e])&&void 0!==t?t:"",i=r.replace(/\s+$/,"").slice(-1);if("."!==i&&"!"!==i&&"?"!==i&&":"!==i){o[e]=`${r} ${n}`;continue}l()}i.push(n)}}return a(),l(),r}function us(e){var t,n;const r=/\[([^\]]+)\]\((https?:\/\/[^\s)]+|mailto:[^\s)]+)\)/g,i=[];let o,s=0,a=0;for(;null!==(o=r.exec(e));){o.index>s&&i.push(Ye(C,{children:hs(e.slice(s,o.index))},a++));const r=null!==(t=o[1])&&void 0!==t?t:"",l=null!==(n=o[2])&&void 0!==n?n:"";i.push(Ye("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:hs(r)},a++)),s=o.index+o[0].length}return s<e.length&&i.push(Ye(C,{children:hs(e.slice(s))},a++)),i}function hs(e){const t=e=>ms(e,"*",e=>Ye("em",{children:e}));return ms(e,"**",e=>Ye("strong",{children:t(e)}),t)}function ms(e,t,n,r=e=>e){const i=[];let o=0,s=0;for(;o<e.length;){const a=e.indexOf(t,o);if(-1===a){i.push(Ye(C,{children:r(e.slice(o))},s++));break}const l=e.indexOf(t,a+t.length);if(-1===l){i.push(Ye(C,{children:r(e.slice(o))},s++));break}a>o&&i.push(Ye(C,{children:r(e.slice(o,a))},s++)),i.push(Ye(C,{children:n(e.slice(a+t.length,l))},s++)),o=l+t.length}return i}function fs(e,t,n){var r,i,o,s;const a=null==e?void 0:e.status_pages;if(!a)return{};const l=n?null===(r=a.per_gateway)||void 0===r?void 0:r[n]:void 0,c=null==l?void 0:l[t],d=null===(i=a.default)||void 0===i?void 0:i[t],u=null!==(o=ps(null==c?void 0:c.title))&&void 0!==o?o:ps(null==d?void 0:d.title),h=null!==(s=ps(null==c?void 0:c.body))&&void 0!==s?s:ps(null==d?void 0:d.body);let m;if("referral"===t){const e=null==c?void 0:c.steps,t=null==d?void 0:d.steps,n=e&&e.length>0?e:t;n&&n.length>0&&(m=n)}return{title:u,body:h,steps:m}}function ps(e){return"string"==typeof e&&e.length>0?e:void 0}function gs({error:e}){var t,n,r,i,o;const s=null!=e?e:{title:"Something went wrong",message:"We weren't able to load this page. Please try again in a moment.",retryable:!0},a=null!==(t=s.organisation)&&void 0!==t?t:null,l=null!==(n=null==a?void 0:a.name)&&void 0!==n?n:null,c=null!==(r=null==a?void 0:a.admin_email)&&void 0!==r?r:null,d=null!==(i=null==a?void 0:a.phone)&&void 0!==i?i:null,u=Boolean(c||d),h=fs(null==a?void 0:a.client_settings,"maintenance"),m=null!==(o=h.title)&&void 0!==o?o:s.title,f=h.body,p=Et.create("error-fallback-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),g=Et.create("error-fallback-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),y=Et.create("error-fallback-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),v=Et.create("error-fallback-header",{textAlign:"center",marginBottom:St.spacing.xl}),w=Et.create("error-fallback-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),b=Et.create("error-fallback-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),x=Et.create("error-fallback-refresh-actions",{display:"flex",justifyContent:"center",marginBottom:u?"0":St.spacing.sm}),k=Et.create("error-fallback-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),S=Et.create("error-fallback-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),N=Et.create("error-fallback-contact-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"});return Ye(os,{title:m,noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:p,children:[Ye("div",{className:g,children:Ye(()=>Ye("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:y,children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),Ye("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),{})}),Ye("div",{className:v,children:[Ye("h1",{className:w,children:m}),f?Ye(cs,{source:f,className:b}):Ye("p",{className:b,children:s.message})]}),s.retryable&&Ye("div",{className:x,children:Ye(as,{onClick:()=>{window.location.reload()},children:"Try Again"})}),u&&Ye("div",{className:k,children:[Ye("p",{className:S,children:l?`Need assistance? Contact ${l}`:"Need assistance? Contact us"}),Ye("div",{className:N,children:[d&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${d}`),children:[Ye(()=>Ye("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:Ye("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"]}),c&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[Ye(()=>Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),{}),"Email Us"]})]})]})]})})})})}function ys({message:e,estimatedTime:t,organisation:n}){var r;const i=(null==n?void 0:n.name)||null,o=(null==n?void 0:n.admin_email)||null,s=(null==n?void 0:n.phone)||null,a=Boolean(o||s),l=Et.create("maintenance-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),c=Et.create("maintenance-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),d=Et.create("maintenance-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),u=Et.create("maintenance-header",{textAlign:"center",marginBottom:St.spacing.xl}),h=Et.create("maintenance-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),m=Et.create("maintenance-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),f=Et.create("maintenance-estimated-time",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.sm}),p=Et.create("maintenance-refresh-actions",{display:"flex",justifyContent:"center",marginBottom:a?"0":St.spacing.sm}),g=Et.create("maintenance-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),y=Et.create("maintenance-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),v=Et.create("maintenance-contact-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),w=fs(null==n?void 0:n.client_settings,"maintenance"),b=null!==(r=w.title)&&void 0!==r?r:"We'll be right back",x=w.body;return Ye(os,{title:b,description:"Quotes are temporarily unavailable",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:l,children:[Ye("div",{className:c,children:Ye(()=>Ye("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:d,children:Ye("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"})}),{})}),Ye("div",{className:u,children:[Ye("h1",{className:h,children:b}),x?Ye(cs,{source:x,className:m}):Ye("p",{className:m,children:e||"We're temporarily unable to issue new quotes. Please try again shortly."}),t&&Ye("p",{className:f,children:[Ye("strong",{children:"Estimated time:"})," ",t]})]}),Ye("div",{className:p,children:Ye(as,{onClick:()=>{window.location.reload()},children:"Refresh Page"})}),a&&Ye("div",{className:g,children:[Ye("p",{className:y,children:i?`Need assistance? Contact ${i}`:"Need assistance? Contact us"}),Ye("div",{className:v,children:[s&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${s}`),children:[Ye(()=>Ye("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:Ye("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&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${o}`),children:[Ye(()=>Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),{}),"Email Us"]})]})]})]})})})})}function vs({quotePageUrl:e,message:t,clientSettings:n}){var r,i,o;const s=function(e){if(!e)return null;try{const t=new URL(e,window.location.href);return"https:"===t.protocol||"http:"===t.protocol?t.toString():null}catch(e){return null}}(e),a=fs(n,"version_invalidated"),l=null!==(r=a.title)&&void 0!==r?r:"This quote needs to be restarted",c=null!==(o=null!==(i=a.body)&&void 0!==i?i:t)&&void 0!==o?o:"The questions have been updated, sorry for the inconvenience.",d="#f59e0b",u="#92400e",h=Et.create("version-invalidated-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),m=Et.create("version-invalidated-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),f=Et.create("version-invalidated-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:d,color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),p=Et.create("version-invalidated-header",{textAlign:"center",marginBottom:St.spacing.xl}),g=Et.create("version-invalidated-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=Et.create("version-invalidated-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0 auto",maxWidth:"450px",paddingLeft:St.spacing.md,paddingRight:St.spacing.md}),v=Et.create("version-invalidated-callout-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),w=Et.create("version-invalidated-callout-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),b=Et.create("version-invalidated-callout-box",{backgroundColor:"#fef3c7",border:`1px solid ${d}`,borderRadius:St.radius.default,padding:St.spacing.md,marginBottom:St.spacing.lg,color:u}),x=Et.create("version-invalidated-callout-heading",{margin:"0",marginBottom:St.spacing.sm,fontSize:St.fontSize.default,fontWeight:"600",color:u}),k=Et.create("version-invalidated-callout-body",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.5",color:u}),S=Et.create("version-invalidated-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),N=Et.create("version-invalidated-cta",{display:"inline-block",padding:"0.75rem 1.75rem",backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:St.radius.default,textDecoration:"none",fontSize:St.fontSize.default,fontWeight:"600",border:`1px solid ${St.colors.primary}`,cursor:"pointer",transition:`background-color ${St.transition}`},{":hover":{opacity:"0.9"}});return Ye(os,{title:"This quote needs to be restarted",description:"Start a fresh quote to get an accurate price",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:h,children:[Ye("div",{className:m,children:Ye("div",{className:f,children:Ye("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:[Ye("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),Ye("path",{d:"M21 3v5h-5"}),Ye("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),Ye("path",{d:"M3 21v-5h5"})]})})}),Ye("div",{className:p,children:[Ye("h1",{className:g,children:l}),Ye("p",{className:y,children:c})]}),Ye("div",{className:v,children:[Ye("h3",{className:w,children:"Before you start"}),Ye("div",{className:b,role:"alert",children:[Ye("p",{className:x,children:"Your saved answers will not carry over."}),Ye("p",{className:k,children:"When you click the button below you'll start a fresh quote and need to re-enter your details."})]}),s&&Ye("div",{className:S,children:Ye("a",{href:s,className:N,children:"Start a new quote"})})]})]})})})})}function ws({size:e="default",style:t="normal",className:n,children:r}){const i=Et.create("text",{marginTop:"0",marginBottom:"0"}),o=Et.create("text-small",{fontSize:St.fontSize.small}),s=Et.create("text-default",{fontSize:St.fontSize.default}),a=Et.create("text-italic",{fontStyle:"italic"}),l=Et.create("text-bold",{fontWeight:"bold"}),c=Et.create("text-underline",{textDecoration:"underline"}),d=Ot({[a]:"italic"===t,[l]:"bold"===t,[c]:"underline"===t}),u=Ot({[o]:"small"===e,[s]:"default"===e});return Ye("p",{className:Ot(i,u,d,n),children:r})}function bs({title:e,description:t}){return Ye("div",{className:Et.create("section-header",{}),children:[Ye("h3",{className:Et.create("section-title",{fontSize:St.fontSize.large,fontWeight:"600",margin:"0",color:St.colors.foreground}),children:e}),t&&Ye(ws,{className:Et.create("section-description",{color:St.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 xs({selected:e}){return Ye("div",{className:Ot(Et.create("selected-indicator",{height:"14px",width:"14px",borderRadius:"100%",border:`${St.borderWidth} solid transparent`}),e?Et.create("selected-indicator-selected",{backgroundColor:St.colors.primary}):Et.create("selected-indicator-unselected",{border:`${St.borderWidth} solid ${St.colors.border}`}))})}function ks({excessOptions:e,selectedExcessId:t,onExcessSelect:n}){const r=[...e].sort((e,t)=>e.excess_amount-t.excess_amount),i=e.find(e=>e.id===t);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:1===e.length?"Excess":"Excess Options"}),Ye("div",{className:Et.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Ye("div",{className:Ot(Et.create("excess-option-card",{borderRadius:St.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Et.create("excess-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("excess-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>n(e.id),children:[Ye(xs,{selected:r}),Ye("div",{className:Et.create("excess-amount",{color:St.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Ye("div",{className:Et.create("excess-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(ws,{className:Et.create("excess-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:i.description})})]})}function Ss(e,t="NZD",n="en-NZ"){return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)}function Ns(e,t){return"bank_transfer"===t?"Bank Transfer":"one-time"===e?"Online Payment":"monthly"===e?"Monthly Installments":`${e.charAt(0).toUpperCase()}${e.slice(1)} Installments`}function _s({paymentOptions:e,paymentGateways:t,selectedCalculationId:n,selectedPaymentOption:r,onPaymentSelect:i}){const o=dt(()=>{if(!n)return[];const r=e.filter(e=>e.calculation_id===n).map(e=>{const n=t.find(t=>t.id===e.gateway_id);if(!n)throw new Error(`Gateway not found for option: ${e.gateway_id}`);return{...e,gateway:n}});return r.sort((e,t)=>e.amount.success!==t.amount.success?e.amount.success?-1:1:0)},[e,t,n]);return n?Ye(Cs,{sortedOptions:o,selectedPaymentOption:r,onPaymentSelect:i}):Ye("div",{className:Et.create("payment-section-disabled",{opacity:"0.5",pointerEvents:"none"}),children:Ye(Cs,{sortedOptions:[],selectedPaymentOption:null,onPaymentSelect:i})})}function Cs({sortedOptions:e,selectedPaymentOption:t,onPaymentSelect:n}){const r=e.length>0;return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Ye(bs,{title:"Payment Options"}),Ye("div",r?{className:Et.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>{var r;return Ye($s,{option:e,selectedPaymentOption:t,onPaymentSelect:n},`${e.gateway_id}-${null!==(r=e.gateway_method)&&void 0!==r?r:"default"}-${e.calculation_id}`)})}:{className:Et.create("no-options-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.muted}),children:Ye(ws,{className:Et.create("placeholder-text",{color:St.colors.mutedForeground,margin:"0"}),children:"Payment options will appear here after selecting an excess amount"})})]})}function $s({option:e,selectedPaymentOption:t,onPaymentSelect:n}){var r,i,o,s,a,l;const c=(null!==(r=null==t?void 0:t.gateway_method)&&void 0!==r?r:null)===(null!==(i=e.gateway_method)&&void 0!==i?i:null)&&(null==t?void 0:t.gateway_id)===e.gateway_id&&(null==t?void 0:t.calculation_id)===e.calculation_id,d=e.amount.success,u=null!==(s=null!==(o=e.display_title)&&void 0!==o?o:e.gateway.display_title)&&void 0!==s?s:null,h=null!==(l=null!==(a=e.description)&&void 0!==a?a:e.gateway.description)&&void 0!==l?l:null,m=()=>d?"one-time"===e.amount.frequency?Ss(e.amount.dueToday):`${Ss(e.amount.installmentAmount||0)} x ${e.amount.numberOfInstallments}`:"Currently Unavailable",f=()=>h||("bank_transfer"===e.gateway.code?"Manual":`via ${e.gateway.name}`);return Ye("div",{className:Ot(Et.create("payment-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:d?"pointer":"not-allowed",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",opacity:d?"1":"0.6"},{"(max-width: 950px)":{padding:"0.75rem",flexDirection:"column",alignItems:"stretch",gap:"0.25rem"}}),c?Et.create("payment-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("payment-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>d&&n(e),children:[Ye("div",{className:Et.create("payment-option-desktop-wrapper",{display:"flex",flexDirection:"column",flex:"1"},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("frequency-title",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:u||Ns(e.amount.frequency,e.gateway.code)}),Ye("div",{className:Et.create("gateway-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:f()})]}),Ye("div",{className:Et.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 950px)":{display:"none"}}),children:[Ye(ws,{className:d?Et.create("amount-text",{textAlign:"right",color:St.colors.foreground,fontStyle:"normal"}):Et.create("amount-text-unavailable",{textAlign:"right",color:St.colors.mutedForeground,fontStyle:"italic"}),children:m()}),d&&Ye(ws,{size:"small",className:Et.create("gateway-fee-text",{textAlign:"right",color:St.colors.mutedForeground}),children:"bank_transfer"!==e.gateway.code&&e.amount.gatewayFee>0?`${Ss(e.amount.gatewayFee)} fee`:"No fees"})]}),Ye("div",{className:Et.create("payment-option-mobile-wrapper",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:"0.125rem"}}),children:[Ye("div",{className:Et.create("payment-option-title-mobile",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:u||Ns(e.amount.frequency,e.gateway.code)}),Ye(ws,{className:d?Et.create("amount-text-mobile",{fontWeight:"500",color:St.colors.foreground,fontStyle:"normal"}):Et.create("amount-text-mobile-unavailable",{fontWeight:"500",color:St.colors.mutedForeground,fontStyle:"italic"}),children:[m(),d&&e.amount.gatewayFee>0&&Ye("span",{className:Et.create("gateway-fee-inline",{fontWeight:"400",fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginLeft:"0.375rem"}),children:["(",Ss(e.amount.gatewayFee)," fee)"]})]}),Ye("div",{className:Et.create("gateway-description-mobile",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:f()})]})]})}const Is={client_full_name:e=>{const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return t?{label:"Name",value:t}:null},client_email:e=>e.email?{label:"Email",value:e.email}:null,client_phone:e=>e.phone?{label:"Phone",value:e.phone}:null,client_dob:e=>e.dob?{label:"Date of Birth",value:Es(e.dob)}:null,client_address:e=>e.address?{label:"Address",value:e.address}:null},Ts=["client_full_name","client_email","client_phone","client_dob"],Es=e=>{try{return new Date(e).toLocaleDateString("en-NZ",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}};function Ps({excessOptions:e,selectedExcessId:t,onEditQuote:n,isEditingQuote:r=!1,productName:i,quoteIntent:o,embedded:s=!1}){var a,l,c,d,u,h;const m=dt(()=>t?e.find(e=>e.id===t):null,[e,t]),{formProgress:f,checkoutConfig:p}=qt(e=>{var t,n,r,i;return{formProgress:e.getFormProgress(),checkoutConfig:null!==(i=null===(r=null===(n=null===(t=e.getQuoteIntent())||void 0===t?void 0:t.organisation)||void 0===n?void 0:n.client_settings)||void 0===r?void 0:r.checkout)&&void 0!==i?i:null}}),g=null!=p?p:{},y=null!==(l=null===(a=null==g?void 0:g.insurance_details)||void 0===a?void 0:a.fields)&&void 0!==l?l:Ts,v=null===(d=null===(c=null==g?void 0:g.insurance_details)||void 0===c?void 0:c.show_edit_button)||void 0===d||d,w=null!==(h=null===(u=null==g?void 0:g.line_items)||void 0===u?void 0:u.visibility)&&void 0!==h?h:{},b=null!=(null==m?void 0:m.sum_insured)&&m.sum_insured>0?m.sum_insured:null,x=((null==m?void 0:m.line_item_display)||[]).filter(e=>{var t;const n=null!==(t=null==e?void 0:e.code)&&void 0!==t?t:null==e?void 0:e.line_item_code;return!n||!1!==w[n]}),k=dt(()=>{var e;const t=(null==f?void 0:f.page_data)||(null===(e=null==o?void 0:o.form_data)||void 0===e?void 0:e.page_data);if(!t)return null;let n={};for(const e in t){const r=t[e];r&&"object"==typeof r&&(r.client_first_name&&(n.firstName=r.client_first_name),r.client_last_name&&(n.lastName=r.client_last_name),r.client_email&&(n.email=r.client_email),r.client_phone&&(n.phone=r.client_phone),r.client_dob&&(n.dob=r.client_dob),(r.client_address||r.client_address_line_1)&&(n.address=r.client_address||r.client_address_line_1))}return Object.keys(n).length>0?n:null},[f,o]),S=dt(()=>k?y.map(e=>{const t=Is[e];if(!t)return null;const n=t(k);return n?{...n,code:e}:null}).filter(e=>Boolean(e)):[],[k,y]);return Ye("div",{className:Et.create(s?"cart-summary-container-embedded":"cart-summary-container",s?{}:{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm},s?{}:{"(max-width: 768px)":{padding:St.spacing.md}}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.md,color:St.colors.foreground}),children:"Insurance Details"}),S.length>0&&Ye(C,{children:[Ye("div",{className:Et.create("cart-client-details",{display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.md}),children:S.map(e=>Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e.label}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:e.value})]},e.code))}),Ye("hr",{className:Et.create("divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})})]}),Ye("div",{className:Et.create("cart-product-section",{display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),children:[x.map((e,t)=>Ye("div",{className:Et.create("cart-item",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:Ye("div",{className:Et.create("cart-item-description",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground}),children:e.description})},t)),null!=b&&Ye("div",{className:Et.create("cart-sum-insured-total",{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:x.length>0?St.spacing.sm:"0"}),children:[Ye("span",{className:Et.create("cart-sum-insured-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Total Sum Insured"}),Ye("span",{className:Et.create("cart-sum-insured-value",{fontWeight:"600",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Ss(b)})]})]}),v&&Ye(as,{onClick:n,disabled:r,variant:"outline",className:Et.create("edit-quote-button",{width:"100%"}),children:r?"Clearing quote...":"Edit details"})]})}function Rs({clauses:e}){const[t,n]=at(!0);return 0===e.length?null:Ye("div",{className:Et.create("policy-clauses-section",{borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`,overflow:"hidden"}),children:[Ye("button",{type:"button",onClick:()=>n(!t),className:Et.create("policy-clauses-toggle",{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:`${St.spacing.sm} ${St.spacing.md}`,background:"none",border:"none",cursor:"pointer",fontFamily:"inherit",textAlign:"left"}),children:[Ye("div",{className:Et.create("policy-clauses-header",{display:"flex",alignItems:"center",gap:St.spacing.sm}),children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Ye("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Ye("polyline",{points:"14 2 14 8 20 8"}),Ye("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),Ye("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),Ye("polyline",{points:"10 9 9 9 8 9"})]}),Ye("span",{className:Et.create("policy-clauses-title",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground,opacity:"0.7"}),children:"Policy Clauses"})]}),Ye("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.mutedForeground,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{transition:"transform 0.2s ease",transform:t?"rotate(180deg)":"rotate(0deg)"},children:Ye("polyline",{points:"6 9 12 15 18 9"})})]}),t&&Ye("div",{className:Et.create("policy-clauses-content",{padding:`0 ${St.spacing.md} ${St.spacing.md}`,borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.md}),children:Ye("ul",{className:Et.create("policy-clauses-list",{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:e.map((e,t)=>Ye("li",{className:Et.create("policy-clause-item",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.7",lineHeight:"1.5",paddingLeft:St.spacing.md,position:"relative"}),children:[Ye("span",{className:Et.create("policy-clause-bullet",{position:"absolute",left:"0",top:"0.6em",width:"4px",height:"4px",borderRadius:"50%",backgroundColor:St.colors.mutedForeground,opacity:"0.5"})}),e.note||e.reference||""]},t))})})]})}function zs({label:e,value:t,isTotal:n=!1,className:r}){return Ye("div",{className:Ot(Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Ye("span",{className:Et.create("summary-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e}),Ye("span",{className:Et.create("summary-value",{fontWeight:n?"600":"500",color:St.colors.foreground,fontSize:n?St.fontSize.large:"inherit"}),children:t})]})}function Ds({excessOptions:e,paymentGateways:t,selectedExcessId:n,selectedPaymentOption:r,onPurchase:i,canPurchase:o,onContinueLater:s,continueLaterLoading:a=!1,showContinueLaterSuccess:l=!1}){dt(()=>n?e.find(e=>e.id===n):null,[e,n]);const c=dt(()=>r?t.find(e=>e.id===r.gateway_id):null,[t,r]);return Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[r&&Ye("div",{className:Et.create("summary-section",{paddingBottom:"1rem"}),children:Ye("div",{className:Et.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"one-time"===r.amount.frequency?Ye(C,{children:[r.amount.gatewayFee>0&&Ye(zs,{label:"windcave"===(null==c?void 0:c.code)?"Credit card surcharge:":"Provider Fee:",value:Ss(r.amount.gatewayFee)}),Ye(zs,{label:"Due Today:",value:Ss(Number(r.amount.dueToday)+Number(r.amount.gatewayFee)),isTotal:!0})]}):Ye(C,{children:[r.amount.gatewayFee>0&&Ye(zs,{label:"windcave"===(null==c?void 0:c.code)?"Credit card surcharge:":"Provider Fee:",value:Ss(r.amount.gatewayFee)}),r.amount.totalRepayable&&Ye(zs,{label:"Total Payable:",value:Ss(Number(r.amount.totalRepayable))}),Ye(zs,{label:"Due Today:",value:Ss(r.amount.dueToday)}),r.amount.installmentAmount&&r.amount.numberOfInstallments&&r.amount.numberOfInstallments>1&&Ye(zs,{label:"Remaining payments:",value:`${r.amount.numberOfInstallments-1} x ${Ss(r.amount.installmentAmount)}`})]})})}),s&&Ye(as,{onClick:s,disabled:a||l,variant:"outline",className:Et.create("continue-later-button",{width:"100%",height:"2.75rem",fontSize:St.fontSize.default,fontWeight:"500"},{"(max-width: 380px)":{fontSize:St.fontSize.small,height:"2.5rem"}}),children:l?"Email sent":a?"Sending...":"Continue Later"}),Ye(as,{onClick:i,disabled:!o,className:Et.create("purchase-button",{width:"100%",height:"3rem",fontSize:St.fontSize.default,fontWeight:"600"},{"(max-width: 380px)":{fontSize:St.fontSize.small,height:"2.75rem"}}),children:o?"Go to Payment":n?"Select Payment Option":"Select Excess"})]})}function Ms({details:e,onClose:t}){const n=(e,t)=>{navigator.clipboard.writeText(e).then(()=>{alert(`${t} copied to clipboard!`)}).catch(()=>{})};return Ye("div",{className:Et.create("bank-transfer-container",{display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[Ye("div",{className:Et.create("success-message",{backgroundColor:St.colors.accent,border:`2px solid ${St.colors.primary}`,borderRadius:St.radius.default,padding:St.spacing.lg,textAlign:"center"}),children:[Ye("div",{className:Et.create("success-icon",{fontSize:"3rem",marginBottom:St.spacing.sm}),children:"✓"}),Ye("h3",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.primary,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Quote Reserved"}),Ye(ws,{className:Et.create("success-description",{margin:"0",color:St.colors.foreground,opacity:"0.9"}),children:"Your quote has been reserved. Please complete the bank transfer to finalize your coverage."})]}),Ye("div",{className:Et.create("transfer-instructions",{backgroundColor:St.colors.card,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:St.spacing.lg}),children:[Ye("h4",{className:Et.create("instructions-title",{margin:"0",marginBottom:St.spacing.md,fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground}),children:"Bank Transfer Instructions"}),Ye("div",{className:Et.create("instructions-grid",{display:"grid",gap:St.spacing.md}),children:[Ye("div",{className:Et.create("detail-row-highlighted",{backgroundColor:St.colors.accent,border:`2px solid ${St.colors.primary}`,borderRadius:St.radius.default,padding:St.spacing.md}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem",fontWeight:"500"}),children:"Reference Number (IMPORTANT)"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("code",{className:Et.create("detail-value-code",{fontFamily:"monospace",fontSize:St.fontSize.large,fontWeight:"700",color:St.colors.primary,letterSpacing:"0.05em"}),children:e.reference}),Ye("button",{onClick:()=>n(e.reference,"Reference"),className:Et.create("copy-button",{background:"transparent",border:`1px solid ${St.colors.primary}`,borderRadius:St.radius.small,padding:"0.25rem 0.5rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.primary,transition:"all 150ms ease"}),children:"Copy"})]}),Ye(ws,{size:"small",className:Et.create("reference-note",{marginTop:"0.5rem",marginBottom:"0",color:St.colors.foreground,fontWeight:"500"}),children:"⚠️ Please include this reference in your transfer particulars"})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Amount"}),Ye("div",{className:Et.create("detail-value",{fontSize:St.fontSize.large,fontWeight:"600",color:St.colors.foreground}),children:["$",e.amount.toFixed(2)," ",e.currency]})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Name"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("span",{className:Et.create("detail-value",{fontFamily:"monospace",fontSize:St.fontSize.default,color:St.colors.foreground}),children:e.bank_account_name}),Ye("button",{onClick:()=>n(e.bank_account_name,"Account name"),className:Et.create("copy-button-small",{background:"transparent",border:`1px solid ${St.colors.border}`,borderRadius:St.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]}),Ye("div",{className:Et.create("detail-row",{}),children:[Ye("div",{className:Et.create("detail-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:"0.25rem"}),children:"Account Number"}),Ye("div",{className:Et.create("detail-value-wrapper",{display:"flex",alignItems:"center",gap:"0.5rem"}),children:[Ye("span",{className:Et.create("detail-value",{fontFamily:"monospace",fontSize:St.fontSize.default,color:St.colors.foreground}),children:e.bank_account_number}),Ye("button",{onClick:()=>n(e.bank_account_number,"Account number"),className:Et.create("copy-button-small",{background:"transparent",border:`1px solid ${St.colors.border}`,borderRadius:St.radius.small,padding:"0.125rem 0.375rem",cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.mutedForeground,transition:"all 150ms ease"}),children:"Copy"})]})]})]}),e.instructions_html&&Ye("div",{className:Et.create("additional-instructions",{marginTop:St.spacing.md,paddingTop:St.spacing.md,borderTop:`1px solid ${St.colors.border}`}),children:Ye("div",{className:Et.create("instructions-content",{fontSize:St.fontSize.small,color:St.colors.foreground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:e.instructions_html}})})]}),Ye("div",{className:Et.create("important-note",{backgroundColor:St.colors.muted,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:St.spacing.md}),children:Ye(ws,{size:"small",className:Et.create("note-text",{margin:"0",color:St.colors.foreground,lineHeight:"1.5"}),children:[Ye("strong",{children:"Important:"})," Your coverage will be activated once we verify receipt of your payment. This typically takes 1-2 business days. We'll send you a confirmation email once your payment is processed."]})}),Ye("div",{className:Et.create("actions",{display:"flex",justifyContent:"center"}),children:Ye(as,{onClick:t,variant:"primary",children:"I've Made the Transfer"})})]})}function Os({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,onVersionInvalidated:i}){const{fsm:o}=qt(()=>({})),[s,a]=at("initiating"),[l,c]=at(null),[d,u]=at(null),[h,m]=at(null),[f,p]=at(null);lt(()=>{e&&r&&g()},[e,r]);const g=async()=>{var e,t;if(r)try{a("initiating"),c(null);const e={...r,returnUrl:window.location.href},t=await o.initiatePayment(e);if(m(t.transaction_id),t.bank_account_name&&t.reference){a("bank_transfer");const e=o.getQuoteIntent(),t=await o.httpClient.getQuoteIntent(e.url);o.updateQuoteIntent({status:t.quote_intent.status,payment_transactions:t.payment_transactions}),o.getQuoteIntent(),setTimeout(()=>{y()},500)}else{if(!t.gateway_acceptance_url)throw new Error("Invalid payment response");a("redirecting"),window.location.href=t.gateway_acceptance_url}}catch(n){if("VERSION_INVALIDATED"===(null==n?void 0:n.type)&&i)return void i({quotePageUrl:null!==(t=null===(e=null==n?void 0:n.versionInvalidated)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:null==n?void 0:n.message});c(n.message||"Failed to initiate payment"),a("failed")}},y=()=>{d&&!d.closed&&d.close(),a("initiating"),c(null),m(null),u(null),p(null),t()},v=()=>{y(),n()};return e?Ye("div","bank_transfer"===s&&f?{className:Et.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",overflowY:"auto",padding:"1rem"}),onClick:e=>{e.target===e.currentTarget&&v()},children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.background,borderRadius:St.radius.large,padding:"2rem",maxWidth:"600px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,margin:"auto"}),onClick:e=>e.stopPropagation(),children:Ye(Ms,{details:f,onClose:v})})}:{className:Et.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:[Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`}),children:[Ye("div",{className:Et.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Ye("div",{className:Et.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(s){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Ye("h2",{className:Et.create("modal-title",{margin:"0",color:St.colors.foreground,fontSize:St.fontSize.large}),children:"Payment Processing"})]}),Ye("div",{className:Et.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Ye(ws,{className:Et.create("status-message",{fontSize:St.fontSize.default,color:St.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"}})()}),l&&Ye(ws,{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,padding:"0.75rem",backgroundColor:St.colors.destructive+"10",borderRadius:St.radius.default,border:`1px solid ${St.colors.destructive}30`}),children:l}),("redirecting"===s||"initiating"===s)&&Ye("div",{className:Et.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${St.colors.border}`,borderTop:`3px solid ${St.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Ye("div",{className:Et.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===s||"cancelled"===s?Ye(C,{children:[Ye(as,{onClick:y,variant:"outline",children:"Close"}),"cancelled"===s&&Ye(as,{onClick:()=>{a("initiating"),c(null),g()},children:"Try Again"})]}):Ye(as,"completed"===s?{onClick:y,children:"Continue"}:{onClick:y,variant:"outline",disabled:"initiating"===s,children:"Cancel"})})]}),Ye("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}const js={success:"payment_success",declined:"payment_declined",cancelled:"payment_cancelled",error:"payment_error"};function Ws({type:e,transactionId:t,isOpen:n,onClose:r,clientSettings:i,gatewayCode:o}){var s;if(!n)return null;const a=fs(i,js[e],null!=o?o:void 0),l=(()=>{switch(e){case"success":return{title:"Payment Successful!",message:"Your payment has been processed successfully and your policy is now active.",icon:Ye("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:St.colors.primary||"#10b981"},children:Ye("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:Ye("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:St.colors.destructive},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"m15 9-6 6"}),Ye("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:Ye("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:St.colors.secondary},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"m15 9-6 6"}),Ye("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:Ye("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:St.colors.destructive},children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("path",{d:"M12 8v4"}),Ye("path",{d:"m12 16 .01 0"})]}),buttonText:"Try Again"}}})(),c=Et.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"}),d=Et.create("modal-content",{backgroundColor:St.colors.background,borderRadius:St.radius.default,padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${St.borderWidth} solid ${St.colors.border}`}),u=Et.create("modal-body",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1.5rem",textAlign:"center"}),h=Et.create("modal-title",{fontSize:"1.25rem",fontWeight:"600",color:St.colors.foreground,margin:"0"}),m=Et.create("modal-message",{color:St.colors.foreground,lineHeight:"1.5",margin:"0"});Et.create("transaction-info",{backgroundColor:St.colors.muted||"#f8f9fa",padding:"0.75rem",borderRadius:St.radius.small,border:`${St.borderWidth} solid ${St.colors.border}`,fontSize:St.fontSize.small,color:St.colors.mutedForeground,wordBreak:"break-all"});const f=Et.create("modal-button",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground,border:"none",borderRadius:St.radius.default,padding:"0.75rem 1.5rem",fontSize:St.fontSize.default,fontWeight:"500",cursor:"pointer",minWidth:"120px",transition:"background-color 0.2s"}),p=Et.create("message-container",{display:"flex",flexDirection:"column",alignItems:"center",gap:"1rem",marginTop:"0.5rem"});return Ye("div",{className:c,onClick:r,children:Ye("div",{className:d,onClick:e=>e.stopPropagation(),children:Ye("div",{className:u,children:[l.icon,Ye("div",{className:p,children:[Ye("h2",{className:h,children:null!==(s=a.title)&&void 0!==s?s:l.title}),a.body?Ye(cs,{source:a.body,className:m}):Ye("p",{className:m,children:l.message})]}),Ye("button",{className:f,onClick:r,children:l.buttonText})]})})})}function As({httpClient:e,transactionId:t,onResolved:n,onError:r}){const[i,o]=at(!1),s=ct(!1);return lt(()=>{if(s.current)return;s.current=!0;let i=!1;return(async()=>{var s;try{const r=await e.resolvePaymentTransaction(t);if(i)return;n(r.status,r.recovery,r.fallback)}catch(e){if(i)return;r(null!==(s=null==e?void 0:e.message)&&void 0!==s?s:"Failed to confirm payment status"),o(!0)}})(),()=>{i=!0}},[e,t]),Ye("div",{role:"status","aria-live":"polite",className:Et.create("payment-processing-overlay",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"}),children:Ye("div",{className:Et.create("payment-processing-card",{backgroundColor:St.colors.background,borderRadius:St.radius.default,border:`${St.borderWidth} solid ${St.colors.border}`,boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",padding:"2rem",maxWidth:"400px",width:"100%",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:St.spacing.md}),children:[Ye(Ls,{}),Ye("h2",{className:Et.create("payment-processing-title",{margin:"0",fontSize:St.fontSize.large,fontWeight:"600",color:St.colors.foreground}),children:"Payment Processing"}),Ye(ws,{children:i?"Just a moment, we're still finishing up. Hang tight, this page will update automatically.":"Hang tight, we're finalising your payment. This page will update automatically in a few seconds."})]})})}function Ls(){return Et.keyframes("payment-processing-spin",{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),Ye("span",{"aria-hidden":"true",className:Et.create("payment-processing-spinner",{width:"2.5rem",height:"2.5rem",borderRadius:"50%",border:`3px solid ${St.colors.border}`,borderTopColor:St.colors.primary,animation:"insure-os-payment-processing-spin 0.9s linear infinite",display:"block"})})}function Bs({isOpen:e,onClose:t,title:n,description:r,children:i,footer:o,width:s="440px"}){if(lt(()=>{if(e)return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n);function n(e){"Escape"===e.key&&t()}},[e,t]),!e)return null;const a=Et.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"}),l=Et.create("modal-content-card",{backgroundColor:St.colors.background,borderRadius:St.radius.large,boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",border:`${St.borderWidth} solid ${St.colors.border}`,width:"100%",maxWidth:s,maxHeight:"calc(100vh - 2rem)",display:"flex",flexDirection:"column",padding:St.spacing.lg,gap:St.spacing.md,overflow:"hidden"});Et.media("(max-width: 640px)",{"modal-overlay":{padding:"0.5rem"},"modal-content-card":{padding:St.spacing.md,gap:St.spacing.sm,maxHeight:"calc(100vh - 1rem)"}});const c=Et.create("modal-card-header-row",{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:St.spacing.md,flexShrink:"0"}),d=Et.create("modal-card-title",{margin:"0",fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground}),u=Et.create("modal-card-description",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.5"}),h=Et.create("modal-card-body",{display:"flex",flexDirection:"column",gap:St.spacing.sm,flex:"1 1 auto",minHeight:"0",overflowY:"auto"}),m=Et.create("modal-card-footer",{display:"flex",gap:St.spacing.sm,marginTop:St.spacing.sm,flexWrap:"wrap",justifyContent:"flex-end",flexShrink:"0"}),f=Et.create("modal-card-close",{background:"none",border:"none",padding:"0.25rem",margin:"-0.25rem -0.25rem 0 0",color:St.colors.mutedForeground,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:St.radius.default,lineHeight:"0"});Et.pseudoElement("modal-card-close",":hover",{color:St.colors.foreground,backgroundColor:St.colors.muted});const p=Et.create("modal-card-footer-close",{background:St.colors.background,border:`${St.borderWidth} solid ${St.colors.border}`,borderRadius:St.radius.default,padding:"0.5rem 1rem",fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground,cursor:"pointer"});return Et.pseudoElement("modal-card-footer-close",":hover",{backgroundColor:St.colors.muted}),Ye("div",{className:a,onClick:t,children:Ye("div",{className:l,onClick:e=>e.stopPropagation(),children:[Ye("div",{className:c,children:[Ye("h2",{className:d,children:n}),Ye("button",{type:"button",onClick:t,"aria-label":"Close",className:f,children:Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[Ye("path",{d:"M18 6 6 18"}),Ye("path",{d:"m6 6 12 12"})]})})]}),Ye("div",{className:h,children:[r&&Ye("p",{className:u,children:r}),i]}),Ye("div",o?{className:m,children:o}:{className:m,children:Ye("button",{type:"button",onClick:t,className:p,children:"Close"})})]})})}function qs({isOpen:e,onClose:t,status:n,onSendEmail:r,onCopyLink:i,email:o}){const s="sending"===n.kind,a="sent"===n.kind,l=s||a,c=Et.create("continue-later-status",{margin:"0",fontSize:St.fontSize.small,color:St.colors.primary}),d=Et.create("continue-later-status-error",{margin:"0",fontSize:St.fontSize.small,color:St.colors.destructive});let u=null;return"sent"===n.kind?u=Ye("p",{className:c,children:o?`A link will be sent to ${o} shortly.`:"A link will be sent to your email shortly."}):"copied"===n.kind?u=Ye("p",{className:c,children:"Link copied to your clipboard."}):"error"===n.kind&&(u=Ye("p",{className:d,children:n.message})),Ye(Bs,{isOpen:e,onClose:t,title:"Save and continue later",description:"We'll save your progress and give you a link to come back to. Your details stay safe and only the people you share the link with can resume.",footer:Ye(C,{children:[Ye(as,{variant:"outline",onClick:i,disabled:s,children:"Copy link"}),Ye(as,{onClick:r,disabled:l,loading:s,children:a?"Email sent":o?"Email me a link":"Send email"})]}),children:u})}function Fs(e=0){const t=new Date;return t.setDate(t.getDate()+e),`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function Hs(){if("undefined"==typeof window||!window.location)return!1;const e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e||e.endsWith(".test")||e.endsWith(".localhost")}function Us({results:e}){var t,n,r,i,o;const{fsm:s,selectedExcessId:a,selectedPaymentOption:l,quoteIntent:c,httpClient:d}=qt(e=>({selectedExcessId:e.getSelectedExcessId(),selectedPaymentOption:e.getSelectedPaymentOption(),quoteIntent:e.getQuoteIntent(),httpClient:e.httpClient})),[u,h]=at(!1),[m,f]=at(null),[p,g]=at(!1),[y,v]=at({kind:"idle"}),[w,b]=at(!1),[x,k]=at(null),S=dt(()=>{var e,t;const n=null!==(t=null===(e=null==c?void 0:c.form_data)||void 0===e?void 0:e.page_data)&&void 0!==t?t:{};for(const[e,t]of Object.entries(n))if(t&&"object"==typeof t&&t.cover_start_date)return{pageId:e,value:String(t.cover_start_date)};return null},[null==c?void 0:c.form_data]),N=null!==(t=null==S?void 0:S.value)&&void 0!==t?t:null,_=dt(()=>{if(!N)return!1;const e=new Date(N);if(Number.isNaN(e.getTime()))return!1;e.setHours(0,0,0,0);const t=new Date;return t.setHours(0,0,0,0),e<t},[N]),C=Fs(),[$,I]=at(()=>_?C:null!=N?N:C),[T,E]=at(null),[P,R]=at(null),[z,D]=at(!1),[M,O]=at(!_),[j,W]=at(!1),A=_||Hs(),L=new URLSearchParams(window.location.search),B=L.get("status"),q=L.get("transactionId")||L.get("transaction_id"),[F,H]=at(null),[U,Y]=at(null),Z="processing"===B&&!!q&&!F&&!U,V=null!=F?F:B,[G,Q]=at(!(!B||"failed"!==B&&"declined"!==B&&"cancelled"!==B)),J=e.calculations,K=e.payment_options,X=e.payment_gateways,ee=null!==(r=null===(n=J.find(e=>e.id===a))||void 0===n?void 0:n.calculation_id)&&void 0!==r?r:null;lt(()=>{const e=J.find(e=>e.id===a);if(e&&c){const t=K.some(e=>"monthly"===e.amount.frequency),n=s.getPageCompletionStatus(),r=Math.round(n.completedPages.length/n.totalPages*100);je(c,e,K.length,t,r)}},[]),lt(()=>{if(!l||!a)return;const e=J.find(e=>e.id===a);if(!e)return;if(l.calculation_id===e.calculation_id)return;const t=K.find(t=>t.gateway_id===l.gateway_id&&t.calculation_id===e.calculation_id&&t.amount.frequency===l.amount.frequency);t?s.setSelectedPaymentOption(t):s.setSelectedPaymentOption(null)},[a,l,J,K,s]);const te=async e=>{var t,n,r,i;if(!d||!(null==c?void 0:c.id))return{valid:!1,requiresRecalculation:!1};D(!0),E(null),R(null);try{const i=await d.validateQuoteCoverStartDate(c.id,e);return i.valid?(O(!0),{valid:!0,requiresRecalculation:null!==(t=i.requires_recalculation)&&void 0!==t&&t}):(O(!1),E(null!==(n=i.message)&&void 0!==n?n:"Cover start date is invalid"),R(null!==(r=i.quote_page_url)&&void 0!==r?r:null),{valid:!1,requiresRecalculation:!1})}catch(e){return O(!1),E(null!==(i=null==e?void 0:e.message)&&void 0!==i?i:"Failed to validate cover start date"),{valid:!1,requiresRecalculation:!1}}finally{D(!1)}},ne=async e=>{var t,n,r,i;if(I(e),O(!1),E(null),R(null),!e)return;const{valid:o,requiresRecalculation:a}=await te(e);if(o&&(null==S?void 0:S.pageId))try{W(a),s.updatePageData(S.pageId,{cover_start_date:e}),await s.saveFormData(!0);const o=null!==(t=null==c?void 0:c.form_data)&&void 0!==t?t:{};s.updateQuoteIntent({form_data:{...o,page_data:{...null!==(n=o.page_data)&&void 0!==n?n:{},[S.pageId]:{...null!==(i=null===(r=o.page_data)||void 0===r?void 0:r[S.pageId])&&void 0!==i?i:{},cover_start_date:e}}}}),a&&await s.calculateQuote()}catch(e){O(!1),E("Couldn't update the price for this date. Please try again.")}finally{W(!1)}};lt(()=>{_&&$&&!M&&!z&&te($)},[_,null==c?void 0:c.id]);const re=()=>{if(!a||!l)return void alert("Please select both an excess amount and payment option");if(_&&!M)return void alert("Please choose and validate a new cover start date before continuing.");const t={quoteIntentId:e.quote_intent.id,excessId:a,gatewayId:l.gateway_id,calculationId:l.calculation_id,clientDetails:{legalName:"Test"},...l.gateway_method?{gateway_method:l.gateway_method}:{},..._&&$?{coverStartDate:$}:{}};f(t),h(!0)},ie=async()=>{try{b(!0),await s.clearCalculationResults()}catch(e){alert("Failed to edit quote. Please try again.")}finally{b(!1)}},oe=()=>{const e=null==c?void 0:c.form_data;if(!(null==e?void 0:e.page_data))return null;for(const t in e.page_data){const n=e.page_data[t];if(n&&"object"==typeof n&&n.client_email)return n.client_email}return null},se=()=>{v(e=>"sent"===e.kind?e:{kind:"idle"}),g(!0)},ae=Boolean(a&&l&&(!_||M)&&!j),le=null==c?void 0:c.payment_return,ce=le&&("declined"===le.paymentStatus||"cancelled"===le.paymentStatus||"error"===le.paymentStatus)||G,de=(null==le?void 0:le.paymentStatus)||("failed"===V?"declined":"cancelled"===V?"cancelled":"error"),ue=(null==le?void 0:le.paymentTransactionId)||q||void 0,he=null===(i=null==le?void 0:le.transactionStatus)||void 0===i?void 0:i.gateway_code;return x?Ye(vs,{quotePageUrl:x.quotePageUrl,message:x.message}):Ye(os,{title:"Complete Your Purchase",description:"Choose your coverage and payment options",hideHeader:!0,children:[Z&&d&&q&&Ye(As,{httpClient:d,transactionId:q,onResolved:async e=>{const t="completed"===e?"approved":"cancelled"===e?"cancelled":"failed"===e?"declined":"error",n=new URL(window.location.href);if(n.searchParams.set("status",t),q&&n.searchParams.set("transactionId",q),window.history.replaceState({},"",n.toString()),"completed"===e&&d&&(null==c?void 0:c.url))try{const e=await d.getQuoteIntent(c.url);s.updateQuoteIntent({status:e.quote_intent.status,payment_transactions:e.payment_transactions})}catch(e){}H(t),"declined"!==t&&"cancelled"!==t&&"error"!==t||Q(!0)},onError:e=>{Y(e),Q(!0)}}),Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:J.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),(null==c?void 0:c.reference)&&Ye("p",{className:Et.create("checkout-quote-reference",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:["Quote reference: ",Ye("strong",{style:{color:St.colors.foreground,fontWeight:600},children:c.reference})]}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[e.clauses&&e.clauses.length>0&&Ye(Rs,{clauses:e.clauses}),A&&Ye(Ys,{value:$,onChange:ne,validating:z,validated:M,error:T,quotePageUrl:P,isStale:_,recalculating:j}),Ye(ks,{excessOptions:J,selectedExcessId:a,onExcessSelect:e=>s.setSelectedExcessId(e)}),Ye(_s,{paymentOptions:K,paymentGateways:X,selectedCalculationId:ee,selectedPaymentOption:l,onPaymentSelect:e=>s.setSelectedPaymentOption(e)})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{}),children:[Ye(Ps,{excessOptions:J,selectedExcessId:a,onEditQuote:ie,isEditingQuote:w,productName:e.product_name,quoteIntent:c}),Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg},{"(max-width: 950px)":{height:St.spacing.md}})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye(Ds,{excessOptions:J,paymentGateways:X,selectedExcessId:a,selectedPaymentOption:l,onPurchase:re,canPurchase:ae,onContinueLater:se,continueLaterLoading:"sending"===y.kind,showContinueLaterSuccess:"sent"===y.kind})})]})})]}),Ye("div",{className:Et.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("mobile-card-summary",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye("h2",{className:Et.create("mobile-checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.5rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:"Complete Your Purchase"}),Ye("p",{className:Et.create("mobile-checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:J.length>1?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage."}),Ye("hr",{className:Et.create("mobile-summary-divider",{marginTop:St.spacing.md,marginBottom:St.spacing.md,borderColor:St.colors.border})}),Ye(Ps,{excessOptions:J,selectedExcessId:a,onEditQuote:ie,isEditingQuote:w,productName:e.product_name,quoteIntent:c,embedded:!0})]}),e.clauses&&e.clauses.length>0&&Ye("div",{className:Et.create("mobile-card-clauses",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Rs,{clauses:e.clauses})}),Ye("div",{className:Et.create("mobile-card-options",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[A&&Ye(Ys,{value:$,onChange:ne,validating:z,validated:M,error:T,quotePageUrl:P,isStale:_,recalculating:j}),Ye(ks,{excessOptions:J,selectedExcessId:a,onExcessSelect:e=>s.setSelectedExcessId(e)})]}),Ye("div",{className:Et.create("mobile-card-payment",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye(_s,{paymentOptions:K,paymentGateways:X,selectedCalculationId:ee,selectedPaymentOption:l,onPaymentSelect:e=>s.setSelectedPaymentOption(e)}),Ye("hr",{className:Et.create("mobile-payment-divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})}),Ye(Ds,{excessOptions:J,paymentGateways:X,selectedExcessId:a,selectedPaymentOption:l,onPurchase:re,canPurchase:ae,onContinueLater:se,continueLaterLoading:"sending"===y.kind,showContinueLaterSuccess:"sent"===y.kind})]})]}),ce&&Ye(Ws,{type:de,transactionId:ue,clientSettings:null===(o=null==c?void 0:c.organisation)||void 0===o?void 0:o.client_settings,gatewayCode:he,isOpen:!0,onClose:()=>{s.updateQuoteIntent({payment_return:void 0}),Q(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}}),Ye(Os,{isOpen:u,onClose:()=>{h(!1),f(null)},onSuccess:()=>{h(!1),f(null),alert("Payment completed successfully!")},onError:e=>{alert("Payment failed: "+e)},onVersionInvalidated:e=>{h(!1),f(null),k(e)},paymentRequest:m}),Ye(qs,{isOpen:p,onClose:()=>g(!1),status:y,onSendEmail:async()=>{const t=oe();if(!t)return void v({kind:"error",message:"Email address not found. Please fill in your email first."});const n=e.quote_intent.id;try{v({kind:"sending"}),await d.continueLater(n,t),v({kind:"sent"})}catch(e){v({kind:"error",message:"Failed to send link. Please try again."})}},onCopyLink:async()=>{var t;const n=(e=>{var t,n;const r=null!==(t=null==c?void 0:c.short_code)&&void 0!==t?t:e,i=null===(n=null==c?void 0:c.organisation)||void 0===n?void 0:n.quote_page_url;if(i){const e=i.replace(/\/+$/,""),t=e.includes("?")?"&":"?";return`${e}${t}q=${r}`}return`${window.location.origin}${window.location.pathname}?q=${r}`})(e.quote_intent.id);try{if(null===(t=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===t?void 0:t.writeText)await navigator.clipboard.writeText(n);else{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}v({kind:"copied"})}catch(e){v({kind:"error",message:"Could not copy link. Please copy manually."})}},email:oe()})]})]})}function Ys({value:e,onChange:t,validating:n,validated:r,error:i,quotePageUrl:o,isStale:s,recalculating:a}){const l=Fs();return Ye("div",{className:Et.create("cover-date-field",{}),children:[Ye(bs,{title:"Cover Start Date"}),Ye("div",{className:Et.create("cover-date-row",{display:"flex",alignItems:"center",gap:St.spacing.sm,marginTop:St.spacing.sm}),children:[Ye("input",{type:"date",value:e,min:l,disabled:a,onChange:e=>t(e.target.value),className:Et.create("cover-date-input",{padding:"0.5rem 1rem",border:`1px solid ${i?"#dc2626":St.colors.border}`,borderRadius:St.radius.large,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,boxSizing:"border-box",width:"auto",maxWidth:"16rem",opacity:a?"0.6":"1"})}),(n||a)&&Ye("span",{className:Et.create("cover-date-busy",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:a?"Updating price…":"Checking…"}),!n&&!a&&r&&!i&&Ye("span",{"aria-label":"Date confirmed",className:Et.create("cover-date-tick",{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.75rem",height:"1.75rem",borderRadius:"9999px",backgroundColor:St.colors.primary,color:St.colors.card,flexShrink:"0"}),children:Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",children:Ye("polyline",{points:"20 6 9 17 4 12"})})})]}),Hs()&&!s&&!i&&Ye("p",{className:Et.create("cover-date-hint",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:"Changing the cover start date re-rates this quote."}),!n&&i&&Ye("div",{className:Et.create("cover-date-error",{marginTop:St.spacing.sm}),children:[Ye("p",{className:Et.create("cover-date-error-text",{margin:"0",fontSize:St.fontSize.small,color:"#dc2626",lineHeight:"1.5"}),children:i}),o&&Ye("a",{href:o,className:Et.create("cover-date-new-quote",{display:"inline-block",marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.primary,textDecoration:"underline"}),children:"Start a new quote"})]})]})}function Zs({coverTypes:e,selectedCoverTypeId:t,onCoverTypeSelect:n}){const r=[...e].sort((e,t)=>e.sort_order-t.sort_order),i=e.find(e=>e.id===t);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:"Cover Type"}),Ye("div",{className:Et.create("cover-type-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:r.map(e=>{const r=e.id===t;return Ye("div",{className:Ot(Et.create("cover-type-card",{borderRadius:St.radius.default,minWidth:"180px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),r?Et.create("cover-type-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("cover-type-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>n(e.id),children:[Ye(xs,{selected:r}),Ye("div",{className:Et.create("cover-type-label",{color:St.colors.foreground}),children:[e.label,e.description?"*":""]})]},e.id)})}),(null==i?void 0:i.description)&&Ye("div",{className:Et.create("cover-type-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(ws,{className:Et.create("cover-type-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:i.description})})]})}function Vs({offers:e,selectedIds:t,onToggle:n,isCalculating:r}){if(0===e.length)return null;const i=[...e].sort((e,t)=>e.sort_order-t.sort_order);return Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:"Add-ons"}),Ye("div",{className:Et.create("coverage-options-grid",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:i.map(e=>{const i=t.includes(e.id),o=null!=e.delta_total;return Ye("div",{onClick:()=>!r&&n(e.id),className:Ot(Et.create("coverage-option-card",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:r?"wait":"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"1rem",opacity:r?"0.6":"1"}),i?Et.create("coverage-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("coverage-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),children:[Ye("div",{className:Et.create("coverage-option-indicator",{marginTop:"0.125rem"}),children:Ye(xs,{selected:i})}),Ye("div",{className:Et.create("coverage-option-body",{flex:"1",display:"flex",flexDirection:"column",gap:"0.25rem",minWidth:"0"}),children:[Ye("div",{className:Et.create("coverage-option-label",{fontWeight:"600",color:St.colors.foreground}),children:e.label}),e.description&&Ye(ws,{className:Et.create("coverage-option-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:e.description}),!o&&Ye(ws,{className:Et.create("coverage-option-roundtrip",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,fontStyle:"italic",margin:"0"}),children:"Price updates when you toggle this option."})]}),Ye("div",{className:Et.create("coverage-option-price",{fontWeight:"600",whiteSpace:"nowrap",color:St.colors.foreground}),children:o?`+${Ss(e.delta_total)}`:"See total"})]},e.id)})})]})}function Gs({value:e,className:t,durationMs:n=500}){const[r,i]=at(e),o=ct(e),s=ct(null);return lt(()=>{if(null!==s.current&&(cancelAnimationFrame(s.current),s.current=null),"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||o.current===e)return o.current=e,void i(e);const t=o.current,r=e,a=performance.now(),l=e=>{const c=e-a,d=Math.min(1,c/n);i(t+(r-t)*(1-(1-d)*(1-d))),d<1?s.current=requestAnimationFrame(l):(o.current=r,s.current=null)};return s.current=requestAnimationFrame(l),()=>{null!==s.current&&(cancelAnimationFrame(s.current),s.current=null)}},[e,n]),Ye("span",{className:t,children:Ss(r)})}function Qs(){var e,t,n,r,i,o,s,a,l,c,d,u,h,m;const{fsm:f,v2Result:p,selection:g,isCalculating:y,isRepricing:v,selectedExcessId:w,quoteIntent:b,calculationResult:x}=qt(e=>({v2Result:e.getCalculationResultV2(),selection:e.getSelectionV2(),isCalculating:e.getIsCalculating(),isRepricing:e.getIsRepricing(),selectedExcessId:e.getSelectedExcessId(),quoteIntent:e.getQuoteIntent(),calculationResult:e.getCalculationResult()})),[k,S]=at(null),[N,_]=at(!1),[C,$]=at(!1),I=dt(()=>{var e;return null!==(e=null==x?void 0:x.calculations)&&void 0!==e?e:[]},[x]),T=null===(t=null===(e=null==b?void 0:b.organisation)||void 0===e?void 0:e.client_settings)||void 0===t?void 0:t.checkout,E=(null===(n=null==T?void 0:T.headings)||void 0===n?void 0:n.new_business)||"Complete Your Purchase",P=null===(r=null==T?void 0:T.descriptions)||void 0===r?void 0:r.new_business;if(lt(()=>{S(null)},[null==g?void 0:g.cover_type_id,null==g?void 0:g.excess_id,null==g?void 0:g.coverage_option_ids.join(",")]),!p||!g)return Ye(os,{title:E,description:"Choose your coverage and payment options",hideHeader:!0,children:Ye(Wt,{children:Ye("p",{style:{color:St.colors.mutedForeground},children:"Loading calculation…"})})});const R=null!==(o=null!==(i=p.product_name)&&void 0!==i?i:null==b?void 0:b.product_name)&&void 0!==o?o:"Insurance",z=p.cover_types.length>1,D=I.length>1,M=(null!==(a=null===(s=null==x?void 0:x.clauses)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0||z||D||(null!==(c=null===(l=p.policy_coverage_options)||void 0===l?void 0:l.length)&&void 0!==c?c:0)>0,O=!(!g.cover_type_id||!g.excess_id||y||v),j=async()=>{_(!0);try{const e=await f.bindV2();S(e)}catch(e){}finally{_(!1)}},W=async()=>{try{$(!0),await f.clearCalculationResults()}catch(e){}finally{$(!1)}};return Ye(os,{title:E,description:"Choose your coverage and payment options",hideHeader:!0,children:Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"none"}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",alignSelf:"start"}),children:[Ye(Js,{showCoverType:z,showExcess:D,checkoutHeading:E,descriptionOverride:P}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[(null==x?void 0:x.clauses)&&x.clauses.length>0&&Ye(Rs,{clauses:x.clauses}),z&&Ye(Zs,{coverTypes:p.cover_types,selectedCoverTypeId:g.cover_type_id,onCoverTypeSelect:e=>f.setV2Selection({cover_type_id:e})}),D&&Ye(ks,{excessOptions:I,selectedExcessId:w,onExcessSelect:e=>f.setV2Selection({excess_id:e})}),Ye(Vs,{offers:p.policy_coverage_options,selectedIds:g.coverage_option_ids,onToggle:e=>f.toggleV2CoverageOption(e),isCalculating:v}),!M&&Ye(Xs,{adminEmail:null===(d=null==b?void 0:b.organisation)||void 0===d?void 0:d.admin_email,phone:null===(u=null==b?void 0:b.organisation)||void 0===u?void 0:u.phone})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{position:"sticky",top:St.spacing.lg}),children:[Ye(Ps,{excessOptions:I,selectedExcessId:w,onEditQuote:W,isEditingQuote:C,productName:R,quoteIntent:b}),Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye(Ks,{fsm:f,onBind:j,binding:N,canContinue:O,bindOutcome:k,isRepricing:v})})]})})]}),Ye("div",{className:Et.create("checkout-mobile-layout",{display:"none"},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("mobile-card-summary",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:[Ye("h2",{className:Et.create("mobile-checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.5rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:E}),Ye("p",{className:Et.create("mobile-checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:z||D?"Choose your cover and add-ons to secure your policy.":"Review your cover and add-ons to secure your policy."}),Ye("hr",{className:Et.create("mobile-summary-divider",{marginTop:St.spacing.md,marginBottom:St.spacing.md,borderColor:St.colors.border})}),Ye(Ps,{excessOptions:I,selectedExcessId:w,onEditQuote:W,isEditingQuote:C,productName:R,quoteIntent:b,embedded:!0})]}),(null==x?void 0:x.clauses)&&x.clauses.length>0&&Ye("div",{className:Et.create("mobile-card-clauses",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Rs,{clauses:x.clauses})}),Ye("div",{className:Et.create("mobile-card-options",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[z&&Ye(Zs,{coverTypes:p.cover_types,selectedCoverTypeId:g.cover_type_id,onCoverTypeSelect:e=>f.setV2Selection({cover_type_id:e})}),D&&Ye(ks,{excessOptions:I,selectedExcessId:w,onExcessSelect:e=>f.setV2Selection({excess_id:e})}),Ye(Vs,{offers:p.policy_coverage_options,selectedIds:g.coverage_option_ids,onToggle:e=>f.toggleV2CoverageOption(e),isCalculating:y}),!M&&Ye(Xs,{adminEmail:null===(h=null==b?void 0:b.organisation)||void 0===h?void 0:h.admin_email,phone:null===(m=null==b?void 0:b.organisation)||void 0===m?void 0:m.phone})]}),Ye("div",{className:Et.create("mobile-card-payment",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,padding:St.spacing.md}),children:Ye(Ks,{fsm:f,onBind:j,binding:N,canContinue:O,bindOutcome:k,isRepricing:v})})]})]})})}function Js({showCoverType:e,showExcess:t,checkoutHeading:n,descriptionOverride:r}){let i="Review your cover and add-ons to secure your policy.";return e&&t?i="Choose your cover type, excess amount, and add-ons to secure your policy.":e?i="Choose your cover type and add-ons to secure your policy.":t&&(i="Choose your excess amount and add-ons to secure your policy."),r&&""!==r.trim()&&(i=r),Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:n}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:i}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]})}function Ks({fsm:e,onBind:t,binding:n,canContinue:r,bindOutcome:i,isRepricing:o}){const s=e.getV2DisplayedTotal();return Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:"Payment"}),Ye("div",{className:Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("summary-label",{display:"flex",alignItems:"center",gap:"0.5rem",color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:["Total payable",Ye("span",{className:Et.create("summary-label-spinner",{display:"inline-flex",color:St.colors.mutedForeground,opacity:o?"1":"0",transition:"opacity 200ms ease"}),"aria-hidden":!o,children:Ye(jt,{size:"small"})})]}),Ye(Gs,{value:s,className:Et.create("summary-value-total",{fontWeight:"600",fontSize:St.fontSize.large,color:St.colors.foreground,fontVariantNumeric:"tabular-nums"})})]}),"verified"===(null==i?void 0:i.status)&&Ye("div",{className:Et.create("verified-banner",{padding:"0.75rem 1rem",border:`1px solid ${St.colors.primary}`,borderRadius:St.radius.default,backgroundColor:St.colors.accent,fontSize:St.fontSize.small}),children:["Verified at ",Ss(i.server_total),". Payment gateway integration for v2 is pending, quote is ready."]}),"mismatch"===(null==i?void 0:i.status)&&Ye("div",{className:Et.create("mismatch-banner",{padding:"0.75rem 1rem",border:`1px solid ${St.colors.destructive}`,borderRadius:St.radius.default,color:St.colors.destructive,fontSize:St.fontSize.small}),children:[Ye("strong",{children:"Price updated."})," The server calculated ",Ss(i.server_total),". Please review and try again."]}),Ye(as,{onClick:t,disabled:!r||n,children:n?"Verifying…":"verified"===(null==i?void 0:i.status)?"Continue to payment":"Verify & continue"}),Ye(ws,{className:Et.create("payment-footer-note",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:'Payment gateway integration for v2 products is scoped for a later phase. The "verify" step confirms your selection against the server.'})]})}function Xs({adminEmail:e,phone:t}){const n=!!e||!!t;return Ye("div",{className:Et.create("v2-no-options",{padding:St.spacing.lg,textAlign:"center",color:St.colors.foreground,border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,display:"flex",flexDirection:"column",alignItems:"center",gap:St.spacing.md}),children:[Ye("p",{className:Et.create("v2-no-options-title",{margin:"0",fontSize:St.fontSize.default,fontWeight:"600"}),children:"Sorry, there are no payment options available at this time."}),n?Ye(C,{children:[Ye("p",{className:Et.create("v2-no-options-body",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),children:"Please get in touch and we'll help you complete your purchase."}),Ye("div",{className:Et.create("v2-no-options-actions",{display:"flex",flexWrap:"wrap",gap:St.spacing.sm,justifyContent:"center"}),children:[t&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${t}`),children:"Call Us"}),e&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${e}`),children:"Email Us"})]})]}):Ye("p",{className:Et.create("v2-no-options-body-no-contact",{margin:"0",fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),children:"Please get in touch with the provider directly to complete your purchase."})]})}function ea({results:e}){var t,n,r,i,o,s;const{quoteIntent:a,fsm:l}=qt(e=>({quoteIntent:null==e?void 0:e.getQuoteIntent()})),c=null===(t=null==a?void 0:a.organisation)||void 0===t?void 0:t.admin_email,d=null===(n=null==a?void 0:a.organisation)||void 0===n?void 0:n.phone,u=c||d,h=fs(null===(r=null==a?void 0:a.organisation)||void 0===r?void 0:r.client_settings,"referral"),m=null!==(i=h.steps)&&void 0!==i?i:["Our team will review your application within 1-2 business days","We'll contact you with either approval or additional requirements","If approved, we'll provide you with payment options to complete your purchase"],f=Et.create("referral-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),p=Et.create("referral-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),g=Et.create("referral-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),y=Et.create("referral-header",{textAlign:"center",marginBottom:St.spacing.xl}),v=Et.create("referral-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),w=Et.create("referral-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),b=Et.create("referral-process-box",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg,marginBottom:St.spacing.xl}),x=Et.create("referral-process-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.accentForeground,marginBottom:St.spacing.md,marginTop:"0"}),k=Et.create("referral-process-list",{listStyle:"none",padding:"0",margin:"0",display:"flex",flexDirection:"column",gap:St.spacing.sm}),S=Et.create("referral-process-item",{display:"flex",alignItems:"flex-start",fontSize:St.fontSize.small,color:St.colors.accentForeground,lineHeight:"1.6"}),N=Et.create("referral-bullet",{width:"1.5rem",height:"1.5rem",backgroundColor:St.colors.primary,color:St.colors.primaryForeground,borderRadius:"50%",marginRight:St.spacing.sm,flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.75rem",fontWeight:"600"}),_=Et.create("referral-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),C=Et.create("referral-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),$=Et.create("referral-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:St.spacing.lg}),I=Et.create("referral-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.md}),T=Et.create("referral-new-request",{textAlign:"center",marginTop:St.spacing.md}),E=Et.create("referral-new-request-link",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:"0",fontFamily:"inherit"});return Ye(os,{title:"Quote Under Review",description:"We'll get back to you",hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:f,children:[Ye("div",{className:p,children:Ye(()=>Ye("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:g,children:[Ye("path",{d:"M7 10v12"}),Ye("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"})]}),{})}),Ye("div",{className:y,children:[Ye("h1",{className:v,children:null!==(o=h.title)&&void 0!==o?o:"Thanks for your quote request!"}),h.body?Ye(cs,{source:h.body,className:w}):Ye("p",{className:w,children:"Our team is reviewing your details and will come back to you with a personalised quote."})]}),Ye("div",{className:b,children:[Ye("h3",{className:x,children:"What happens next?"}),Ye("ul",{className:k,children:m.map((e,t)=>Ye("li",{className:S,children:[Ye("span",{className:N,children:t+1}),Ye("span",{children:e})]},t))})]}),u&&Ye("div",{className:_,children:[Ye("p",{className:C,children:"Need to speak with someone about your quote?"}),Ye("div",{className:$,children:[d&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${d}`),children:[Ye("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:Ye("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"]}),c&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${c}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(null===(s=e.quote_intent)||void 0===s?void 0:s.reference)&&Ye("div",{className:I,children:["Quote Reference: ",Ye("strong",{children:e.quote_intent.reference})]})]}),Ye("div",{className:T,children:Ye("button",{type:"button",className:E,onClick:()=>null==l?void 0:l.reset(),children:"Start a new quote"})})]})})})})}function ta({results:e}){const{calculationResultV2:t}=qt(e=>({calculationResultV2:e.getCalculationResultV2()}));return"referral"===e.outcome_type?Ye(ea,{results:e}):t?Ye(Qs,{}):Ye(Us,{results:e})}function na(e,t){return n=e?.use_custom_options?t||e?.options||[]:e?.options||t||[],r=e?.options_sort,r&&"default"!==r?[...n].sort((e,t)=>e.label.localeCompare(t.label,void 0,"numerical"===r?{numeric:!0}:void 0)):[...n];var n,r}function ra({value:e,onChange:t,name:n,id:r,placeholder:i,required:o,disabled:s,className:a,hasError:l,prefix:c="$"}){const d=ct(null),[u,h]=at("");function m(e){if(!e)return"";const t=e.replace(/[^\d.]/g,"");if(!t)return"";const n=t.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}lt(()=>{h(null!=e&&""!==e?m(e):"")},[e]);const f=Et.create("money-input-wrapper",{position:"relative",display:"flex",alignItems:"center"}),p=Et.create("money-input-prefix",{position:"absolute",left:"1rem",color:St.colors.mutedForeground,pointerEvents:"none",fontSize:"14px",userSelect:"none"}),g=Et.create("money-input-with-prefix",{paddingLeft:c?"2rem":"1rem"});return Ye("div",{className:f,children:[c&&Ye("span",{className:p,children:c}),Ye("input",{ref:d,type:"text",inputMode:"decimal",name:n,id:r,value:u,onInput:function(e){const n=e.currentTarget,r=n.selectionStart||0,i=u,o=n.value.replace(/[^\d.]/g,""),s=m(o);h(s),t(o),requestAnimationFrame(()=>{if(d.current){const e=function(e,t,n){let r=n+(t.length-e.length);return r=Math.max(0,Math.min(r,t.length)),r}(i,s,r);d.current.setSelectionRange(e,e)}})},onBlur:function(){u&&u.includes(".")},placeholder:i,required:o,disabled:s,className:Ot(a,c&&g)})]})}function ia(e){var t,n;const r=Et.create("input",{width:"100%",maxWidth:"100%",minWidth:"0",boxSizing:"border-box",height:"2.75rem",paddingLeft:"1.25rem",paddingRight:"1.25rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,transition:St.transition,outline:"none",boxShadow:"none"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"0.75rem"}}),i=Et.create("input-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),o=e.hasError?`${r} ${i}`:r,s=Et.name("input");Et.pseudoElement("input",":focus",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const a=Et.create("select",{width:"100%",minWidth:"0",boxSizing:"border-box",height:`calc(2.75rem - (${St.borderWidth} * 2))`,paddingLeft:"1.25rem",paddingRight:"2.5rem",paddingTop:"0.625rem",paddingBottom:"0.625rem",border:"none",fontSize:St.fontSize.default,backgroundColor:"transparent",color:St.colors.foreground,outline:"none",WebkitAppearance:"none",appearance:"none",textOverflow:"ellipsis"},{"(max-width: 480px)":{paddingLeft:"0.75rem",paddingRight:"2rem"}}),l=Et.create("select-wrapper",{position:"relative",minWidth:"0",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,backgroundColor:St.colors.card,transition:St.transition,outline:"none",boxShadow:"none"}),c=Et.create("select-wrapper-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),d=e.hasError?`${l} ${c}`:l,u=Et.name("select-wrapper");Et.pseudoElement("select-wrapper",":focus-within",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const{onChange:h,onBlur:m,onKeyDown:f,className:p,validation:g,errors:y,suffix:v,...w}=e;function b(e){h(e.currentTarget.value)}function x(e){h(e.currentTarget.value)}function k(e){m&&m(e.currentTarget.value)}if("select"===e.type){const S=e.null_option_label||"N/A",N=na(e.validation,e.options),_=!w.value&&!e.add_null_option,C=Et.create("select-placeholder",{color:St.colors.mutedForeground}),$=Et.create("select-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:St.colors.mutedForeground});return Ye("div",{className:Ot(d,u),children:[Ye("select",{...w,onChange:b,className:Ot(a,_&&C),children:[_&&Ye("option",{value:"",disabled:!0,selected:!0,children:"Select..."}),e.add_null_option&&Ye("option",{value:"",children:S}),N.map(e=>Ye("option",{value:e.value,children:e.label},e.value))]}),Ye("svg",{className:$,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:Ye("path",{d:"M6 9l6 6 6-6"})})]})}if("radio"===e.type){const I=e.null_option_label||"N/A",T=na(e.validation,e.options),E=Et.create(e.inline?"radio-container-inline":"radio-container",{display:"flex",flexDirection:e.inline?"row":"column",gap:e.inline?"1rem":"0.5rem",flexWrap:e.inline?"wrap":"nowrap"}),P=Et.create("radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer",fontSize:St.fontSize.default,color:St.colors.foreground}),R=Et.create("radio-input",{accentColor:St.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),z=Et.name("radio-input");return Et.pseudoElement("radio-input",":focus",{outline:`3px solid color-mix(in srgb, ${St.colors.primary} 30%, transparent)`,outlineOffset:"2px"}),Ye("div",{className:E,children:[e.add_null_option&&Ye("label",{className:P,children:[Ye("input",{type:"radio",name:e.name,value:"",checked:""===e.value,onChange:()=>h(""),className:Ot(R,z)}),Ye("span",{children:I})]}),T.map(t=>Ye("label",{className:P,children:[Ye("input",{type:"radio",name:e.name,value:t.value,checked:e.value===t.value,onChange:()=>h(t.value),className:Ot(R,z)}),Ye("span",{children:t.label})]},t.value))]})}if("date"===e.type){const D=Et.create("input-date",{height:"2.75rem",minHeight:"2.75rem",maxHeight:"2.75rem",WebkitAppearance:"none",appearance:"none"});return Ye("input",{...w,type:"date",min:null===(t=e.validation)||void 0===t?void 0:t.minDate,max:null===(n=e.validation)||void 0===n?void 0:n.maxDate,onInput:x,onChange:b,className:Ot(o,s,D,p)})}if("monthyear"===e.type)return Ye(sa,{id:e.id,name:e.name,value:e.value,required:e.required,disabled:e.disabled,hasError:e.hasError,onChange:h,selectWrapperBaseClass:l,selectWrapperErrorClass:c,selectWrapperBaseClassName:u,selectBaseClassName:a});if("year"===e.type){const M=(new Date).getFullYear();return Ye("input",{...w,type:"number",min:M-100,max:M,placeholder:"YYYY",onInput:x,onChange:b,className:Ot(o,s,p)})}if("money"===e.type)return Ye(ra,{value:e.value,onChange:h,name:e.name,id:e.id,placeholder:e.placeholder,required:e.required,disabled:e.disabled,className:Ot(o,s,p),hasError:e.hasError});if("checkbox"===e.type){const O=!0===e.value||"true"===e.value||"true"===e.value,j=Et.create("checkbox-wrapper",{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"1.25rem",height:"1.25rem",flexShrink:"0"}),W=Et.create("checkbox-"+(O?"checked":"unchecked"),{appearance:"none",width:"1.25rem",height:"1.25rem",border:`2px solid ${O?St.colors.primary:e.hasError?St.colors.destructive:St.colors.input}`,borderRadius:"0.375rem",cursor:"pointer",backgroundColor:O?St.colors.primary:St.colors.card,transition:St.transition,position:"absolute"}),A=Et.name("checkbox-"+(O?"checked":"unchecked"));function L(e){e.preventDefault(),h(O?"false":"true")}return Et.pseudoElement("checkbox-"+(O?"checked":"unchecked"),":focus",{outline:"none",boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:"0.375rem"}),Ye("div",{className:j,children:[Ye("input",{type:"checkbox",id:e.id,name:e.name,checked:O,onClick:L,className:Ot(W,A,p),required:e.required,readOnly:!0}),O&&Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:St.colors.primaryForeground,"stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",style:{pointerEvents:"none",position:"relative",zIndex:1},children:Ye("path",{d:"M20 6 9 17l-5-5"})})]})}if("boolean"===e.type){const B=Et.create("boolean-container",{display:"flex",flexDirection:"column",gap:"1rem"}),q=Et.create("boolean-radio-group",{display:"flex",gap:"1rem"}),F=Et.create("boolean-radio-label",{display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer"}),H=Et.create("boolean-radio",{accentColor:St.colors.primary,width:"1.25rem",height:"1.25rem",cursor:"pointer",marginRight:"0.25rem"}),U=Et.name("boolean-radio");Et.pseudoElement("boolean-radio",":focus",{outline:`3px solid color-mix(in srgb, ${St.colors.primary} 30%, transparent)`,outlineOffset:"2px"});const Y=Et.create("boolean-textarea",{width:"100%",boxSizing:"border-box",minHeight:"5rem",padding:"1rem",border:`${St.borderWidth} solid ${St.colors.input}`,borderRadius:St.radius.default,fontSize:St.fontSize.default,backgroundColor:St.colors.card,color:St.colors.foreground,transition:St.transition,outline:"none",boxShadow:"none",resize:"vertical",fontFamily:St.fontFamily}),Z=Et.create("boolean-textarea-error",{border:`${St.borderWidth} solid ${St.colors.destructive}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 20%, transparent)`}),V=e.hasError?`${Y} ${Z}`:Y,G=Et.name("boolean-textarea");Et.pseudoElement("boolean-textarea",":focus",{border:`${St.borderWidth} solid ${St.colors.primary}`,boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.primary} 20%, transparent)`,borderRadius:St.radius.default});const Q=!0===e.value||"true"===e.value,J=!1===e.value||"false"===e.value,K=e.answer||"",X=e.booleanConfig,ee=(null==X?void 0:X.enable_details_textbox)&&("yes"===X.show_details_on&&Q||"no"===X.show_details_on&&J);function te(t){h(t),(!(null==X?void 0:X.enable_details_textbox)||!("yes"===X.show_details_on&&"true"===t||"no"===X.show_details_on&&"false"===t))&&e.onAnswerChange&&K&&e.onAnswerChange("")}return Ye("div",{className:Ot(B,p),children:[Ye("div",{className:q,children:[Ye("label",{className:F,children:[Ye("input",{type:"radio",name:e.name,checked:Q,onChange:()=>te("true"),className:Ot(H,U)}),Ye("span",{children:"Yes"})]}),Ye("label",{className:F,children:[Ye("input",{type:"radio",name:e.name,checked:J,onChange:()=>te("false"),className:Ot(H,U)}),Ye("span",{children:"No"})]})]}),ee&&Ye("textarea",{placeholder:(null==X?void 0:X.details_placeholder)||"Please provide details",value:K,required:!0,onInput:t=>{return n=t.target.value,void(e.onAnswerChange&&e.onAnswerChange(n));var n},className:Ot(V,G)})]})}return v?Ye("div",{className:Et.create("input-with-suffix",{display:"flex",alignItems:"center",gap:St.spacing.sm,minWidth:"0",maxWidth:"100%"}),children:[Ye("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Ot(o,s,p),style:{flex:1,minWidth:0}}),v]}):Ye("input",{...w,onInput:x,onChange:b,onBlur:k,onKeyDown:f,className:Ot(o,s,p)})}const oa=[{value:"01",label:"January"},{value:"02",label:"February"},{value:"03",label:"March"},{value:"04",label:"April"},{value:"05",label:"May"},{value:"06",label:"June"},{value:"07",label:"July"},{value:"08",label:"August"},{value:"09",label:"September"},{value:"10",label:"October"},{value:"11",label:"November"},{value:"12",label:"December"}];function sa(e){const t=e.value||"",n=t.length>=7?t.substring(5,7):"",r=t.length>=4?t.substring(0,4):"",[i,o]=at(n),[s,a]=at(r),[l,c]=at(!1),[d,u]=at(!1),[h,m]=at(!(!n||!r));lt(()=>{o(n),a(r),m(!(!n||!r))},[e.value]);const f=(new Date).getFullYear(),p=[];for(let e=f;e>=f-100;e--)p.push(e);function g(t,n){if(t&&n)return m(!0),void e.onChange(`${n}-${t}-01`);h&&e.onChange("")}const y=!!i!=!!s&&l&&d&&!e.required,v=!i&&l&&(e.hasError||y),w=!s&&d&&(e.hasError||y),b=v?`${e.selectWrapperBaseClass} ${e.selectWrapperErrorClass}`:e.selectWrapperBaseClass,x=w?`${e.selectWrapperBaseClass} ${e.selectWrapperErrorClass}`:e.selectWrapperBaseClass,k=Et.create("monthyear-row",{display:"flex",gap:St.spacing.sm,minWidth:"0"}),S=Et.create("monthyear-item",{flex:"1 1 0",minWidth:"0"}),N=Et.create("monthyear-placeholder",{color:St.colors.mutedForeground}),_=Et.create("monthyear-chevron",{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:St.colors.mutedForeground}),C=Et.create("monthyear-partial-error",{marginTop:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.destructive}),$=Ye("svg",{className:_,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:Ye("path",{d:"M6 9l6 6 6-6"})}),I=!i,T=!s,E=!e.required;return Ye("div",{children:[Ye("div",{className:k,children:[Ye("div",{className:Ot(b,e.selectWrapperBaseClassName,S),children:[Ye("select",{id:e.id,name:e.name,required:e.required,disabled:e.disabled,value:i,onChange:function(e){const t=e.currentTarget.value;o(t),c(!0),g(t,s)},onBlur:function(){c(!0)},className:Ot(e.selectBaseClassName,I&&N),children:[I?Ye("option",{value:"",disabled:!0,selected:!0,children:"Month"}):E&&Ye("option",{value:"",children:"— None —"}),oa.map(e=>Ye("option",{value:e.value,children:e.label},e.value))]}),$]}),Ye("div",{className:Ot(x,e.selectWrapperBaseClassName,S),children:[Ye("select",{id:`${e.id}__year`,required:e.required,disabled:e.disabled,value:s,onChange:function(e){const t=e.currentTarget.value;a(t),u(!0),g(i,t)},onBlur:function(){u(!0)},className:Ot(e.selectBaseClassName,T&&N),children:[T?Ye("option",{value:"",disabled:!0,selected:!0,children:"Year"}):E&&Ye("option",{value:"",children:"— None —"}),p.map(e=>Ye("option",{value:String(e),children:e},e))]}),$]})]}),y&&Ye("div",{className:C,children:"Please select both month and year, or clear both."})]})}function aa(e,t){const{fsm:n,lastUpdated:r}=qt(e=>{var t,n;return{lastUpdated:null!==(n=null===(t=e.getFormProgress())||void 0===t?void 0:t.last_updated)&&void 0!==n?n:null}}),[i,o]=at({kind:"idle"}),s=dt(()=>{var t;for(let n=0;n<e.length;n++)if((null!==(t=e[n].fields)&&void 0!==t?t:[]).some(e=>"client_email"===e.code))return n;return-1},[e]);return{showContinueLater:s>=0&&t.includes(s),lastUpdated:r,continueLaterStatus:i,sendContinueLaterEmail:async function(){var e,t;const r=function(){const e=null==n?void 0:n.getFormProgress(),t=null==e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null}();if(!r)return void o({kind:"error",message:"Email address not found. Please fill in your email first."});const i=null===(e=null==n?void 0:n.getQuoteIntent())||void 0===e?void 0:e.id;if(i)try{o({kind:"sending"}),await(null===(t=null==n?void 0:n.httpClient)||void 0===t?void 0:t.continueLater(i,r)),o({kind:"sent"})}catch(e){o({kind:"error",message:"Failed to send link. Please try again."})}},copyContinueLaterLink:async function(){var e,t;const r=null===(e=null==n?void 0:n.getQuoteIntent())||void 0===e?void 0:e.id;if(!r)return;const i=function(e){var t,r;const i=null==n?void 0:n.getQuoteIntent(),o=null!==(t=null==i?void 0:i.short_code)&&void 0!==t?t:e,s=null===(r=null==i?void 0:i.organisation)||void 0===r?void 0:r.quote_page_url;if(s){const e=s.replace(/\/+$/,""),t=e.includes("?")?"&":"?";return`${e}${t}q=${o}`}return`${window.location.origin}${window.location.pathname}?q=${o}`}(r);try{if(null===(t=null===navigator||void 0===navigator?void 0:navigator.clipboard)||void 0===t?void 0:t.writeText)await navigator.clipboard.writeText(i);else{const e=document.createElement("textarea");e.value=i,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}o({kind:"copied"})}catch(e){o({kind:"error",message:"Could not copy link. Please copy manually."})}},resetContinueLaterStatus:function(){o({kind:"idle"})},clearTransientStatus:function(){o(e=>"sent"===e.kind?e:{kind:"idle"})},confirmReset:function(){null==n||n.reset()}}}function la({isOpen:e,onClose:t,onConfirm:n}){return Ye(Bs,{isOpen:e,onClose:t,title:"Reset your progress?",description:"This will clear everything you've entered so far and start the form over. This cannot be undone.",footer:Ye(C,{children:[Ye(as,{variant:"outline",onClick:t,children:"Cancel"}),Ye(as,{onClick:function(){n(),t()},children:"Reset progress"})]})})}function ca({pages:e,currentPageIndex:n,completedPages:r,incompletePages:i}){const{fsm:o,isSaving:s}=qt(e=>({isSaving:e.getIsSaving()})),{showContinueLater:a,lastUpdated:l,continueLaterStatus:c,sendContinueLaterEmail:d,copyContinueLaterLink:u,clearTransientStatus:h,confirmReset:m}=aa(e,r),[f,p]=at(!1),[g,y]=at(!1),v=ct(null),w=ct(null);t(e.length),t(e.map((e,t)=>({index:t,id:e.id,title:e.title})));const b=(()=>{var e;const t=null===(e=null==o?void 0:o.getFormProgress())||void 0===e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})();lt(()=>{if(v.current&&w.current){const e=w.current,t=v.current,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top<n.top||r.bottom>n.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}},[n]);const x=Math.round((n+1)/e.length*100),k=Et.create("sidebar-nav-item-base",{display:"flex",alignItems:"flex-start",gap:St.spacing.sm,padding:`${St.spacing.sm} ${St.spacing.sm}`,borderRadius:St.radius.default,border:"none",backgroundColor:"transparent",color:St.colors.foreground,cursor:"pointer",transition:St.transition,textAlign:"left",width:"100%",fontFamily:St.fontFamily,fontSize:St.fontSize.small,opacity:"1"}),S=Et.create("sidebar-nav-item-active",{backgroundColor:St.colors.accent,color:St.colors.accentForeground}),N=Et.create("sidebar-nav-item-disabled",{cursor:"not-allowed",opacity:"0.5"});Et.pseudoElement("sidebar-nav-item-base",":hover",{backgroundColor:St.colors.muted}),Et.pseudoElement("sidebar-nav-item-active",":hover",{backgroundColor:St.colors.accent});const _=Et.create("sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",marginTop:"0.125rem",backgroundColor:St.colors.muted,color:St.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),C=Et.create("sidebar-indicator-active",{backgroundColor:St.colors.accentForeground,color:St.colors.accent}),$=Et.create("sidebar-indicator-completed",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground}),I=Et.create("sidebar-indicator-revision-cleared",{backgroundColor:St.colors.destructive,color:"#ffffff",boxShadow:`0 0 0 3px color-mix(in srgb, ${St.colors.destructive} 22%, transparent)`}),T=Et.create("sidebar-page-title-base",{fontWeight:"500",fontSize:"0.875rem",lineHeight:"1.7",wordWrap:"break-word",overflowWrap:"break-word"}),E=Et.create("sidebar-page-title-active",{fontWeight:"600"});return Ye("div",{className:Et.create("sidebar-navigation",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm,alignSelf:"flex-start",display:"flex",flexDirection:"column",gap:St.spacing.lg}),children:[Ye("div",{className:Et.create("sidebar-progress-container",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[Ye("span",{className:Et.create("sidebar-progress-text",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:["Step ",n+1," of ",e.length]}),Ye("div",{className:Et.create("sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:St.colors.muted,borderRadius:St.radius.small,overflow:"hidden"}),children:Ye("div",{className:Et.create("sidebar-progress-fill",{height:"100%",backgroundColor:St.colors.primary,borderRadius:St.radius.small,transition:St.transition}),style:{width:`${x}%`}})})]}),Ye("hr",{className:Et.create("sidebar-divider",{borderColor:St.colors.border})}),Ye("nav",{ref:w,className:Et.create("sidebar-nav",{display:"flex",flexDirection:"column",gap:St.spacing.sm,maxHeight:"calc(100vh - 400px)",overflowY:"auto",overflowX:"hidden",paddingRight:St.spacing.sm}),children:e.map((e,a)=>{const l=a===n,c=function({page:e,index:t,currentPageIndex:n,completedPages:r,incompletePages:i}){const o=t===n,s=r.includes(t)||r.includes(e.id);return(null==i?void 0:i.includes(e.id))?"revision-cleared":s?"completed":o?"current":"pending"}({page:e,index:a,currentPageIndex:n,completedPages:r,incompletePages:i}),d="completed"===c,u="revision-cleared"===c,h=o.canNavigateToPage(a);a===n&&t(e.title);const m=[k];l&&m.push(S),h&&!s||m.push(N);const f=m.join(" "),p=[_];d?p.push($):u?p.push(I):l&&p.push(C);const g=p.join(" ");return Ye("button",{ref:l?v:null,onClick:()=>{return e=a,void((null==o?void 0:o.canNavigateToPage(e))&&o.navigateToPage(e));var e},disabled:!h||s,className:f,"data-page-state":c,children:[Ye("div",{className:g,"data-testid":u?`page-revision-indicator-${e.id}`:void 0,children:d?Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})}):u?Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3.5","stroke-linecap":"round","stroke-linejoin":"round",children:[Ye("line",{x1:"12",y1:"7",x2:"12",y2:"14"}),Ye("line",{x1:"12",y1:"18",x2:"12.01",y2:"18"})]}):a+1}),Ye("div",{className:Et.create("sidebar-nav-text",{display:"flex",flexDirection:"column",gap:"0.125rem",flex:"1",minWidth:"0"}),children:Ye("span",{className:l?`${T} ${E}`:T,children:e.title})})]},e.id)})}),l&&Ye("div",{className:Et.create("sidebar-footer",{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"}),children:[Ye("div",{className:Et.create("sidebar-last-saved",{fontSize:"0.6875rem",color:St.colors.mutedForeground,textAlign:"center",opacity:"0.6",fontStyle:"italic"}),children:["Last saved: ",rs.fromJSDate(new Date(l)).toFormat("T")]}),Ye("button",{onClick:()=>y(!0),className:Et.create("sidebar-reset-link",{background:"none",border:"none",padding:"0",fontSize:"0.6875rem",color:St.colors.mutedForeground,opacity:"0.5",cursor:"pointer",textDecoration:"underline",fontFamily:St.fontFamily}),children:"Reset progress"})]}),a&&Ye("button",{onClick:()=>{h(),p(!0)},className:Et.create("sidebar-continue-later-button",{padding:`${St.spacing.sm} ${St.spacing.md}`,border:`${St.borderWidth} solid ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:"transparent",color:St.colors.mutedForeground,fontSize:St.fontSize.small,fontFamily:St.fontFamily,cursor:"pointer",transition:St.transition,textAlign:"center",width:"100%"}),children:"Continue Later"}),Ye(qs,{isOpen:f,onClose:()=>p(!1),status:c,onSendEmail:d,onCopyLink:u,email:b}),Ye(la,{isOpen:g,onClose:()=>y(!1),onConfirm:m})]})}function da({pages:e,currentPageIndex:t,completedPages:n}){const{fsm:r,isSaving:i}=qt(e=>({fsm:e,isSaving:null==e?void 0:e.getIsSaving()})),[o,s]=at(!1),a=Math.round((t+1)/e.length*100),l=Et.create("mobile-sidebar-item-base",{display:"flex",alignItems:"center",gap:St.spacing.sm,padding:St.spacing.sm,border:"none",borderRadius:St.radius.default,backgroundColor:"transparent",color:St.colors.foreground,cursor:"pointer",opacity:"1",transition:St.transition,width:"100%",textAlign:"left",fontFamily:St.fontFamily}),c=Et.create("mobile-sidebar-item-active",{backgroundColor:St.colors.accent,color:St.colors.accentForeground}),d=Et.create("mobile-sidebar-item-disabled",{cursor:"not-allowed",opacity:"0.5"}),u=Et.create("mobile-sidebar-indicator-base",{width:"1.25rem",height:"1.25rem",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",backgroundColor:St.colors.muted,color:St.colors.mutedForeground,fontSize:"0.75rem",fontWeight:"600"}),h=Et.create("mobile-sidebar-indicator-active",{backgroundColor:St.colors.accentForeground,color:St.colors.accent}),m=Et.create("mobile-sidebar-indicator-completed",{backgroundColor:St.colors.primary,color:St.colors.primaryForeground}),f=Et.create("mobile-sidebar-page-title-base",{fontSize:St.fontSize.small,fontWeight:"500"}),p=Et.create("mobile-sidebar-page-title-active",{fontWeight:"600"});return Ye("div",{className:Et.create("mobile-sidebar",{overflow:"hidden"}),children:[Ye("button",{onClick:()=>s(!o),className:Et.create("mobile-sidebar-header",{width:"100%",padding:St.spacing.md,border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[Ye("div",{className:Et.create("mobile-sidebar-header-row",{display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[Ye("span",{className:Et.create("mobile-sidebar-step-text",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:["Step ",t+1," of ",e.length]}),Ye("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:Et.create("mobile-sidebar-chevron",{transition:St.transition,transform:o?"rotate(180deg)":"rotate(0deg)",color:St.colors.mutedForeground}),children:Ye("path",{d:"m6 9 6 6 6-6"})})]}),Ye("div",{className:Et.create("mobile-sidebar-progress-bg",{width:"100%",height:"0.5rem",backgroundColor:St.colors.muted,borderRadius:St.radius.small,overflow:"hidden"}),children:Ye("div",{className:Et.create("mobile-sidebar-progress-fill",{height:"100%",backgroundColor:St.colors.primary,borderRadius:St.radius.small,transition:St.transition}),style:{width:`${a}%`}})})]}),Ye("hr",{className:Et.create("mobile-sidebar-border",{borderColor:St.colors.border})}),o&&Ye("div",{className:Et.create("mobile-sidebar-content",{padding:St.spacing.sm,display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"300px",overflowY:"auto"}),children:e.map((e,o)=>{const a=o===t,g=n.includes(o),y=r.canNavigateToPage(o),v=[l];a&&v.push(c),y&&!i||v.push(d);const w=v.join(" "),b=[u];g?b.push(m):a&&b.push(h);const x=b.join(" ");return Ye("button",{onClick:()=>{return e=o,void((null==r?void 0:r.canNavigateToPage(e))&&(r.navigateToPage(e),s(!1)));var e},disabled:!y||i,className:w,children:[Ye("div",{className:x,children:g?Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})}):o+1}),Ye("span",{className:a?`${f} ${p}`:f,children:e.title})]},e.id)})})]})}function ua({pages:e,completedPages:t}){const{fsm:n}=qt(()=>({})),{showContinueLater:r,lastUpdated:i,continueLaterStatus:o,sendContinueLaterEmail:s,copyContinueLaterLink:a,clearTransientStatus:l,confirmReset:c}=aa(e,t),[d,u]=at(!1),[h,m]=at(!1);if(!i&&!r)return null;const f=(()=>{var e;const t=null===(e=null==n?void 0:n.getFormProgress())||void 0===e?void 0:e.page_data;if(!t)return null;for(const e in t){const n=t[e];if(null==n?void 0:n.client_email)return n.client_email}return null})(),p=Et.create("mobile-form-actions-container",{display:"flex",justifyContent:"center",alignItems:"center",gap:St.spacing.lg,paddingTop:St.spacing.sm,paddingBottom:St.spacing.sm}),g=Et.create("mobile-form-actions-link",{background:"none",border:"none",padding:"0",fontSize:"0.75rem",color:St.colors.mutedForeground,opacity:"0.6",cursor:"pointer",textDecoration:"underline",fontFamily:St.fontFamily});return Ye("div",{className:p,children:[i&&Ye("button",{type:"button",onClick:()=>m(!0),className:g,children:"Reset progress"}),r&&Ye("button",{type:"button",onClick:()=>{l(),u(!0)},className:g,children:"Continue later"}),Ye(qs,{isOpen:d,onClose:()=>u(!1),status:o,onSendEmail:s,onCopyLink:a,email:f}),Ye(la,{isOpen:h,onClose:()=>m(!1),onConfirm:c})]})}function ha({organisation:e}){return Ye("div",{className:Et.create("welcome-card",{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},{"(max-width: 950px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("welcome-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 950px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:St.spacing.sm}}),children:["Thank you for choosing ",e.name,"."]}),Ye("p",{className:Et.create("welcome-text",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.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."}),Ye("hr",{className:Et.create("welcome-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]})}function ma({title:e,description:t}){return Ye(os,{title:e,description:t,children:Ye(Wt,{children:Ye(ls,{className:Et.name("error-container"),children:Ye("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:[Ye("path",{d:"M4.929 4.929 19.07 19.071"}),Ye("circle",{cx:"12",cy:"12",r:"10"})]})})})})}function fa({errors:e,className:t}){return e&&0!==e.length?Ye("div",{className:Et.create("field-error",{color:St.colors.destructive,fontSize:St.fontSize.small,marginTop:"0.25rem",display:"flex",flexDirection:"column",gap:"0.125rem"}),children:e.map((e,t)=>Ye("span",{className:Et.create("field-error-message",{lineHeight:"1.4"}),children:e.message},t))}):null}function pa({htmlFor:e,label:t,children:n,required:r,tooltip:i,...o}){const[s,a]=at({visible:!1,top:0,left:0,flipped:!1}),l=ct(null),c=ut(()=>{const e=l.current;if(!e)return;const t=e.getBoundingClientRect(),n=!(t.top>68),r=n?t.bottom+8:t.top-8,i=t.left+t.width/2;a({visible:!0,top:r,left:i,flipped:n})},[]),d=ut(()=>{a(e=>({...e,visible:!1}))},[]);return Ye("label",{for:e,className:Et.create("label",{display:"flex",flexDirection:"column",minWidth:"0"}),...o,children:[Ye("span",{className:Et.create("label-text",{marginBottom:St.spacing.sm,fontSize:St.fontSize.default,fontWeight:"600",display:"flex",alignItems:"center",gap:St.spacing.sm,color:St.colors.foreground}),children:[Ye("span",{children:r?Ye(C,{children:[t.includes(" ")?t.substring(0,t.lastIndexOf(" ")+1):"",Ye("span",{style:{whiteSpace:"nowrap"},children:[t.includes(" ")?t.substring(t.lastIndexOf(" ")+1):t,Ye("span",{className:Et.create("label-required-indicator",{color:St.colors.destructive}),children:"*"})]})]}):t}),i&&Ye("span",{ref:l,className:Et.create("tooltip-container",{position:"relative",display:"inline-flex"}),onMouseEnter:c,onMouseLeave:d,children:[Ye("svg",{className:Et.create("tooltip-icon",{width:"1rem",height:"1rem",color:St.colors.mutedForeground,cursor:"help"}),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[Ye("circle",{cx:"12",cy:"12",r:"10",strokeWidth:"2"}),Ye("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Ye("circle",{cx:"12",cy:"17",r:"0.5",fill:"currentColor",strokeWidth:"0"})]}),s.visible&&Ye("span",{style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,transform:s.flipped?"translateX(-50%)":"translateX(-50%) translateY(-100%)",padding:"0.5rem 0.75rem",backgroundColor:St.colors.popover,color:St.colors.popoverForeground,fontSize:"0.875rem",borderRadius:St.radius.default,whiteSpace:"normal",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",zIndex:1e4,minWidth:"200px",maxWidth:"300px",pointerEvents:"none"},children:[i,Ye("span",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...s.flipped?{bottom:"100%",borderBottom:`6px solid ${St.colors.popover}`}:{top:"100%",borderTop:`6px solid ${St.colors.popover}`}}})]})]})]}),n]})}function ga(e){const t={"(max-width: 600px)":{gridColumn:"span 12 / span 12"}};switch(null!=e?e:100){case 25:return Et.create("field-wrapper-25",{gridColumn:"span 3 / span 3"},t);case 33:return Et.create("field-wrapper-33",{gridColumn:"span 4 / span 4"},t);case 50:return Et.create("field-wrapper-50",{gridColumn:"span 6 / span 6"},t);case 66:return Et.create("field-wrapper-66",{gridColumn:"span 8 / span 8"},t);case 75:return Et.create("field-wrapper-75",{gridColumn:"span 9 / span 9"},t);default:return Et.create("field-wrapper-100",{gridColumn:"span 12 / span 12"})}}function ya(e){return e?e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,t,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">${t}</a>`:e}):""}function va({code:e,isOpen:t,onClose:n}){var r,i;const{httpClient:o}=qt(e=>({httpClient:e.httpClient})),[s,a]=at(null!==(r=J(e))&&void 0!==r?r:null),[l,c]=at(null),[d,u]=at(!1);lt(()=>{if(!t)return;const n=J(e);n?a(n):(u(!0),c(null),o.getDocument(e).then(t=>{var n;const r=null!==(n=null==t?void 0:t.data)&&void 0!==n?n:t,i={name:r.name,content:r.content};!function(e,t){Q.set(e,t)}(e,i),a(i),u(!1)}).catch(e=>{c(e instanceof Error?e.message:"Unable to load document."),u(!1)}))},[t,e,o]);const h=Et.create("document-modal-body",{fontSize:St.fontSize.small,lineHeight:"1.55",color:St.colors.foreground});return Et.pseudoElement("document-modal-body"," p",{margin:"0 0 0.85em"}),Et.pseudoElement("document-modal-body"," p:last-child",{marginBottom:"0"}),Et.pseudoElement("document-modal-body"," ul",{margin:"0 0 0.85em",paddingLeft:"1.5em",listStyleType:"disc",listStylePosition:"outside"}),Et.pseudoElement("document-modal-body"," ol",{margin:"0 0 0.85em",paddingLeft:"1.75em",listStyleType:"decimal",listStylePosition:"outside"}),Et.pseudoElement("document-modal-body"," li",{marginBottom:"0.25em"}),Ye(Bs,{isOpen:t,onClose:n,title:null!==(i=null==s?void 0:s.name)&&void 0!==i?i:"Loading...",width:"720px",children:[d&&Ye("p",{style:{margin:0,color:"#6b7280"},children:"Loading…"}),l&&Ye("p",{style:{margin:0,color:"#b91c1c"},children:l}),!d&&!l&&s&&Ye("div",{className:h,children:Ye(cs,{source:s.content})})]})}function wa({field:e,errors:t,children:n,className:r}){const i=e.code||e.id,o=(null==t?void 0:t.filter(e=>e.field===i))||[],[s,a]=at(!1),l=Et.create("validated-field",{display:"flex",flexDirection:"column",gap:St.spacing.sm,minWidth:"0"});if("notice"===e.type){const t=Et.create("notice-field",{display:"flex",gap:St.spacing.sm,padding:St.spacing.md,backgroundColor:St.colors.accent,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),n=Et.create("notice-icon",{flexShrink:"0",fontSize:St.fontSize.default,lineHeight:"1.6"}),r=Et.create("notice-text",{fontSize:St.fontSize.small,color:St.colors.foreground,lineHeight:"1.6"});return Ye("div",{className:Ot(ga(e.width)),children:Ye("div",{className:t,children:[Ye("span",{className:n,children:"ⓘ"}),Ye("div",{className:r,children:[e.label&&Ye("strong",{children:e.label}),e.label&&e.description&&Ye("br",{}),e.description&&Ye("span",{children:e.description})]})]})})}if("section"===e.type){const t=Et.create("section-separator",{display:"flex",alignItems:"center",gap:St.spacing.md}),n=Et.create("section-line",{flex:"1",height:"1px",backgroundColor:St.colors.border}),r=Et.create("section-title",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.mutedForeground,whiteSpace:"nowrap"});return Ye("div",{className:Ot(ga(e.width)),children:Ye("div",{className:t,children:e.label?Ye(C,{children:[Ye("div",{className:n}),Ye("span",{className:r,children:e.label}),Ye("div",{className:n})]}):Ye("div",{className:n})})})}if("checkbox"===e.type){const t=Et.create("checkbox-field-container",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),c=Et.create("checkbox-field-row",{display:"flex",alignItems:"flex-start",gap:"0.75rem",cursor:"pointer"}),d=Et.create("checkbox-field-control",{display:"flex",cursor:"pointer",paddingTop:"0.125rem"}),u=Et.create("checkbox-field-label",{display:"flex",flexDirection:"column",gap:"0.25rem",flex:"1"}),h=Et.create("checkbox-label-text",{fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground,lineHeight:"1.4"});return Ye("div",{className:Ot(l,ga(e.width),r),children:[Ye("div",{className:t,children:Ye("div",{className:c,children:[Ye("label",{htmlFor:i,className:d,children:n}),Ye("label",{htmlFor:i,className:u,children:[Ye("span",{className:h,children:[e.label,e.required&&Ye(C,{children:[" ",Ye("span",{className:Et.create("checkbox-required-indicator",{color:St.colors.destructive}),children:"*"})]})]}),e.description&&Ye("div",{className:Et.create("checkbox-field-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ya(e.description)}}),e.document_code&&Ye("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},className:Et.create("checkbox-field-doc-link",{alignSelf:"flex-start",background:"none",border:"none",padding:0,margin:0,cursor:"pointer",fontSize:St.fontSize.small,color:St.colors.primary,textDecoration:"underline"}),children:"View document"})]})]})}),Ye(fa,{errors:o}),e.document_code&&Ye(va,{code:e.document_code,isOpen:s,onClose:()=>a(!1)})]})}return Ye("div",{className:Ot(l,ga(e.width),r),children:[Ye(pa,{htmlFor:i,label:e.label,required:e.required,tooltip:e.tooltip,children:[e.description&&Ye("div",{className:Et.create("field-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginBottom:St.spacing.sm,lineHeight:"1.6"}),dangerouslySetInnerHTML:{H:ya(e.description)}}),n]}),Ye(fa,{errors:o})]})}function ba({error:e,onDismiss:t,className:n}){const r=globalThis.insureOSDebug,i={warning:{backgroundColor:St.colors.muted,borderColor:St.colors.border,accentColor:St.colors.mutedForeground,titleColor:St.colors.foreground},error:{backgroundColor:St.colors.destructive+"0A",borderColor:St.colors.destructive+"30",accentColor:St.colors.destructive,titleColor:St.colors.foreground},critical:{backgroundColor:St.colors.destructive+"0A",borderColor:St.colors.destructive+"40",accentColor:St.colors.destructive,titleColor:St.colors.foreground}}[e.severity],o=Et.create("error-card",{padding:`${St.spacing.sm} ${St.spacing.md}`,borderRadius:St.radius.default,border:`1px solid ${i.borderColor}`,backgroundColor:i.backgroundColor,marginInline:St.spacing.lg,marginBlock:St.spacing.md}),s=Et.create("error-card-header",{display:"flex",alignItems:"flex-start",gap:St.spacing.sm}),a=Et.create("error-card-icon",{width:"1rem",height:"1rem",color:i.accentColor,flexShrink:"0",marginTop:"0.15rem"}),l=Et.create("error-card-content-wrapper",{flex:"1",minWidth:"0",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.75rem"}),c=Et.create("error-card-content",{flex:"1",minWidth:"0",display:"flex",flexDirection:"column",gap:"0.5rem"}),d=Et.create("error-card-title",{fontSize:St.fontSize.default,fontWeight:"600",color:i.titleColor,lineHeight:"1.4"}),u=Et.create("error-card-message",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,lineHeight:"1.5"}),h=Et.create("error-card-details",{fontSize:"0.8125rem",color:St.colors.mutedForeground,fontFamily:"monospace",backgroundColor:St.colors.muted,padding:"0.625rem",borderRadius:St.radius.small,wordBreak:"break-word",lineHeight:"1.4"}),m=Et.create("error-card-support",{fontSize:"0.8125rem",color:St.colors.mutedForeground,lineHeight:"1.4"}),f=Et.create("error-card-dismiss",{padding:"0.125rem",border:"none",backgroundColor:"transparent",color:St.colors.mutedForeground,cursor:"pointer",borderRadius:St.radius.small,lineHeight:"1",display:"flex",alignItems:"center",justifyContent:"center",width:"1.5rem",height:"1.5rem",flexShrink:"0",marginTop:"-0.125rem",transition:St.transition});return Et.pseudoElement("error-card-dismiss",":hover",{backgroundColor:St.colors.muted,color:St.colors.foreground}),Ye("div",{className:Ot(o,n),children:Ye("div",{className:s,children:[Ye(()=>"warning"===e.severity?Ye("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Ye("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"})}):Ye("svg",{className:a,fill:"currentColor",viewBox:"0 0 20 20",children:Ye("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"})}),{}),Ye("div",{className:l,children:[Ye("div",{className:c,children:[Ye("div",{className:d,children:e.title}),Ye("div",{className:u,children:e.message}),r&&e.details&&Ye("div",{className:h,children:e.details}),Ye("div",{className:m,children:Ee(e)})]}),t&&Ye("button",{className:f,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":"Dismiss error",title:"Dismiss",type:"button",children:Ye("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:[Ye("path",{d:"M18 6 6 18"}),Ye("path",{d:"m6 6 12 12"})]})})]})]})})}function xa(){var e,n;const{definition:r,currentPageIndex:i,totalPages:o,validationErrors:s,generalErrors:a,quoteIntent:l,isSaving:c,fsm:d}=qt(e=>({definition:e.getFormDefinition(),currentPageIndex:e.getCurrentPageIndex(),totalPages:e.getTotalPages(),results:e.getCalculationResult(),validationErrors:e.getValidationErrors(),generalErrors:e.getGeneralErrors(),quoteIntent:e.getQuoteIntent(),isSaving:e.getIsSaving()})),{httpClient:u,urlPromoCode:h}=Bt(),[m,f]=at({status:"idle"}),[p,g]=at(""),[y,v]=at(null),w=ut(async e=>{const n=null!=e?e:p;if(n&&n.trim()){if((null==l?void 0:l.id)&&u){f({status:"validating"});try{const e=await u.validatePromoCode(l.id,n.trim());e.valid?f({status:"valid",name:e.name||n}):f({status:"invalid",message:e.message})}catch(e){t(),f({status:"invalid",message:"Unable to validate promo code"})}}}else f({status:"idle"})},[null==l?void 0:l.id,u,p]),b=ut(e=>{"Enter"===e.key&&(e.preventDefault(),w())},[w]),x=ct(!1);lt(()=>{h&&!x.current&&(null==l?void 0:l.id)&&u&&(x.current=!0,g(h),(async()=>{try{const e=await u.validatePromoCode(l.id,h.trim());if(e.valid){f({status:"valid",name:e.name||h});const t=d.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));t&&d.updateFieldValue(t.id,"promo_code",h)}else{g("");const e=d.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e&&d.updateFieldValue(e.id,"promo_code","")}}catch(e){g("")}})())},[h,null==l?void 0:l.id,u]);const k=r.pages[i];if(!k)return Ye(ma,{title:"Unexpected Error",description:"No page available"});const S=ct(new Map),N=(e,t)=>{var n;const r=d.getFormProgress().page_data[k.id],i=null==r?void 0:r[e];if(null!=i&&""!==i)return i;if(t&&("date"===t.type||"monthyear"===t.type)&&(null===(n=t.validation)||void 0===n?void 0:n.defaultDate)){const n=_(t.validation.defaultDate,"monthyear"===t.type);if(n)return d.updateFieldValue(k.id,e,n),n}return""},_=(e,t)=>{var n;const r=(null===(n=null==l?void 0:l.organisation)||void 0===n?void 0:n.timezone)||"Pacific/Auckland",i=(new Date).toLocaleString("en-US",{timeZone:r}),o=new Date(i);let s=new Date(i);switch(e){case"today":s=o;break;case"+1week":s.setDate(o.getDate()+7);break;case"+1month":s.setMonth(o.getMonth()+1);break;case"+1year":s.setFullYear(o.getFullYear()+1);break;default:return""}const a=s.getFullYear(),c=String(s.getMonth()+1).padStart(2,"0"),d=String(s.getDate()).padStart(2,"0");return t?`${a}-${c}-01`:`${a}-${c}-${d}`},C=e=>{const t=d.getFormProgress().page_data[k.id];return((null==t?void 0:t.U)||{})[e]||""},$=d.getFormProgress(),I={};Object.values($.page_data).forEach(e=>{const{U:t,...n}=e;Object.assign(I,n),t&&Object.keys(t).length>0&&(I.U||(I.U={}),Object.assign(I.U,t))});const T=e=>{if(!e.visibility)return!0;const n=e.visibility.conditions.map(e=>"field"in e?e.field:null).filter(Boolean);n.length>0&&(t((e.label,e.code)),t(Object.keys(I)),n.forEach(e=>{e&&t((I[e],I[e]))}));const r=he(I,{condition_type:e.visibility.condition_type,conditions:e.visibility.conditions}),i="show"===e.visibility.action?r.matched:!r.matched;return S.current.get(e.id)!==i&&(t((e.label,e.code)),t(),S.current.set(e.id,i)),i},E=(()=>{for(const e of k.fields)if(e.blocker&&T(e))if(e.blocker.conditions&&e.blocker.conditions.length>0){if(he(I,{condition_type:e.blocker.condition_type||"or",conditions:e.blocker.conditions}).matched)return{field:e,config:e.blocker}}else if(void 0!==e.blocker.trigger_value){const t=e.code||e.id,n=N(t,e);if(String(n)===String(e.blocker.trigger_value))return{field:e,config:e.blocker}}return null})();if(y)return Ye(vs,{quotePageUrl:y.quotePageUrl,message:y.message});const P=null==l?void 0:l.payment_return,R=P&&("declined"===P.paymentStatus||"cancelled"===P.paymentStatus||"error"===P.paymentStatus),z=d.getFormProgress().completed_pages||[],D=d.getFormProgress().incomplete_pages||[];return Ye(os,{title:k.title,description:k.description,hideHeader:!0,children:Ye("div",{children:[R&&Ye(Ws,{type:P.paymentStatus,transactionId:P.paymentTransactionId||void 0,clientSettings:null===(e=null==l?void 0:l.organisation)||void 0===e?void 0:e.client_settings,gatewayCode:null===(n=P.transactionStatus)||void 0===n?void 0:n.gateway_code,isOpen:!0,onClose:()=>{d.updateQuoteIntent({payment_return:void 0})}}),Ye(Wt,{children:[Ye("div",{className:Et.create("form-layout",{display:"grid",gridTemplateColumns:"1fr 320px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column",gap:St.spacing.sm}}),children:[Ye("div",{className:Et.create("form-content-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",minHeight:"100%"},{"(max-width: 950px)":{minHeight:"auto"}}),children:[Ye("div",{className:Et.create("mobile-sidebar-container",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Ye(da,{pages:r.pages,currentPageIndex:i,completedPages:z})}),i>0&&Ye("div",{className:Et.create("page-heading-container",{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},{"(max-width: 950px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("div",{className:Et.create("page-heading-content",{display:"flex",alignItems:"center",justifyContent:"space-between",gap:St.spacing.lg}),children:Ye("div",{className:Et.create("page-heading-text",{flex:"1",minWidth:"0"}),children:[Ye("h1",{className:Et.create("page-template-title",{margin:"0",fontSize:"1.5rem",fontWeight:"700",lineHeight:"1.3",color:St.colors.primary,letterSpacing:"-0.025em"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:k.title}),k.description&&Ye("p",{className:Et.create("page-template-description",{margin:"0",marginTop:St.spacing.sm,fontSize:St.fontSize.small,lineHeight:"1.5",color:St.colors.foreground,opacity:"0.7"}),children:k.description})]})}),Ye("hr",{className:Et.create("page-heading-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),0===i&&(null==l?void 0:l.organisation)&&Ye(ha,{organisation:l.organisation}),a.length>0&&a.map(e=>Ye(ba,{error:e,onDismiss:()=>d.dismissGeneralError(e.id)},e.id)),Ye("div",{className:Et.create("form-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm,display:"flex",flexDirection:"column",gap:St.spacing.xl,flex:"1",minWidth:"0",overflow:"hidden"},{"(max-width: 950px)":{padding:St.spacing.md,gap:St.spacing.lg,flex:"initial"},"(max-width: 480px)":{padding:St.spacing.md,gap:St.spacing.md}}),children:[Ye("form",{onSubmit:e=>e.preventDefault(),className:Et.create("form-fields-container",{flex:"1"},{"(max-width: 950px)":{flex:"initial"}}),children:Ye("div",{className:Et.create("form-content-page",{display:"grid",gap:St.spacing.md,rowGap:St.spacing.lg,gridTemplateColumns:"repeat(12, minmax(0, 1fr))",minWidth:"0"},{"(max-width: 600px)":{display:"flex",flexDirection:"column"}}),children:k.fields.map(e=>{const t=e.code||e.id,n="promo_code"===t;if(!T(e))return null;if("section"===e.type)return Ye(wa,{field:e,errors:[],children:Ye("span",{})},e.id);if("notice"===e.type)return Ye(wa,{field:e,errors:[],children:Ye("span",{})},e.id);const r="validating"===m.status,i=n?Ye("button",{type:"button",onClick:()=>w(),disabled:!p.trim()||r,style:{height:"2.75rem",minWidth:"5rem",padding:"0 1rem",fontSize:St.fontSize.small,backgroundColor:St.colors.primary,color:St.colors.primaryForeground,border:"none",borderRadius:St.radius.default,cursor:p.trim()&&!r?"pointer":"not-allowed",opacity:p.trim()&&!r?1:.5,whiteSpace:"nowrap"},children:r?Ye(jt,{size:"small"}):"Apply"}):void 0,o=!n||"valid"!==m.status&&"invalid"!==m.status?null:Ye("div",{style:{marginTop:"0.5rem"},children:["valid"===m.status&&Ye("span",{style:{color:"#22c55e",fontSize:St.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:Ye("path",{d:"M20 6 9 17l-5-5"})}),'Promo code "',m.name,'" applied']}),"invalid"===m.status&&Ye("span",{style:{color:St.colors.destructive,fontSize:St.fontSize.small,display:"flex",alignItems:"center",gap:"0.25rem"},children:[Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Ye("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),m.message]})]});return Ye(wa,{field:e,errors:s,children:[Ye(ia,{value:N(t,e).toString(),onChange:r=>{let i=r;"boolean"!==e.type&&"checkbox"!==e.type||(i="true"===r),d.updateFieldValue(k.id,t,i),n&&(g(r),f({status:"idle"}))},onKeyDown:n?b:void 0,answer:C(t),onAnswerChange:n=>{var r;d.updateFieldAnswer(k.id,t,n,null===(r=e.boolean_config)||void 0===r?void 0:r.details_rating_factor_id)},id:t,name:t,type:e.type,placeholder:e.placeholder,required:e.required,options:e.options,validation:e.validation,booleanConfig:e.boolean_config,add_null_option:e.add_null_option,null_option_label:e.null_option_label,inline:e.inline,hasError:d.hasFieldErrors(t),errors:d.getFieldErrors(t),suffix:i}),o]},e.id)})})}),E&&Ye("div",{className:Et.create("form-blocker",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg}),children:[Ye("h3",{className:Et.create("form-blocker-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.125rem",fontWeight:"600",color:St.colors.accentForeground}),children:E.config.title}),Ye("p",{className:Et.create("form-blocker-message",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.accentForeground,opacity:"0.9"}),children:E.config.message}),E.config.link&&Ye("a",{href:E.config.link.url,target:"_blank",rel:"noopener noreferrer",className:Et.create("form-blocker-link",{display:"inline-flex",alignItems:"center",gap:"0.375rem",marginTop:St.spacing.md,fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.primary,textDecoration:"none"}),children:[E.config.link.label,Ye("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Ye("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),Ye("polyline",{points:"15 3 21 3 21 9"}),Ye("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),Ye("hr",{className:Et.create("form-navigation-border",{border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})}),Ye("div",{className:0===i?Et.create("form-navigation-inline-first",{paddingTop:St.spacing.lg,display:"flex",alignItems:"center",justifyContent:"flex-end"}):Et.create("form-navigation-inline",{paddingTop:St.spacing.lg,display:"flex",alignItems:"center",justifyContent:"space-between"}),children:[i>0&&Ye(as,{onClick:()=>null==d?void 0:d.navigateToPreviousPage(),variant:"outline",children:"Back"}),!E&&Ye(as,{onClick:async function(){var e,t;if(!(d.validateCurrentPage().length>0))if(i===o-1)try{await(null==d?void 0:d.calculateQuote())}catch(n){if("VERSION_INVALIDATED"===(null==n?void 0:n.type))return void v({quotePageUrl:null!==(t=null===(e=null==n?void 0:n.versionInvalidated)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:null==n?void 0:n.message});throw n}else await(null==d?void 0:d.navigateToNextPage())},disabled:c,loading:c,children:i===o-1?"Get Quote":"Continue"})]})]})]}),Ye("div",{className:Et.create("form-sidebar",{display:"block"},{"(max-width: 950px)":{display:"none"}}),children:Ye(ca,{pages:r.pages,currentPageIndex:i,completedPages:z,incompletePages:D})}),Ye("div",{className:Et.create("form-mobile-actions",{display:"none"},{"(max-width: 950px)":{display:"block"}}),children:Ye(ua,{pages:r.pages,completedPages:z})})]}),(null==l?void 0:l.reference)&&Ye("p",{className:Et.create("form-quote-reference",{margin:"0",marginTop:St.spacing.md,textAlign:"center",fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:["Quote reference: ",Ye("strong",{style:{color:St.colors.foreground,fontWeight:600},children:l.reference})]})]})]})})}function ka(){var e,t,n,r,i,o,s;const{quoteIntent:a,fsm:l}=qt(e=>({quoteIntent:e.getQuoteIntent(),fsm:e})),c=null==a?void 0:a.payment_return,d=null==c?void 0:c.paymentTransactionId,u=null==c?void 0:c.transactionStatus,h=null===(e=null==a?void 0:a.organisation)||void 0===e?void 0:e.name,m=null===(t=null==a?void 0:a.organisation)||void 0===t?void 0:t.admin_email,f=null===(n=null==a?void 0:a.organisation)||void 0===n?void 0:n.phone,p=m||f,g=null===(r=null==a?void 0:a.payment_transactions)||void 0===r?void 0:r.find(e=>"completed"===e.status),y=null!==(i=null==u?void 0:u.gateway_code)&&void 0!==i?i:null==g?void 0:g.gateway_code,v=fs(null===(o=null==a?void 0:a.organisation)||void 0===o?void 0:o.client_settings,"payment_success",y);lt(()=>{if(d&&a){const e=null==c?void 0:c.paymentStatus,t=null==u?void 0:u.amount;"success"===e&&u?Le(a,d,t||0,u.gateway_code,t,void 0):e&&["declined","cancelled","error"].includes(e)&&Be(a,d,t,null==u?void 0:u.gateway_code,e,null==u?void 0:u.status)}const e=setTimeout(()=>{null==l||l.clearStoredQuoteIntent()},2e3);return()=>clearTimeout(e)},[l,d,c,a]);const w=Et.create("success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),b=Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),x=Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),k=Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),S=Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),N=Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0 auto",maxWidth:"450px",paddingLeft:St.spacing.md,paddingRight:St.spacing.md}),_=Et.create("success-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),C=Et.create("success-contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),$=Et.create("success-contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),I=Et.create("success-contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),T=Et.create("success-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),E=Et.create("success-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textAlign:"center",marginTop:St.spacing.md});return Ye(os,{title:"Payment Successful",description:"Your payment has been processed successfully",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:w,children:[Ye("div",{className:b,children:Ye("div",{className:x,children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:k,children:[Ye("h1",{className:S,children:null!==(s=v.title)&&void 0!==s?s:"Payment Complete!"}),v.body?Ye(cs,{source:v.body,className:N}):Ye("p",{className:N,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 ",h?`covered by ${h}`:"covered","."]})]}),p&&Ye("div",{className:_,children:[Ye("h3",{className:C,children:"Need assistance?"}),Ye("div",{className:$,children:[m&&Ye("div",{className:I,children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),Ye("span",{children:m})]}),f&&Ye("div",{className:I,children:[Ye("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:Ye("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"})}),Ye("span",{children:f})]})]}),Ye("div",{className:T,children:[f&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${f}`),children:[Ye("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:Ye("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"]}),m&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${m}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]}),a.reference&&Ye("div",{className:E,children:["Quote Reference: ",Ye("strong",{children:a.reference})]})]})})})})}function Sa({isOpen:e,onClose:t,onSuccess:n,paymentRequest:r,httpClient:i}){const[o,s]=at("initiating"),[a,l]=at(null),[c,d]=at(null),[u,h]=at(null);lt(()=>{e&&r&&m()},[e,r]);const m=async()=>{var e;if(r)try{s("initiating"),l(null);const t={...r,returnUrl:window.location.href},n=null===(e=r.metadata)||void 0===e?void 0:e.gateway;if(!n)throw new Error("Payment gateway not found");const o=await i.initiatePayment(t,n);h(o.transaction_id),s("redirecting"),window.location.href=o.gateway_acceptance_url}catch(e){l(e.message||"Failed to initiate payment"),s("failed")}},f=()=>{c&&!c.closed&&c.close(),s("initiating"),l(null),h(null),d(null),t()};return e?Ye("div",{className:Et.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:[Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:"2rem",minWidth:"400px",maxWidth:"500px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`}),children:[Ye("div",{className:Et.create("modal-header",{textAlign:"center",marginBottom:"1.5rem"}),children:[Ye("div",{className:Et.create("status-icon",{fontSize:"3rem",marginBottom:"1rem"}),children:(()=>{switch(o){case"completed":return"✅";case"cancelled":return"❌";case"failed":return"⚠️";default:return"⏳"}})()}),Ye("h2",{className:Et.create("modal-title",{margin:"0",color:St.colors.foreground,fontSize:St.fontSize.large}),children:"Payment Processing"})]}),Ye("div",{className:Et.create("modal-body",{textAlign:"center",marginBottom:"2rem"}),children:[Ye(ws,{className:Et.create("status-message",{fontSize:St.fontSize.default,color:St.colors.mutedForeground,marginBottom:"1rem"}),children:(()=>{switch(o){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"}})()}),a&&Ye(ws,{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,padding:"0.75rem",backgroundColor:St.colors.destructive+"10",borderRadius:St.radius.default,border:`1px solid ${St.colors.destructive}30`}),children:a}),("redirecting"===o||"initiating"===o)&&Ye("div",{className:Et.create("loading-indicator",{display:"inline-block",width:"20px",height:"20px",marginTop:"1rem",border:`3px solid ${St.colors.border}`,borderTop:`3px solid ${St.colors.primary}`,borderRadius:"50%",animation:"spin 1s linear infinite"})})]}),Ye("div",{className:Et.create("modal-actions",{display:"flex",gap:"1rem",justifyContent:"center"}),children:"failed"===o||"cancelled"===o?Ye(C,{children:[Ye(as,{onClick:f,variant:"outline",children:"Close"}),"cancelled"===o&&Ye(as,{onClick:()=>{s("initiating"),l(null),m()},children:"Try Again"})]}):Ye(as,"completed"===o?{onClick:f,children:"Continue"}:{onClick:f,variant:"outline",disabled:"initiating"===o,children:"Cancel"})})]}),Ye("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):null}function Na({transactionId:e,organisationId:t,allowCancel:n=!0,clientSettings:r=null}){var i,o,s,a,l,c;const{httpClient:d,formStateManager:u}=Bt(),h=null!==(o=null===(i=null==u?void 0:u.getQuoteIntent)||void 0===i?void 0:i.call(u))&&void 0!==o?o:null,m=null!==(a=null!=r?r:null===(s=null==h?void 0:h.organisation)||void 0===s?void 0:s.client_settings)&&void 0!==a?a:null,f=fs(m,"bank_transfer","bank_transfer"),p=(()=>{var e,t,n,r,i,o;const s=null===(n=null===(t=null===(e=null==m?void 0:m.status_pages)||void 0===e?void 0:e.per_gateway)||void 0===t?void 0:t.bank_transfer)||void 0===n?void 0:n.bank_transfer,a=null===(i=null===(r=null==m?void 0:m.status_pages)||void 0===r?void 0:r.default)||void 0===i?void 0:i.bank_transfer;return null!==(o=null!=s?s:a)&&void 0!==o?o:{}})(),g={title:null==p?void 0:p.instructions_title,body:null==p?void 0:p.instructions_body},[y,v]=at(!0),[w,b]=at(null),[x,k]=at(null),[S,N]=at(!1),[_,$]=at(!1),[I,T]=at(!1);lt(()=>{E()},[e]);const E=async()=>{try{if(v(!0),b(null),!d)throw new Error("HTTP client not available");const n=d.getBaseUrl(),r=await fetch(`${n}/payments/bank-transfer/${e}?orgId=${t}`);if(!r.ok)throw new Error(`Failed to load bank transfer details: ${r.statusText}`);const i=await r.json(),o=i.data||i;k({bank_account_name:o.bank_account_name,bank_account_number:o.bank_account_number,instructions_html:o.instructions_html,reference:o.reference,amount:Number(o.amount),currency:o.currency})}catch(e){b(e.message||"Failed to load bank transfer details")}finally{v(!1)}};return y?Ye(ss,{message:"Loading payment details..."}):w?Ye(os,{title:"Error",description:"Failed to load bank transfer details",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:Et.create("error-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto",textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg}}),children:[Ye("div",{className:Et.create("error-icon",{fontSize:"3rem",marginBottom:St.spacing.md,color:St.colors.destructive}),children:"⚠️"}),Ye("h2",{className:Et.create("error-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.foreground}),children:"Error Loading Payment Details"}),Ye("p",{className:Et.create("error-message",{color:St.colors.mutedForeground}),children:w})]})})})}):x?Ye(os,{title:"Bank Transfer Payment",description:"Complete your payment via bank transfer",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:[Ye(ls,{children:Ye("div",{className:Et.create("bank-transfer-container",{backgroundColor:St.colors.card,borderRadius:St.radius.large,maxWidth:"42rem",margin:"0 auto",overflow:"hidden",boxShadow:"0 20px 60px rgba(0,0,0,0.1)"}),children:[Ye("div",{style:{backgroundColor:St.colors.primary},className:Et.create("bank-transfer-header",{color:"white",padding:"2.5rem 2rem",textAlign:"center"},{"(max-width: 480px)":{padding:"1.5rem 1rem"}}),children:[Ye("h1",{className:Et.create("header-title",{fontSize:"1.75rem",fontWeight:"700",margin:"0",marginBottom:"0.5rem"},{"(max-width: 480px)":{fontSize:"1.25rem",marginBottom:"0.25rem"}}),children:null!==(l=f.title)&&void 0!==l?l:"Bank Transfer Payment"}),f.body?Ye(cs,{source:f.body,className:Et.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:St.fontSize.small}})}):Ye("p",{className:Et.create("header-subtitle",{fontSize:"1rem",margin:"0",opacity:"0.9"},{"(max-width: 480px)":{fontSize:St.fontSize.small}}),children:"Complete your payment using the details below"})]}),Ye("div",{className:Et.create("bank-transfer-content",{padding:"2rem"},{"(max-width: 480px)":{padding:"1rem"}}),children:[Ye("div",{className:Et.create("payment-details-card",{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:St.radius.default,padding:"1.5rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Ye("div",{className:Et.create("detail-row-amount",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.5rem"}}),children:[Ye("span",{className:Et.create("detail-label",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Amount to Transfer"}),Ye("span",{className:Et.create("detail-value-amount",{color:St.colors.primary,fontSize:"1.5rem",fontWeight:"700"},{"(max-width: 480px)":{fontSize:"1.25rem"}}),children:["$",x.amount.toFixed(2)," ",x.currency]})]}),Ye("div",{className:Et.create("detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-name",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Account Name"}),Ye("span",{className:Et.create("detail-value-name",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.bank_account_name})]}),Ye("div",{className:Et.create("detail-row-number",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid #e5e7eb"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-number",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Account Number"}),Ye("span",{className:Et.create("detail-value-number",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.bank_account_number})]}),Ye("div",{className:Et.create("detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},{"(max-width: 480px)":{flexDirection:"column",alignItems:"flex-start",gap:"0.25rem"}}),children:[Ye("span",{className:Et.create("detail-label-ref",{color:"#6b7280",fontSize:St.fontSize.default}),children:"Payment Reference"}),Ye("span",{className:Et.create("detail-value-ref",{color:St.colors.foreground,fontSize:St.fontSize.default,fontWeight:"600"}),children:x.reference})]})]}),Ye("div",{className:Et.create("instructions-card",{backgroundColor:St.colors.muted,border:`1px solid ${St.colors.border}`,borderRadius:St.radius.default,padding:"1.25rem",marginBottom:"1.5rem"},{"(max-width: 480px)":{padding:"1rem",marginBottom:"1rem"}}),children:[Ye("h3",{className:Et.create("instructions-title",{margin:"0 0 0.75rem 0",fontSize:St.fontSize.default,fontWeight:"600",color:St.colors.foreground}),children:null!==(c=g.title)&&void 0!==c?c:"Payment Instructions"}),g.body?Ye(cs,{source:g.body,className:Et.create("instructions-text",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground})}):Ye(C,{children:[Ye("p",{className:Et.create("instructions-text",{margin:"0 0 0.75rem 0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground}),children:[Ye("strong",{children:"Important:"})," Please include the payment reference when making your transfer to ensure your payment is processed correctly."]}),Ye("p",{className:Et.create("instructions-text",{margin:"0",fontSize:St.fontSize.small,lineHeight:"1.6",color:St.colors.foreground}),children:"Once we receive your payment, we will process your quote and send you a confirmation email."})]})]}),Ye("div",{className:Et.create("button-wrapper",{textAlign:"center",marginBottom:"1.5rem",display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},{"(max-width: 480px)":{flexDirection:"column",gap:"0.75rem",marginBottom:"1rem"}}),children:[Ye("button",{onClick:()=>{N(!0)},style:{backgroundColor:St.colors.primary},className:Et.create("confirm-button",{color:"white",border:"none",borderRadius:St.radius.default,padding:"0.75rem 2rem",fontSize:St.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"opacity 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"I've Made the Transfer"}),n&&Ye("button",{onClick:()=>{$(!0)},className:Et.create("cancel-button",{color:"#6b7280",backgroundColor:"white",border:"2px solid #e5e7eb",borderRadius:St.radius.default,padding:"0.75rem 2rem",fontSize:St.fontSize.default,fontWeight:"600",cursor:"pointer",transition:"all 150ms ease"},{"(max-width: 480px)":{width:"100%",padding:"0.625rem 1.5rem"}}),children:"Cancel"})]}),Ye("p",{className:Et.create("footer-text",{textAlign:"center",color:"#6b7280",fontSize:St.fontSize.small,margin:"0"}),children:"Your quote has been saved. We'll process it once payment is received."})]})]})}),_&&Ye("div",{className:Et.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"}),onClick:()=>!I&&$(!1),children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Ye("div",{className:Et.create("warning-icon",{fontSize:"4rem",marginBottom:St.spacing.md}),children:"⚠️"}),Ye("h3",{className:Et.create("modal-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.foreground,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Are you sure?"}),Ye("p",{className:Et.create("modal-message",{margin:"0",marginBottom:St.spacing.lg,color:St.colors.foreground,lineHeight:"1.6"}),children:"This will take you back to the checkout page."}),Ye("div",{className:Et.create("modal-buttons",{display:"flex",flexDirection:"column-reverse",gap:"0.75rem",justifyContent:"center"}),children:[Ye("button",{onClick:()=>$(!1),disabled:I,className:Et.create("no-button",{backgroundColor:"#f3f4f6",color:St.colors.foreground,border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:I?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:I?"0.5":"1",width:"100%"}),children:"No, Go Back"}),Ye("button",{onClick:async()=>{if(d)try{T(!0);const n=d.getBaseUrl();if(!(await fetch(`${n}/payments/${e}/cancel-bank-transfer?orgId=${t}`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to cancel payment");window.location.reload()}catch(e){b("Failed to cancel payment. Please try again."),$(!1),T(!1)}},disabled:I,className:Et.create("yes-button",{backgroundColor:"#ef4444",color:"white",border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:I?"not-allowed":"pointer",transition:"opacity 150ms ease",opacity:I?"0.5":"1",width:"100%"}),children:I?"Cancelling...":"Yes, Cancel Payment"})]})]})}),S&&Ye("div",{className:Et.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"}),onClick:()=>N(!1),children:Ye("div",{className:Et.create("modal-content",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,maxWidth:"400px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.2)",border:`1px solid ${St.colors.border}`,textAlign:"center"},{"(max-width: 480px)":{padding:St.spacing.lg,margin:"0 1rem"}}),onClick:e=>e.stopPropagation(),children:[Ye("div",{className:Et.create("success-icon",{fontSize:"4rem",marginBottom:St.spacing.md}),children:"✓"}),Ye("h3",{className:Et.create("modal-title",{margin:"0",marginBottom:St.spacing.sm,color:St.colors.primary,fontSize:St.fontSize.large,fontWeight:"600"}),children:"Thank You!"}),Ye("p",{className:Et.create("modal-message",{margin:"0",marginBottom:St.spacing.lg,color:St.colors.foreground,lineHeight:"1.6"}),children:"We'll process your payment as soon as we receive it. You'll receive a confirmation email once your coverage is activated."}),Ye("button",{onClick:()=>N(!1),className:Et.create("close-button",{backgroundColor:St.colors.primary,color:"white",border:"none",borderRadius:St.radius.default,padding:`${St.spacing.sm} ${St.spacing.lg}`,fontSize:St.fontSize.default,fontWeight:"500",cursor:"pointer",transition:"opacity 150ms ease"}),children:"Close"})]})})]})}):null}Et.pseudoElement("sidebar-continue-later-button",":hover",{backgroundColor:St.colors.muted,borderColor:St.colors.primary,color:St.colors.primary});class _a{static async loadTheme(e){try{if(t(e.slug),t(e.theme_url),this.loadedThemes.has(e.slug))return void t(e.slug);const n=await fetch(e.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();t(r.substring(0,200));const i=this.parseCSSContent(r);t(i.mappedVariables),t(i.classRules.length),this.applyParsedTheme(e.slug,i),this.loadedThemes.add(e.slug),t(e.slug)}catch(n){throw t(e.slug),n}}static parseCSSContent(e){t();const n={},r={};let i="";const o=e.match(/:root\s*\{([^}]+)\}/);if(o){const e=o[1];t(null==e||e.substring(0,100));const i=/--([\w-]+):\s*([^;]+);/g;let s;for(;null!==(s=i.exec(e));){const e=`--${s[1]}`,i=s[2].trim();n[e]=i;const o=this.variableMapping[e];o?(r[o]=i,t()):t()}}else t();return i=e.replace(/:root\s*\{[^}]+\}/,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),i&&t(i.substring(0,100)),{variables:n,classRules:i,mappedVariables:r}}static applyParsedTheme(e,n){t(),Promise.resolve().then(function(){return Pt}).then(({updateBaseVariables:e})=>{Object.keys(n.mappedVariables).length>0&&(t(n.mappedVariables),e(n.mappedVariables))}).catch(()=>{t()}),n.classRules&&this.applyClassRules(e,n.classRules),this.injectOriginalCSS(e,n)}static applyClassRules(e,n){const r=document.getElementById(`insure-os-theme-classes-${e}`);if(r&&r.remove(),n.trim()){const r=document.createElement("style");r.id=`insure-os-theme-classes-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static injectOriginalCSS(e,n){const r=document.getElementById(`insure-os-theme-original-${e}`);r&&r.remove();const i={};for(const[e,t]of Object.entries(n.variables))this.variableMapping[e]||(i[e]=t);if(Object.keys(i).length>0){const n=`:root {\n${Object.entries(i).map(([e,t])=>` ${e}: ${t};`).join("\n")}\n}`,r=document.createElement("style");r.id=`insure-os-theme-original-${e}`,r.type="text/css",r.textContent=n,document.head.appendChild(r),t()}}static removeTheme(e){let n=!1;[`insure-os-theme-classes-${e}`,`insure-os-theme-original-${e}`].forEach(e=>{const t=document.getElementById(e);t&&(t.remove(),n=!0)}),n&&(this.loadedThemes.delete(e),t())}static isThemeLoaded(e){return this.loadedThemes.has(e)}static getLoadedThemes(){return Array.from(this.loadedThemes)}}_a.loadedThemes=new Set,_a.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"};var Ca=Object.freeze({__proto__:null,ThemeLoader:_a});function $a(e,t){return"windcave"!==e?"Provider Fee:":"account2account"===t?"Account2Account surcharge:":"Credit card surcharge:"}function Ia(e){var t;return(null===(t=e.metadata)||void 0===t?void 0:t.gateway_method)?`${e.gateway_code}:${e.metadata.gateway_method}`:e.gateway_code}function Ta({paymentLinkId:e,signedUrl:n}){var r,i,o,s,a,l,c,d,u,h,m,f,p,g,y,v,w,b,x,k,S,N,_,$,I,T,E,P,R;const z=Bt().httpClient,[D,M]=at(null),[O,j]=at(!0),[W,A]=at(null),[L,B]=at(!1),[q,F]=at(null),[H,U]=at(null),[Y,Z]=at(null),[V,G]=at(!1),[Q,J]=at(null),[K,X]=at(null),[ee,te]=at(!0),ne="undefined"!=typeof window?new URLSearchParams(window.location.search):new URLSearchParams,[re,ie]=at("processing"===ne.get("status")?ne.get("transactionId"):null),[oe,se]=at(()=>Fs()),[ae,le]=at(null),[ce,de]=at(!1),[ue,he]=at(null),[me,fe]=at(null),[pe,ge]=at(null);lt(()=>{ye()},[e]);const ye=async()=>{var r,i,o,s;try{j(!0);const a=new URLSearchParams(window.location.search),l=a.get("transactionId"),c=a.get("status"),d=a.get("gateway_code"),u=a.get("method"),h=a.get("excess_id");l&&c&&(G(!0),J(c),X(l)),d&&Z(u?`${d}:${u}`:d);const m=n?await z.getPaymentLinkDetails(n):await z.getPaymentLinkById(e);if(m.organisation&&m.organisation.theme)try{await _a.loadTheme({slug:m.organisation.slug,theme_url:m.organisation.theme.css_url})}catch(e){t()}if("paid"===m.status)return V||l&&("completed"===c||"success"===c)?(M(m),void((null===(r=m.organisation)||void 0===r?void 0:r.quote_page_url)&&he(m.organisation.quote_page_url))):(M(m),void A("This payment link has already been used."));if("superseded"===m.status)return M(m),void A("This payment link has been replaced by a newer one. Please use the latest link you received.");if("confirmed"===m.status)return M(m),void fe({message:"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:null===(i=m.metadata)||void 0===i?void 0:i.effective_date});if("expired"===m.status)return M(m),void A("This payment link has expired.");if("cancelled"===m.status)return M(m),void A("This payment link has been cancelled.");if("outdated"===m.status)return M(m),void A("This payment link is no longer valid because the quote has been updated. Please request a new payment link.");const f=Array.isArray(m.payment_options)&&m.payment_options.some(e=>{var t,n;return Number(null!==(n=null===(t=e.amount)||void 0===t?void 0:t.total)&&void 0!==n?n:0)>0}),p=Array.isArray(m.calculations)&&m.calculations.some(e=>{var t;return Number(null!==(t=e.premium_payable)&&void 0!==t?t:0)>0});if(!f&&!p)return M(m),void A("This payment link is not available. Please contact support.");if("awaiting_payment"===m.status&&m.pending_bank_transfer){const e=m.pending_bank_transfer;return t(),void ge({transactionId:e.transaction_id,organisationId:(null===(o=m.organisation)||void 0===o?void 0:o.id)||""})}if(h){const e=m.calculations.find(e=>e.excess_id===h);e?U(e.id):1===m.calculations.length&&m.calculations[0]&&U(m.calculations[0].id)}else 1===m.calculations.length&&m.calculations[0]&&U(m.calculations[0].id);!d&&1===m.payment_options.length&&m.payment_options[0]&&Z(Ia(m.payment_options[0])),M(m),(null===(s=m.organisation)||void 0===s?void 0:s.quote_page_url)&&he(m.organisation.quote_page_url)}catch(e){A("Failed to load payment details. Please check your link.")}finally{j(!1)}},ve=dt(()=>D&&H?D.calculations.find(e=>e.id===H):null,[D,H]),we=dt(()=>D&&Y?D.payment_options.find(e=>Ia(e)===Y):null,[D,Y]);if(pe)return Ye(Na,{transactionId:pe.transactionId,organisationId:pe.organisationId,allowCancel:!0,clientSettings:null!==(i=null===(r=null==D?void 0:D.organisation)||void 0===r?void 0:r.client_settings)&&void 0!==i?i:null});if(me){const e=null==D?void 0:D.organisation,t=null==e?void 0:e.admin_email,n=null==e?void 0:e.phone,r=t||n;return Ye(os,{title:"Renewal Confirmed",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("auto-renew-success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Ye("div",{className:Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),children:Ye("div",{className:Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),children:[Ye("h1",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:"Renewal Confirmed"}),Ye("p",{className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"}),children:me.message})]}),me.effectiveDate&&Ye("div",{className:Et.create("payment-date-box",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.lg,marginBottom:St.spacing.lg,textAlign:"center"}),children:[Ye("p",{className:Et.create("payment-date-label",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0",marginBottom:St.spacing.sm}),children:"Your first payment will be on"}),Ye("p",{className:Et.create("payment-date-value",{fontSize:"1.25rem",fontWeight:"600",color:St.colors.foreground,margin:"0"}),children:new Date(me.effectiveDate).toLocaleDateString("en-NZ",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]}),Ye("div",{className:Et.create("info-box",{backgroundColor:St.colors.muted,borderRadius:St.radius.default,padding:St.spacing.md,marginBottom:St.spacing.lg}),children:Ye("p",{className:Et.create("info-text",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0",textAlign:"center"}),children:"No further action is required. Your monthly payments will continue as normal."})}),r&&Ye("div",{className:Et.create("contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),children:[Ye("h3",{className:Et.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Ye("div",{className:Et.create("contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[t&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Email: ",t]})}),n&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Phone: ",n]})})]})]})]})})})}if(re&&z)return Ye(os,{title:"Payment Processing",noSubscription:!0,hideHeader:!0,children:Ye(As,{httpClient:z,transactionId:re,onResolved:async e=>{const t="completed"===e?"success":"cancelled"===e?"cancelled":"failed"===e?"declined":"error",n=new URL(window.location.href);n.searchParams.set("status",t),re&&n.searchParams.set("transactionId",re),window.history.replaceState({},"",n.toString()),ie(null),await ye()},onError:async()=>{const e=new URL(window.location.href);e.searchParams.set("status","error"),window.history.replaceState({},"",e.toString()),ie(null),await ye()}})});if(O)return Ye(ss,{message:"Loading payment details..."});if(W){const e=null==D?void 0:D.organisation,t=null==e?void 0:e.quote_page_url,n=null==e?void 0:e.name,r=null==e?void 0:e.admin_email,i=null==e?void 0:e.phone,s=r||i,a="paid"===(null==D?void 0:D.status),l=a?"Payment Completed":"Payment Link Unavailable",c=a?"Thank you, your payment was received.":W,d=a?null===(o=null==D?void 0:D.policy_details)||void 0===o?void 0:o.external_policy_number:null,u=a?null==D?void 0:D.quote_reference:null,h=Et.create("pl-error-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"},{"(max-width: 768px)":{padding:St.spacing.lg},"(max-width: 480px)":{padding:St.spacing.md}}),m=Et.create("pl-error-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),f=Et.create("pl-error-icon",{width:"4rem",height:"4rem",color:St.colors.primary}),p=Et.create("pl-error-header",{textAlign:"center",marginBottom:St.spacing.xl}),g=Et.create("pl-error-title",{fontSize:"2rem",fontWeight:"700",color:St.colors.primary,marginBottom:St.spacing.sm,lineHeight:"1.2",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.75rem"},"(max-width: 480px)":{fontSize:"1.5rem"}}),y=Et.create("pl-error-subtitle",{fontSize:St.fontSize.default,color:St.colors.foreground,lineHeight:"1.6",opacity:"0.8"}),v=Et.create("pl-error-contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl,textAlign:"center"}),w=Et.create("pl-error-contact-text",{fontSize:St.fontSize.default,color:St.colors.foreground,marginBottom:St.spacing.lg}),b=Et.create("pl-error-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center",marginBottom:St.spacing.lg}),x=()=>Ye("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:f,children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),Ye("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),k=()=>Ye("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:f,children:[Ye("circle",{cx:"12",cy:"12",r:"10"}),Ye("polyline",{points:"8 12.5 11 15.5 16 9.5"})]});return Ye(os,{title:"Payment Link",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye(ls,{children:Ye("div",{className:h,children:[Ye("div",{className:m,children:Ye(a?k:x,{})}),Ye("div",{className:p,children:[Ye("h1",{className:g,children:l}),Ye("p",{className:y,children:c}),(d||u)&&Ye("p",{className:Et.create("pl-error-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,marginTop:St.spacing.md}),children:Ye(C,d?{children:["Policy Number: ",Ye("strong",{children:d})]}:{children:["Quote Reference: ",Ye("strong",{children:u})]})})]}),t&&Ye("div",{className:Et.create("pl-error-quote-action",{display:"flex",justifyContent:"center",marginBottom:s?"0":St.spacing.sm}),children:Ye(as,{variant:"primary",onClick:()=>{window.location.href=t},children:"Start a New Quote"})}),s&&Ye("div",{className:v,children:[Ye("p",{className:w,children:n?`Need assistance? Contact ${n}`:"Need assistance? Contact us"}),Ye("div",{className:b,children:[i&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${i}`),children:[Ye("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:Ye("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"]}),r&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${r}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]})]})]})})})})}if(!D)return null;const be=new URLSearchParams(window.location.search),xe=be.get("transactionId"),ke=be.get("status"),Se=xe&&ke;if("paid"===D.status&&("completed"===ke||"success"===ke||Se||V||"completed"===Q)){const e=null===(s=D.organisation)||void 0===s?void 0:s.admin_email,t=null===(a=D.organisation)||void 0===a?void 0:a.phone,n=e||t,r=null===(l=D.policy_details)||void 0===l?void 0:l.external_policy_number,i=D.quote_reference,o=null!==(d=null!==(c=be.get("gateway_code"))&&void 0!==c?c:null==we?void 0:we.gateway_code)&&void 0!==d?d:null,p=fs(null!==(h=null===(u=D.organisation)||void 0===u?void 0:u.client_settings)&&void 0!==h?h:null,"payment_success",o),g=null!==(m=p.title)&&void 0!==m?m:"Payment Complete!",y=p.body;return Ye(os,{title:"Payment Successful",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("payment-success-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.xl,boxShadow:St.shadow.sm,maxWidth:"42rem",margin:"0 auto"}),children:[Ye("div",{className:Et.create("success-icon-container",{display:"flex",justifyContent:"center",marginBottom:St.spacing.lg}),children:Ye("div",{className:Et.create("success-icon",{width:"5rem",height:"5rem",borderRadius:"50%",backgroundColor:"#10b981",color:"white",display:"flex",alignItems:"center",justifyContent:"center"}),children:Ye("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:Ye("path",{d:"M20 6 9 17l-5-5"})})})}),Ye("div",{className:Et.create("success-header",{textAlign:"center",marginBottom:St.spacing.xl}),children:[Ye("h1",{className:Et.create("success-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"2rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.2",letterSpacing:"-0.025em"}),children:g}),y?Ye(cs,{source:y,className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"})}):Ye("p",{className:Et.create("success-message",{fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9",margin:"0"}),children:"Your payment has been processed successfully and your policy is being set up. You will receive your policy documentation by email."})]}),n&&Ye("div",{className:Et.create("contact-section",{borderTop:`1px solid ${St.colors.border}`,paddingTop:St.spacing.xl,marginTop:St.spacing.xl}),children:[Ye("h3",{className:Et.create("contact-title",{fontSize:"1.125rem",fontWeight:"600",color:St.colors.foreground,marginBottom:St.spacing.md,textAlign:"center"}),children:"Need assistance?"}),Ye("div",{className:Et.create("contact-details",{backgroundColor:St.colors.accent,borderRadius:St.radius.default,padding:St.spacing.md,display:"flex",flexDirection:"column",gap:St.spacing.sm,marginBottom:St.spacing.lg}),children:[e&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Email: ",e]})}),t&&Ye("div",{className:Et.create("contact-item",{display:"flex",alignItems:"center",gap:St.spacing.sm,fontSize:St.fontSize.small,color:St.colors.accentForeground}),children:Ye("span",{children:["Phone: ",t]})})]}),Ye("div",{className:Et.create("success-actions",{display:"flex",gap:St.spacing.md,flexWrap:"wrap",justifyContent:"center"}),children:[t&&Ye(as,{variant:"outline",onClick:()=>window.open(`tel:${t}`),children:[Ye("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:Ye("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"]}),e&&Ye(as,{variant:"outline",onClick:()=>window.open(`mailto:${e}`),children:[Ye("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:[Ye("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),Ye("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),"Email Us"]})]}),(K||xe)&&Ye("div",{className:Et.create("reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textAlign:"center",marginTop:St.spacing.md}),children:["Transaction ID: ",Ye("strong",{children:null===(f=K||xe)||void 0===f?void 0:f.slice(0,8).toUpperCase()})]})]}),(r||i)&&Ye("div",{className:Et.create("policy-reference",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,textAlign:"center",marginTop:St.spacing.md}),children:Ye(C,r?{children:["Policy Number: ",Ye("strong",{children:r})]}:{children:["Quote Reference: ",Ye("strong",{children:i})]})})]})})})}const Ne=ee&&Se&&("failed"===ke||"declined"===ke||"cancelled"===ke||"failed"===Q||"declined"===Q||"cancelled"===Q),_e="cancelled"===ke||"cancelled"===Q?"cancelled":"failed"===ke||"declined"===ke||"failed"===Q||"declined"===Q?"declined":"error",Ce=D.calculations,$e=Ce.length>1,Ie=Ce.length>0,Te=Ie,Ee=(null===(p=D.metadata)||void 0===p?void 0:p.product_name)||(null===(g=D.policy_details)||void 0===g?void 0:g.product_name)||"Payment",Pe=Boolean(null===(y=null==D?void 0:D.metadata)||void 0===y?void 0:y.quote_intent_id),Re=Boolean((!Ie||H)&&Y&&!ae&&!ce),ze=dt(()=>{var e,t;const n=null===(e=null==D?void 0:D.metadata)||void 0===e?void 0:e.client_details;if(n)return{firstName:n.first_name,lastName:n.last_name,email:n.email,phone:n.phone};const r=null===(t=null==D?void 0:D.policy_details)||void 0===t?void 0:t.client_name;if(r){const e=r.trim().split(/\s+/);return{firstName:e[0]||r,lastName:e.slice(1).join(" ")||"",email:void 0,phone:void 0}}return null},[D]),De=dt(()=>{var e;const t=null==D?void 0:D.policy_details;if(!t)return null;const n=e=>{if(!e)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString()},r=n(t.insured_from),i=n(t.insured_to),o=r&&i?`${r} – ${i}`:r||i||null,s=null!=t.sum_insured&&t.sum_insured>0?t.sum_insured:null,a=null!=t.excess&&t.excess>=0?t.excess:null;return t.external_policy_number||o||null!=s||null!=a?{externalPolicyNumber:null!==(e=t.external_policy_number)&&void 0!==e?e:null,insurancePeriod:o,sumInsured:s,excess:a}:null},[D]),Me=dt(()=>ve&&ve.line_item_display||null,[ve]),Oe=null===(v=null==D?void 0:D.metadata)||void 0===v?void 0:v.type,je=null!==(k=null===(x=null===(b=null===(w=null==D?void 0:D.organisation)||void 0===w?void 0:w.client_settings)||void 0===b?void 0:b.checkout)||void 0===x?void 0:x.headings)&&void 0!==k?k:{},We="renewal"===Oe?"Complete Your Renewal":"endorsement"===Oe?"Complete Your Payment":"Complete Your Purchase",Ae="renewal"===Oe?"renewal":"endorsement"===Oe?"endorsement":"payment_link",Le=je[Ae]&&String(je[Ae]).trim()||We;return Ye(os,{title:Le,noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:[Ye("div",{className:Et.create("checkout-layout",{display:"grid",gridTemplateColumns:"1fr 380px",gap:St.spacing.lg},{"(max-width: 950px)":{display:"flex",flexDirection:"column"},"(max-width: 480px)":{gap:St.spacing.md}}),children:[Ye("div",{className:Et.create("checkout-main-wrapper",{minWidth:"0",backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column"}),children:[Ye("div",{className:Et.create("checkout-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("checkout-title",{margin:"0",marginBottom:St.spacing.md,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.25rem"}}),children:Le}),Ye("p",{className:Et.create("checkout-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:Ie?$e?"Choose your excess amount and payment option to secure your coverage.":"Choose your payment method to secure your coverage.":"Choose your payment option to complete your purchase."}),Ye("hr",{className:Et.create("checkout-header-border",{marginTop:St.spacing.lg,border:"0",borderTop:`1px solid ${St.colors.border}`,height:"0"})})]}),Ye("div",{className:Et.create("checkout-sections",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[Pe&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:"Cover Start Date"}),Ye("div",{className:Et.create("cover-date-container",{display:"flex",flexDirection:"column",gap:"0.75rem"}),children:[Ye("input",{type:"date",value:oe,onChange:e=>{return t=e.target.value,se(t),void(async e=>{var t;if(D&&z&&(null===(t=D.metadata)||void 0===t?void 0:t.quote_intent_id)){de(!0),le(null);try{const t=await z.validateCoverStartDate(D.payment_link_id,e);t.valid?le(null):(le(t.message||"This cover start date is not valid."),t.quote_page_url&&he(t.quote_page_url))}catch(e){le("Failed to validate cover date. Please try again.")}finally{de(!1)}}})(t);var t},min:Fs(),disabled:ce,className:Et.create("cover-date-input",{padding:"0.75rem 1rem",fontSize:St.fontSize.default,border:`2px solid ${ae?St.colors.destructive:St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.background,color:St.colors.foreground,width:"auto",maxWidth:"200px",cursor:ce?"wait":"pointer"})}),ce&&Ye("p",{className:Et.create("validating-text",{fontSize:St.fontSize.small,color:St.colors.mutedForeground,margin:"0"}),children:"Validating..."}),ae&&Ye("div",{className:Et.create("cover-date-error",{backgroundColor:`${St.colors.destructive}10`,border:`1px solid ${St.colors.destructive}`,borderRadius:St.radius.default,padding:"1rem"}),children:[Ye("p",{className:Et.create("error-message",{color:St.colors.destructive,fontSize:St.fontSize.small,margin:"0",marginBottom:ue?St.spacing.md:"0"}),children:ae}),ue&&Ye("a",{href:ue,className:Et.create("new-quote-link",{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:St.colors.primary,fontSize:St.fontSize.small,fontWeight:"500",textDecoration:"none"}),children:["Start New Quote",Ye("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:[Ye("path",{d:"M5 12h14"}),Ye("path",{d:"m12 5 7 7-7 7"})]})]})]})]})]}),Te&&Ie&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem"}),children:[Ye(bs,{title:1===Ce.length?"Excess":"Excess Options"}),Ye("div",{className:Et.create("excess-options-grid",{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"1rem"}),children:[...Ce].sort((e,t)=>e.excess_amount-t.excess_amount).map(e=>{const t=e.id===H;return Ye("div",{className:Ot(Et.create("excess-option-card",{borderRadius:St.radius.default,minWidth:"125px",padding:"0.5rem 1rem 0.5rem 0.5rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",flexDirection:"row",alignItems:"center",gap:"1rem"}),t?Et.create("excess-option-card-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("excess-option-card-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>U(e.id),children:[Ye(xs,{selected:t}),Ye("div",{className:Et.create("excess-amount",{color:St.colors.foreground}),children:[e.excess_label||`$${Number(e.excess_amount).toFixed(0)}`,e.description?"*":""]})]},e.id)})}),(null==ve?void 0:ve.description)&&Ye("div",{className:Et.create("excess-description",{padding:"0.75rem",backgroundColor:St.colors.muted,borderRadius:St.radius.default,border:`1px solid ${St.colors.border}`}),children:Ye(ws,{className:Et.create("excess-description-text",{fontSize:St.fontSize.small,color:St.colors.foreground,margin:"0"}),children:ve.description})})]}),D.payment_options.length>0&&Ye("div",{className:Et.create("checkout-section",{display:"flex",flexDirection:"column",gap:"1rem",width:"100%"}),children:[Ye(bs,{title:"Payment Options"}),Ye("div",{className:Et.create("payment-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:D.payment_options.map(e=>{var t,n;const r=Ia(e),i=Y===r,o="monthly"===e.payment_frequency,s=!!((null===(t=e.metadata)||void 0===t?void 0:t.gateway_fee)&&parseFloat(e.metadata.gateway_fee)>0),a=!0===(null===(n=e.metadata)||void 0===n?void 0:n.unavailable),l=()=>{var t;return a?"Currently Unavailable":o&&e.amount.monthly?`${Ss(parseFloat(e.amount.monthly))} x ${(null===(t=e.metadata)||void 0===t?void 0:t.number_of_instalments)||12}`:Ss(parseFloat(e.amount.due_today))},c=()=>e.description?e.description:"bank_transfer"===e.gateway_code?"Manual":`via ${e.gateway_name}`;return Ye("div",{title:a?"Currently Unavailable":void 0,className:Ot(Et.create("payment-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:a?"not-allowed":"pointer",opacity:a?"0.55":"1",transition:"all 150ms ease",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem",gap:"0.25rem",flexWrap:"wrap",alignItems:"flex-start"}}),i?Et.create("payment-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("payment-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:()=>{a||Z(r)},children:[Ye("div",{className:Et.create("payment-option-desktop-wrapper",{display:"flex",alignItems:"center",gap:"1rem",flex:"1"},{"(max-width: 480px)":{display:"none"}}),children:[Ye(xs,{selected:i}),Ye("div",{className:Et.create("payment-option-info-desktop",{display:"flex",flexDirection:"column",flex:"1"}),children:[Ye("div",{className:Et.create("frequency-title",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.display_title||Ns(o?"monthly":"one-time",e.gateway_code)}),Ye("div",{className:Et.create("gateway-description",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:c()})]})]}),Ye("div",{className:Et.create("payment-option-amount-desktop",{display:"flex",flexDirection:"column",alignItems:"flex-end"},{"(max-width: 480px)":{display:"none"}}),children:[Ye(ws,{className:Et.create("amount-text",{textAlign:"right",color:St.colors.foreground}),children:l()}),!a&&Ye(ws,{size:"small",className:Et.create("gateway-fee-text",{textAlign:"right",color:St.colors.mutedForeground}),children:s?`${(()=>{var t;return"bank_transfer"===e.gateway_code?null:(null===(t=e.metadata)||void 0===t?void 0:t.gateway_fee)?Ss(parseFloat(e.metadata.gateway_fee)):Ss(0)})()} fee`:"No fees"})]}),Ye("div",{className:Et.create("payment-option-title-mobile-wrapper",{display:"none"},{"(max-width: 480px)":{display:"flex",alignItems:"center",gap:"0.5rem",flex:"1 1 100%"}}),children:[Ye(xs,{selected:i}),Ye("div",{className:Et.create("payment-option-title-mobile",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.display_title||Ns(o?"monthly":"one-time",e.gateway_code)})]}),Ye("div",{className:Et.create("payment-option-bottom-mobile",{display:"none"},{"(max-width: 480px)":{display:"flex",flex:"1 1 100%",justifyContent:"space-between",alignItems:"center",paddingLeft:"1.5rem"}}),children:[Ye("div",{className:Et.create("gateway-description-mobile",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:c()}),Ye(ws,{className:Et.create("amount-text-mobile",{fontWeight:"500",color:St.colors.foreground}),children:l()})]})]},r)})})]})]})]}),Ye("div",{className:Et.create("checkout-sidebar",{display:"flex",flexDirection:"column"},{"(max-width: 950px)":{display:"block"}}),children:Ye("div",{className:Et.create("checkout-sidebar-sticky",{}),children:[(ze||De||Me&&Me.length>0)&&Ye("div",{className:Et.create("insurance-details-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,padding:St.spacing.lg,boxShadow:St.shadow.sm},{"(max-width: 768px)":{padding:St.spacing.md}}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.md,color:St.colors.foreground}),children:"Insurance Details"}),(ze||De||"Payment"!==Ee)&&Ye(C,{children:[Ye("div",{className:Et.create("client-details",{display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[(null==ze?void 0:ze.firstName)&&(null==ze?void 0:ze.lastName)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Name"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:[null==ze?void 0:ze.firstName," ",null==ze?void 0:ze.lastName]})]}),(null==ze?void 0:ze.email)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Email"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:null==ze?void 0:ze.email})]}),(null==ze?void 0:ze.phone)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Phone"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:null==ze?void 0:ze.phone})]}),"Payment"!==Ee&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Product"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Ee})]}),(null==De?void 0:De.externalPolicyNumber)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Policy Number"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:De.externalPolicyNumber})]}),(null==D?void 0:D.quote_reference)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Quote Reference"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:D.quote_reference})]}),null!=(null==De?void 0:De.sumInsured)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Total Sum Insured"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Ss(De.sumInsured)})]}),null!=(null==De?void 0:De.excess)&&Ye("div",{className:Et.create("detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("detail-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:"Excess"}),Ye("span",{className:Et.create("detail-value",{fontWeight:"500",color:St.colors.foreground,fontSize:St.fontSize.small}),children:Ss(De.excess)})]})]}),Me&&Me.length>0&&Ye("hr",{className:Et.create("divider",{border:"none",borderTop:`1px solid ${St.colors.border}`,margin:`${St.spacing.md} 0`})})]}),Me&&Me.length>0&&Ye("div",{className:Et.create("line-items-section",{display:"flex",flexDirection:"column",gap:St.spacing.md}),children:Me.map((e,t)=>Ye("div",{className:Et.create("line-item",{}),children:Ye("div",{className:Et.create("line-item-description",{fontSize:St.fontSize.small,fontWeight:"500",color:St.colors.foreground}),children:e.description})},t))})]}),(ze||De||Me&&Me.length>0)&&Ye("div",{className:Et.create("checkout-sidebar-spacer",{height:St.spacing.lg},{"(max-width: 950px)":{height:St.spacing.md}})}),Ye("div",{className:Et.create("checkout-sidebar-card",{backgroundColor:St.colors.card,borderRadius:St.radius.large,boxShadow:St.shadow.sm,padding:St.spacing.lg},{"(max-width: 768px)":{padding:St.spacing.md}}),children:Ye("div",{className:Et.create("payment-summary",{display:"flex",flex:"1",flexDirection:"column",gap:"1rem"}),children:[Ye("h3",{className:Et.create("cart-summary-title",{fontSize:St.fontSize.large,fontWeight:"600",marginBottom:St.spacing.sm,color:St.colors.foreground}),children:"Payment Details"}),we&&Ye("div",{className:Et.create("summary-section",{paddingBottom:"1rem"}),children:Ye("div",{className:Et.create("payment-breakdown",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:"monthly"!==we.payment_frequency?Ye(C,{children:[(null===(S=we.metadata)||void 0===S?void 0:S.gateway_fee)&&parseFloat(we.metadata.gateway_fee)>0&&Ye(Ea,{label:$a(we.gateway_code,null===(N=we.metadata)||void 0===N?void 0:N.gateway_method),value:Ss(parseFloat(we.metadata.gateway_fee))}),Ye(Ea,{label:"Total Due Today:",value:Ss(parseFloat(we.amount.due_today)),isTotal:!0})]}):Ye(C,{children:[(null===(_=we.metadata)||void 0===_?void 0:_.gateway_fee)&&parseFloat(we.metadata.gateway_fee)>0&&Ye(Ea,{label:$a(we.gateway_code,null===($=we.metadata)||void 0===$?void 0:$.gateway_method),value:Ss(parseFloat(we.metadata.gateway_fee))}),we.amount.total&&Ye(Ea,{label:"Total Payable:",value:Ss(parseFloat(we.amount.total))}),Ye(Ea,{label:"Due Today:",value:Ss(parseFloat(we.amount.due_today))}),we.amount.monthly&&(null===(I=we.metadata)||void 0===I?void 0:I.number_of_instalments)&&we.metadata.number_of_instalments>1&&Ye(Ea,{label:"Remaining payments:",value:`${we.metadata.number_of_instalments-1} x ${Ss(parseFloat(we.amount.monthly))}`})]})})}),Ye(as,{onClick:async()=>{var e,t,n,r,i,o;if(!D)return;const s=D.calculations.length>0,a=!s;if(s&&!H)return void alert("Please select an excess amount before proceeding.");if(!Y)return void alert("Please select a payment method before proceeding.");const l=s?D.calculations.find(e=>e.id===H):null;if(s&&!l)return void alert("Payment configuration error. Please try again.");const c=D.payment_options.find(e=>Ia(e)===Y);if(!c)return void alert("Payment method not available. Please try again.");const d=c.gateway_code,u=null===(e=c.metadata)||void 0===e?void 0:e.gateway_method;let h="Customer";if(null===(t=D.metadata)||void 0===t?void 0:t.client_name)h=D.metadata.client_name;else if(null===(n=D.metadata)||void 0===n?void 0:n.client_details){const e=D.metadata.client_details;e.first_name&&(h=`${e.first_name} ${e.last_name||""}`.trim())}if(a){if(!z)return void alert("Payment service not available. Please try again.");try{j(!0);const e=await z.initiateFixedPayment(D.payment_link_id,d,h,u);if("auto_renew_confirmed"===e.status)return void fe({message:e.message||"Your renewal is confirmed. Your premium funding will continue automatically on the policy start date.",effectiveDate:e.effective_date});if("bank_transfer"===d&&e.transaction_id)return void ge({transactionId:e.transaction_id,organisationId:(null===(r=D.organisation)||void 0===r?void 0:r.id)||""});e.gateway_acceptance_url?window.location.href=e.gateway_acceptance_url:alert("Payment initiated successfully")}catch(e){alert(e.message||"Failed to initiate payment")}finally{j(!1)}return}const m=null===(i=D.metadata)||void 0===i?void 0:i.quote_intent_id,f={...m?{quoteIntentId:m}:{paymentLinkId:D.payment_link_id},paymentLinkId:D.payment_link_id,excessId:(null==l?void 0:l.excess_id)||"",gatewayId:d,calculationId:H||"",clientDetails:{legalName:h},metadata:{payment_link_id:D.payment_link_id,payment_type:m?"quote":"rate",gateway_code:d,gateway:d,...u?{gateway_method:u}:{}},...Pe&&oe?{coverStartDate:oe}:{}};if("bank_transfer"!==d)F(f),B(!0);else{if(!z)return void alert("Payment service not available. Please try again.");try{j(!0);const e={...f,returnUrl:window.location.href},t=await z.initiatePayment(e,d);if(!(t.bank_account_name&&t.reference&&t.transaction_id))throw new Error("Invalid bank transfer response");ge({transactionId:t.transaction_id,organisationId:(null===(o=D.organisation)||void 0===o?void 0:o.id)||""})}catch(e){alert(e.message||"Failed to initiate bank transfer")}finally{j(!1)}}},disabled:!Re,className:Et.create("purchase-button",{width:"100%",height:"3rem",fontSize:St.fontSize.default,fontWeight:"600"}),children:Re?"Go to Payment":"Select Options to Continue"})]})})]})})]}),L&&q&&z&&Ye(Sa,{isOpen:L,onClose:()=>{B(!1),F(null)},onSuccess:()=>{B(!1),F(null),alert("Payment completed successfully!")},paymentRequest:q,httpClient:z}),Ne&&Ye(Ws,{type:_e,transactionId:xe||K||void 0,clientSettings:null!==(E=null===(T=null==D?void 0:D.organisation)||void 0===T?void 0:T.client_settings)&&void 0!==E?E:null,gatewayCode:null!==(R=null!==(P=be.get("gateway_code"))&&void 0!==P?P:null==we?void 0:we.gateway_code)&&void 0!==R?R:void 0,isOpen:!0,onClose:()=>{te(!1);const e=new URL(window.location.href);e.searchParams.delete("status"),e.searchParams.delete("transactionId"),e.searchParams.delete("transaction_id"),window.history.replaceState({},"",e.toString())}})]})})}function Ea({label:e,value:t,isTotal:n=!1,className:r}){return Ye("div",{className:Ot(Et.create("summary-item",{display:"flex",justifyContent:"space-between",alignItems:"center"}),r),children:[Ye("span",{className:Et.create("summary-label",{color:St.colors.mutedForeground,fontSize:St.fontSize.small}),children:e}),Ye("span",{className:Et.create("summary-value",{fontWeight:n?"600":"500",color:St.colors.foreground,fontSize:n?St.fontSize.large:"inherit"}),children:t})]})}function Pa({products:e,onSelectProduct:t}){const[n,r]=at(null),i=(e,t)=>{t&&(t.preventDefault(),t.stopPropagation()),r(e)};return Ye(os,{title:"Select cover",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("product-selection-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Ye("div",{className:Et.create("product-selection-card",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Ye("div",{className:Et.create("product-selection-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("product-selection-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Select Your Cover"}),Ye("p",{className:Et.create("product-selection-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:"What type of vessel are you insuring?"}),Ye("hr",{className:Et.create("product-selection-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]}),Ye("div",{className:Et.create("product-selection-content",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[0===e.length?Ye("div",{className:Et.create("no-products-placeholder",{padding:"2rem",textAlign:"center",border:`1px dashed ${St.colors.border}`,borderRadius:St.radius.default,backgroundColor:St.colors.muted}),children:[Ye("div",{style:{marginBottom:St.spacing.default},children:Ye("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",style:{margin:"0 auto",opacity:.5},children:[Ye("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),Ye("polyline",{points:"14 2 14 8 20 8"})]})}),Ye("p",{className:Et.create("placeholder-text",{color:St.colors.mutedForeground,margin:"0"}),children:"No products available for quoting."})]}):Ye("div",{className:Et.create("product-options-container",{display:"flex",flexDirection:"column",gap:"0.5rem"}),children:e.map(e=>Ye(Ra,{product:e,isSelected:(null==n?void 0:n.id)===e.id,onSelect:i},e.id))}),e.length>0&&Ye("div",{className:Et.create("product-selection-actions",{marginTop:St.spacing.lg}),children:Ye(as,{onClick:()=>{n&&t(n)},disabled:!n,className:Et.create("product-selection-continue-button",{width:"100%"}),children:"Continue"})})]})]})})})})}function Ra({product:e,isSelected:t,onSelect:n}){return Ye("div",{className:Ot(Et.create("product-option-row",{borderRadius:St.radius.default,padding:"0.75rem 1rem",cursor:"pointer",transition:"all 150ms ease",display:"flex",alignItems:"center",gap:"1rem"},{"(max-width: 480px)":{padding:"0.625rem 0.75rem"}}),t?Et.create("product-option-row-selected",{border:`2px solid ${St.colors.primary}`,backgroundColor:St.colors.accent}):Et.create("product-option-row-unselected",{border:`2px solid ${St.colors.border}`,backgroundColor:St.colors.card})),onClick:t=>n(e,t),role:"button",tabIndex:0,onKeyPress:t=>{"Enter"!==t.key&&" "!==t.key||n(e,t)},children:[Ye(xs,{selected:t}),Ye("div",{className:Et.create("product-option-content",{display:"flex",alignItems:"center",justifyContent:"space-between",flex:"1",gap:"1rem"}),children:[Ye("div",{className:Et.create("product-option-info",{display:"flex",flexDirection:"column"}),children:[e.description&&Ye("div",{className:Et.create("product-option-description",{fontSize:St.fontSize.default,fontWeight:"500",color:St.colors.foreground}),children:e.description}),Ye("div",{className:Et.create("product-option-name",{fontSize:St.fontSize.small,color:St.colors.mutedForeground}),children:e.name})]}),e.icon_svg&&Ye("div",{className:Et.create("product-option-icon",{width:"2.5rem",height:"2.5rem",flexShrink:"0",display:"flex",alignItems:"center",justifyContent:"center",color:t?St.colors.primary:St.colors.mutedForeground,transition:"color 150ms ease"}),dangerouslySetInnerHTML:{H:e.icon_svg.replace(/^<svg(?![^>]*\bwidth\b)/,'<svg width="100%" height="100%"')}})]})]})}function za(){var e,t;const n=Bt(),{paymentLinkConfig:r,availableProducts:i,formStateManager:o}=n;if(i&&!o)return Ye(Pa,{products:i,onSelectProduct:()=>{}});if(r)return Ye(Ta,{paymentLinkId:r.paymentLinkId,signedUrl:r.signedUrl});const s=new URLSearchParams(window.location.search),a=s.get("p")||s.get("pl_ref");if(a&&!o)return Ye(Ta,{paymentLinkId:a});const l=window.location.pathname,c=l.match(/\/pay\/([a-f0-9-]+)/);if(c&&c[1])return Ye(Ta,{paymentLinkId:c[1],signedUrl:window.location.href});const d=l.match(/\/payments\/bank-transfer\/([a-f0-9-]+)/),u=s.get("orgId");if(d&&d[1]&&u)return Ye(Na,{transactionId:d[1],organisationId:u});const{isCalculating:h,results:m,quoteIntent:f}=qt(e=>({isCalculating:null==e?void 0:e.getIsCalculating(),results:null==e?void 0:e.getCalculationResult(),quoteIntent:null==e?void 0:e.getQuoteIntent(),fsm:e})),p="hold"===(null==f?void 0:f.status),g=null===(e=null==f?void 0:f.payment_transactions)||void 0===e?void 0:e.find(e=>"bank_transfer"===e.gateway_code&&"pending"===e.status),y="paid"===(null==f?void 0:f.status)||"completed"===(null==f?void 0:f.status);return h?Ye(ss,{title:"Calculating premium",message:"Crunching the numbers now"}):p&&g&&(null===(t=null==f?void 0:f.organisation)||void 0===t?void 0:t.id)?Ye(Na,{transactionId:g.id,organisationId:f.organisation.id,allowCancel:!0}):y?Ye(ka,{}):m?Ye(ta,{results:m}):Ye(xa,{})}function Da(e){return Ye(Lt,{...e,children:Ye(za,{})})}function Ma({reference:e,productName:t,firstName:n,lastUpdated:r,onContinue:i,onStartFresh:o}){const[s,a]=at(null);return Ye(os,{title:"Resume Quote",noSubscription:!0,hideHeader:!0,children:Ye(Wt,{children:Ye("div",{className:Et.create("resume-prompt-layout",{display:"flex",justifyContent:"center",width:"100%"}),children:Ye("div",{className:Et.create("resume-prompt-card",{backgroundColor:St.colors.card,boxShadow:St.shadow.sm,borderRadius:St.radius.large,display:"flex",flexDirection:"column",width:"100%",maxWidth:"600px"}),children:[Ye("div",{className:Et.create("resume-prompt-header",{paddingInline:St.spacing.xl,paddingTop:St.spacing.xl,paddingBottom:St.spacing.lg},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingTop:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingTop:St.spacing.md}}),children:[Ye("h2",{className:Et.create("resume-prompt-title",{margin:"0",marginBottom:St.spacing.sm,fontSize:"1.75rem",fontWeight:"700",color:St.colors.primary,lineHeight:"1.1",letterSpacing:"-0.025em"},{"(max-width: 768px)":{fontSize:"1.5rem"},"(max-width: 480px)":{fontSize:"1.125rem"}}),children:"Existing Quote Found"}),Ye("p",{className:Et.create("resume-prompt-description",{margin:"0",fontSize:St.fontSize.default,lineHeight:"1.6",color:St.colors.foreground,opacity:"0.9"}),children:"There is a quote in progress. Would you like to continue where you left off or start a new quote?"}),(e||t||n||r)&&Ye("div",{className:Et.create("resume-prompt-details",{marginTop:St.spacing.md,padding:St.spacing.md,backgroundColor:St.colors.background,borderRadius:St.radius.default,display:"flex",flexDirection:"column",gap:St.spacing.sm}),children:[t&&Ye("div",{className:Et.create("resume-prompt-detail-row",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Product"}),Ye("span",{className:Et.create("resume-prompt-detail-value",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:t})]}),n&&Ye("div",{className:Et.create("resume-prompt-detail-row-name",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-name",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Client"}),Ye("span",{className:Et.create("resume-prompt-detail-value-name",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:n})]}),e&&Ye("div",{className:Et.create("resume-prompt-detail-row-ref",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-ref",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Reference"}),Ye("span",{className:Et.create("resume-prompt-detail-value-ref",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:e})]}),r&&Ye("div",{className:Et.create("resume-prompt-detail-row-date",{display:"flex",justifyContent:"space-between",alignItems:"center"}),children:[Ye("span",{className:Et.create("resume-prompt-detail-label-date",{fontSize:St.fontSize.small,color:St.colors.foreground,opacity:"0.6"}),children:"Last updated"}),Ye("span",{className:Et.create("resume-prompt-detail-value-date",{fontSize:St.fontSize.small,fontWeight:"600",color:St.colors.foreground}),children:r})]})]}),Ye("hr",{className:Et.create("resume-prompt-header-border",{marginTop:St.spacing.lg,borderColor:St.colors.border})})]}),Ye("div",{className:Et.create("resume-prompt-content",{paddingInline:St.spacing.xl,paddingBottom:St.spacing.xl,display:"flex",flexDirection:"column",gap:St.spacing.md},{"(max-width: 768px)":{paddingInline:St.spacing.lg,paddingBottom:St.spacing.lg},"(max-width: 480px)":{paddingInline:St.spacing.md,paddingBottom:St.spacing.md}}),children:[Ye(as,{onClick:()=>{a("continue"),i()},loading:"continue"===s,disabled:null!==s,className:Et.create("resume-prompt-continue-btn",{width:"100%"}),children:"Continue where I left off"}),Ye(as,{variant:"outline",onClick:()=>{a("fresh"),o()},loading:"fresh"===s,disabled:null!==s,className:Et.create("resume-prompt-fresh-btn",{width:"100%"}),children:"Start a new quote"})]})]})})})})}class Oa extends ${constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(e,n){t();try{Promise.resolve().then(function(){return rm}).then(({captureException:t,addBreadcrumb:r,isSentryInitialized:i})=>{i()&&(r({message:"Component error",category:"ui",level:"error",data:{componentStack:n.componentStack}}),t(e,{componentStack:n.componentStack}))}).catch(()=>{})}catch(e){}const r=ke("initialization",e,"A component error occurred");this.setState({hasError:!0,error:r})}render(){if(this.state.hasError){const e=this.state.error;return Te(e)?Ye(ys,{message:e.message,organisation:e.organisation}):Ye(gs,{error:e})}return this.props.children}}function ja({config:e,initializeFormContext:n}){const[r,i]=at({type:"loading",message:"Loading application..."}),o=n=>{if(n.resumePrompt)return t(),void i({type:"resume_prompt",resumeData:n.resumePrompt});const r=n.availableProducts&&n.availableProducts.length>0;if(r&&!n.formStateManager)return t(),void i({type:"product_selection",products:n.availableProducts});if(!("payment"===e.mode||n.paymentLinkConfig||r||n.formStateManager&&"function"==typeof n.formStateManager.getFormProgress))throw new Error("FormStateManager was not properly initialized");t(),i({type:"success",formContextProps:n})},s=async(r="Loading application...")=>{var s;i({type:"loading",message:r});try{t();const r=await n(e);o(r)}catch(e){let n;if(t(),e&&"object"==typeof e&&"type"in e&&"VERSION_INVALIDATED"===e.type){const t=e.versionInvalidated,r=e.message;n=ke("version_invalidated",{...e,organisation:{quote_page_url:null!==(s=null==t?void 0:t.quote_page_url)&&void 0!==s?s:null}},r)}else n=e&&"object"==typeof e&&"type"in e&&"MAINTENANCE_ERROR"===e.type||e&&"object"==typeof e&&"statusCode"in e&&503===e.statusCode||e&&"object"==typeof e&&"status"in e&&503===e.status?ke("maintenance",e):ke("initialization",e);t((n.type,n.severity,n.statusCode)),i({type:"error",error:n})}};lt(()=>{e.isolateStyles&&Ct(),s()},[e,n]);const a=async e=>{if("resume_prompt"!==r.type)return;const{onContinue:n,onStartFresh:s}=r.resumeData;i({type:"loading",message:"continue"===e?"Loading your quote...":"Starting a new quote..."});try{const t="continue"===e?await n():await s();o(t)}catch(e){t();const n=ke("initialization",e);i({type:"error",error:n})}},l=async e=>{t(e.code),localStorage.setItem("insure-os-selected-product",e.code),await s("Loading...")};return Ye(Oa,{children:Ye("div",{className:Et.create("root",{fontFamily:St.fontFamily,backgroundColor:St.colors.background,minHeight:"100vh",color:St.colors.foreground,maxWidth:"100vw",overflowX:"hidden",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"}),children:function(){var e,t,n,i;switch(r.type){case"loading":return Ye(ss,{message:r.message});case"error":return Te(r.error)?Ye(ys,{message:r.error.message,organisation:r.error.organisation}):"version_invalidated"===r.error.type?Ye(vs,{quotePageUrl:null!==(t=null===(e=r.error.organisation)||void 0===e?void 0:e.quote_page_url)&&void 0!==t?t:null,message:r.error.message,clientSettings:null!==(i=null===(n=r.error.organisation)||void 0===n?void 0:n.client_settings)&&void 0!==i?i:null}):Ye(gs,{error:r.error});case"product_selection":return Ye(Pa,{products:r.products,onSelectProduct:l});case"resume_prompt":return Ye(Ma,{reference:r.resumeData.reference,productName:r.resumeData.productName,firstName:r.resumeData.firstName,lastUpdated:r.resumeData.lastUpdated,onContinue:()=>a("continue"),onStartFresh:()=>a("fresh")});case"success":return Ye(Da,{...r.formContextProps});default:return Ye(gs,{})}}()})})}const Wa="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Aa=globalThis,La="10.56.0";function Ba(){return qa(Aa),Aa}function qa(e){const t=e.oe=e.oe||{};return t.version=t.version||La,t[La]=t[La]||{}}function Fa(e,t,n=Aa){const r=n.oe=n.oe||{},i=r[La]=r[La]||{};return i[e]||(i[e]=t())}const Ha=["debug","info","warn","error","log","assert","trace"],Ua={};function Ya(e){if(!("console"in Aa))return e();const t=Aa.console,n={},r=Object.keys(Ua);r.forEach(e=>{const r=Ua[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Za(){return Ga().enabled}function Va(e,...t){Wa&&Za()&&Ya(()=>{Aa.console[e](`Sentry Logger [${e}]:`,...t)})}function Ga(){return Wa?Fa("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const Qa={enable:function(){Ga().enabled=!0},disable:function(){Ga().enabled=!1},isEnabled:Za,log:function(...e){Va("log",...e)},warn:function(...e){Va("warn",...e)},error:function(...e){Va("error",...e)}},Ja="?",Ka=/\(error: (.*)\)/,Xa=/captureMessage|captureException/;function el(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{const i=[],o=e.split("\n");for(let e=n;e<o.length;e++){let n=o[e];n.length>1024&&(n=n.slice(0,1024));const s=Ka.test(n)?n.replace(Ka,"$1"):n;if(!s.includes("Error: ")){for(const e of t){const t=e(s);if(t){i.push(t);break}}if(i.length>=50+r)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(tl(t).function||"")&&t.pop(),t.reverse(),Xa.test(tl(t).function||"")&&(t.pop(),Xa.test(tl(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||tl(t).filename,function:e.function||Ja}))}(i.slice(r))}}function tl(e){return e[e.length-1]||{}}const nl="<anonymous>";function rl(e){try{return e&&"function"==typeof e&&e.name||nl}catch{return nl}}function il(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}const ol={},sl={};function al(e,t){return ol[e]=ol[e]||[],ol[e].push(t),()=>{const n=ol[e];if(n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}function ll(e,t){if(!sl[e]){sl[e]=!0;try{t()}catch(t){Wa&&Qa.error(`Error while instrumenting ${e}`,t)}}}function cl(e,t){const n=e&&ol[e];if(n)for(const r of n)try{r(t)}catch(t){Wa&&Qa.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${rl(r)}\nError:`,t)}}let dl=null;function ul(){dl=Aa.onerror,Aa.onerror=function(e,t,n,r,i){return cl("error",{column:r,error:i,line:n,msg:e,url:t}),!!dl&&dl.apply(this,arguments)},Aa.onerror.se=!0}let hl=null;function ml(){hl=Aa.onunhandledrejection,Aa.onunhandledrejection=function(e){return cl("unhandledrejection",e),!hl||hl.apply(this,arguments)},Aa.onunhandledrejection.se=!0}const fl={}.toString;function pl(e){switch(fl.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return _l(e,Error)}}function gl(e,t){return fl.call(e)===`[object ${t}]`}function yl(e){return gl(e,"ErrorEvent")}function vl(e){return gl(e,"DOMError")}function wl(e){return gl(e,"String")}function bl(e){return"object"==typeof e&&null!==e&&"ae"in e&&"le"in e}function xl(e){return null===e||bl(e)||"object"!=typeof e&&"function"!=typeof e}function kl(e){return gl(e,"Object")}function Sl(e){return"undefined"!=typeof Event&&_l(e,Event)}function Nl(e){return Boolean(e?.then&&"function"==typeof e.then)}function _l(e,t){try{return e instanceof t}catch{return!1}}function Cl(e){return"undefined"!=typeof Request&&_l(e,Request)}function $l(e,t,n){if(!(t in e))return;const r=e[t];if("function"!=typeof r)return;const i=n(r);"function"==typeof i&&Tl(i,r);try{e[t]=i}catch{Wa&&Qa.log(`Failed to replace method "${t}" in object`,e)}}function Il(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Wa&&Qa.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Tl(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Il(e,"__sentry_original__",t)}catch{}}function El(e){return e.ce}function Pl(e){if(pl(e))return{message:e.message,name:e.name,stack:e.stack,...Rl(e)};if(Sl(e)){const{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...Rl(e)}}return e}function Rl(e){return"object"==typeof e&&null!==e?Object.fromEntries(Object.entries(e)):{}}let zl;function Dl(e){if(void 0!==zl)return zl?zl(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=Aa;return t in n&&"function"==typeof n[t]?(zl=n[t],zl(e)):(zl=null,e())}function Ml(){return Dl(()=>Math.random())}function Ol(){return Dl(()=>Date.now())}const jl=Symbol.for("sentry.skipNormalization"),Wl=Symbol.for("sentry.overrideNormalizationDepth");let Al,Ll,Bl;function ql(e,t=100,n=1/0){try{return Hl("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Fl(e,t=3,n=102400){const r=ql(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?Fl(e,t-1,n):r;var i}function Hl(e,t,n=1/0,r=1/0,i=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[o,s]=i;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const a=Ul(0,t);if(!a.startsWith("[object "))return a;if(function(e){return Boolean(e[jl])}(t))return t;const l=function(e){const t=e[Wl];return"number"==typeof t?t:void 0}(t),c=void 0!==l?l:n;if(0===c)return a.replace("object ","");if(o(t))return"[Circular ~]";const d=t;if(d&&"function"==typeof d.toJSON)try{return Hl("",d.toJSON(),c-1,r,i)}catch{}const u=Array.isArray(t)?[]:{};let h=0;const m=Pl(t);for(const e in m){if(!{}.hasOwnProperty.call(m,e))continue;if(h>=r){u[e]="[MaxProperties ~]";break}const t=m[e];u[e]=Hl(e,t,c-1,r,i),h++}return s(t),u}function Ul(e,t){try{if(Al){const e=Al(t);if(e)return e}if("undefined"!=typeof global&&t===global)return"[Global]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${rl(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const e=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return`[object ${e}]`}catch(e){return`**non-serializable** (${e})`}}function Yl(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Zl(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];xl(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(Ul(0,r))}return n.join(t)}function Vl(e,t,n=!1){return!!wl(e)&&(gl(t,"RegExp")?t.test(e):wl(t)?n?e===t:e.includes(t):"function"==typeof t&&t(e))}function Gl(e,t=[],n=!1){for(const r of t)if(Vl(e,r,n))return!0;return!1}function Ql(e=function(){const e=Aa;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return Dl(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Ll||(Ll="10000000100040008000100000000000"),Ll.replace(/[018]/g,e=>(e^(16*Ml()&15)>>e/4).toString(16))}function Jl(e){return e.exception?.values?.[0]}function Kl(e){const{message:t,event_id:n}=e;if(t)return t;const r=Jl(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Xl(e,t){const n=e.exception=e.exception||{},r=n.values=n.values||[],i=r[0]=r[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function ec(e,t){const n=Jl(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r?.data,...t.data};n.mechanism.data=e}}function tc(e){if(function(e){try{return e.de}catch{}}(e))return!0;try{Il(e,"__sentry_captured__",!0)}catch{}return!1}function nc(){return Ol()/1e3}function rc(){return(Bl??(Bl=function(){const{performance:e}=Aa;if(!e?.now||!e.timeOrigin)return nc;const t=e.timeOrigin;return()=>(t+Dl(()=>e.now()))/1e3}()))()}function ic(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||rc(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Ql()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function oc(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)({}).hasOwnProperty.call(t,e)&&(r[e]=oc(r[e],t[e],n-1));return r}function sc(){return Ql()}function ac(){return Ql().substring(16)}function lc(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}const cc="_sentrySpan";function dc(e,t){t?Il(e,cc,function(e){try{const t=Aa.WeakRef;if("function"==typeof t)return new t(e)}catch{}return e}(t)):delete e[cc]}function uc(e){return lc(e[cc])}class hc{constructor(){this.ue=!1,this.he=[],this.me=[],this.fe=[],this.pe=[],this.ge={},this.ye={},this.ve={},this.we={},this.be={},this.xe={},this.ke={traceId:sc(),sampleRand:Ml()}}clone(){const e=new hc;return e.fe=[...this.fe],e.ye={...this.ye},e.ve={...this.ve},e.we={...this.we},e.be={...this.be},this.be.flags&&(e.be.flags={values:[...this.be.flags.values]}),e.ge=this.ge,e.Se=this.Se,e.Ne=this.Ne,e._e=this._e,e.Ce=this.Ce,e.me=[...this.me],e.pe=[...this.pe],e.xe={...this.xe},e.ke={...this.ke},e.$e=this.$e,e.Ie=this.Ie,e.Te=this.Te,dc(e,uc(this)),e}setClient(e){this.$e=e}setLastEventId(e){this.Ie=e}getClient(){return this.$e}lastEventId(){return this.Ie}addScopeListener(e){this.he.push(e)}addEventProcessor(e){return this.me.push(e),this}setUser(e){return this.ge=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.Ne&&ic(this.Ne,{user:e}),this.Ee(),this}getUser(){return this.ge}setConversationId(e){return this.Te=e||void 0,this.Ee(),this}setTags(e){return this.ye={...this.ye,...e},this.Ee(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this.ve={...this.ve,...e},this.Ee(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this.ve&&(delete this.ve[e],this.Ee()),this}setExtras(e){return this.we={...this.we,...e},this.Ee(),this}setExtra(e,t){return this.we={...this.we,[e]:t},this.Ee(),this}setFingerprint(e){return this.Ce=e,this.Ee(),this}setLevel(e){return this.Se=e,this.Ee(),this}setTransactionName(e){return this._e=e,this.Ee(),this}setContext(e,t){return null===t?delete this.be[e]:this.be[e]=t,this.Ee(),this}setSession(e){return e?this.Ne=e:delete this.Ne,this.Ee(),this}getSession(){return this.Ne}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,n=t instanceof hc?t.getScopeData():kl(t)?e:void 0,{tags:r,attributes:i,extra:o,user:s,contexts:a,level:l,fingerprint:c=[],propagationContext:d,conversationId:u}=n||{};return this.ye={...this.ye,...r},this.ve={...this.ve,...i},this.we={...this.we,...o},this.be={...this.be,...a},s&&Object.keys(s).length&&(this.ge=s),l&&(this.Se=l),c.length&&(this.Ce=c),d&&(this.ke=d),u&&(this.Te=u),this}clear(){return this.fe=[],this.ye={},this.ve={},this.we={},this.ge={},this.be={},this.Se=void 0,this._e=void 0,this.Ce=void 0,this.Ne=void 0,this.Te=void 0,dc(this,void 0),this.pe=[],this.setPropagationContext({traceId:sc(),sampleRand:Ml()}),this.Ee(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:nc(),...e,message:e.message?Yl(e.message,2048):e.message};return this.fe.push(r),this.fe.length>n&&(this.fe=this.fe.slice(-n),this.$e?.recordDroppedEvent("buffer_overflow","log_item")),this.Ee(),this}getLastBreadcrumb(){return this.fe[this.fe.length-1]}clearBreadcrumbs(){return this.fe=[],this.Ee(),this}addAttachment(e){return this.pe.push(e),this}clearAttachments(){return this.pe=[],this}getScopeData(){return{breadcrumbs:this.fe,attachments:this.pe,contexts:this.be,tags:this.ye,attributes:this.ve,extra:this.we,user:this.ge,level:this.Se,fingerprint:this.Ce||[],eventProcessors:this.me,propagationContext:this.ke,sdkProcessingMetadata:this.xe,transactionName:this._e,span:uc(this),conversationId:this.Te}}setSDKProcessingMetadata(e){return this.xe=oc(this.xe,e,2),this}setPropagationContext(e){return this.ke=e,this}getPropagationContext(){return this.ke}captureException(e,t){const n=t?.event_id||Ql();if(!this.$e)return Wa&&Qa.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this.$e.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n?.event_id||Ql();if(!this.$e)return Wa&&Qa.warn("No client configured on scope - will not capture message!"),r;const i=n?.syntheticException??new Error(e);return this.$e.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=e.event_id||t?.event_id||Ql();return this.$e?(this.$e.captureEvent(e,{...t,event_id:n},this),n):(Wa&&Qa.warn("No client configured on scope - will not capture event!"),n)}Ee(){this.ue||(this.ue=!0,this.he.forEach(e=>{e(this)}),this.ue=!1)}}const mc=e=>e instanceof Promise&&!e[fc],fc=Symbol("chained PromiseLike");class pc{constructor(e,t){let n,r;n=e||new hc,r=t||new hc,this.Pe=[{scope:n}],this.Re=r}withScope(e){const t=this.ze();let n;try{n=e(t)}catch(e){throw this.De(),e}return Nl(n)?((e,t,n)=>{const r=e.then(e=>(t(),e),e=>{throw n(),e});return mc(r)&&mc(e)?r:((e,t)=>{if(!t)return e;let n=!1;for(const r in e){if(r in t)continue;n=!0;const i=e[r];"function"==typeof i?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[fc]:!0}),t})(e,r)})(n,()=>this.De(),()=>this.De()):(this.De(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.Re}getStackTop(){return this.Pe[this.Pe.length-1]}ze(){const e=this.getScope().clone();return this.Pe.push({client:this.getClient(),scope:e}),e}De(){return!(this.Pe.length<=1||!this.Pe.pop())}}function gc(){const e=qa(Ba());return e.stack=e.stack||new pc(Fa("defaultCurrentScope",()=>new hc),Fa("defaultIsolationScope",()=>new hc))}function yc(e){return gc().withScope(e)}function vc(e,t){const n=gc();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function wc(e){return gc().withScope(()=>e(gc().getIsolationScope()))}function bc(e){const t=qa(e);return t.acs?t.acs:{withIsolationScope:wc,withScope:yc,withSetScope:vc,withSetIsolationScope:(e,t)=>wc(t),getCurrentScope:()=>gc().getScope(),getIsolationScope:()=>gc().getIsolationScope()}}function xc(e,t){const{value:n,unit:r}="object"==typeof(i=e)&&null!=i&&!Array.isArray(i)&&Object.keys(i).includes("value")?e:{value:e,unit:void 0};var i;const o=function(e){if(Array.isArray(e))return{value:e,type:"array"};const t="string"==typeof e?"string":"boolean"==typeof e?"boolean":"number"!=typeof e||Number.isNaN(e)?null:Number.isInteger(e)?"integer":"double";return t?{value:e,type:t}:void 0}(n),s=r&&"string"==typeof r?{unit:r}:{};if(o)return{...o,...s};if(!t||"skip-undefined"===t&&void 0===n)return;let a="";try{a=JSON.stringify(n)??""}catch{}return{value:a,type:"string",...s}}function kc(e,t=!1){const n={};for(const[r,i]of Object.entries(e??{})){const e=xc(i,t);e&&(n[r]=e)}return n}function Sc(){return bc(Ba()).getCurrentScope()}function Nc(){return bc(Ba()).getIsolationScope()}function _c(...e){const t=bc(Ba());if(2===e.length){const[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Cc(){return Sc().getClient()}function $c(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,o={trace_id:n,span_id:i||ac()};return r&&(o.parent_span_id=r),o}const Ic="sentry.profile_id",Tc="sentry.exclusive_time";function Ec(e){const t=e;return{scope:t.Me,isolationScope:lc(t.Oe)}}function Pc(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}const Rc=/^o(\d+)\./,zc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function Dc(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:l}=e;return`${a}://${l}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${s}`}function Mc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Oc(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=function(e){const t=e.match(Rc);return t?.[1]}(n)),r}let jc=!1;function Wc(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:qc(e).parent_span_id,o=Ec(e).scope;return{parent_span_id:i,span_id:r?o?.getPropagationContext().propagationSpanId||ac():t,trace_id:n}}function Ac(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:1===n,attributes:i,...r})):void 0}function Lc(e){return"number"==typeof e?Bc(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Bc(e.getTime()):rc()}function Bc(e){return e>9999999999?e/1e3:e}function qc(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:r,startTime:i,name:o,endTime:s,status:a,links:l}=e;return{span_id:t,trace_id:n,data:r,description:o,parent_span_id:Fc(e),start_timestamp:Lc(i),timestamp:Lc(s)||void 0,status:Hc(a),op:r["sentry.op"],origin:r["sentry.origin"],links:Ac(l)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Fc(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Hc(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"internal_error"}const Uc=function(e){return e.je||e};function Yc(){jc||(Ya(()=>{}),jc=!0)}function Zc(e){Qa.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Vc(e,t){if(!t?.length)return!1;for(const n of t){if(Qc(n)){if(e.description&&Vl(e.description,n))return Wa&&Zc(e),!0;continue}const t=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!t)continue;const r=!n.name||e.description&&Vl(e.description,n.name),i=!n.op||e.op&&Vl(e.op,n.op),o=!n.attributes||Object.entries(n.attributes).every(([t,n])=>{return r=e.attributes?.[t],i=n,"string"==typeof r&&("string"==typeof i||i instanceof RegExp)?Vl(r,i):Array.isArray(r)&&Array.isArray(i)?r.length===i.length&&r.every((e,t)=>e===i[t]):r===i;var r,i});if(r&&i&&o)return Wa&&Zc(e),!0}return!1}function Gc(e,t){const n=t.parent_span_id,r=t.span_id;if(n)for(const t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Qc(e){return"string"==typeof e||e instanceof RegExp}const Jc="production";function Kc(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Jc,release:n.release,public_key:r,trace_id:e,org_id:Oc(t)};return t.emit("createDsc",i),i}function Xc(e){const t=Cc();if(!t)return{};const n=Uc(e),r=qc(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(e){return"number"!=typeof s&&"string"!=typeof s||(e.sample_rate=`${s}`),e}const l=n.We;if(l)return a(l);const c=o?.get("sentry.dsc"),d=c&&function(e){const t=function(e){if(e&&(wl(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const n=Pc(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):Pc(e)}(e);if(!t)return;const n=Object.entries(t).reduce((e,[t,n])=>(t.startsWith("sentry-")&&(e[t.slice(7)]=n),e),{});return Object.keys(n).length>0?n:void 0}(c);if(d)return a(d);const u=Kc(e.spanContext().traceId,t),h=i["sentry.source"]??i["sentry.span.source"],m=r.description;return"url"!==h&&m&&(u.transaction=m),function(){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const e=Cc()?.getOptions();return!(!e||null==e.tracesSampleRate&&!e.tracesSampler)}()&&(u.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(n)),u.sample_rand=o?.get("sentry.sample_rand")??Ec(n).scope?.getPropagationContext().sampleRand.toString()),a(u),t.emit("createDsc",u,n),u}function ed(e,t=[]){return[e,t]}function td(e,t){const[n,r]=e;return[n,[...r,t]]}function nd(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function rd(e){const t=qa(Aa);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function id(e){const[t,n]=e;let r=JSON.stringify(t);function i(e){"string"==typeof r?r="string"==typeof e?r+e:[rd(r),e]:r.push("string"==typeof e?rd(e):e)}for(const e of n){const[t,n]=e;if(i(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(ql(n))}i(e)}}return"string"==typeof r?r:function(e){const t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(r)}function od(e){const t="string"==typeof e.data?rd(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const sd={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function ad(e){return function(e){return e in sd}(e)?sd[e]:e}function ld(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function cd(e,t){const{extra:n,tags:r,attributes:i,user:o,contexts:s,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:d,eventProcessors:u,attachments:h,propagationContext:m,transactionName:f,span:p}=t;dd(e,"extra",n),dd(e,"tags",r),dd(e,"attributes",i),dd(e,"user",o),dd(e,"contexts",s),e.sdkProcessingMetadata=oc(e.sdkProcessingMetadata,l,2),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext={...e.propagationContext,...m}}function dd(e,t,n){e[t]=oc(e[t],n,1)}function ud(e,t){const n=Fa("globalScope",()=>new hc).getScopeData();return e&&cd(n,e.getScopeData()),t&&cd(n,t.getScopeData()),n}function hd(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function md(e,t){const n=e.attributes??(e.attributes={});Object.entries(t).forEach(([e,t])=>{null==t||e in n||(n[e]=t)})}function fd(e){return new gd(t=>{t(e)})}function pd(e){return new gd((t,n)=>{n(e)})}class gd{constructor(e){this.Ae=0,this.Le=[],this.Be(e)}then(e,t){return new gd((n,r)=>{this.Le.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this.qe()})}catch(e){return this.then(e=>e,e)}finally(e){return new gd((t,n)=>{let r,i;return this.then(t=>{i=!1,r=t,e&&e()},t=>{i=!0,r=t,e&&e()}).then(()=>{i?n(r):t(r)})})}qe(){if(0===this.Ae)return;const e=this.Le.slice();this.Le=[],e.forEach(e=>{e[0]||(1===this.Ae&&e[1](this.Fe),2===this.Ae&&e[2](this.Fe),e[0]=!0)})}Be(e){const t=(e,t)=>{0===this.Ae&&(Nl(t)?t.then(n,r):(this.Ae=e,this.Fe=t,this.qe()))},n=e=>{t(1,e)},r=e=>{t(2,e)};try{e(n,r)}catch(e){r(e)}}}function yd(e,t,n,r=0){try{const i=vd(t,n,e,r);return Nl(i)?i:fd(i)}catch(e){return pd(e)}}function vd(e,t,n,r){const i=n[r];if(!e||!i)return e;const o=i({...e},t);return Wa&&null===o&&Qa.log(`Event processor "${i.id||"?"}" dropped event`),Nl(o)?o.then(e=>vd(e,t,n,r+1)):vd(o,t,n,r+1)}let wd,bd,xd,kd;function Sd(e,t,n,r,i,o){const{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,l={...t,event_id:t.event_id||n.event_id||Ql(),timestamp:t.timestamp||nc()},c=n.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o}=t;e.environment=e.environment||n||Jc,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const s=e.request;s?.url&&o&&(s.url=Yl(s.url,o)),o&&e.exception?.values?.forEach(e=>{e.value&&(e.value=Yl(e.value,o))})}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),i&&i.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const n=function(e){const t=Aa.He,n=Aa.Ue;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(kd&&r.length===bd&&i.length===xd)return kd;bd=r.length,xd=i.length,kd={},wd||(wd={});const o=(t,n)=>{for(const r of t){const t=n[r],i=wd?.[r];if(i&&kd&&t)kd[i[0]]=t,wd&&(wd[r]=[i[0],t]);else if(t){const n=e(r);for(let e=n.length-1;e>=0;e--){const i=n[e],o=i?.filename;if(o&&kd&&wd){kd[o]=t,wd[r]=[o,t];break}}}}};return t&&o(r,t),n&&o(i,n),kd}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}(l,e.stackParser);const d=function(e,t){if(!t)return e;const n=e?e.clone():new hc;return n.update(t),n}(r,n.captureContext);n.mechanism&&ec(l,n.mechanism);const u=i?i.getEventProcessors():[],h=ud(o,d),m=[...n.attachments||[],...h.attachments];m.length&&(n.attachments=m),function(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:s,transactionName:a}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(o).length&&(e.contexts={...o,...e.contexts}),s&&(e.level=s),a&&"transaction"!==e.type&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts={trace:Wc(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Xc(t),...e.sdkProcessingMetadata};const n=qc(Uc(t)).description;n&&!e.transaction&&"transaction"===e.type&&(e.transaction=n)}(e,r),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}(l,h);const f=[...u,...h.eventProcessors];return(n.data&&!0===n.data.Ye?fd(l):yd(f,l,n)).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof s&&s>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:ql(e.data,t,n)}}))},...e.user&&{user:ql(e.user,t,n)},...e.contexts&&{contexts:ql(e.contexts,t,n)},...e.extra&&{extra:ql(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=ql(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:ql(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=ql(e.contexts.flags,3,n)),r}(e,s,a):e))}function Nd(e){return Sc().captureException(e,void 0)}function _d(e,t){const n="string"==typeof t?t:void 0,r="string"!=typeof t?{captureContext:t}:void 0;return Sc().captureMessage(e,n,r)}function Cd(e,t){return Sc().captureEvent(e,t)}function $d(e){const t=Nc(),{user:n}=ud(t,Sc()),{userAgent:r}=Aa.navigator||{},i=function(e){const t=rc(),n={sid:Ql(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(n)};return e&&ic(n,e),n}({user:n,...r&&{userAgent:r},...e}),o=t.getSession();return"ok"===o?.status&&ic(o,{status:"exited"}),Id(),t.setSession(i),i}function Id(){const e=Nc(),t=Sc().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),ic(e,t)}(t),Td(),e.setSession()}function Td(){const e=Nc(),t=Cc(),n=e.getSession();n&&t&&t.captureSession(n)}function Ed(e=!1){e?Id():Td()}const Pd=[];function Rd(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;if(t.forEach(e=>{e.isDefaultInstance=!0}),Array.isArray(n))r=[...t,...n];else if("function"==typeof n){const e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return function(e){const t={};return e.forEach(e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}(r)}function zd(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function Dd(e,t,n){if(n[t.name])Wa&&Qa.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,Pd.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),Pd.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,r)=>n(t,r,e))}if("function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}["processSpan","processSegmentSpan"].forEach(n=>{const r=t[n];"function"==typeof r&&e.on(n,n=>r.call(t,n,e))}),Wa&&Qa.log(`Integration installed: ${t.name}`)}}function Md(){return"undefined"!=typeof window&&(!(("undefined"==typeof __SENTRY_BROWSER_BUNDLE__||!__SENTRY_BROWSER_BUNDLE__)&&"[object process]"==={}.toString.call("undefined"!=typeof process?process:0))||function(){const e=Aa.process;return"renderer"===e?.type}())}function Od(e,t){const n=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Md()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function jd(e,t){const n=t??function(e){return Wd().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r,i){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Dc(r)),ed(o,[Od(e,i)])}(n,r.Ze,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Wd().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function Wd(){return Fa("clientToLogBufferMap",()=>new WeakMap)}function Ad(e,t){const n=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Md()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function Ld(e,t){const n=t??function(e){return Bd().get(e)}(e)??[];if(0===n.length)return;const r=e.getOptions(),i=function(e,t,n,r,i){const o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(o.dsn=Dc(r)),ed(o,[Ad(e,i)])}(n,r.Ze,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Bd().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function Bd(){return Fa("clientToMetricBufferMap",()=>new WeakMap)}function qd(e){return t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:e.status&&"ok"!==e.status&&"cancelled"!==e.status?"error":"ok",is_segment:!1,attributes:{...e.data},links:e.links},{...t,attributes:kc(t.attributes),links:t.links?.map(e=>({...e,attributes:kc(e.attributes)}))};var t}function Fd(e){return"object"==typeof e&&"function"==typeof e.unref&&e.unref(),e}const Hd=Symbol.for("SentryBufferFullError");function Ud(e=100){const t=new Set;function n(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(r){if(!(t.size<e))return pd(Hd);const i=r();return t.add(i),i.then(()=>n(i),()=>n(i)),i},drain:function(e){if(!t.size)return fd(!0);const n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;const r=[n,new Promise(t=>Fd(setTimeout(()=>t(!1),e)))];return Promise.race(r)}}}function Yd(e,t,n=Ud(e.bufferSize||64)){let r={};return{send:function(i){const o=[];if(nd(i,(t,n)=>{const i=ad(n);!function(e,t,n=Ol()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)?o.push(t):e.recordDroppedEvent("ratelimit_backoff",i)}),0===o.length)return Promise.resolve({});const s=ed(i[0],o),a=t=>{!function(e,t){return nd(e,(e,n)=>t.includes(n))}(s,["client_report"])?nd(s,(n,r)=>{e.recordDroppedEvent(t,ad(r))}):Wa&&Qa.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return n.add(()=>t({body:id(s)}).then(e=>413===e.statusCode?(Wa&&Qa.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),a("send_error"),e):(Wa&&void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Qa.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=Ol()){const i={...e},o=n?.["x-sentry-rate-limits"],s=n?.["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),s=parseInt(t,10),a=1e3*(isNaN(s)?60:s);if(n)for(const e of n.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=r+a);else i.all=r+a}else s?i.all=r+function(e,t=Ol()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(s,r):429===t&&(i.all=r+6e4);return i}(r,e),e),e=>{throw a("network_error"),Wa&&Qa.error("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Hd)return Wa&&Qa.error("Skipped sending event because buffer is full."),a("queue_overflow"),Promise.resolve({});throw e})},flush:e=>n.drain(e)}}function Zd(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}const Vd=["forwarded","-ip","remote-","via","-user"],Gd={userInfo:!1,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5};const Qd="Not capturing exception because it's already been captured.",Jd="Discarded session because of missing or non-string release",Kd=Symbol.for("SentryInternalError"),Xd=Symbol.for("SentryDoNotSendEventError");function eu(e){return{message:e,[Kd]:!0}}function tu(e){return{message:e,[Xd]:!0}}function nu(e){return!!e&&"object"==typeof e&&Kd in e}function ru(e){return!!e&&"object"==typeof e&&Xd in e}function iu(e,t,n,r,i){let o,s=0,a=!1;e.on(n,()=>{s=0,clearTimeout(o),a=!1}),e.on(t,t=>{if(s+=r(t),s>=8e5)i(e);else if(!a){const t=e.getOptions().Ve??5e3;t>0&&(a=!0,o=Fd(setTimeout(()=>{i(e)},t)))}}),e.on("flush",()=>{i(e)})}class ou{constructor(e){if(this.Ge=e,this.Qe={},this.Je=0,this.Ke={},this.Xe={},this.me=[],this.et=Ud(e.transportOptions?.bufferSize??64),this.nt=function(e){const t=null!=e.dataCollection?Gd:!0===e.sendDefaultPii?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5}:{userInfo:!1,cookies:{deny:Vd},httpHeaders:{request:{deny:Vd},response:{deny:Vd}},httpBodies:[],queryParams:{deny:Vd},genAI:{inputs:!1,outputs:!1},stackFrameVariables:!0,frameContextLines:5},n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,queryParams:n.queryParams??t.queryParams,genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}(e),e.dsn?this.rt=function(e){const t="string"==typeof e?function(e){const t=zc.exec(e);if(!t)return void Ya(()=>{});const[n,r,i="",o="",s="",a=""]=t.slice(1);let l="",c=a;const d=c.split("/");if(d.length>1&&(l=d.slice(0,-1).join("/"),c=d.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return Mc({host:o,pass:i,path:l,projectId:c,port:s,protocol:n,publicKey:r})}(e):Mc(e);if(t&&function(e){if(!Wa)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(Qa.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(Qa.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(Qa.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(Qa.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Wa&&Qa.warn("No DSN provided, client will not send events."),this.rt){const i=(t=this.rt,n=e.tunnel,r=e.Ze?e.Ze.sdk:void 0,n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const n={sentry_version:"7"};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}(t,r)}`);this.it=e.transport({tunnel:this.Ge.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:i})}var t,n,r;this.Ge.enableLogs=this.Ge.enableLogs??this.Ge.ot?.enableLogs,this.Ge.enableLogs&&iu(this,"afterCaptureLog","flushLogs",du,jd),(this.Ge.enableMetrics??this.Ge.ot?.enableMetrics??1)&&iu(this,"afterCaptureMetric","flushMetrics",cu,Ld)}captureException(e,t,n){const r=Ql();if(tc(e))return Wa&&Qa.log(Qd),r;const i={event_id:r,...t};return this.st(()=>this.eventFromException(e,i).then(e=>this.lt(e,i,n)).then(e=>e),"error"),i.event_id}captureMessage(e,t,n,r){const i={event_id:Ql(),...n},o=bl(e)?e:String(e),s=xl(e),a=s?this.eventFromMessage(o,t,i):this.eventFromException(e,i);return this.st(()=>a.then(e=>this.lt(e,i,r)),s?"unknown":"error"),i.event_id}captureEvent(e,t,n){const r=Ql();if(t?.originalException&&tc(t.originalException))return Wa&&Qa.log(Qd),r;const i={event_id:r,...t},o=e.sdkProcessingMetadata||{},s=o.capturedSpanScope,a=o.capturedSpanIsolationScope,l=su(e.type);return this.st(()=>this.lt(e,i,s||n,a),l),i.event_id}captureSession(e){this.sendSession(e),ic(e,{init:!1})}getDsn(){return this.rt}getOptions(){return this.Ge}getDataCollectionOptions(){return this.nt}getSdkMetadata(){return this.Ge.Ze}getTransport(){return this.it}async flush(e){const t=this.it;if(this.emit("flush"),!t)return!0;const n=await this.ct(e),r=await t.flush(e);return n&&r}async close(e){jd(this);const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this.me}addEventProcessor(e){this.me.push(e)}init(){(this.ut()||this.Ge.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this.ht()}getIntegrationByName(e){return this.Qe[e]}getIntegrationNames(){return Object.keys(this.Qe)}addIntegration(e){const t=this.Qe[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Dd(this,e,this.Qe),t||zd(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);const n=function(e,t){if("transaction"!==e.type||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||!t.getOptions().streamGenAiSpans||function(e){return"stream"===e.getOptions().traceLifecycle}(t))return;const n=[],r=[];for(const t of e.spans)t.op?.startsWith("gen_ai.")?n.push(qd(t)):r.push(t);if(0===n.length)return;e.spans=r;const i=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:n.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Md()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}(e,this);let r=function(e,t,n,r){const i=ld(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const n=e.sdk||{};e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,n?.sdk);const s=function(e,t,n,r){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Dc(r)},...i&&{trace:i}}}(e,i,r,t);return delete e.sdkProcessingMetadata,ed(s,[[{type:o},e]])}(e,this.rt,this.Ge.Ze,this.Ge.tunnel);for(const e of t.attachments||[])r=td(r,od(e));n&&(r=td(r,n)),this.sendEnvelope(r).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:n=Jc}=this.Ge;if("aggregates"in e){const r=e.attrs||{};if(!r.release&&!t)return void(Wa&&Qa.warn(Jd));r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t)return void(Wa&&Qa.warn(Jd));e.release=e.release||t,e.environment=e.environment||n}this.emit("beforeSendSession",e);const r=function(e,t,n,r){const i=ld(n);return ed({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Dc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this.rt,this.Ge.Ze,this.Ge.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this.Ge.sendClientReports){const r=`${e}:${t}`;Wa&&Qa.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:""}`),this.Ke[r]=(this.Ke[r]||0)+n}}on(e,t){const n=this.Xe[e]=this.Xe[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){const n=this.Xe[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this.ut()&&this.it)try{return await this.it.send(e)}catch(e){return Wa&&Qa.error("Error while sending envelope:",e),{}}return Wa&&Qa.error("Transport disabled"),{}}registerCleanup(e){}dispose(){}ht(){const{integrations:e}=this.Ge;this.Qe=function(e,t){const n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Dd(e,t,n)}),n}(this,e),zd(this,e)}ft(e,t){let n="fatal"===t.level,r=!1;const i=t.exception?.values;if(i){r=!0,n=!1;for(const e of i)if(!1===e.mechanism?.handled){n=!0;break}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(ic(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}async ct(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this.Je)return!0;t++}return!1}ut(){return!1!==this.getOptions().enabled&&void 0!==this.it}gt(e,t,n,r){const i=this.getOptions(),o=this.getIntegrationNames();return!t.integrations&&o.length&&(t.integrations=o),this.emit("preprocessEvent",e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Sd(i,e,t,n,this,r).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:{...e.contexts?.trace,...$c(n)},...e.contexts};const r=function(e,t){const n=t.getPropagationContext();return n.dsc||Kc(n.traceId,e)}(this,n);return e.sdkProcessingMetadata={dynamicSamplingContext:r,...e.sdkProcessingMetadata},e})}lt(e,t={},n=Sc(),r=Nc()){return Wa&&au(e)&&Qa.log(`Captured error event \`${Zd(e)[0]||"<unknown>"}\``),this.yt(e,t,n,r).then(e=>e.event_id,e=>{Wa&&(ru(e)?Qa.log(e.message):nu(e)?Qa.warn(e.message):Qa.warn(e))})}yt(e,t,n,r){const i=this.getOptions(),{sampleRate:o}=i,s=lu(e),a=au(e),l=`before send for type \`${e.type||"error"}\``,c=void 0===o?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(o);if(a&&"number"==typeof c&&Ml()>c)return this.recordDroppedEvent("sample_rate","error"),pd(tu(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const d=su(e.type);return this.gt(e,t,n,r).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",d),tu("An event processor returned `null`, will not send event.");if(!0===t.data?.Ye)return e;const n=function(e,t,n,r){const{beforeSend:i,beforeSendTransaction:o,ignoreSpans:s}=t,a=!((l=t.beforeSendSpan)&&"function"==typeof l&&"vt"in l&&l.vt)&&t.beforeSendSpan;var l;let c=n;if(au(c)&&i)return i(c,r);if(lu(c)){if(a||s){const t=function(e){const{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:o,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:o,profile_id:s?.[Ic],exclusive_time:s?.[Tc],measurements:e.measurements,is_segment:!0}}(c);if(s?.length&&Vc({description:t.description,op:t.op,attributes:t.data},s))return null;if(a){const e=a(t);e?c=oc(n,{type:"transaction",timestamp:(d=e).timestamp,start_timestamp:d.start_timestamp,transaction:d.description,contexts:{trace:{trace_id:d.trace_id,span_id:d.span_id,parent_span_id:d.parent_span_id,op:d.op,status:d.status,origin:d.origin,data:{...d.data,...d.profile_id&&{[Ic]:d.profile_id},...d.exclusive_time&&{[Tc]:d.exclusive_time}}}},measurements:d.measurements}):Yc()}if(c.spans){const t=[],n=c.spans;for(const e of n)if(s?.length&&Vc({description:e.description,op:e.op,attributes:e.data},s))Gc(n,e);else if(a){const n=a(e);n?t.push(n):(Yc(),t.push(e))}else t.push(e);const r=c.spans.length-t.length;r&&e.recordDroppedEvent("before_send","span",r),c.spans=t}}if(o){if(c.spans){const e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return o(c,r)}}var d;return c}(this,i,e,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(Nl(e))return e.then(e=>{if(!kl(e)&&null!==e)throw eu(n);return e},e=>{throw eu(`${t} rejected with ${e}`)});if(!kl(e)&&null!==e)throw eu(n);return e}(n,l)}).then(i=>{if(null===i){if(this.recordDroppedEvent("before_send",d),s){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw tu(`${l} returned \`null\`, will not send event.`)}const o=n.getSession()||r.getSession();if(a&&o&&this.ft(o,i),s){const e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const c=i.transaction_info;if(s&&c&&i.transaction!==e.transaction){const e="custom";i.transaction_info={...c,source:e}}return this.sendEvent(i,t),i}).then(null,e=>{if(ru(e)||nu(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{Ye:!0},originalException:e}),eu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}st(e,t){this.Je++,this.et.add(e).then(e=>(this.Je--,e),e=>(this.Je--,e===Hd&&this.recordDroppedEvent("queue_overflow",t),e))}wt(){const e=this.Ke;return this.Ke={},Object.entries(e).map(([e,t])=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t}})}bt(){Wa&&Qa.log("Flushing outcomes...");const e=this.wt();if(0===e.length)return void(Wa&&Qa.log("No outcomes to send"));if(!this.rt)return void(Wa&&Qa.log("No dsn provided, will not send outcomes"));Wa&&Qa.log("Sending outcomes:",e);const t=(n=e,ed((r=this.Ge.tunnel&&Dc(this.rt))?{dsn:r}:{},[[{type:"client_report"},{timestamp:nc(),discarded_events:n}]]));var n,r;this.sendEnvelope(t)}}function su(e){return"replay_event"===e?"replay":e||"error"}function au(e){return void 0===e.type}function lu(e){return"transaction"===e.type}function cu(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+uu(e.attributes)}function du(e){let t=0;return e.message&&(t+=2*e.message.length),t+uu(e.attributes)}function uu(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*hu(e[0]):xl(e)?t+=hu(e):t+=100}),t}function hu(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function mu(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}const fu=100;function pu(e,t){const n=Cc(),r=Nc();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=fu}=n.getOptions();if(o<=0)return;const s={timestamp:nc(),...e},a=i?Ya(()=>i(s,t)):s;null!==a&&(n.emit&&n.emit("beforeAddBreadcrumb",a,t),r.addBreadcrumb(a,o))}let gu;const yu=new WeakMap,vu=()=>({name:"FunctionToString",setupOnce(){gu=function(){}.toString;try{Function.prototype.toString=function(...e){const t=El(this),n=yu.has(Cc())&&void 0!==t?t:this;return gu.apply(n,e)}}catch{}},setup(e){yu.set(e,!0)}}),wu=[/^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/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],bu=(e={})=>{let t;return{name:"EventFilters",setup(n){const r=n.getOptions();t=ku(e,r)},processEvent(n,r,i){if(!t){const n=i.getOptions();t=ku(e,n)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const n=e.transaction;return!!n&&Gl(n,t)}(e,t.ignoreTransactions))return Wa&&Qa.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Kl(e)}`),!0}else{if(function(e,t){return!!t?.length&&Zd(e).some(e=>Gl(e,t))}(e,t.ignoreErrors))return Wa&&Qa.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Kl(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return Wa&&Qa.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Kl(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const n=Su(e);return!!n&&Gl(n,t)}(e,t.denyUrls))return Wa&&Qa.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Kl(e)}.\nUrl: ${Su(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const n=Su(e);return!n||Gl(n,t)}(e,t.allowUrls))return Wa&&Qa.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Kl(e)}.\nUrl: ${Su(e)}`),!0}return!1}(n,t)?null:n}}},xu=(e={})=>({...bu(e),name:"InboundFilters"});function ku(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:wu],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Su(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),n=t?.stacktrace?.frames;return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch{return Wa&&Qa.error(`Cannot extract url for event ${Kl(e)}`),null}}function Nu(e,t,n,r,i,o){if(!i.exception?.values||!o||!_l(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=_u(e,t,r,o.originalException,n,i.exception.values,s,0))}function _u(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let l=[...o];if(_l(r[i],Error)){$u(s,a,r);const o=e(t,r[i]),c=l.length;Iu(o,i,c,a),l=_u(e,t,n,r[i],i,[o,...l],o,c)}return Cu(r)&&r.errors.forEach((o,c)=>{if(_l(o,Error)){$u(s,a,r);const d=e(t,o),u=l.length;Iu(d,`errors[${c}]`,u,a),l=_u(e,t,n,o,i,[d,...l],d,u)}}),l}function Cu(e){return Array.isArray(e.errors)}function $u(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Cu(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Iu(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Tu(e){return function(e){return pl(e)&&"xt"in e&&"string"==typeof e.xt}(e)?`${e.message} (${e.xt})`:e.message}const Eu=new Set([]);function Pu(){"console"in Aa&&Ha.forEach(function(e){e in Aa.console&&$l(Aa.console,e,function(t){return Ua[e]=t,function(...t){const n=t[0],r=Ua[e],i=Eu.size&&"string"==typeof n&&Gl(n,Eu);i||cl("console",{args:t,level:e}),(!i||Wa&&Qa.isEnabled())&&r?.apply(Aa.console,t)}})})}const Ru=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!Du(e,t)&&!!zu(e,t))))}(e,t)||!!function(e,t){const n=Mu(t),r=Mu(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!Du(e,t)&&!!zu(e,t)))}(e,t))}(t,e))return Wa&&Qa.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function zu(e,t){let n=il(e),r=il(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Du(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch{return!1}}function Mu(e){return e.exception?.values?.[0]}function Ou(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}const ju=Aa;function Wu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Au(e,t){const n="fetch",r=al(n,e);return ll(n,()=>function(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in ju))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(Wu(ju.fetch))return!0;let e=!1;const t=ju.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=Wu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Wa&&Qa.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||$l(Aa,"fetch",function(e){return function(...t){const n=new Error,{method:r,url:i}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:Bu(t),method:Lu(n,"method")?String(n.method).toUpperCase():Cl(t)&&Lu(t,"method")?String(t.method).toUpperCase():"GET"}}const t=e[0];return{url:Bu(t),method:Lu(t,"method")?String(t.method).toUpperCase():"GET"}}(t),o={args:t,fetchData:{method:r,url:i},startTimestamp:1e3*rc(),virtualError:n,headers:qu(t)};return cl("fetch",{...o}),e.apply(Aa,t).then(async e=>(cl("fetch",{...o,endTimestamp:1e3*rc(),response:e}),e),e=>{cl("fetch",{...o,endTimestamp:1e3*rc(),error:e}),pl(e)&&void 0===e.stack&&(e.stack=n.stack,Il(e,"framesToPop",1));const t=Cc(),r=t?.getOptions().enhanceFetchErrorMessages??"always";if(!1!==r&&e instanceof TypeError&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(o.fetchData.url).host;"always"===r?e.message=`${e.message} (${t})`:Il(e,"__sentry_fetch_url_host__",t)}catch{}throw e})}})}(0,t)),r}function Lu(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Bu(e){return"string"==typeof e?e:e?Lu(e,"url")?e.url:e.toString?e.toString():"":""}function qu(e){const[t,n]=e;try{if("object"==typeof n&&null!==n&&"headers"in n&&n.headers)return new Headers(n.headers);if(Cl(t))return new Headers(t.headers)}catch{}}const Fu=Aa;function Hu(){try{return Fu.document.location.href}catch{return""}}const Uu=Aa;let Yu=0;function Zu(){return Yu>0}function Vu(e,t={}){if("function"!=typeof e)return e;try{const t=e.kt;if(t)return"function"==typeof t?t:e;if(El(e))return e}catch{return e}const n=function(...n){Aa.St=(Aa.St||0)+1;try{const r=n.map(e=>Vu(e,t));return e.apply(this,r)}catch(e){throw Yu++,setTimeout(()=>{Yu--}),_c(r=>{r.addEventProcessor(e=>(t.mechanism&&(Xl(e,void 0),ec(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Nd(e)}),e}finally{Aa.St=(Aa.St||0)-1}};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}Tl(n,e),Il(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}function Gu(){const e=Hu(),{referrer:t}=Uu.document||{},{userAgent:n}=Uu.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}function Qu(e,t){const n=Ku(e,t),r={type:th(t),value:nh(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Ju(e,t){return{exception:{values:[Qu(e,t)]}}}function Ku(e,t){const n=t.stacktrace||t.stack||"",r=function(e){return e&&Xu.test(e.message)?1:0}(t),i=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(n,r,i)}catch{}return[]}const Xu=/Minified React error #\d+;/i;function eh(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function th(e){const t=e?.name;return!t&&eh(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function nh(e){const t=e?.message;return eh(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?Tu(t.error):Tu(e):"No error message"}function rh(e,t,n,r,i){let o;if(yl(t)&&t.error)return Ju(e,t.error);if(vl(t)||gl(t,"DOMException")){const i=t;if("stack"in t){o=Ju(e,t);const i=o.exception?.values?.[0];if(r&&n&&i&&!i.stacktrace){const t=Ku(e,n);t.length&&(i.stacktrace={frames:t},ec(o,{synthetic:!0}))}}else{const t=i.name||(vl(i)?"DOMError":"DOMException"),s=i.message?`${t}: ${i.message}`:t;o=ih(e,s,n,r),Xl(o,s)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return pl(t)?Ju(e,t):kl(t)||Sl(t)?(o=function(e,t,n,r){const i=Cc(),o=i?.getOptions().normalizeDepth,s=(a=t,Object.values(a).find(e=>e instanceof Error));var a;const l={Nt:Fl(t,o)};if(s)return{exception:{values:[Qu(e,s)]},extra:l};const c={exception:{values:[{type:Sl(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:oh(t,{isUnhandledRejection:r})}]},extra:l};if(n){const t=Ku(e,n);t.length&&(c.exception.values[0].stacktrace={frames:t})}return c}(e,t,n,i),ec(o,{synthetic:!0}),o):(o=ih(e,t,n,r),Xl(o,`${t}`),ec(o,{synthetic:!0}),o)}function ih(e,t,n,r){const i={};if(r&&n){const r=Ku(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),ec(i,{synthetic:!0})}if(bl(t)){const{ae:e,le:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function oh(e,{isUnhandledRejection:t}){const n=function(e){const t=Object.keys(Pl(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),r=t?"promise rejection":"exception";return yl(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:Sl(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}class sh extends ou{constructor(e){const t=(n=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Uu.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...n});var n;!function(e,t,n=[t],r="npm"){const i=(e.Ze=e.Ze||{}).sdk=e.Ze.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:La})),i.version=La)}(t,"browser",["browser"],Uu.SENTRY_SDK_SOURCE||"npm"),super(t);const{userInfo:r}=this.getDataCollectionOptions();t.Ze?.sdk&&(t.Ze.sdk.settings={infer_ip:r?"auto":"never",...t.Ze.sdk.settings});const{sendClientReports:i,enableLogs:o,ot:s,enableMetrics:a}=this.Ge,l=a??s?.enableMetrics??!0;Uu.document&&(i||o||l)&&Uu.document.addEventListener("visibilitychange",()=>{"hidden"===Uu.document.visibilityState&&(i&&this.bt(),o&&jd(this),l&&Ld(this))}),r&&this.on("beforeSendSession",mu)}eventFromException(e,t){return function(e,t,n,r){const i=rh(e,t,n?.syntheticException||void 0,r);return ec(i),i.level="error",n?.event_id&&(i.event_id=n.event_id),fd(i)}(this.Ge.stackParser,e,t,this.Ge.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=ih(e,t,r?.syntheticException||void 0,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),fd(o)}(this.Ge.stackParser,e,t,n,this.Ge.attachStacktrace)}gt(e,t,n,r){return e.platform=e.platform||"javascript",super.gt(e,t,n,r)}}const ah="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,lh=Aa;function ch(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,s=0;const a=" > ",l=a.length;let c;const d=Array.isArray(t)?t:t.keyAttrs,u=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(c=dh(n,d),!("html"===c||o>1&&s+i.length*l+c.length>=u));)i.push(c),s+=c.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function dh(e,t){const n=e,r=[];if(!n?.tagName)return"";if("undefined"!=typeof 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=t?.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(i?.length)i.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const e=n.className;if(e&&wl(e)){const t=e.split(/\s+/);for(const e of t)r.push(`.${e}`)}}for(const e of["aria-label","type","name","title","alt"]){const t=n.getAttribute(e);t&&r.push(`[${e}="${t}"]`)}return r.join("")}let uh,hh,mh,fh;function ph(){if(!lh.document)return;const e=cl.bind(null,"dom"),t=gh(e,!0);lh.document.addEventListener("click",t,!1),lh.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const n=lh,r=n[t]?.prototype;r?.hasOwnProperty?.("addEventListener")&&($l(r,"addEventListener",function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this._t=this._t||{},o=r[n]=r[n]||{refCount:0};if(!o.handler){const r=gh(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),$l(r,"removeEventListener",function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this._t||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),0===Object.keys(n).length&&delete this._t)}catch{}return e.call(this,t,n,r)}}))})}function gh(e,t=!1){return n=>{if(!n||n.Ct)return;const r=function(e){try{return e.target}catch{return null}}(n);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;Il(n,"_sentryCaptured",!0),r&&!r.$t&&Il(r,"_sentryId",Ql());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==hh)return!1;try{if(!e.target||e.target.$t!==mh)return!1}catch{}return!0})(n)||(e({event:n,name:i,global:t}),hh=n.type,mh=r?r.$t:void 0),clearTimeout(uh),uh=lh.setTimeout(()=>{mh=void 0,hh=void 0},1e3)}}function yh(e){const t="history";al(t,e),ll(t,vh)}function vh(){function e(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const r=fh,i=function(e){try{return new URL(e,lh.location.origin).toString()}catch{return e}}(String(n));if(fh=i,r===i)return e.apply(this,t);cl("history",{from:r,to:i})}return e.apply(this,t)}}lh.addEventListener("popstate",()=>{const e=lh.location.href,t=fh;fh=e,t!==e&&cl("history",{from:t,to:e})}),"history"in ju&&ju.history&&($l(lh.history,"pushState",e),$l(lh.history,"replaceState",e))}const wh={},bh="__sentry_xhr_v3__";function xh(){if(!lh.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){const r=new Error,i=1e3*rc(),o=wl(n[0])?n[0].toUpperCase():void 0,s=function(e){if(wl(e))return e;try{return e.toString()}catch{}}(n[1]);if(!o||!s)return e.apply(t,n);t[bh]={method:o,url:s,request_headers:{}},"POST"===o&&s.match(/sentry_key/)&&(t.It=!0);const a=()=>{const e=t[bh];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}cl("xhr",{endTimestamp:1e3*rc(),startTimestamp:i,xhr:t,virtualError:r})}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,n)=>(a(),e.apply(t,n))}):t.addEventListener("readystatechange",a),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){const[r,i]=n,o=t[bh];return o&&wl(r)&&wl(i)&&(o.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){const r=t[bh];return r?(void 0!==n[0]&&(r.body=n[0]),cl("xhr",{startTimestamp:1e3*rc(),xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function kh(e,t=function(e){const t=wh[e];if(t)return t;let n=lh[e];if(Wu(n))return wh[e]=n.bind(lh);const r=lh.document;if(r&&"function"==typeof r.createElement)try{const t=r.createElement("iframe");t.hidden=!0,r.head.appendChild(t);const i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){ah&&Qa.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n?wh[e]=n.bind(lh):n}("fetch")){let n=0,r=0;return Yd(e,async function(i){const o=i.body.length;n+=o,r++;const s={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{const n=await t(e.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(e){throw wh.fetch=void 0,e}finally{n-=o,r--}},Ud(e.bufferSize||40))}const Sh="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Nh(e,t,n,r){const i={filename:e,function:"<anonymous>"===t?Ja:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const _h=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ch=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$h=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ih=/at (.+?) ?\(data:(.+?),/,Th=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Eh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ph=el([30,e=>{const t=e.match(Ih);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=_h.exec(e);if(n){const[,e,t,r]=n;return Nh(e,Ja,+t,+r)}const r=Ch.exec(e);if(r){if(0===r[2]?.indexOf("eval")){const e=$h.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}const[e,t]=Rh(r[1]||Ja,r[2]);return Nh(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],[50,e=>{const t=Th.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Eh.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Ja;return[n,e]=Rh(n,e),Nh(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Rh=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Ja,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},zh=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var n;t.console&&function(e){const t="console";al(t,e);ll(t,Pu)}(function(e){return function(t){if(Cc()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:(r=t.level,"warn"===r?"warning":["fatal","error","warning","log","info","debug"].includes(r)?r:"log"),message:Zl(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${Zl(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}pu(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Cc()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,s="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;s&&s>1024&&(Sh&&Qa.warn(`\`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 e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=ch(t,{keyAttrs:o,maxStringLength:s}),i=function(e,t=5){if(!Fu.HTMLElement)return null;let n=e;for(let e=0;e<t;e++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}(t)}catch{r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};i&&(a.data={"ui.component_name":i}),pu(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),al("dom",n),ll("dom",ph)),t.xhr&&function(e){al("xhr",e),ll("xhr",xh)}(function(e){return function(t){if(Cc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[bh];if(!n||!r||!i)return;const{method:o,url:s,status_code:a,body:l}=i,c={method:o,url:s,status_code:a},d={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},u={category:"xhr",data:c,type:"http",level:Ou(a)};e.emit("beforeOutgoingRequestBreadcrumb",u,d),pu(u,d)}}(e)),t.fetch&&Au(function(e){return function(t){if(Cc()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},o={category:"fetch",data:t.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",o,i),pu(o,i)}else{const i=t.response,o={...t.fetchData,status_code:i?.status},s={input:t.args,response:i,startTimestamp:n,endTimestamp:r},a={category:"fetch",data:o,type:"http",level:Ou(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",a,s),pu(a,s)}}}(e)),t.history&&yh(function(e){return function(t){if(Cc()!==e)return;let n=t.from,r=t.to;const i=hd(Uu.location.href);let o=n?hd(n):void 0;const s=hd(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),pu({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){Cc()===e&&pu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Kl(t)},{event:t})}}(e))}}},Dh="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".split(","),Mh=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&$l(Uu,"setTimeout",Oh),t.setInterval&&$l(Uu,"setInterval",Oh),t.requestAnimationFrame&&$l(Uu,"requestAnimationFrame",jh),t.XMLHttpRequest&&"XMLHttpRequest"in Uu&&$l(XMLHttpRequest.prototype,"send",Wh);const e=t.eventTarget;e&&(Array.isArray(e)?e:Dh).forEach(e=>function(e,t){const n=Uu,r=n[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&($l(r,"addEventListener",function(n){return function(r,i,o){try{"function"==typeof i.handleEvent&&(i.handleEvent=Vu(i.handleEvent,{mechanism:{data:{handler:rl(i),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,n){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,n)}(this,r,i),n.apply(this,[r,Vu(i,{mechanism:{data:{handler:rl(i),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),o])}}),$l(r,"removeEventListener",function(e){return function(t,n,r){try{const i=n.kt;i&&e.call(this,t,i,r)}catch{}return e.call(this,t,n,r)}}))}(e,t))}}};function Oh(e){return function(...t){const n=t[0];return t[0]=Vu(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${rl(e)}`}}),e.apply(this,t)}}function jh(e){return function(t){return e.apply(this,[Vu(t,{mechanism:{data:{handler:rl(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function Wh(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in n&&"function"==typeof n[e]&&$l(n,e,function(t){const n={mechanism:{data:{handler:rl(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=El(t);return r&&(n.mechanism.data.handler=rl(r)),Vu(t,n)})}),e.apply(this,t)}}const Ah=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(void 0===Uu.document)return void(Sh&&Qa.warn("Using the `browserSessionIntegration` in non-browser environments is not supported."));$d({ignoreDuration:!0}),Ed();const e=Nc();let n=e.getUser();e.addScopeListener(e=>{const t=e.getUser();n?.id===t?.id&&n?.ip_address===t?.ip_address||(Ed(),n=t)}),"route"===t&&yh(({from:e,to:t})=>{e!==t&&($d({ignoreDuration:!0}),Ed())})}}};function Lh(){try{const e=Uu.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const Bh=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";al(t,t=>{const{stackParser:n,attachStacktrace:r}=Fh();if(Cc()!==e||Zu())return;const{msg:i,url:o,line:s,column:a,error:l}=t,c=function(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],s=o[0]=o[0]||{},a=s.stacktrace=s.stacktrace||{},l=a.frames=a.frames||[];return 0===l.length&&l.push({colno:r,lineno:n,filename:Hh(t)??Hu(),function:Ja,in_app:!0}),e}(rh(n,l||i,void 0,r,!1),o,s,a);c.level="error",Cd(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),ll(t,ul)}()}(e),qh("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";al(t,t=>{const{stackParser:n,attachStacktrace:r}=Fh();if(Cc()!==e||Zu())return;const i=function(e){if(xl(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),o=xl(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:rh(n,i,void 0,r,!0);o.level="error",Cd(o,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),ll(t,ml)}()}(e),qh("onunhandledrejection"))}}};function qh(e){Sh&&Qa.log(`Global Handler attached: ${e}`)}function Fh(){const e=Cc();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function Hh(e){if(wl(e)&&0!==e.length)return e.startsWith("data:")?`<${function(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",i=e.includes(";base64,"),o=e.indexOf(",");let s="";if(t&&-1!==o){const t=e.slice(o+1);s=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?",base64":""}${s?`,${s}`:""}`}return e}(e,!1)}>`:e}const Uh=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,r,i){Nu(Qu,i.getOptions().stackParser,n,t,e,r)}}},Yh=/^HTML(\w*)Element$/;function Zh(e){if("undefined"!=typeof window&&e===window)return"[Window]";if("undefined"!=typeof document&&e===document)return"[Document]";if(function(e){if("undefined"==typeof Element)return!1;try{return e instanceof Element}catch{return!1}}(e)){const t=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(e);if(Yh.test(t))return`[HTMLElement: ${ch(e)}]`}}function Vh(e={}){const t=!e.skipBrowserExtensionCheck&&!!function(){if(void 0===Uu.window)return!1;const e=Uu;if(e.nw)return!1;const t=e.chrome||e.browser;if(!t?.runtime?.id)return!1;const n=Hu();return!(Uu===Uu.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(n))}()&&(Sh&&Ya(()=>{}),!0);let n=null==e.defaultIntegrations?[xu(),vu(),{name:"ConversationId",setup(e){e.on("spanStart",e=>{const t=Sc().getScopeData(),n=Nc().getScopeData(),r=t.conversationId||n.conversationId;if(r){const{op:t,data:n,description:i}=qc(e);if(!t?.startsWith("gen_ai.")&&!n["ai.operationId"]&&!i?.startsWith("ai."))return;e.setAttribute("gen_ai.conversation.id",r)}})}},Mh(),zh(),Bh(),Uh(),Ru(),{name:"HttpContext",preprocessEvent(e){if(!Uu.navigator&&!Uu.location&&!Uu.document)return;const t=Gu(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){if(!Uu.navigator&&!Uu.location&&!Uu.document)return;const t=Gu();md(e,{"url.full":t.url||void 0,"http.request.header.user_agent":t.headers["User-Agent"],"http.request.header.referer":t.headers.Referer})}},{name:"CultureContext",preprocessEvent(e){const t=Lh();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){const t=Lh();t&&md(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}},Ah()]:e.defaultIntegrations;const r={...e,enabled:!t&&e.enabled,stackParser:(i=e.stackParser||Ph,Array.isArray(i)?el(...i):i),integrations:Rd({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||kh};var i;return Al=Zh,function(e,t){!0===t.debug&&(Wa?Qa.enable():Ya(()=>{})),Sc().update(t.initialScope);const n=new e(t);return function(e){Sc().setClient(e)}(n),n.init(),n}(sh,r)}let Gh=!1;function Qh(e){if(Gh)t();else if(e.enabled&&e.dsn)try{const n=e.bundleUrlPatterns||[/cdn\.insure-os\.com/,/api\.os\.insure.*\/dist/,/localhost:\d+\/dist/,/index\.(esm|umd|cjs)\.js/];Vh({dsn:e.dsn,environment:e.environment||"production",release:e.release,beforeSend:e=>function(e,t){var n,r,i,o;const s=null===(o=null===(i=null===(r=null===(n=e.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(e=>!!e.filename&&t.some(t=>t.test(e.filename||"")))}(e,n)?(e.tags={...e.tags,source:"insureos-widget"},t(e.exception),e):(t(e.exception),null),allowUrls:n,sampleRate:e.sampleRate||1,tracesSampleRate:e.tracesSampleRate||.1,integrations:[zh({console:!0,dom:!0,fetch:!0,history:!1,xhr:!0}),Ru()],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"]}),Gh=!0,t()}catch(e){}else t()}function Jh(e,n){if(Gh)try{n?_c(t=>{Object.entries(n).forEach(([e,n])=>{t.setContext(e,n)}),Nd(e)}):Nd(e)}catch(e){t()}}function Kh(e,n="info",r){if(Gh)try{r?_c(t=>{Object.entries(r).forEach(([e,n])=>{t.setContext(e,n)}),_d(e,n)}):_d(e,n)}catch(e){t()}}function Xh(e){if(Gh)try{!function(e){Nc().setUser(e)}(e)}catch(e){t()}}function em(e){if(Gh)try{pu(e)}catch(e){t()}}function tm(e,n){if(Gh)try{!function(e,t){Nc().setTag(e,t)}(e,n)}catch(e){t()}}function nm(){return Gh}var rm=Object.freeze({__proto__:null,addBreadcrumb:em,captureException:Jh,captureMessage:Kh,initializeSentry:Qh,isSentryInitialized:nm,setTag:tm,setUser:Xh});const im="https://a73b48791ca06287db6bc587f376f7b9@o490277.ingest.us.sentry.io/4510139918450688",om="production",sm="insureos-scripts",am=!0,lm=1,cm=.1;class dm{constructor(e={}){var t,n,r,i;this.dataLayerAvailable=!1,this.config={enabled:null===(t=e.enabled)||void 0===t||t,customDataLayer:null!==(n=e.customDataLayer)&&void 0!==n?n:"dataLayer",includePersonalData:null!==(r=e.includePersonalData)&&void 0!==r&&r,debug:null!==(i=e.debug)&&void 0!==i&&i},"undefined"!=typeof window?this.initializeDataLayer():this.dataLayerAvailable=!1}initializeDataLayer(){try{const e=this.config.customDataLayer;window[e]||(window[e]=[],this.logDebug(`Created new ${e} array`)),Array.isArray(window[e])?(this.dataLayerAvailable=!0,this.logDebug(`✅ Data layer '${e}' is available and ready`)):(this.dataLayerAvailable=!1,this.logDebug(`⚠️ Data layer '${e}' exists but is not an array`))}catch(e){this.dataLayerAvailable=!1,this.logDebug("⚠️ Failed to initialize data layer:",e)}}isEnabled(){return this.config.enabled&&this.dataLayerAvailable}getDataLayer(){if(!this.isEnabled())return null;try{const e=window[this.config.customDataLayer];return Array.isArray(e)?e:null}catch(e){return this.logDebug("Failed to get data layer:",e),null}}push(e){if(!this.isEnabled())return void this.logDebug("📊 Analytics disabled or data layer not available, skipping event:",e.event);const t=this.getDataLayer();if(t)try{const n=this.config.includePersonalData?e:this.removePII(e);t.push(n),this.logDebug("📊 Pushed event to data layer:",n)}catch(e){this.logDebug("❌ Failed to push event to data layer:",e)}else this.logDebug("⚠️ Data layer not available, skipping event:",e.event)}removePII(e){const t={...e},n=["email","phone","name","address","client_name","client_email"];for(const e of n)e in t&&delete t[e];return t}logDebug(...e){this.config.debug&&t("[Analytics]",...e)}clear(){if(this.dataLayerAvailable)try{window[this.config.customDataLayer]=[],this.logDebug("🧹 Cleared data layer")}catch(e){this.logDebug("Failed to clear data layer:",e)}}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},(e.customDataLayer||void 0!==e.enabled)&&this.initializeDataLayer(),this.logDebug("Updated analytics configuration:",this.config)}}class um{constructor(){this.sentryInitialized=!1,this.analyticsManager=null,this.pendingPromoCodes=new Map}initializeSentryOnce(){if(!this.sentryInitialized)try{Qh({dsn:im,environment:om,release:sm,enabled:am,sampleRate:lm,tracesSampleRate:cm}),this.sentryInitialized=!0,t()}catch(e){t()}}validateConfig(e){if(!e.orgId)throw new Error("orgId is required");if("payment"===e.mode&&!e.paymentLinkId)throw new Error("paymentLinkId is required when mode is 'payment'")}initializeAnalyticsOnce(e){var n,r,i,o,s;if(!this.analyticsManager)try{this.analyticsManager=new dm({enabled:null===(n=e.analyticsConfig)||void 0===n?void 0:n.enabled,customDataLayer:null===(r=e.analyticsConfig)||void 0===r?void 0:r.customDataLayer,includePersonalData:null===(i=e.analyticsConfig)||void 0===i?void 0:i.includePersonalData,debug:null!==(s=null===(o=e.analyticsConfig)||void 0===o?void 0:o.debug)&&void 0!==s?s:e.debug}),Re(this.analyticsManager),t()}catch(e){t()}}async mount(e,t){t.debug&&(globalThis.insureOSDebug=!0),this.validateConfig(t),this.initializeSentryOnce(),this.initializeAnalyticsOnce(t),function(e,t){var i,o,s;t==document&&(t=document.documentElement),r.m&&r.m(e,t),i=t.i,o=[],s=[],L(t,e=t.i=N(C,null,[e]),i||v,v,t.namespaceURI,i?null:t.firstChild?n.call(t.childNodes):null,o,i?i.v:t.firstChild,!1,s),q(o,e,s)}(N(ja,{config:t,initializeFormContext:this.initializeFormContext.bind(this)}),e)}createHttpClient(e){var t,n,r,i,o,s,a,l,c,d;if(!e.orgId)throw new Error("orgId is required");const u=e.apiBaseUrl||"https://api.os.insure";return new X({orgId:e.orgId,apiBaseUrl:u,timeout:(null===(t=e.httpConfig)||void 0===t?void 0:t.timeout)||1e4,retryConfig:{maxRetries:(null===(r=null===(n=e.httpConfig)||void 0===n?void 0:n.retryConfig)||void 0===r?void 0:r.maxRetries)||3,baseDelay:(null===(o=null===(i=e.httpConfig)||void 0===i?void 0:i.retryConfig)||void 0===o?void 0:o.baseDelay)||1e3,maxDelay:(null===(a=null===(s=e.httpConfig)||void 0===s?void 0:s.retryConfig)||void 0===a?void 0:a.maxDelay)||1e4,retryableStatusCodes:(null===(c=null===(l=e.httpConfig)||void 0===l?void 0:l.retryConfig)||void 0===c?void 0:c.retryableStatusCodes)||[429,500,502,503,504],...null===(d=e.httpConfig)||void 0===d?void 0:d.retryConfig}})}createClient(e){const t=this.createHttpClient(e);return new He(t)}clearQuoteStateForOrg(e){try{if(window.localStorage){window.localStorage.removeItem("insure-os-selected-product"),window.localStorage.removeItem(`insure_os_quote_intent_${e}`),window.localStorage.removeItem(`insure-os-pending-promo-${e}`);for(let t=window.localStorage.length-1;t>=0;t--){const n=window.localStorage.key(t);n&&n.startsWith("insure_os_")&&n.endsWith(e)&&window.localStorage.removeItem(n)}}window.sessionStorage&&window.sessionStorage.removeItem(`insure_os_quote_intent_${e}`)}catch(e){}}async initializeFormContext(e){var n,r,i,o,s;const a=this.createHttpClient(e),l=new URLSearchParams(window.location.search),c=l.get("p")||l.get("pl_ref");if(c)return t(),this.clearQuoteStateForOrg(e.orgId),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:c,signedUrl:void 0}};const d=l.get("q")||l.get("qi");if(d){t();let n=d;try{const e=await a.resumeQuoteIntent(d);if("redirect"===(null==e?void 0:e.mode)&&e.payment_link_short_code){const n=window.location.pathname+`?p=${encodeURIComponent(e.payment_link_short_code)}`;return t(),window.location.replace(n),new Promise(()=>{})}"resume"===(null==e?void 0:e.mode)&&e.quote_intent_id&&(n=e.quote_intent_id)}catch(e){t(null==e||e.message)}e.quoteIntentUrl=`${e.apiBaseUrl}/quote-intents/${n}`,this.clearQuoteStateForOrg(e.orgId)}if("payment"===e.mode)return t(),{httpClient:a,stateManager:null,quoteIntent:null,quoteIntentStore:null,formStateManager:null,paymentLinkConfig:{paymentLinkId:e.paymentLinkId,signedUrl:e.signedUrl}};const u="sessionStorage"===e.storageType?new te:new ee;u.isAvailable()?t(u.constructor.name):t();const h=new re(u),m=new ie(h),f=e.products,p=null==f?void 0:f.includes("*"),g=!f||0===f.length,y=g||p||f&&f.length>1,v=f&&1===f.length&&!p,w=localStorage.getItem("insure-os-selected-product"),b=new URLSearchParams(window.location.search),x=!!(b.get("transactionId")||b.get("transaction_id")||b.get("payment_id")),k=b.get("code");if("1"===b.get("clear")){t(),localStorage.clear(),b.delete("clear");const e=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",e),t()}const S=`insure-os-pending-promo-${e.orgId}`,N="skipPendingPromoCode"in e&&!0===e.skipPendingPromoCode;if(k&&!x&&!N){const n={code:k,ts:Date.now()};localStorage.setItem(S,JSON.stringify(n)),this.pendingPromoCodes.set(e.orgId,k),t(),b.delete("code");const r=b.toString()?`${window.location.pathname}?${b.toString()}`:window.location.pathname;window.history.replaceState({},"",r)}const _="promoCode"in e?e.promoCode:void 0;let C=null;if(!N)try{const e=localStorage.getItem(S);if(e){const t=JSON.parse(e);"object"==typeof t&&t.code&&Date.now()-t.ts<36e5?C=t.code:"string"==typeof t?C=t:localStorage.removeItem(S)}}catch(e){localStorage.removeItem(S)}const $=N?void 0:this.pendingPromoCodes.get(e.orgId),I=k||_||C||$||null;if(t(),I&&!x){const i=h.getQuoteIntent(e.orgId);if(null===(n=null==i?void 0:i.form_data)||void 0===n?void 0:n.page_data){const n=i.form_data.page_data,o=null===(r=Object.values(n).find(e=>e&&"object"==typeof e&&"promo_code"in e))||void 0===r?void 0:r.promo_code;o&&o!==I&&(t(),m.clearQuoteIntent(e.orgId))}}const T=async n=>{var r;t(n.id);const i=new qe(n,a,m,{autoSave:!1,autoSaveInterval:n.form_definition.settings.autoSaveInterval});if("prefillFormData"in e&&e.prefillFormData){const o=(null===(r=n.form_definition)||void 0===r?void 0:r.pages.length)||0,s=Array.from({length:o},(e,t)=>t);i.restoreFormProgress({page_data:e.prefillFormData,current_page:o-1,completed_pages:s,last_updated:(new Date).toISOString()}),t()}else n.form_data&&i.restoreFormProgress(n.form_data);if(I){const e=i.getFormDefinition().pages.find(e=>e.fields.some(e=>"promo_code"===(e.code||e.id)));e?(i.updateFieldValue(e.id,"promo_code",I),t(e.id)):t()}if(n.cached_result&&(t(),i.restoreCalculationResult(n.cached_result)),n.organisation&&n.organisation.theme)try{await _a.loadTheme({slug:n.organisation.slug,theme_url:n.organisation.theme.css_url})}catch(e){t()}const o="skipAutoCalculation"in e&&!!e.skipAutoCalculation;return await this.handleAutoCalculationIfComplete(i,o),{httpClient:a,stateManager:h,quoteIntent:n,quoteIntentStore:m,formStateManager:i,urlPromoCode:I||void 0}};if(y&&!e.quoteIntentUrl&&!w){const n=x?null:h.getQuoteIntent(e.orgId);if(n)try{const r=await a.getQuoteIntent(n.url),l={id:r.quote_intent.id,short_code:r.quote_intent.short_code,url:r.url,calculate_url:r.calculate_url,delete_calculations_url:r.delete_calculations_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:e.orgId,product_id:r.product.id,product_name:r.product.description||r.product.name,form_definition:r.product.form_definition,form_data:r.quote_intent.form_data,status:r.quote_intent.status,reference:r.quote_intent.reference,organisation:r.organisation,cached_result:r.cached_result};if(h.saveQuoteIntent(e.orgId,l),null===(o=null===(i=l.form_data)||void 0===i?void 0:i.completed_pages)||void 0===o?void 0:o.length){if(t(),null===(s=l.organisation)||void 0===s?void 0:s.theme)try{await _a.loadTheme({slug:l.organisation.slug,theme_url:l.organisation.theme.css_url})}catch(e){t()}const{firstName:n,lastUpdated:r}=(e=>{var t;const n=["client_first_name","first_name","firstName","fname","given_name"],r=null===(t=e.form_data)||void 0===t?void 0:t.page_data;let i=null;if(r)for(const e of Object.values(r)){if(!e||"object"!=typeof e)continue;const t=e;for(const e of n)if(t[e]){i=String(t[e]);break}if(i)break}return{firstName:i,lastUpdated:e.updated_at?new Date(e.updated_at).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):null}})(l);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,resumePrompt:{reference:l.reference||null,productName:l.product_name||null,firstName:n,lastUpdated:r,onContinue:async()=>T(l),onStartFresh:async()=>{m.clearQuoteIntent(e.orgId);const t=await a.fetchAvailableProducts(g?void 0:f);return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:t.products,productCodes:f}}}}}}catch(n){t(),m.clearQuoteIntent(e.orgId)}t();const r=await a.fetchAvailableProducts(g?void 0:f);if(t(),r.organisation&&r.organisation.theme)try{const e=await Promise.resolve().then(function(){return Ca}).then(e=>e.ThemeLoader);await e.loadTheme({slug:r.organisation.slug,theme_url:r.organisation.theme.css_url}),t()}catch(e){t()}return{httpClient:a,stateManager:h,quoteIntent:null,quoteIntentStore:m,formStateManager:null,availableProducts:r.products,productCodes:f}}let E;w?(t(),E=w,localStorage.removeItem("insure-os-selected-product")):v&&(E=f[0]);const P=async()=>{t();const n=e.quoteIntentUrl?await a.getQuoteIntent(e.quoteIntentUrl):await a.createQuoteIntent({code:E,...e.dealerOrganisationId&&{dealer_organisation_id:e.dealerOrganisationId}});return t(),{id:n.quote_intent.id,short_code:n.quote_intent.short_code,url:n.url,calculate_url:n.calculate_url,delete_calculations_url:n.delete_calculations_url,calculate_url_v2:n.calculate_url_v2,reprice_url_v2:n.reprice_url_v2,bind_url_v2:n.bind_url_v2,calculator_version:n.product.calculator_version,expires_at:new Date(n.quote_intent.expires_at).getTime(),updated_at:new Date(n.quote_intent.updated_at).getTime(),created_at:new Date(n.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:n.product.id,product_name:n.product.description||n.product.name,form_definition:n.product.form_definition,form_data:n.quote_intent.form_data,status:n.quote_intent.status,reference:n.quote_intent.reference,organisation:n.organisation,payment_transactions:n.payment_transactions,cached_result:n.cached_result}},R=async t=>{var n;const r=new URLSearchParams(window.location.search),i=r.get("transaction_id")||r.get("payment_id")||r.get("transactionId"),o=await a.getQuoteIntent(t);let s;const l=r.get("status");if(i&&"processing"!==l){const e=null===(n=o.payment_transactions)||void 0===n?void 0:n.find(e=>e.id===i);if(e){let t="unknown";switch(e.status){case"completed":t="success";break;case"failed":t="declined";break;case"cancelled":t="cancelled";break;default:t="error"}s={paymentTransactionId:e.id,paymentStatus:t,transactionStatus:e}}else if(l){let e="error";switch(l.toLowerCase()){case"success":case"completed":e="success";break;case"failed":case"declined":e="declined";break;case"cancelled":case"canceled":e="cancelled";break;default:e="error"}s={paymentTransactionId:i,paymentStatus:e,transactionStatus:void 0}}}const c={id:o.quote_intent.id,short_code:o.quote_intent.short_code,url:o.url,calculate_url:o.calculate_url,delete_calculations_url:o.delete_calculations_url,calculate_url_v2:o.calculate_url_v2,reprice_url_v2:o.reprice_url_v2,bind_url_v2:o.bind_url_v2,calculator_version:o.product.calculator_version,expires_at:new Date(o.quote_intent.expires_at).getTime(),updated_at:new Date(o.quote_intent.updated_at).getTime(),created_at:new Date(o.quote_intent.created_at).getTime(),org_id:e.orgId,product_id:o.product.id,product_name:o.product.description||o.product.name,form_definition:o.product.form_definition,form_data:o.quote_intent.form_data,status:o.quote_intent.status,reference:o.quote_intent.reference,organisation:o.organisation,payment_return:s,payment_transactions:o.payment_transactions,cached_result:o.cached_result};return s&&h.saveQuoteIntent(e.orgId,c),c};return(async()=>{let t=null,n=!1;try{const r=h.getQuoteIntent(e.orgId),i=await m.getOrCreateQuoteIntent(e.orgId,P,R);i.payment_return&&h.saveQuoteIntent(e.orgId,i),t=i,n=!r}catch(r){if(!(r instanceof V&&404===r.statusCode))throw r;m.clearQuoteIntent(e.orgId),t=await m.getOrCreateQuoteIntent(e.orgId,P,R),n=!0}if(n&&t&&De(t),!t)throw new Error("Failed to initialize quote intent state");return T(t)})()}async handleAutoCalculationIfComplete(e,n=!1){try{if(n)return void t();const r=e.getQuoteIntent();if("paid"===r.status||"completed"===r.status)return void t();if(e.hasCalculationResponse())return void t();if(e.hasLastCalculationFailed())return void t();const i=e.getPageCompletionStatus(),{totalPages:o,completedPages:s}=i,a=s.length===o;t((s.length,e.getIsCalculating(),e.hasLastCalculationFailed())),a&&!e.getIsCalculating()&&(t(),await e.calculateQuote(),t())}catch(e){t()}}}const hm=new um;"undefined"!=typeof window&&(window.InsureOS=hm,function(){const e=document.querySelectorAll('script[src*="insureos"]'),t=e[e.length-1];if(t&&t.src){const e=new URL(t.src),n=e.searchParams.get("orgId"),r=e.searchParams.get("productCode"),i=e.searchParams.get("productCodes"),o=i?i.split(","):r?[r]:null;if(n&&o){const t=e.searchParams.get("container"),r=t?document.getElementById(t):document.body;if(r){const e={orgId:n,products:o};r.dataset.insureosConfig=JSON.stringify(e);const t=async()=>{try{await hm.mount(r,e)}catch(e){}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}}}}());class mm{constructor(){if(this.measurements=new Map,this.completedMeasurements=new Map,this.apiCallMetrics=[],this.initializationTime=0,mm.instance)return mm.instance;mm.instance=this}startMeasurement(e){this.measurements.set(e,this.now())}endMeasurement(e){const t=this.measurements.get(e);if(void 0===t)throw new Error(`No measurement started for: ${e}`);const n=this.now()-t;return this.measurements.delete(e),this.completedMeasurements.has(e)||this.completedMeasurements.set(e,[]),this.completedMeasurements.get(e).push(n),"initialization"===e&&(this.initializationTime=n),n}async measureApiCall(e,t){const n=this.now();let r,i=!1;try{const e=await t();return i=!0,e}catch(e){throw i=!1,r=e instanceof Error?e.message:"Unknown error",e}finally{const t=this.now()-n;this.apiCallMetrics.push({operation:e,duration:t,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 e=performance.memory;return{usedJSHeapSize:e.usedJSHeapSize||0,totalJSHeapSize:e.totalJSHeapSize||0,jsHeapSizeLimit:e.jsHeapSizeLimit||0}}return null}getMetrics(){var e;const t=this.apiCallMetrics.filter(e=>e.success).map(e=>e.duration),n=t.length>0?t.reduce((e,t)=>e+t,0)/t.length:0,r={};return this.completedMeasurements.forEach((e,t)=>{r[t]=[...e]}),{bundleSize:{esm:0,umd:0,cjs:0,gzipped:{esm:0,umd:0,cjs:0}},runtime:{initializationTime:this.initializationTime,apiCallTime:t.length>0&&null!==(e=t[t.length-1])&&void 0!==e?e: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 e=this.getMetrics(),t=this.getDetailedMemoryInfo();let n="=== Performance Report ===\n\n";if(n+="Runtime Performance:\n",n+=` Initialization Time: ${e.runtime.initializationTime.toFixed(2)}ms\n`,n+=` Total API Calls: ${e.runtime.totalApiCalls}\n`,n+=` Average API Call Time: ${e.runtime.averageApiCallTime.toFixed(2)}ms\n`,n+=` Current Memory Usage: ${(e.runtime.memoryUsage/1024/1024).toFixed(2)}MB\n\n`,t&&(n+="Memory Details:\n",n+=` Used Heap: ${(t.usedJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Total Heap: ${(t.totalJSHeapSize/1024/1024).toFixed(2)}MB\n`,n+=` Heap Limit: ${(t.jsHeapSizeLimit/1024/1024).toFixed(2)}MB\n\n`),this.apiCallMetrics.length>0){n+="API Call Breakdown:\n";const e=new Map;this.apiCallMetrics.forEach(t=>{e.has(t.operation)||e.set(t.operation,{count:0,totalTime:0,errors:0});const n=e.get(t.operation);n.count++,n.totalTime+=t.duration,t.success||n.errors++}),e.forEach((e,t)=>{const r=e.totalTime/e.count,i=(e.errors/e.count*100).toFixed(1);n+=` ${t}: ${e.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(e){(new mm).startMeasurement(e)}static endMeasurement(e){return(new mm).endMeasurement(e)}static measureMemoryUsage(){return(new mm).measureMemoryUsage()}static async measureApiCall(e,t){return(new mm).measureApiCall(e,t)}static getMetrics(){return(new mm).getMetrics()}static generateReport(){return(new mm).generateReport()}}let fm=class e{constructor(t){this.headers=new Map,t&&(Array.isArray(t)?t.forEach(([e,t])=>this.set(e,t)):t instanceof e?t.forEach((e,t)=>this.set(t,e)):Object.entries(t).forEach(([e,t])=>this.set(e,t)))}append(e,t){const n=this.get(e);this.set(e,n?`${n}, ${t}`:t)}delete(e){this.headers.delete(e.toLowerCase())}get(e){return this.headers.get(e.toLowerCase())||null}has(e){return this.headers.has(e.toLowerCase())}set(e,t){this.headers.set(e.toLowerCase(),t)}forEach(e){this.headers.forEach(e)}},pm=class{constructor(e,t={}){var n;"string"==typeof e?(this.url=e,this.method=t.method||"GET",this.headers=new fm(t.headers),this.body=t.body||null,this.signal=t.signal||void 0):(this.url=e.url,this.method=t.method||e.method,this.headers=new fm(t.headers||e.headers),this.body=void 0!==t.body?t.body:e.body,this.signal=void 0!==t.signal?null!==(n=t.signal)&&void 0!==n?n:void 0:e.signal)}},gm=class{constructor(e="",t={}){this.status=t.status||200,this.statusText=t.statusText||"OK",this.headers=new fm(t.headers),this.ok=this.status>=200&&this.status<300,this.Tt=e}async text(){return this.Tt}async json(){return JSON.parse(this.Tt)}};var ym=Object.freeze({__proto__:null,Headers:fm,Request:pm,Response:gm,fetch:async function(e,t={}){return new Promise((n,r)=>{const i=new pm(e,t),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((e,t)=>{o.setRequestHeader(t,e)}),o.onload=()=>{const e=new fm;o.getAllResponseHeaders().split("\r\n").forEach(t=>{const[n,r]=t.split(": ");n&&r&&e.set(n,r)});const t=new gm(o.responseText,{status:o.status,statusText:o.statusText,headers:e});n(t)},o.onerror=()=>{r(new TypeError("Network request failed"))},o.ontimeout=()=>{r(new TypeError("Network request timed out"))},o.send(i.body)})}});class vm{constructor(e){this.state="pending",this.onFulfilledCallbacks=[],this.onRejectedCallbacks=[];try{e(this.resolve.bind(this),this.reject.bind(this))}catch(e){this.reject(e)}}resolve(e){"pending"===this.state&&(this.state="fulfilled",this.value=e,this.onFulfilledCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}reject(e){"pending"===this.state&&(this.state="rejected",this.reason=e,this.onRejectedCallbacks.forEach(t=>{setTimeout(()=>t(e),0)}))}then(e,t){return new vm((n,r)=>{const i=t=>{try{if(e){const i=e(t);i instanceof vm?i.then(n,r):n(i)}else n(t)}catch(e){r(e)}},o=e=>{try{if(t){const i=t(e);i instanceof vm?i.then(n,r):n(i)}else r(e)}catch(e){r(e)}};"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(e){return this.then(void 0,e)}static resolve(e){return new vm(t=>t(e))}static reject(e){return new vm((t,n)=>n(e))}static all(e){return new vm((t,n)=>{if(0===e.length)return void t([]);const r=[];let i=0;e.forEach((o,s)=>{o.then(n=>{r[s]=n,i++,i===e.length&&t(r)},n)})})}}var wm=Object.freeze({__proto__:null,PromisePolyfill:vm});class bm{constructor(e){this.params=new Map,"string"==typeof e?this.parseString(e):e&&"object"==typeof e&&"forEach"in e&&"function"==typeof e.forEach?e.forEach((e,t)=>this.append(t,e)):e&&"object"==typeof e&&Object.entries(e).forEach(([e,t])=>this.set(e,t))}parseString(e){const t=e.startsWith("?")?e.slice(1):e;t&&t.split("&").forEach(e=>{if(!e)return;const t=e.indexOf("=");let n,r;-1===t?(n=e,r=""):(n=e.substring(0,t),r=e.substring(t+1)),n&&this.append(decodeURIComponent(n),decodeURIComponent(r))})}append(e,t){const n=this.params.get(e)||[];n.push(t),this.params.set(e,n)}delete(e){this.params.delete(e)}get(e){var t;const n=this.params.get(e);return n&&n.length>0&&null!==(t=n[0])&&void 0!==t?t:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}forEach(e){this.params.forEach((t,n)=>{t.forEach(t=>e(t,n))})}toString(){const e=[];return this.params.forEach((t,n)=>{t.forEach(t=>{e.push(`${encodeURIComponent(n)}=${encodeURIComponent(t)}`)})}),e.join("&")}}var xm=Object.freeze({__proto__:null,URLPolyfill:class{constructor(e,t){const n=this.parseUrl(e,t);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 bm(this.search)}parseUrl(e,t){const n=document.createElement("a");if(t){const r=document.createElement("a");r.href=t,n.href=this.resolveUrl(e,r.href)}else n.href=e;return{protocol:n.protocol,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search,hash:n.hash}}resolveUrl(e,t){if(e.includes("://"))return e;if(e.startsWith("/")){const n=document.createElement("a");return n.href=t,`${n.protocol}//${n.host}${e}`}return`${t.split("/").slice(0,-1).join("/")}/${e}`}toString(){return`${this.protocol}//${this.host}${this.pathname}${this.search}${this.hash}`}},URLSearchParamsPolyfill:bm});e.DataLayerManager=dm,e.EnhancedHttpClient=X,e.ErrorHandlingStrategy=class{handleNetworkError(t){return new V(e.ErrorType.NETWORK_ERROR,"Network connection failed. Please check your internet connection.",!0)}handleApiError(t){if(503===t.status)return new V(e.ErrorType.MAINTENANCE_ERROR,"We're performing scheduled maintenance. Please check back in a few minutes.",!1,t.status);const n=t.status>=500||429===t.status;return 429===t.status?new V(e.ErrorType.API_ERROR,"Too many requests. Please wait a moment and try again.",!0,t.status):t.status>=400&&t.status<500?new V(e.ErrorType.API_ERROR,"Invalid request. Please refresh the page and try again.",!1,t.status):t.status>=500?new V(e.ErrorType.API_ERROR,"Service temporarily unavailable. Please try again in a moment.",!0,t.status):new V(e.ErrorType.API_ERROR,`Request failed: ${t.statusText}`,n,t.status)}handleStorageError(t){return new V(e.ErrorType.STORAGE_ERROR,"Unable to save progress. The quote will still work, but progress won't be saved.",!1)}shouldRetry(e){return e.retryable}getUserFriendlyMessage(t){switch(t.type){case e.ErrorType.NETWORK_ERROR:return"Connection failed. Please check your internet connection and try again.";case e.ErrorType.MAINTENANCE_ERROR:return"We're performing scheduled maintenance. Please check back in a few minutes.";case e.ErrorType.API_ERROR:return 429===t.statusCode?"Too many requests. Please wait a moment and try again.":t.statusCode&&t.statusCode>=400&&t.statusCode<500?"Invalid request. Please refresh the page and try again.":t.statusCode&&t.statusCode>=500?"Service temporarily unavailable. Please try again in a moment.":"Request failed. Please try again.";case e.ErrorType.STORAGE_ERROR:return"Unable to save progress. The quote will still work, but progress won't be saved.";case e.ErrorType.TIMEOUT_ERROR:return"Request timed out. Please try again.";case e.ErrorType.VALIDATION_ERROR:return t.validationErrors&&Object.keys(t.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."}}},e.FormStateManager=qe,e.InsureOS=hm,e.InsureOSClient=um,e.InsureOSError=V,e.LocalStateManager=re,e.LocalStorageAdapter=ee,e.MemoryStorageAdapter=class{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||null}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}clear(){this.storage.clear()}isAvailable(){return!0}},e.PerformanceMonitor=mm,e.PolyfillManager=class{constructor(e={}){var t,n,r;this.detectionResults=null,this.config={fetch:null===(t=e.fetch)||void 0===t||t,promise:null===(n=e.promise)||void 0===n||n,url:null===(r=e.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(e){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 e=Promise.resolve(42);return"function"!=typeof e.then||"function"!=typeof e.catch}catch(e){return!0}}needsUrlPolyfill(){if("undefined"==typeof URL)return!0;try{const e=new URL("http://example.com/path?param=value#hash");if("string"!=typeof e.protocol||"string"!=typeof e.hostname||"string"!=typeof e.pathname||"string"!=typeof e.search||"string"!=typeof e.hash)return!0;if("undefined"==typeof URLSearchParams)return!0;const t=new URLSearchParams("param=value");return"function"!=typeof t.get||"function"!=typeof t.set}catch(e){return!0}}async loadFetchPolyfill(){if(this.needsFetchPolyfill())try{const{fetch:e,Headers:t,Request:n,Response:r}=await Promise.resolve().then(function(){return ym});void 0===globalThis.fetch&&(globalThis.fetch=e),void 0===globalThis.Headers&&(globalThis.Headers=t),void 0===globalThis.Request&&(globalThis.Request=n),void 0===globalThis.Response&&(globalThis.Response=r)}catch(e){}}async loadPromisePolyfill(){if(this.needsPromisePolyfill())try{const{PromisePolyfill:e}=await Promise.resolve().then(function(){return wm});void 0===globalThis.Promise&&(globalThis.Promise=e)}catch(e){}}async loadUrlPolyfill(){if(this.needsUrlPolyfill())try{const{URLPolyfill:e,URLSearchParamsPolyfill:t}=await Promise.resolve().then(function(){return xm});void 0===globalThis.URL&&(globalThis.URL=e),void 0===globalThis.URLSearchParams&&(globalThis.URLSearchParams=t)}catch(e){}}},e.RetryStrategy=G,e.SessionStorageAdapter=te,e.ThemeLoader=_a,e.addBreadcrumb=em,e.captureException=Jh,e.captureMessage=Kh,e.createAppError=ke,e.getAnalytics=function(){return Pe},e.getSupportMessage=Ee,e.groupErrorsByField=function(e){return e.reduce((e,t)=>(e[t.field]||(e[t.field]=[]),e[t.field].push(t),e),{})},e.initializeAnalytics=Re,e.initializeSentry=Qh,e.isSentryInitialized=nm,e.parseServerValidationErrors=ye,e.setTag=tm,e.setUser=Xh,e.shouldShowErrorPage=function(e){return"initialization"===e.type&&"critical"===e.severity},e.shouldShowMaintenancePage=Te,e.trackFormProgress=Me,e.trackPaymentCompleted=Le,e.trackPaymentFailed=Be,e.trackPaymentInitiated=Ae,e.trackQuoteAtCheckout=je,e.trackQuoteCalculated=Oe,e.trackQuoteReferred=We,e.trackQuoteStarted=De,e.validateField=pe,e.validatePage=ge});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|