1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mirfield-logo.png.asset-DCp7Vs-Y.js","assets/button-SBI16Xkx.js","assets/index-Bf-osUzR.js"])))=>i.map(i=>d[i]); 2import{g as Gt,e as g,r as u,j as e,f as he,h as fe,i as ge,t as I,u as Qt,c as Jt,_ as Zt,L as de}from"./index-Bf-osUzR.js";import{u as L,a as Ce}from"./useQuery-VJaSsz_P.js";import{u as Te}from"./useMutation-75LX3ZQs.js";import{C as Xt,g as en,a as tn}from"./stripe-Cwd-Z1GT.js";import{u as nn,a as rn,r as sn,A as ot}from"./app-shell-DgSox7LV.js";import{C as Q,b as me,c as pe,a as J}from"./card-DV9nJvnw.js";import{c as yt,a as an,u as Ye,b as Z,B as D}from"./button-SBI16Xkx.js";import{B as $e}from"./badge-BvDS0yaZ.js";import{P as on,h as cn,R as ln,u as dn,F as un,D as mn,C as pn,S as Ne,a as ke,b as Ee,c as we,d as K}from"./select-yc8IP53n.js";import{a as hn,g as fn,m as gn,s as xn,b as yn,n as vn,o as bn}from"./mirfield-logo.png.asset-DCp7Vs-Y.js";import{u as jn,a as Fe,P as xe,c as ue,b as Cn,d as _n}from"./index-CHrpmcj1.js";import{P as Ve}from"./index-ClQbqnt8.js";import{I as E}from"./input-DVeot5e-.js";import{L as _}from"./label-B9Kyhnw8.js";import{C as _e}from"./checkbox-PAfwZ6Eb.js";import{d as it}from"./horse_disclaimer_2026.pdf.asset-B0D9K51v.js";import{U as vt}from"./user-plus-vR8M4Jd6.js";import{T as ct}from"./textarea-BG6VHnNB.js";import{P as Sn}from"./plus-CpaNIu12.js";import{E as Nn}from"./entry-window-notice-D3Gn4J_v.js";import{T as kn}from"./trash-2-G9Hc7bTQ.js";const En=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],wn=yt("circle-alert",En);const Pn=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Rn=yt("x",Pn);var We={exports:{}},Me,lt;function Dn(){if(lt)return Me;lt=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Me=n,Me}var qe,dt;function An(){if(dt)return qe;dt=1;var n=Dn();function t(){}function r(){}return r.resetWarningCache=t,qe=function(){function s(l,c,m,d,y,k){if(k!==n){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}}s.isRequired=s;function a(){return s}var o={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return o.PropTypes=o,o},qe}var ut;function On(){return ut||(ut=1,We.exports=An()()),We.exports}var In=On();const S=Gt(In);function mt(n,t){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable})),r.push.apply(r,s)}return r}function pt(n){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mt(Object(r),!0).forEach(function(s){bt(n,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):mt(Object(r)).forEach(function(s){Object.defineProperty(n,s,Object.getOwnPropertyDescriptor(r,s))})}return n}function Se(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Se=function(t){return typeof t}:Se=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Se(n)}function bt(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}function Tn(n,t){if(n==null)return{};var r={},s=Object.keys(n),a,o;for(o=0;o<s.length;o++)a=s[o],!(t.indexOf(a)>=0)&&(r[a]=n[a]);return r}function Fn(n,t){if(n==null)return{};var r=Tn(n,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(a=0;a<o.length;a++)s=o[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(n,s)&&(r[s]=n[s])}return r}function jt(n,t){return Wn(n)||Mn(n,t)||qn(n,t)||Hn()}function Wn(n){if(Array.isArray(n))return n}function Mn(n,t){var r=n&&(typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"]);if(r!=null){var s=[],a=!0,o=!1,l,c;try{for(r=r.call(n);!(a=(l=r.next()).done)&&(s.push(l.value),!(t&&s.length===t));a=!0);}catch(m){o=!0,c=m}finally{try{!a&&r.return!=null&&r.return()}finally{if(o)throw c}}return s}}function qn(n,t){if(n){if(typeof n=="string")return ht(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set")return Array.from(n);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ht(n,t)}}function ht(n,t){(t==null||t>n.length)&&(t=n.length);for(var r=0,s=new Array(t);r<t;r++)s[r]=n[r];return s}
2function Hn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var O=function(t,r,s){var a=!!s,o=g.useRef(s);g.useEffect(function(){o.current=s},[s]),g.useEffect(function(){if(!a||!t)return function(){};var l=function(){o.current&&o.current.apply(o,arguments)};return t.on(r,l),function(){t.off(r,l)}},[a,r,t,o])},Ue=function(t){var r=g.useRef(t);return g.useEffect(function(){r.current=t},[t]),r.current},ae=function(t){return t!==null&&Se(t)==="object"},Ln=function(t){return ae(t)&&typeof t.then=="function"},Bn=function(t){return ae(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},ft="[object Object]",$n=function n(t,r){if(!ae(t)||!ae(r))return t===r;var s=Array.isArray(t),a=Array.isArray(r);if(s!==a)return!1;var o=Object.prototype.toString.call(t)===ft,l=Object.prototype.toString.call(r)===ft;if(o!==l)return!1;if(!o&&!s)return t===r;var c=Object.keys(t),m=Object.keys(r);if(c.length!==m.length)return!1;for(var d={},y=0;y<c.length;y+=1)d[c[y]]=!0;for(var k=0;k<m.length;k+=1)d[m[k]]=!0;var P=Object.keys(d);if(P.length!==c.length)return!1;var x=t,h=r,v=function(T){return n(x[T],h[T])};return P.every(v)},Un=function(t,r,s){return ae(t)?Object.keys(t).reduce(function(a,o){var l=!ae(r)||!$n(t[o],r[o]);return s.includes(o)?(l&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),a):l?pt(pt({},a||{}),{},bt({},o,t[o])):a},null):null},Ct="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",gt=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct;if(t===null||Bn(t))return t;throw new Error(r)},Yn=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ct;if(Ln(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return gt(a,r)})};var s=gt(t,r);return s===null?{tag:"empty"}:{tag:"sync",stripe:s}},Vn=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"6.2.0"}),t.registerAppInfo({name:"react-stripe-js",version:"6.2.0",url:"https://stripe.com/docs/stripe-js/react"}))},_t=g.createContext(null);_t.displayName="ElementsContext";var Kn=function(t,r){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(r," in an <Elements> provider."));return t};S.any,S.object;S.func.isRequired;var St=g.createContext(null);St.displayName="CheckoutContext";var xt=function(t){var r=g.useContext(St),s=g.useContext(_t);if(r){if(s)throw new Error("You cannot wrap the part of your app that ".concat(t," in both a checkout provider and <Elements> provider."));return r}else return Kn(s,t)},zn=["mode"],Gn=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},w=function(t,r,s){var a="".concat(Gn(t),"Element"),o=function(d){var y=d.id,k=d.className,P=d.options,x=P===void 0?{}:P,h=d.onBlur,v=d.onFocus,M=d.onReady,T=d.onChange,X=d.onEscape,oe=d.onClick,re=d.onLoadError,ee=d.onLoaderStart,U=d.onNetworksChange,p=d.onConfirm,ie=d.onCancel,b=d.onShippingAddressChange,z
3=d.onShippingRateChange,ye=d.onSavedPaymentMethodRemove,De=d.onSavedPaymentMethodUpdate,A=xt("mounts <".concat(a,">")),R="elements"in A?A.elements:null,Y="checkoutState"in A?A.checkoutState:null,q=Y?.type==="success"||Y?.type==="loading"?Y.sdk:null,ce=g.useState(null),ve=jt(ce,2),C=ve[0],be=ve[1],F=g.useRef(null),W=g.useRef(null);O(C,"blur",h),O(C,"focus",v),O(C,"escape",X),O(C,"click",oe),O(C,"loaderror",re),O(C,"loaderstart",ee),O(C,"networkschange",U),O(C,"confirm",p),O(C,"cancel",ie),O(C,"shippingaddresschange",b),O(C,"shippingratechange",z),O(C,"savedpaymentmethodremove",ye),O(C,"savedpaymentmethodupdate",De),O(C,"change",T);var se;M&&(t==="expressCheckout"?se=M:se=function(){M(C)}),O(C,"ready",se),g.useLayoutEffect(function(){if(F.current===null&&W.current!==null&&(R||q)){var j=null;if(q){var H=q,Ae=q;switch(t){case"paymentForm":j=Ae.createForm(x);break;case"payment":j=H.createPaymentElement(x);break;case"address":if("mode"in x){var V=x.mode,le=Fn(x,zn);if(V==="shipping")j=H.createShippingAddressElement(le);else if(V==="billing")j=H.createBillingAddressElement(le);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":j=H.createExpressCheckoutElement(x);break;case"currencySelector":j=q.createCurrencySelectorElement();break;case"taxId":j=H.createTaxIdElement(x);break;case"contactDetails":j=H.createContactDetailsElement();break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else R&&(j=R.create(t,x));F.current=j,be(j),j&&j.mount(W.current)}},[R,q,x]);var te=Ue(x);return g.useEffect(function(){if(F.current){var j=Un(x,te,["paymentRequest"]);j&&"update"in F.current&&F.current.update(j)}},[x,te]),g.useLayoutEffect(function(){return function(){if(F.current&&typeof F.current.destroy=="function")try{F.current.destroy(),F.current=null}catch{}}},[]),g.createElement("div",{id:y,className:k,ref:W})},l=function(d){xt("mounts <".concat(a,">"));var y=d.id,k=d.className;return g.createElement("div",{id:y,className:k})},c=r?l:o;return c.propTypes={id:S.string,className:S.string,onChange:S.func,onBlur:S.func,onFocus:S.func,onReady:S.func,onEscape:S.func,onClick:S.func,onLoadError:S.func,onLoaderStart:S.func,onNetworksChange:S.func,onConfirm:S.func,onCancel:S.func,onShippingAddressChange:S.func,onShippingRateChange:S.func,onSavedPaymentMethodRemove:S.func,onSavedPaymentMethodUpdate:S.func,options:S.object},c.displayName=a,c.__elementType=t,c},N=typeof window>"u",Ke=g.createContext(null);Ke.displayName="EmbeddedCheckoutProviderContext";var Nt=function(){var t=g.useContext(Ke);if(!t)throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");return t},Qn="Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Jn=function(t){var r=t.stripe,s=t.options,a=t.children,o=g.useMemo(function(){return Yn(r,Qn)},[r]),l=g.useRef(null),c=g.useRef(null),m=g.useState({embeddedCheckout:null}),d=jt(m,2),y=d[0],k=d[1];g.useEffect(function(){if(!(c.current||l.current)){var h=function(M){c.current||l.current||(c.current=M,l.current=c.current.createEmbeddedCheckoutPage(s).then(function(T){k({embeddedCheckout:T})}))};o.tag==="async"&&!c.current&&(s.clientSecret||s.fetchClientSecret)?o.stripePromise.then(function(v){v&&h(v)}):o.tag==="sync"&&!c.current&&(s.clientSecret||s.fetchClientSecret)&&h(o.stripe)}},[o,s,y,c]),g.useEffect(function(){return function(){y.embeddedCheckout?(l.current=null,y.embeddedCheckout.destroy()):l.current&&l.current.then(function(){l.current=null,y.embeddedCheckout&&y.embeddedCheckout.destroy()})}},[y.embeddedCheckout]),g.useEffect(function(){Vn(c)},[c]);var P=Ue(r);g.useEffect(function(){P!==null&&P!==r&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.")},[P,r]);var x=Ue(s);return g.useEffect(function(){if(x!=null){if(s==null){console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");return}s.clientSecret===void 0&&s.fetchClientSecret===void 0&&console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`."),x.clientSecret!=null&&s.clientSecret!==x.clientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),x.fetchClientSecret!=null&&s.fetchClientSecret!==x.fetchClientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),x.onComplete!=null&&s.onComplete!==x.onComplete&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it."),x.onShippingDetailsChange!=null&&s.onShippingDetailsChange!==x.onShippingDetailsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it."),x.onLineItemsChange!=null&&s.onLineItemsChange!==x.onLineItemsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.")}},[x,s]),g.createElement(Ke.Provider,{value:y},a)},Zn=function(t){var r=t.id,s=t.className,a=Nt(),o=a.embeddedCheckout,l=g.useRef(!1),c=g.useRef(null);return g.useLayoutEffect(function(){return!l.current&&o&&c.current!==null&&(o.mount(c.current),l.current=!0),function(){if(l.current&&o)try{o.unmount(),l.current=!1}catch{}}}
vendor: 6,045 bytes, line 3
3,[o]),g.createElement("div",{ref:c,id:r,className:s})},Xn=function(t){var r=t.id,s=t.className;return Nt(),g.createElement("div",{id:r,className:s})},er=N?Xn:Zn;w("auBankAccount",N);w("card",N);w("cardNumber",N);w("cardExpiry",N);w("cardCvc",N);w("iban",N);w("payment",N);w("expressCheckout",N);w("paymentRequestButton",N);w("linkAuthentication",N);w("contactDetails",N);w("address",N);w("shippingAddress",N);w("paymentMethodMessaging",N);w("taxId",N);w("issuingCardNumberDisplay",N);w("issuingCardCvcDisplay",N);w("issuingCardExpiryDisplay",N);w("issuingCardPinDisplay",N);w("issuingCardCopyButton",N);function tr(n){const t=nr(n),r=u.forwardRef((s,a)=>{const{children:o,...l}=s,c=u.Children.toArray(o),m=c.find(sr);if(m){const d=m.props.children,y=c.map(k=>k===m?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:k);return e.jsx(t,{...l,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,y):null})}return e.jsx(t,{...l,ref:a,children:o})});return r.displayName=`${n}.Slot`,r}function nr(n){const t=u.forwardRef((r,s)=>{const{children:a,...o}=r;if(u.isValidElement(a)){const l=or(a),c=ar(o,a.props);return a.type!==u.Fragment&&(c.ref=s?an(s,l):l),u.cloneElement(a,c)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${n}.SlotClone`,t}var rr=Symbol("radix.slottable");function sr(n){return u.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===rr}function ar(n,t){const r={...t};for(const s in t){const a=n[s],o=t[s];/^on[A-Z]/.test(s)?a&&o?r[s]=(...c)=>{const m=o(...c);return a(...c),m}:a&&(r[s]=a):s==="style"?r[s]={...a,...o}:s==="className"&&(r[s]=[a,o].filter(Boolean).join(" "))}return{...n,...r}}function or(n){let t=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?n.ref:(t=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Re="Dialog",[kt]=Cn(Re),[ir,B]=kt(Re),Et=n=>{const{__scopeDialog:t,children:r,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=n,c=u.useRef(null),m=u.useRef(null),[d,y]=jn({prop:s,defaultProp:a??!1,onChange:o,caller:Re});return e.jsx(ir,{scope:t,triggerRef:c,contentRef:m,contentId:Fe(),titleId:Fe(),descriptionId:Fe(),open:d,onOpenChange:y,onOpenToggle:u.useCallback(()=>y(k=>!k),[y]),modal:l,children:r})};Et.displayName=Re;var wt="DialogTrigger",cr=u.forwardRef((n,t)=>{const{__scopeDialog:r,...s}=n,a=B(wt,r),o=Ye(t,a.triggerRef);return e.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Qe(a.open),...s,ref:o,onClick:ue(n.onClick,a.onOpenToggle)})});cr.displayName=wt;var ze="DialogPortal",[lr,Pt]=kt(ze,{forceMount:void 0}),Rt=n=>{const{__scopeDialog:t,forceMount:r,children:s,container:a}=n,o=B(ze,t);return e.jsx(lr,{scope:t,forceMount:r,children:u.Children.map(s,l=>e.jsx(Ve,{present:r||o.open,children:e.jsx(on,{asChild:!0,container:a,children:l})}))})};Rt.displayName=ze;var Pe="DialogOverlay",Dt=u.forwardRef((n,t)=>{const r=Pt(Pe,n.__scopeDialog),{forceMount:s=r.forceMount,...a}=n,o=B(Pe,n.__scopeDialog);return o.modal?e.jsx(Ve,{present:s||o.open,children:e.jsx(ur,{...a,ref:t})}):null});Dt.displayName=Pe;var dr=tr("DialogOverlay.RemoveScroll"),ur=u.forwardRef((n,t)=>{const{__scopeDialog:r,...s}=n,a=B(Pe,r);return e.jsx(ln,{as:dr,allowPinchZoom:!0,shards:[a.contentRef],children:e.jsx(xe.div,{"data-state":Qe(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ne="DialogContent",At=u.forwardRef((n,t)=>{const r=Pt(ne,n.__scopeDialog),{forceMount:s=r.forceMount,...a}=n,o=B(ne,n.__scopeDialog);return e.jsx(Ve,{present:s||o.open,children:o.modal?e.jsx(mr,{...a,ref:t}):e.jsx(pr,{...a,ref:t})})});At.displayName=ne;var mr=u.forwardRef((n,t)=>{const r=B(ne,n.__scopeDialog),s=u.useRef(null),a=Ye(t,r.contentRef,s);return u.useEffect(()=>{const o=s.current;if(o)return cn(o)},[]),e.jsx(Ot,{...n,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(n.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ue(n.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&o.preventDefault()}),onFocusOutside:ue(n.onFocusOutside,o=>o.preventDefault())})}),pr=u.forwardRef((n,t)=>{const r=B(ne,n.__scopeDialog),s=u.useRef(!1),a=u.useRef(!1);return e.jsx(Ot,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{n.onCloseAutoFocus?.(o),o.defaultPrevented||(s.current||r.triggerRef.current?.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{n.onInteractOutside?.(o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;r.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),Ot=u.forwardRef((n,t)=>{const{__scopeDialog:r,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=n,c=B(ne,r),m=u.useRef(null),d=Ye(t,m);return dn(),e.jsxs(e.Fragment,{children:[e.jsx(un,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:e.jsx(mn,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Qe(c.open),...l,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(hr,{titleId:c.titleId}),e.jsx(gr,{contentRef:m,descriptionId:c.descriptionId})]})]})}),Ge="DialogTitle",It=u.forwardRef((n,t)=>{const{__scopeDialog:r,...s}=n,a=B(Ge,r);return e.jsx(xe.h2,{id:a.titleId,...s,ref:t})});It.displayName=Ge;var Tt="DialogDescription",Ft=u.forwardRef((n,t)=>{const{__scopeDialog:r,...s}=n,a=B(Tt,r);return e.jsx(xe.p,{id:a.descriptionId,...s,ref:t})});Ft.displayName=Tt;var Wt="DialogClose",Mt=u.forwardRef((n,t)=>{const{__scopeDialog:r,...s}=n,a=B(Wt,r);return e.jsx(xe.button,{type:"button",...s,ref:t,onClick:ue(n.onClick,()=>a.onOpenChange(!1))})});Mt.displayName=Wt;function Qe(n){return n?"open":"closed"}
3var qt="DialogTitleWarning",[Xr,Ht]=_n(qt,{contentName:ne,titleName:Ge,docsSlug:"dialog"}),hr=({titleId:n})=>{const t=Ht(qt),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 4 5If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 6 7For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{n&&(document.getElementById(n)||console.error(r))},[r,n]),null},fr="DialogDescriptionWarning",gr=({contentRef:n,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ht(fr).contentName}}.`;return u.useEffect(()=>{const a=n.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,n,t]),null},xr=Et,yr=Rt,Lt=Dt,Bt=At,$t=It,Ut=Ft,vr=Mt;const Yt=xr,br=yr,Vt=u.forwardRef(({className:n,...t},r)=>e.jsx(Lt,{ref:r,className:Z("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...t}));Vt.displayName=Lt.displayName;const Je=u.forwardRef(({className:n,children:t,...r},s)=>e.jsxs(br,{children:[e.jsx(Vt,{}),e.jsxs(Bt,{ref:s,className:Z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",n),...r,children:[t,e.jsxs(vr,{className:"absolute right-4 top-4 roun
7ded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Rn,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Je.displayName=Bt.displayName;const Ze=({className:n,...t})=>e.jsx("div",{className:Z("flex flex-col space-y-1.5 text-center sm:text-left",n),...t});Ze.displayName="DialogHeader";const Xe=({className:n,...t})=>e.jsx("div",{className:Z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...t});Xe.displayName="DialogFooter";const et=u.forwardRef(({className:n,...t},r)=>e.jsx($t,{ref:r,className:Z("text-lg font-semibold leading-none tracking-tight",n),...t}));et.displayName=$t.displayName;const jr=u.forwardRef(({className:n,...t},r)=>e.jsx(Ut,{ref:r,className:Z("text-sm text-muted-foreground",n),...t}));jr.displayName=Ut.displayName;const Cr=he({method:"GET"}).middleware([fe]).handler(ge("5ecac926b0218c47efcba4005f73c64a1b8439fb4ae8ecbe2657c34087b7007d")),_r=he({method:"POST"}).middleware([fe]).handler(ge("3f4b1efbac1b2d88deae38cd6b28d6bb53485bb694c23287874fbf420b7f7dd4"));he({method:"POST"}).middleware([fe]).handler(ge("bcda3694c21d600cfae77fcc1c138ff991bc6395c9c532c668fa7c3f580a69e9"));const Sr=he({method:"POST"}).middleware([fe]).handler(ge("1f1d3f3ccfb9ef51a7b0559c864dd7764eba3e3c1c4e88f9e1f2f94c142caf5c")),Nr=he({method:"POST"}).middleware([fe]).handler(ge("00d323231f7c0deacb1b8c85799069a8883abbb9fbcb549c1708ec2b8e8275a6"));function kr({steps:n}){return e.jsx("ol",{className:"flex items-center gap-2 overflow-x-auto pb-1","aria-label":"Entry progress",children:n.map((t,r)=>e.jsxs("li",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("span",{className:Z("flex h-7 w-7 items-center justify-center rounded-full text-xs font-bold border",t.done?"bg-primary text-primary-foreground border-primary":t.active?"border-primary text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t.done?e.jsx(pn,{className:"w-4 h-4"}):r+1}),e.jsx("span",{className:Z("text-xs sm:text-sm",t.active||t.done?"font-medium":"text-muted-foreground"),children:t.label}),r<n.length-1&&e.jsx("span",{className:"w-4 sm:w-8 border-t border-muted-foreground/30"})]},t.label))})}function Er({onSave:n,saving:t}){const[r,s]=u.useState({name:"",phone:"",address:"",postcode:""}),a=r.name.trim().length>1&&r.phone.trim().length>5;return e.jsxs(Q,{className:"border-primary/40",children:[e.jsxs(me,{children:[e.jsx(pe,{children:"Your details"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Who should we contact about these entries? We only ask for this once."})]}),e.jsxs(J,{className:"space-y-3",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(_,{htmlFor:"lead-name",children:"Your name"}),e.jsx(E,{id:"lead-name",autoComplete:"name",value:r.name,onChange:o=>s({...r,name:o.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{htmlFor:"lead-phone",children:"Mobile number"}),e.jsx(E,{id:"lead-phone",type:"tel",autoComplete:"tel",value:r.phone,onChange:o=>s({...r,phone:o.target.value})})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(_,{htmlFor:"lead-address",children:"Address"}),e.jsx(E,{id:"lead-address",autoComplete:"street-address",value:r.address,onChange:o=>s({...r,address:o.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{htmlFor:"lead-postcode",children:"Postcode"}),e.jsx(E,{id:"lead-postcode",autoComplete:"postal-code",value:r.postcode,onChange:o=>s({...r,postcode:o.target.value})})]})]}),e.jsx(D,{className:"w-full",size:"lg",disabled:!a||t,onClick:()=>n(r),children:t?"Savingâ¦":"Save & continue"})]})]})}const He={first_name:"",last_name:"",date_of_birth:"",age_band:"age_16_plus"};function wr({competitors:n,onAdd:t,saving:r,horseFlow:s}){const[a,o]=u.useState(n.length===0),[l,c]=u.useState(He),m=l.first_name.trim()&&l.last_name.trim();return e.jsxs(Q,{className:n.length===0?"border-primary/40":void 0,children:[e.jsxs(me,{children:[e.jsx(pe,{children:s?"Who is riding?":"Who is competing?"}),n.length===0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Add the ",s?"rider or handler":"competitor",". Your classes will be attached to them automatically."]})]}),e.jsxs(J,{className:"space-y-3",children:[n.map(d=>e.jsxs("div",{className:"flex items-center justify-between rounded bg-muted/40 p-2",children:[e.jsxs("span",{className:"font-medium",children:[d.first_name," ",d.last_name]}),e.jsx($e,{variant:d.age_band==="under_16"?"secondary":"outline",className:"text-xs",children:d.age_band==="under_16"?"Under 16":"16+"})]},d.id)),a?e.jsxs("div",{className:"space-y-2 rounded border p-3",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-2",children:[e.jsx(E,{placeholder:"First name",value:l.first_name,onChange:d=>c({...l,first_name:d.target.value})}),e.jsx(E,{placeholder:"Last name",value:l.last_name,onChange:d=>c({...l,last_name:d.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{className:"text-xs",children:"Date of birth (optional)"}),e.jsx(E,{type:"date",value:l.date_of_birth,onChange:d=>c({...l,date_of_birth:d.target.value})})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"radio",name:"rider_age",checked:l.age_band==="age_16_plus",onChange:()=>c({...l,age_band:"age_16_plus"})})," 16 or over"]}),e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"radio",name:"rider_age",checked:l.age_band==="under_16",onChange:()=>c({...l,age_band:"under_16"})})," Under 16"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(D,{disabled:!m||r,onClick:async()=>{await t(l),c(He),o(!1)},children:r?"Savingâ¦":"Save rider"}),n.length>0&&e.jsx(D,{variant:"ghost",onClick:()=>{c(He),o(!1)},children:"Cancel"})]})]}):e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[e.jsx(vt,{className:"w-4 h-4 mr-2"})," Add another ",s?"rider":"competitor"]})]})]})}const Le={name:"",nickname:"",sex:"",colour:"",age_years:"",passport_life_no:"",insurance_provider:"",insurance_policy_no:"",insurance_certificate_no:"",insurance_expiry:"",commentator_notes:""};function Be(n){return`${n.classes?.code?n.classes.code+" â ":""}${n.classes?.name??""}`}function Pr({horseItems:n,horses:t,onSaveHorse:r,onApply:s}){const a=n.filter(m=>!m.horse_id),[o,l]=u.useState(null),c=a.length===0;return e.jsxs(Q,{className:c?void 0:"border-amber-300",children:[e.jsxs(me,{children:[e.jsxs(pe,{className:"flex items-center gap-2",children:[c?e.jsx(Xt,{className:"w-5 h-5 text-primary"}):e.jsx(wn,{className:"w-5 h-5 text-amber-500"}),"Your horse"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c?"Horse details saved for every horse class in your basket.":`We need the horse details once â they'll be used for all ${n.length} horse ${n.length===1?"class":"classes"}.`})]}),e.jsxs(J,{className:"space-y-3",children:[!c&&e.jsx(D,{size:"lg",className:"w-full",onClick:()=>l({itemIds:a.map(m=>m.id),label:a.length===1?Be(a[0]):`${a.length} horse classes`}),children:t.length>0?"Choose your horse":"Add your horse details"}),e.jsx("div",{className:"space-y-1",children:n.map(m=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded bg-muted/40 p-2 text-sm",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:Be(m)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:m.horse_id?e.jsxs(e.Fragment,{children:["Horse: ",e.jsx("strong",{children:m.horses?.name})]}):"Horse details needed"})]}),e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>l({itemIds:[m.id],label:Be(m),current:m}),children:m.horse_id?"Change":"Add"})]},m.id))})]}),o&&e.jsx(Rr,{label:o.label,itemIds:o.itemIds,current:o.current,otherUnassigned:a.filter(m=>!o.itemIds.includes(m.id)).map(m=>m.id),horses:t,onSaveHorse:r,onApply:s,onClose:()=>l(null)})]})}function Rr({label:n,itemIds:t,current:r,otherUnassigned:s,horses:a,onSaveHorse:o,onApply:l,onClose:c}){const[m,d]=u.useState(r?.horse_id??(a.length===1?a[0].id:"")),[y,k]=u.useState(r?.rider_notes??""),[P,x]=u.useState(a.length===0),[h,v]=u.useState(Le),[M,T]=u.useState(!1),[X,oe]=u.useState(!0);async function re(){T(!0);try{const p=await o({name:h.name,nickname:h.nickname||null,sex:h.sex||null,colour:h.c
7olour||null,age_years:h.age_years?Number(h.age_years):null,passport_life_no:h.passport_life_no||null,insurance_provider:h.insurance_provider||null,insurance_policy_no:h.insurance_policy_no||null,insurance_certificate_no:h.insurance_certificate_no||null,insurance_expiry:h.insurance_expiry||null,commentator_notes:h.commentator_notes||null});d(p.id),x(!1),v(Le),I.success(`Saved ${p.name}`)}catch(p){I.error(p?.message??"Could not save horse")}finally{T(!1)}}async function ee(){T(!0);try{const p=X&&s.length>0?[...t,...s]:t;await l({horseId:m,itemIds:p,riderNotes:y||null}),c()}catch(p){I.error(p?.message??"Could not save horse details")}finally{T(!1)}}const U=a.find(p=>p.id===m);return e.jsx(Yt,{open:!0,onOpenChange:p=>!p&&c(),children:e.jsxs(Je,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ze,{children:e.jsxs(et,{children:["Horse details · ",n]})}),!P&&a.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(_,{children:"Choose horse/pony"}),e.jsxs(Ne,{value:m,onValueChange:d,children:[e.jsx(ke,{children:e.jsx(Ee,{placeholder:"Pick a horseâ¦"})}),e.jsx(we,{children:a.map(p=>e.jsxs(K,{value:p.id,children:[p.name,p.insurance_expiry?` · ins. exp ${p.insurance_expiry}`:""]},p.id))})]})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>x(!0),children:[e.jsx(Sn,{className:"w-4 h-4 mr-1"})," Add a different horse"]})]}),P&&e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(_,{children:"Horse/pony name *"}),e.jsx(E,{value:h.name,onChange:p=>v({...h,name:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Nickname"}),e.jsx(E,{value:h.nickname,onChange:p=>v({...h,nickname:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Sex"}),e.jsxs(Ne,{value:h.sex,onValueChange:p=>v({...h,sex:p}),children:[e.jsx(ke,{children:e.jsx(Ee,{placeholder:"â"})}),e.jsxs(we,{children:[e.jsx(K,{value:"mare",children:"Mare"}),e.jsx(K,{value:"gelding",children:"Gelding"}),e.jsx(K,{value:"filly",children:"Filly"}),e.jsx(K,{value:"colt",children:"Colt"}),e.jsx(K,{value:"stallion",children:"Stallion"}),e.jsx(K,{value:"other",children:"Other"})]})]})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Colour"}),e.jsx(E,{value:h.colour,onChange:p=>v({...h,colour:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Age (years)"}),e.jsx(E,{type:"number",value:h.age_years,onChange:p=>v({...h,age_years:p.target.value})})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(_,{children:"Passport life number"}),e.jsx(E,{value:h.passport_life_no,onChange:p=>v({...h,passport_life_no:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Insurance provider"}),e.jsx(E,{value:h.insurance_provider,onChange:p=>v({...h,insurance_provider:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Policy no."}),e.jsx(E,{value:h.insurance_policy_no,onChange:p=>v({...h,insurance_policy_no:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Certificate no."}),e.jsx(E,{value:h.insurance_certificate_no,onChange:p=>v({...h,insurance_certificate_no:p.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Certificate expiry"}),e.jsx(E,{type:"date",value:h.insurance_expiry,onChange:p=>v({...h,insurance_expiry:p.target.value})})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(_,{children:"For the commentator (nickname, favourite food, dislikesâ¦)"}),e.jsx(ct,{rows:2,value:h.commentator_notes,onChange:p=>v({...h,commentator_notes:p.target.value})})]}),e.jsxs("div",{className:"sm:col-span-2 flex gap-2",children:[e.jsx(D,{onClick:re,disabled:M||!h.name.trim(),children:"Save horse"}),a.length>0&&e.jsx(D,{variant:"ghost",onClick:()=>{x(!1),v(Le)},children:"Cancel"})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsx(_,{children:"For the commentator â about the rider/handler (years showing, other interestsâ¦)"}),e.jsx(ct,{rows:2,value:y,onChange:p=>k(p.target.value)})]}),m&&s.length>0&&e.jsxs("label",{className:"flex items-start gap-2 rounded border bg-muted/30 p-3 text-sm",children:[e.jsx(_e,{checked:X,onCheckedChange:p=>oe(!!p)}),e.jsxs("span",{children:["Use ",e.jsx("strong",{children:U?.name??"this horse"})," for the other ",s.length," ","horse ",s.length===1?"class":"classes"," too"]})]}),e.jsxs(Xe,{children:[e.jsx(D,{variant:"ghost",onClick:c,children:"Cancel"}),e.jsx(D,{disabled:!m||M,onClick:ee,children:"Save & continue"})]})]})})}function es(){const n=nn(),t=Qt(),r=Jt(),s=L(hn),a=L(fn),o=L(gn),l=L(xn),c=L(yn),m=L(Cr),d=L(_r),y=L(Sr),k=L(Nr),P=L(vn),x=L(bn),h=Ce({queryKey:["basket"],queryFn:()=>s()}),v=Ce({queryKey:["household"],queryFn:()=>a()}),M=Ce({queryKey:["horses"],queryFn:()=>m()}),T=Ce({queryKey:["schedule"],queryFn:async()=>{const{listScheduleForActiveYear:i}=await Zt(async()=>{const{listScheduleForActiveYear:f}=await import("./mirfield-logo.png.asset-DCp7Vs-Y.js").then($=>$.q);return{listScheduleForActiveYear:f}},__vite__mapDeps([0,1,2]));return i()}}),[X,oe]=u.useState(null),[re,ee]=u.useState(null),U=rn(),[p,ie]=u.useState(null),[b,z]=u.useState({rules:!1,indemnity:!1,data:!1,signedBy:"",signedBySecondary:"",signedAt:new Date().toISOString().slice(0,10)}),[ye,De]=u.useState(""),A=v.data?.competitors??[],R=A.length>0,Y=new Map((T.data?.classes??[]).map(i=>[i.id,i])),q=Te({mutationFn:i=>P({data:i}),onSuccess:()=>
7t.invalidateQueries(),onError:i=>I.error(i.message)}),ce=u.useRef(!1);u.useEffect(()=>{ce.current||!v.data||!R||U.length===0||(ce.current=!0,(async()=>{try{const i=A[0].id;for(const f of U){for(let $=0;$<f.quantity;$++)await c({data:{class_id:f.class_id,competitor_id:i}});sn(f.class_id)}t.invalidateQueries({queryKey:["basket"]}),I.success("Your saved classes have been added")}catch(i){I.error(i?.message??"Could not add your saved classes")}finally{ce.current=!1}})())},[v.data,R,U,A,c,t]);const ve=Te({mutationFn:i=>o({data:{id:i}}),onSuccess:()=>t.invalidateQueries({queryKey:["basket"]})}),C=Te({mutationFn:()=>l({data:{environment:en(),waiver_rules_accepted:b.rules,waiver_indemnity_accepted:b.indemnity,waiver_data_accepted:b.data,waiver_signed_by:b.signedBy||null,waiver_signed_by_secondary:b.signedBySecondary||null,waiver_signed_at:b.signedAt||null,promo_code:ye.trim()||null}}),onMutate:()=>ee(null),onSuccess:i=>{if(t.invalidateQueries(),i.clientSecret){i.freeCount>0&&I.success(`${i.freeCount} free ${i.freeCount===1?"entry":"entries"} confirmed. Please pay for the rest below.`),oe(i.clientSecret),window.setTimeout(()=>window.scrollTo({top:0,behavior:"smooth"}),0);return}if(i.paidCount>0){const f="Payment could not be prepared. Please try again.";ee(f),I.error(f);return}I.success(`Submitted ${i.freeCount} ${i.freeCount===1?"entry":"entries"}!`),r({to:"/dashboard"})},onError:i=>{ee(i.message),I.error(i.message)}}),be=h.data?.items??[],F=new Map;for(const i of be){if(!i.classes?.requires_horse_form)continue;const f=F.get(i.competitor_id)??new Set;f.add(i.class_id),F.set(i.competitor_id,f)}const W=be.map(i=>{if(!i.classes?.free_if_other_horse_entry)return i;const f=F.get(i.competitor_id);return f&&Array.from(f).some(Ie=>Ie!==i.class_id)?{...i,_freeWithHorse:!0,classes:{...i.classes,payment_required:!1,entry_fee_pence:0}}:i}),se=W.reduce((i,f)=>i+(f.quantity??1),0),te=W.reduce((i,f)=>i+(f.classes?.payment_required?(f.classes?.entry_fee_pence??0)*(f.quantity??1):0),0),j=W.filter(i=>i.classes?.requires_horse_form),H=j.filter(i=>!i.horse_id),Ae=U.some(i=>Y.get(i.class_id)?.requires_horse_form),V=j.length>0||Ae,le=j.length>0,tt=!le||b.rules&&b.indemnity&&b.data&&!!b.signedBy.trim()&&!!b.signedAt,G=!!v.data,Oe=!V||j.length>0&&H.length===0,nt=h.data?.entryWindow??null,rt=!!nt?.entriesClosed,st=!rt&&W.length>0&&G&&R&&Oe&&tt&&!C.isPending,at=rt?"Online entries have closed â entries on the day are welcome at the entries desk":G?R?W.length===0?"Your basket is empty":H.length>0?`Add horse details for ${H.length} ${H.length===1?"class":"classes"}`:tt?null:"Tick the acknowledgements and sign below":`Add ${V?"a rider":"a competitor"} above first`:"Add your contact details above first",Kt=[{label:"Your details",done:G,active:!G},{label:V?"Rider":"Competitor",done:R,active:G&&!R},...V?[{label:"Horse",done:Oe,active:R&&!Oe}]:[],{label:"Confirm & pay",done:!1,active:!!st}];async function zt({horseId:i,itemIds:f,riderNotes:$}){if($)for(const Ie of f)await y({data:{basket_item_id:Ie,horse_id:i,rider_notes:$}});else await k({data:{basket_item_ids:f,horse_id:i}});t.invalidateQueries({queryKey:["basket"]}),I.success(f.length>1?`Horse added to ${f.length} classes`:"Horse details saved")}if(X)return e.jsxs(ot,{showAdminLink:!!n.data,children:[e.jsx("h1",{className:"mb-4",children:"Pay for your entries"}),e.jsx(Q,{children:e.jsx(J,{className:"pt-6",children:e.jsx(Jn,{stripe:tn(),options:{fetchClientSecret:async()=>X},children:e.jsx(er,{})})})})]});const je=U.reduce((i,f)=>i+f.quantity,0);return e.jsxs(ot,{showAdminLink:!!n.data,children:[e.jsx("h1",{className:"mb-3",children:"Complete your entry"}),e.jsx("div",{className:"mb-4",children:e.jsx(kr,{steps:Kt})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Nn,{window:nt}),!G&&e.jsx(Er,{saving:q.isPending,onSave:i=>q.mutate({household:{name:i.name,phone:i.phone||null,address:i.address||null,postcode:i.postcode||null}})}),G&&e.jsx(wr,{competitors:A,horseFlow:V,saving:q.isPending,onAdd:async i=>{await q.mutateAsync({competitor:{first_name:i.first_name,last_name:i.last_name,date_of_birth:i.date_of_birth||null,age_band:i.age_band}})}}),je>0&&(!G||!R)&&e.jsx(Q,{children:e.jsxs(J,{className:"pt-6 text-sm text-muted-foreground",children:[je," ",je===1?"class is":"classes are"," saved and will be added as soon as you've added your ",V?"rider":"competitor"," above."]})}),R&&j.length>0&&e.jsx(Pr,{horseItems:j,horses:M.data??[],onSaveHorse:async i=>{const f=await d({data:i});return t.invalidateQueries({queryKey:["horses"]}),f},onApply:zt}),W.length===0?R&&je===0&&e.jsx(Q,{children:e.jsxs(J,{className:"pt-6",children:["Your basket is empty. ",e.jsx(de,{className:"text-primary underline",to:"/schedule",children:"Browse the schedule"}),"."]})}):e.jsxs(Q,{children:[e.jsx(me,{children:e.jsxs(pe,{children:[se," ",se===1?"entry":"entries"]})}),e.jsx(J,{className:"space-y-2",children:W.map(i=>e.jsxs("div",{className:"flex flex-col gap-2 border rounded p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"font-medium",children:[i.classes?.code?`${i.classes.code} â `:"",i.classes?.name]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.classes?.sections?.name,(i.quantity??1)>1&&e.jsxs("span",{className:"ml-1 font-medium",children:["à ",i.quantity]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.classes?.payment_required?e.jsxs($e,{children:["£",((i.classes?.entry_fee_pence??0)*(i.quantity??1)/100).toFixed(2)]}):e.jsx($e,{variant:"secondary",children:i._freeWithHorse?"Free with another horse entry":"Free"}),e.jsx(D,{size:"sm",variant:"ghost",onClick:()=>ve.mutate(i.id),"aria-label":"Remove entry",children:e.jsx(kn,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[A.length>1?e.jsxs(Ne,{value:i.competitor_id,onValueChange:async f=>{try{await x({data:{basket_item_id:i.id,competitor_id:f}}),t.invalidateQueries({queryKey:["basket"]})}catch($){I.error($?.message??"Could not change rider")}},children:[e.jsx(ke,{className:"h-8 w-56 text-xs",children:e.jsx(Ee,{})}),e.jsx(we,{children:A.map(f=>e.jsxs(K,{value:f.id,children:[f.first_name," ",f.last_name]},f.id))})]}):e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i.competitors?.first_name," ",i.competitors?.last_name]}),A.length>1&&e.jsxs(D,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>ie({classId:i.class_id,classLabel:`${i.classes?.code?i.classes.code+" â ":""}${i.classes?.name}`,excludeCompetitorId:i.competitor_id}),children:[e.jsx(vt,{className:"w-3.5 h-3.5 mr-1"})," Add another rider to this class"]})]})]},i.id))})]}),W.length>0&&R&&e.jsxs(Q,{className:"border-primary/40",children:[e.jsx(me,{children:e.jsx(pe,{children:"Confirm & pay"})}),e.jsxs(J,{className:"space-y-3",children:[le&&e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"rounded-md border bg-muted/30 p-2 text-xs flex flex-wrap gap-x-4 gap-y-1",children:[e.jsx(de,{to:"/documents",search:{doc:"rules",from:"basket"},className:"underline text-primary",children:"View Horse & Pony Show Rules 2026 (PDF)"}),e.jsx(de,{to:"/documents",search:{doc:"disclaimer",from:"basket"},className:"underline text-primary",children:"View Horse Attendance Disclaimer 2026 (PDF)"}),e.jsx("a",{href:it.url,download:it.original_filename,className:"underline text-primary",children:"Download disclaimer"})]}),e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx(_e,{checked:b.rules,onCheckedChange:i=>z({...b,rules:!!i}
7)})," ",e.jsxs("span",{children:["I have read and agree to the ",e.jsx(de,{to:"/documents",search:{doc:"rules",from:"basket"},className:"underline",children:"Horse and Pony Show Rules 2026"}),"."]})]}),e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx(_e,{checked:b.indemnity,onCheckedChange:i=>z({...b,indemnity:!!i})})," ",e.jsxs("span",{children:["I have read and understood the ",e.jsx(de,{to:"/documents",search:{doc:"disclaimer",from:"basket"},className:"underline",children:"Horse Attendance Disclaimer"})," and agree to its terms."]})]}),e.jsxs("label",{className:"flex items-start gap-2",children:[e.jsx(_e,{checked:b.data,onCheckedChange:i=>z({...b,data:!!i})})," ",e.jsx("span",{children:"I agree these details may be retained by Mirfield Agricultural Show Society Limited for show administration and welfare."})]}),e.jsxs("div",{className:"grid sm:grid-cols-3 gap-2 pt-1",children:[e.jsxs("div",{children:[e.jsx(_,{children:"Signed by (rider/handler or responsible adult)"}),e.jsx(E,{value:b.signedBy,onChange:i=>z({...b,signedBy:i.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Second signature (if rider under 18)"}),e.jsx(E,{value:b.signedBySecondary,onChange:i=>z({...b,signedBySecondary:i.target.value})})]}),e.jsxs("div",{children:[e.jsx(_,{children:"Date"}),e.jsx(E,{type:"date",value:b.signedAt,onChange:i=>z({...b,signedAt:i.target.value})})]})]})]}),te>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-sm font-medium",children:["Total to pay: £",(te/100).toFixed(2)]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(_,{htmlFor:"promo-code",className:"text-xs text-muted-foreground",children:"Promo code (optional)"}),e.jsx(E,{id:"promo-code",value:ye,onChange:i=>De(i.target.value),placeholder:"Enter code",className:"max-w-xs",autoComplete:"off"})]})]}),e.jsx(D,{className:"w-full",size:"lg",type:"button",onClick:()=>C.mutate(),disabled:!st,"aria-busy":C.isPending,children:C.isPending?te>0?"Preparing secure paymentâ¦":"Submitting entriesâ¦":te>0?"Submit & pay":"Submit entries"}),at&&e.jsx("div",{className:"text-xs text-amber-600 text-center",children:at}),C.isPending&&e.jsx("div",{className:"text-xs text-muted-foreground text-center",children:"Please wait â preparing your secure card payment."}),re&&e.jsx("div",{role:"alert",className:"text-xs text-destructive text-center",children:re})]})]})]}),p&&e.jsx(Dr,{classLabel:p.classLabel,competitors:A,defaultCompetitorId:A.find(i=>i.id!==p.excludeCompetitorId)?.id??A[0]?.id,onClose:()=>ie(null),onAdd:async i=>{try{await c({data:{class_id:p.classId,competitor_id:i}}),t.invalidateQueries({queryKey:["basket"]}),I.success("Added to your basket"),ie(null)}catch(f){I.error(f?.message??"Could not add entry")}}})]})}function Dr({classLabel:n,competitors:t,defaultCompetitorId:r,onClose:s,onAdd:a}){const[o,l]=u.useState(r??t[0]?.id??""),[c,m]=u.useState(!1);return e.jsx(Yt,{open:!0,onOpenChange:d=>!d&&s(),children:e.jsxs(Je,{children:[e.jsx(Ze,{children:e.jsxs(et,{children:["Add another entry · ",n]})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pick which rider/competitor is also entering this class."}),e.jsxs(Ne,{value:o,onValueChange:l,children:[e.jsx(ke,{children:e.jsx(Ee,{placeholder:"Choose competitorâ¦"})}),e.jsx(we,{children:t.map(d=>e.jsxs(K,{value:d.id,children:[d.first_name," ",d.last_name]},d.id))})]}),e.jsxs(Xe,{children:[e.jsx(D,{variant:"ghost",onClick:s,children:"Cancel"}),e.jsx(D,{disabled:!o||c,onClick:async()=>{m(!0);try{await a(o)}finally{m(!1)}},children:"Add entry"})]})]})})}export{es as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.