@roomstay/core 0.1.77-0 → 0.1.77-2

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/node.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};let n,i,o,r,a;e.r(t),e.d(t,{ADDON_PER_NIGHT_TYPES:()=>tr,AddGiftCardSchema:()=>Ro,AdyenEventCode:()=>Go,AdyenResultCode:()=>Mo,BaseGiftCardSchema:()=>No,CancelGiftCardTransactionSchema:()=>Vo,CompleteGiftCardTransactionSchema:()=>qo,CreatePaymentSessionSchema:()=>So,DATE_FORMAT:()=>S,EAddonPricingType:()=>er,EAdminCompanyUserRole:()=>p,EBookingFlow:()=>i,EBookingPaymentMethod:()=>o,EBookingStatus:()=>n,ECompanyProvider:()=>l,EDistanceUnitType:()=>_,EFeeType:()=>x,EGiftCardPaymentProvider:()=>jo,EGiftCardPaymentStatus:()=>Lo,EGiftCardPaymentType:()=>Oo,EGiftCardTransactionType:()=>Ho,EGuaranteePolicyDepositMode:()=>E,EGuarantyPolicyPrepaymentType:()=>A,EHotelAddressRequirement:()=>f,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>m,EHotelWeekdayStartsOn:()=>g,EIntegration:()=>v,ELogCategory:()=>ir,ELogSeverity:()=>nr,ELogType:()=>or,EPlanpayBookingStatus:()=>a,EPromoCodeDiscountType:()=>T,EPromoCodeStayDateRangeRepeatType:()=>N,EPromoCodeStayDateRangeType:()=>C,ERMSAuthSyncHistoryStatus:()=>P,ERMSDiscountType:()=>k,ERMSSyncStrategy:()=>b,ERoomstayEventName:()=>F,ERoomstayEventSource:()=>R,ERoomstayImageSize:()=>z,ETransactionStatus:()=>Bo,EditGiftCardSchema:()=>Io,GetCompanyConfigSchema:()=>Yo,GuestProfile:()=>d,HttpMethod:()=>$,IAuxiliaryFilterType:()=>y,IMaintenanceStatusService:()=>w,InternationalAddressSchema:()=>Co,ItineraryResponse:()=>c,META_USER_DATA_KEYS:()=>Z,PCIBookingCardProcessorTypes:()=>s,Package:()=>I,PassthroughPaymentDataSchema:()=>xo,PaymentProcessorDataSchema:()=>$o,PurchaseGiftCardSchema:()=>Fo,RedeemGiftCardSchema:()=>Uo,RefreshGiftCardTokenSchema:()=>Ko,RefundGiftCardSchema:()=>Zo,RegisterGiftCardAdminSchema:()=>Xo,Reservation:()=>u,ReservedPackage:()=>O,RoundingType:()=>cr,TotalCalculator:()=>br,UpdateAdyenConfigSchema:()=>Jo,UpdateCompanyConfigSchema:()=>Qo,ValidateGiftCardSchema:()=>Do,buildPixelEventOptions:()=>M,calculateFeeAmount:()=>dr,calculateTotalForMemberBooking:()=>rr,getFeeOptionValidity:()=>yr,getFilteredBookingAddonFees:()=>vr,getFilteredBookingFees:()=>mr,getFilteredBookingRateFees:()=>gr,maxString:()=>To,nameof:()=>_r,preprocessDate:()=>bo,preprocessNumber:()=>ko,requireEmail:()=>wo,requireFutureDate:()=>Ao,requirePositiveAmount:()=>Eo,requireString:()=>zo,resizeRoomstayImageUrl:()=>kr,roundMoney:()=>ur,subset:()=>Pr,toMetaEventName:()=>D,transformToMetaEventData:()=>j,transformToMetaUserData:()=>L,uppercaseString:()=>zr,validateFormWithZod:()=>Po}),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(n||(n={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(i||(i={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard",e.TrueRewards="TrueRewards"}(o||(o={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave",e.Mastercard="Mastercard",e.Stripe="Stripe",e.PayPal="PayPal"}(r||(r={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const s=[];class c{constructor(){this.roomstayId=void 0,this.itineraryNumber=void 0,this.total=void 0,this.hotelFrontendId=void 0,this.reservations=[],this.payment=void 0,this.feesSummary=void 0,this.itemisedFees=void 0,this.warnings=void 0}}class u{constructor(){this.reservationNumber=void 0,this.roomType=void 0,this.roomCode=void 0,this.rate=void 0,this.rateCode=void 0,this.images=void 0,this.guaranteePolicy=void 0,this.cancellationPolicy=void 0,this.checkInDate=void 0,this.checkOutDate=void 0,this.nights={},this.guestCounts={adults:1,children:0},this.guest=new d,this.paymentCard=void 0,this.paymentMethod=void 0,this.total=void 0,this.status=void 0,this.isCancelable=void 0,this.addons=void 0,this.comments=void 0,this.specialRequests=void 0,this.promoCode=void 0,this.guaranteePolicyLongDescription=void 0,this.cancellationPolicyLongDescription=void 0,this.itemisedFees=void 0}}class d{constructor(){this.title=void 0,this.firstName=void 0,this.middleName=void 0,this.lastName=void 0,this.nameSuffix=void 0,this.phone=void 0,this.email=void 0,this.address={},this.marketingOptIn=void 0,this.country=void 0}}let l,p,f,h,m,g,v,y,_,P,k,b,z,w,E,A,T,C,N,R;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay",e.OHIP="OHIP"}(l||(l={})),function(e){e.SuperAdmin="SuperAdmin",e.Admin="Admin",e.Limited="Limited"}(p||(p={})),function(e){e.FullAddressRequired="FullAddressRequired",e.AddressOptionalCountryRequired="AddressOptionalCountryRequired",e.AddressOptional="AddressOptional"}(f||(f={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(h||(h={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(m||(m={})),function(e){e.Monday="monday",e.Sunday="sunday"}(g||(g={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce",e.RAC="RAC",e.AnalyticsEvents="AnalyticsEvents"}(v||(v={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(y||(y={})),function(e){e.Metric="metric",e.Imperial="imperial"}(_||(_={})),function(e){e.Success="success",e.Failure="failure",e.New="new",e.Queued="queued",e.InProgress="in_progress",e.RequireResume="require_resume"}(P||(P={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(k||(k={})),function(e){e.Hotel="hotel",e.HotelImages="hotelImages",e.Cancellation="cancellation",e.Room="room",e.Rates="rates",e.OneGuaranteePolicy="oneGuaranteePolicy",e.RoomRates="roomRates",e.RoomImages="roomImages",e.BookingSources="booking-sources",e.Areas="areas",e.Dwellings="dwellings",e.AreaDwellings="areaDwellings",e.ConvertDwellingConfigToAuxInput="convertDwellingConfigToAuxInput",e.Discounts="discounts",e.PropertyDiscounts="propertyDiscounts",e.RoomDiscounts="roomDiscounts",e.PropertySundries="propertySundries",e.PropertyFees="propertyFees",e.PropertyCards="property-cards",e.Countries="countries",e.Addons="addons",e.Requirements="requirements",e.RoomAddons="room-addons",e.ClientFacingPromoSync="clientFacingPromoSync",e.ClientFacingRoomSync="clientFacingRoomSync",e.ClientFacingRateSync="clientFacingRateSync",e.NewRateFetch="newRateFetch"}(b||(b={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(z||(z={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(w||(w={}));class I{constructor(){this.ratePlanCode=void 0,this.name=void 0,this.description=void 0,this.inclusive=void 0,this.image=void 0,this.url=void 0,this.pricingType=void 0,this.quantity=void 0,this.category=void 0,this.cancelPenalty=void 0,this.guaranteeDescription=void 0,this.availability={}}}class O extends I{constructor(...e){super(...e),this.code=void 0,this.price=void 0,this.fees=void 0,this.itemisedFees=void 0,this.adultQuantity=void 0,this.childQuantity=void 0,this.adultPrice=void 0,this.childPrice=void 0,this.startDate=void 0,this.startTime=void 0,this.hideDatePicker=!1,this.hideQuantity=!1,this.order=void 0,this.discount=void 0,this.total=void 0}}!function(e){e.Full="Full",e.Percentage="Percentage",e.FirstNight="FirstNight",e.None="None"}(E||(E={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(A||(A={})),function(e){e.FlatPercent="flatPercent",e.FlatQuantity="flatQuantity",e.FlatQuantityPerStay="flatQuantityPerStay"}(T||(T={})),function(e){e.Allowed="Allowed",e.Blocked="Blocked"}(C||(C={})),function(e){e.None="None",e.Weekly="Weekly",e.MonthlyDayOfWeek="MonthlyDayOfWeek",e.MonthlyDate="MonthlyDate",e.Yearly="Yearly"}(N||(N={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(R||(R={}));const S="DD/MM/YYYY";let $,x,F;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}($||($={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(x||(x={})),function(e){e.BasketAdd="Basket/Add",e.BasketAddAddon="Basket/AddAddon",e.ViewCheckout="View/Checkout",e.BookingCommitted="Booking/Committed"}(F||(F={}));const Z=["em","ph","fn","ln","ct","st","zp","country","external_id"];function D(e){return{[F.BasketAdd]:"AddToCart",[F.BasketAddAddon]:"AddToCart",[F.ViewCheckout]:"InitiateCheckout",[F.BookingCommitted]:"Purchase"}[e]}function U(e,t,n){let i=0;const o=[],r=[];for(const t of e)i+=t.totalPrice,t.roomCode&&(o.push(t.roomCode),r.push({id:t.roomCode,quantity:1,item_price:t.totalPrice}));if(t)for(const e of t)i+=e.totalPrice,e.addonCode&&(o.push(e.addonCode),r.push({id:e.addonCode,quantity:e.quantity,item_price:e.unitPrice}));return{currency:n,value:i,content_ids:o,content_type:"hotel",contents:r,num_items:e.length+(t?.length??0)}}function j(e){if("addon"in e)return t=e.addon,{currency:e.currency,value:t.totalPrice,content_ids:t.addonCode?[t.addonCode]:[],content_type:"hotel",contents:t.addonCode?[{id:t.addonCode,quantity:t.quantity,item_price:t.unitPrice}]:[],num_items:1};var t;if("item"in e)return U([e.item],void 0,e.currency);if("items"in e){const t=e,n=U(t.items,t.addons,e.currency);return"itineraryNumber"in t&&(n.order_id=t.itineraryNumber),n}throw new Error("Invalid event data")}function L(e){return{em:e.email,ph:e.phone,fn:e.firstName,ln:e.lastName,ct:e.city,st:e.state,zp:e.postalCode,country:e.country,external_id:e.externalId}}function M(e,t){const n={eventID:e};if(t)for(const e of Z)t[e]&&(n[e]=t[e]);return n}function G(e,t,n){function i(n,i){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,i);for(const e in a.prototype)e in n||Object.defineProperty(n,e,{value:a.prototype[e].bind(n)});n._zod.constr=a,n._zod.def=i}const o=n?.Parent??Object;class r extends o{}function a(e){var t;const o=n?.Parent?new r:this;i(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Object.freeze({status:"aborted"}),Symbol("zod_brand");class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class B extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const q={};function V(e){return e&&Object.assign(q,e),q}const Y=/^[cC][^\s-]{8,}$/,W=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,J=/^[0-9a-vA-V]{20}$/,K=/^[A-Za-z0-9]{27}$/,X=/^[a-zA-Z0-9_-]{21}$/,ee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,te=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ne=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ie=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,oe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,re=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,ae=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,se=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ue=/^[A-Za-z0-9_-]*$/,de=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,le=/^\+(?:[0-9]){6,14}[0-9]$/,pe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",fe=new RegExp(`^${pe}$`);function he(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const me=/^\d+$/,ge=/^-?\d+(?:\.\d+)?/i,ve=/true|false/i,ye=/^[^A-Z]*$/,_e=/^[^a-z]*$/;function Pe(e,t){return"bigint"==typeof t?t.toString():t}function ke(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function be(e){return null==e}function ze(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const we=Symbol("evaluating");function Ee(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==we)return void 0===i&&(i=we,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ae(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Te(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ce(e){return JSON.stringify(e)}const Ne="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Ie=ke((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function Oe(e){if(!1===Re(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Re(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Se(e){return Oe(e)?{...e}:e}const $e=new Set(["string","number","symbol"]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function Ze(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}new Set(["string","number","bigint","boolean","symbol","undefined"]);const De={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ue(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function je(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function Le(e){return"string"==typeof e?e:e?.message}function Me(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const o=Le(e.inst?._zod.def?.error?.(e))??Le(t?.error?.(e))??Le(n.customError?.(e))??Le(n.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Ge(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function He(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const Be=G("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),qe={number:"number",bigint:"bigint",object:"date"},Ve=G("$ZodCheckLessThan",((e,t)=>{Be.init(e,t);const n=qe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Ye=G("$ZodCheckGreaterThan",((e,t)=>{Be.init(e,t);const n=qe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),We=G("$ZodCheckMultipleOf",((e,t)=>{Be.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let o=(i.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const r=n>o?n:o;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Qe=G("$ZodCheckNumberFormat",((e,t)=>{Be.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[o,r]=De[t.format];e._zod.onattach.push((e=>{const i=e._zod.bag;i.format=t.format,i.minimum=o,i.maximum=r,n&&(i.pattern=me)})),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>r&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:r,inst:e})}})),Je=G("$ZodCheckMaxLength",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const o=Ge(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Ke=G("$ZodCheckMinLength",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const o=Ge(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Xe=G("$ZodCheckLengthEquals",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const r=Ge(i),a=o>t.length;n.issues.push({origin:r,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),et=G("$ZodCheckStringFormat",((e,t)=>{var n,i;Be.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})})),tt=G("$ZodCheckRegex",((e,t)=>{et.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),nt=G("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ye),et.init(e,t)})),it=G("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=_e),et.init(e,t)})),ot=G("$ZodCheckIncludes",((e,t)=>{Be.init(e,t);const n=xe(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),rt=G("$ZodCheckStartsWith",((e,t)=>{Be.init(e,t);const n=new RegExp(`^${xe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),at=G("$ZodCheckEndsWith",((e,t)=>{Be.init(e,t);const n=new RegExp(`.*${xe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),st=G("$ZodCheckOverwrite",((e,t)=>{Be.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class ct{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),i=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const ut=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},dt=G("$ZodError",ut),lt=G("$ZodError",ut,{Parent:Error}),pt=e=>(t,n,i,o)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new H;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Me(e,r,V()))));throw Ne(t,o?.callee),t}return a.value},ft=e=>async(t,n,i,o)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Me(e,r,V()))));throw Ne(t,o?.callee),t}return a.value},ht=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new H;return r.issues.length?{success:!1,error:new(e??dt)(r.issues.map((e=>Me(e,o,V()))))}:{success:!0,data:r.value}},mt=ht(lt),gt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>Me(e,o,V()))))}:{success:!0,data:r.value}},vt=gt(lt),yt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return pt(e)(t,n,o)},_t=e=>(t,n,i)=>pt(e)(t,n,i),Pt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ft(e)(t,n,o)},kt=e=>async(t,n,i)=>ft(e)(t,n,i),bt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ht(e)(t,n,o)},zt=e=>(t,n,i)=>ht(e)(t,n,i),wt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gt(e)(t,n,o)},Et=e=>async(t,n,i)=>gt(e)(t,n,i),At={major:4,minor:1,patch:5},Tt=G("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=At;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,o=Ue(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=r._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new H;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a,e.issues.length!==t&&(o||(o=Ue(e,t)))}));else{if(e.issues.length===t)continue;o||(o=Ue(e,t))}}return i?i.then((()=>e)):e},n=(n,o,r)=>{if(Ue(n))return n.aborted=!0,n;const a=t(o,i,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((t=>e._zod.parse(t,r)))}return e._zod.parse(a,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const t=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,o,r))):n(t,o,r)}const a=e._zod.parse(o,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((e=>t(e,i,r)))}return t(a,i,r)}}e["~standard"]={validate:t=>{try{const n=mt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return vt(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Ct=G("$ZodString",((e,t)=>{var n;Tt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Nt=G("$ZodStringFormat",((e,t)=>{et.init(e,t),Ct.init(e,t)})),Rt=G("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=te),Nt.init(e,t)})),It=G("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ne(e))}else t.pattern??(t.pattern=ne());Nt.init(e,t)})),Ot=G("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=ie),Nt.init(e,t)})),St=G("$ZodURL",((e,t)=>{Nt.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),o=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:de.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),$t=G("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nt.init(e,t)})),xt=G("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=X),Nt.init(e,t)})),Ft=G("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=Y),Nt.init(e,t)})),Zt=G("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=W),Nt.init(e,t)})),Dt=G("$ZodULID",((e,t)=>{t.pattern??(t.pattern=Q),Nt.init(e,t)})),Ut=G("$ZodXID",((e,t)=>{t.pattern??(t.pattern=J),Nt.init(e,t)})),jt=G("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=K),Nt.init(e,t)})),Lt=G("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=he({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${pe}T(?:${i})$`)}(t)),Nt.init(e,t)})),Mt=G("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=fe),Nt.init(e,t)})),Gt=G("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${he(t)}$`)),Nt.init(e,t)})),Ht=G("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=ee),Nt.init(e,t)})),Bt=G("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=oe),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),qt=G("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=re),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),Vt=G("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=ae),Nt.init(e,t)})),Yt=G("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=se),Nt.init(e,t),e._zod.check=n=>{const[i,o]=n.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function Wt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qt=G("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=ce),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=n=>{Wt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),Jt=G("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=ue),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=n=>{(function(e){if(!ue.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Wt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),Kt=G("$ZodE164",((e,t)=>{t.pattern??(t.pattern=le),Nt.init(e,t)})),Xt=G("$ZodJWT",((e,t)=>{Nt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),en=G("$ZodNumber",((e,t)=>{Tt.init(e,t),e._zod.pattern=e._zod.bag.pattern??ge,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const r="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...r?{received:r}:{}}),n}})),tn=G("$ZodNumber",((e,t)=>{Qe.init(e,t),en.init(e,t)})),nn=G("$ZodBoolean",((e,t)=>{Tt.init(e,t),e._zod.pattern=ve,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}})),on=G("$ZodUnknown",((e,t)=>{Tt.init(e,t),e._zod.parse=e=>e})),rn=G("$ZodNever",((e,t)=>{Tt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),an=G("$ZodDate",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const o=n.value,r=o instanceof Date;return r&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...r?{received:"Invalid Date"}:{},inst:e}),n}}));function sn(e,t,n){e.issues.length&&t.issues.push(...je(n,e.issues)),t.value[n]=e.value}const cn=G("$ZodArray",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const r=[];for(let e=0;e<o.length;e++){const a=o[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?r.push(s.then((t=>sn(t,n,e)))):sn(s,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function un(e,t,n,i){e.issues.length&&t.issues.push(...je(n,e.issues)),void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function dn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter((e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout)));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ln(e,t,n,i,o,r){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type;for(const o of Object.keys(t)){if(s.has(o))continue;if("never"===u){a.push(o);continue}const r=c.run({value:t[o],issues:[]},i);r instanceof Promise?e.push(r.then((e=>un(e,n,o,t)))):un(r,n,o,t)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:r}),e.length?Promise.all(e).then((()=>n)):n}const pn=G("$ZodObject",((e,t)=>{Tt.init(e,t);const n=ke((()=>dn(t)));Ee(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n}));const i=Re,o=t.catchall;let r;e._zod.parse=(t,a)=>{r??(r=n.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],u=r.shape;for(const e of r.keys){const n=u[e]._zod.run({value:s[e],issues:[]},a);n instanceof Promise?c.push(n.then((n=>un(n,t,e,s)))):un(n,t,e,s)}return o?ln(c,s,t,a,n.value,e):c.length?Promise.all(c).then((()=>t)):t}})),fn=G("$ZodObjectJIT",((e,t)=>{pn.init(e,t);const n=e._zod.parse,i=ke((()=>dn(t)));let o;const r=Re,a=!q.jitless,s=a&&Ie.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=i.value);const p=d.value;return r(p)?a&&s&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new ct(["shape","payload","ctx"]),n=i.value,o=e=>{const t=Ce(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let a=0;for(const e of n.keys)r[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys){const n=r[e],i=Ce(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=o(d,l),c?ln([],p,d,l,u,e):d):n(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}}));function hn(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter((e=>!Ue(e)));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Me(e,i,V())))))}),t)}const mn=G("$ZodUnion",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),Ee(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),Ee(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),Ee(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>ze(e.source))).join("|")})$`)}}));const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(o,r)=>{if(n)return i(o,r);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},r);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then((t=>hn(t,o,e,r))):hn(s,o,e,r)}})),gn=G("$ZodIntersection",((e,t)=>{Tt.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,o=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then((([t,n])=>yn(e,t,n))):yn(e,o,r)}}));function vn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const n=Object.keys(t),i=Object.keys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const n of i){const i=vn(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=vn(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yn(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Ue(e))return e;const i=vn(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const _n=G("$ZodEnum",((e,t)=>{Tt.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((e=>$e.has(typeof e))).map((e=>"string"==typeof e?xe(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}})),Pn=G("$ZodTransform",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new B(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then((e=>(n.value=e,n)));if(o instanceof Promise)throw new H;return n.value=o,n}}));function kn(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const bn=G("$ZodOptional",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),Ee(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ze(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((t=>kn(t,e.value))):kn(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),zn=G("$ZodNullable",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),Ee(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ze(e.source)}|null)$`):void 0})),Ee(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),wn=G("$ZodDefault",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>En(e,t))):En(i,t)}}));function En(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const An=G("$ZodPrefault",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Tn=G("$ZodNonOptional",((e,t)=>{Tt.init(e,t),Ee(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then((t=>Cn(t,e))):Cn(o,e)}}));function Cn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nn=G("$ZodCatch",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Me(e,n,V())))},input:e.value}),e.issues=[]),e))):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Me(e,n,V())))},input:e.value}),e.issues=[]),e)}})),Rn=G("$ZodPipe",((e,t)=>{Tt.init(e,t),Ee(e._zod,"values",(()=>t.in._zod.values)),Ee(e._zod,"optin",(()=>t.in._zod.optin)),Ee(e._zod,"optout",(()=>t.out._zod.optout)),Ee(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then((e=>In(e,t.in,n))):In(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then((e=>In(e,t.out,n))):In(i,t.out,n)}}));function In(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const On=G("$ZodReadonly",((e,t)=>{Tt.init(e,t),Ee(e._zod,"propValues",(()=>t.innerType._zod.propValues)),Ee(e._zod,"values",(()=>t.innerType._zod.values)),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(Sn):Sn(i)}}));function Sn(e){return e.value=Object.freeze(e.value),e}const $n=G("$ZodCustom",((e,t)=>{Be.init(e,t),Tt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then((t=>xn(t,n,i,e)));xn(o,n,i,e)}}));function xn(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(He(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Fn{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zn(){return new Fn}const Dn=Zn();function Un(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ze(t)})}function jn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ze(t)})}function Ln(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ze(t)})}function Mn(e,t){return new Ve({check:"less_than",...Ze(t),value:e,inclusive:!1})}function Gn(e,t){return new Ve({check:"less_than",...Ze(t),value:e,inclusive:!0})}function Hn(e,t){return new Ye({check:"greater_than",...Ze(t),value:e,inclusive:!1})}function Bn(e,t){return new Ye({check:"greater_than",...Ze(t),value:e,inclusive:!0})}function qn(e,t){return new We({check:"multiple_of",...Ze(t),value:e})}function Vn(e,t){return new Je({check:"max_length",...Ze(t),maximum:e})}function Yn(e,t){return new Ke({check:"min_length",...Ze(t),minimum:e})}function Wn(e,t){return new Xe({check:"length_equals",...Ze(t),length:e})}function Qn(e){return new st({check:"overwrite",tx:e})}const Jn=G("ZodISODateTime",((e,t)=>{Lt.init(e,t),_i.init(e,t)}));const Kn=G("ZodISODate",((e,t)=>{Mt.init(e,t),_i.init(e,t)}));const Xn=G("ZodISOTime",((e,t)=>{Gt.init(e,t),_i.init(e,t)}));const ei=G("ZodISODuration",((e,t)=>{Ht.init(e,t),_i.init(e,t)}));const ti=(e,t)=>{dt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},i={_errors:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>o({issues:e})));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)i._errors.push(n(t));else{let e=i,o=0;for(;o<t.path.length;){const i=t.path[o];o===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(n(t))):e[i]=e[i]||{_errors:[]},e=e[i],o++}}};return o(e),i}(e,t)},flatten:{value:t=>function(e,t=(e=>e.message)){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Pe,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Pe,2)}},isEmpty:{get:()=>0===e.issues.length}})},ni=(G("ZodError",ti),G("ZodError",ti,{Parent:Error})),ii=pt(ni),oi=ft(ni),ri=ht(ni),ai=gt(ni),si=yt(ni),ci=_t(ni),ui=Pt(ni),di=kt(ni),li=bt(ni),pi=zt(ni),fi=wt(ni),hi=Et(ni),mi=G("ZodType",((e,t)=>(Tt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>Fe(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>ii(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ri(e,t,n),e.parseAsync=async(t,n)=>oi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ai(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>si(e,t,n),e.decode=(t,n)=>ci(e,t,n),e.encodeAsync=async(t,n)=>ui(e,t,n),e.decodeAsync=async(t,n)=>di(e,t,n),e.safeEncode=(t,n)=>li(e,t,n),e.safeDecode=(t,n)=>pi(e,t,n),e.safeEncodeAsync=async(t,n)=>fi(e,t,n),e.safeDecodeAsync=async(t,n)=>hi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ze(n)})}(yo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e,t){const n=new Be({check:"custom",...Ze(void 0)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(He(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(He(i))}},e(n.value,n))));return t}(t)),e.overwrite=t=>e.check(Qn(t)),e.optional=()=>so(e),e.nullable=()=>uo(e),e.nullish=()=>so(uo(e)),e.nonoptional=t=>function(e,t){return new fo({type:"nonoptional",innerType:e,...Ze(t)})}(e,t),e.array=()=>Ji(e),e.or=t=>function(e,t){return new eo({type:"union",options:e,...Ze(t)})}([e,t]),e.and=t=>new to({type:"intersection",left:e,right:t}),e.transform=t=>go(e,ro(t)),e.default=t=>{return n=t,new lo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():Se(n)}});var n},e.prefault=t=>{return n=t,new po({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():Se(n)}});var n},e.catch=t=>{return new ho({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>go(e,t),e.readonly=()=>new vo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Dn.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Dn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Dn.get(e);const n=e.clone();return Dn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),gi=G("_ZodString",((e,t)=>{Ct.init(e,t),mi.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new tt({check:"string_format",format:"regex",...Ze(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ot({check:"string_format",format:"includes",...Ze(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new rt({check:"string_format",format:"starts_with",...Ze(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new at({check:"string_format",format:"ends_with",...Ze(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Yn(...t)),e.max=(...t)=>e.check(Vn(...t)),e.length=(...t)=>e.check(Wn(...t)),e.nonempty=(...t)=>e.check(Yn(1,...t)),e.lowercase=t=>e.check(function(e){return new nt({check:"string_format",format:"lowercase",...Ze(e)})}(t)),e.uppercase=t=>e.check(function(e){return new it({check:"string_format",format:"uppercase",...Ze(e)})}(t)),e.trim=()=>e.check(Qn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Qn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Qn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Qn((e=>e.toUpperCase())))})),vi=G("ZodString",((e,t)=>{Ct.init(e,t),gi.init(e,t),e.email=t=>e.check(Un(Pi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ze(t)})}(wi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ze(t)})}(Ui,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ze(t)})}(Ei,t)),e.guid=t=>e.check(jn(bi,t)),e.uuid=t=>e.check(Ln(zi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ze(t)})}(zi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ze(t)})}(zi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ze(t)})}(zi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ze(t)})}(Ai,t)),e.guid=t=>e.check(jn(bi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ze(t)})}(Ti,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ze(t)})}(Ci,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ze(t)})}(Ni,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ze(t)})}(Fi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ze(t)})}(Zi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ze(t)})}(Ri,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ze(t)})}(Ii,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ze(t)})}(Oi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ze(t)})}(Si,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ze(t)})}($i,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ze(t)})}(xi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ze(t)})}(Di,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ze(t)})}(Jn,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Ze(t)})}(Kn,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ze(t)})}(Xn,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ze(t)})}(ei,e)}(t))}));function yi(e){return function(e,t){return new e({type:"string",...Ze(t)})}(vi,e)}const _i=G("ZodStringFormat",((e,t)=>{Nt.init(e,t),gi.init(e,t)})),Pi=G("ZodEmail",((e,t)=>{Ot.init(e,t),_i.init(e,t)}));function ki(e){return Un(Pi,e)}const bi=G("ZodGUID",((e,t)=>{Rt.init(e,t),_i.init(e,t)})),zi=G("ZodUUID",((e,t)=>{It.init(e,t),_i.init(e,t)})),wi=G("ZodURL",((e,t)=>{St.init(e,t),_i.init(e,t)})),Ei=G("ZodEmoji",((e,t)=>{$t.init(e,t),_i.init(e,t)})),Ai=G("ZodNanoID",((e,t)=>{xt.init(e,t),_i.init(e,t)})),Ti=G("ZodCUID",((e,t)=>{Ft.init(e,t),_i.init(e,t)})),Ci=G("ZodCUID2",((e,t)=>{Zt.init(e,t),_i.init(e,t)})),Ni=G("ZodULID",((e,t)=>{Dt.init(e,t),_i.init(e,t)})),Ri=G("ZodXID",((e,t)=>{Ut.init(e,t),_i.init(e,t)})),Ii=G("ZodKSUID",((e,t)=>{jt.init(e,t),_i.init(e,t)})),Oi=G("ZodIPv4",((e,t)=>{Bt.init(e,t),_i.init(e,t)})),Si=G("ZodIPv6",((e,t)=>{qt.init(e,t),_i.init(e,t)})),$i=G("ZodCIDRv4",((e,t)=>{Vt.init(e,t),_i.init(e,t)})),xi=G("ZodCIDRv6",((e,t)=>{Yt.init(e,t),_i.init(e,t)})),Fi=G("ZodBase64",((e,t)=>{Qt.init(e,t),_i.init(e,t)})),Zi=G("ZodBase64URL",((e,t)=>{Jt.init(e,t),_i.init(e,t)})),Di=G("ZodE164",((e,t)=>{Kt.init(e,t),_i.init(e,t)})),Ui=G("ZodJWT",((e,t)=>{Xt.init(e,t),_i.init(e,t)})),ji=G("ZodNumber",((e,t)=>{en.init(e,t),mi.init(e,t),e.gt=(t,n)=>e.check(Hn(t,n)),e.gte=(t,n)=>e.check(Bn(t,n)),e.min=(t,n)=>e.check(Bn(t,n)),e.lt=(t,n)=>e.check(Mn(t,n)),e.lte=(t,n)=>e.check(Gn(t,n)),e.max=(t,n)=>e.check(Gn(t,n)),e.int=t=>e.check(Gi(t)),e.safe=t=>e.check(Gi(t)),e.positive=t=>e.check(Hn(0,t)),e.nonnegative=t=>e.check(Bn(0,t)),e.negative=t=>e.check(Mn(0,t)),e.nonpositive=t=>e.check(Gn(0,t)),e.multipleOf=(t,n)=>e.check(qn(t,n)),e.step=(t,n)=>e.check(qn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Li(e){return function(e,t){return new e({type:"number",checks:[],...Ze(t)})}(ji,e)}const Mi=G("ZodNumberFormat",((e,t)=>{tn.init(e,t),ji.init(e,t)}));function Gi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ze(t)})}(Mi,e)}const Hi=G("ZodBoolean",((e,t)=>{nn.init(e,t),mi.init(e,t)}));const Bi=G("ZodUnknown",((e,t)=>{on.init(e,t),mi.init(e,t)}));function qi(){return new Bi({type:"unknown"})}const Vi=G("ZodNever",((e,t)=>{rn.init(e,t),mi.init(e,t)}));function Yi(e){return function(e,t){return new e({type:"never",...Ze(t)})}(Vi,e)}const Wi=G("ZodDate",((e,t)=>{an.init(e,t),mi.init(e,t),e.min=(t,n)=>e.check(Bn(t,n)),e.max=(t,n)=>e.check(Gn(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));const Qi=G("ZodArray",((e,t)=>{cn.init(e,t),mi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Yn(t,n)),e.nonempty=t=>e.check(Yn(1,t)),e.max=(t,n)=>e.check(Vn(t,n)),e.length=(t,n)=>e.check(Wn(t,n)),e.unwrap=()=>e.element}));function Ji(e,t){return function(e,t,n){return new e({type:"array",element:t,...Ze(n)})}(Qi,e,t)}const Ki=G("ZodObject",((e,t)=>{fn.init(e,t),mi.init(e,t),Ee(e,"shape",(()=>t.shape)),e.keyof=()=>io(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:qi()}),e.loose=()=>e.clone({...e._zod.def,catchall:qi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Yi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Oe(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Te(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:[]});return Fe(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!Oe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:e._zod.def.checks};return Fe(e,n)}(e,t),e.merge=t=>function(e,t){const n=Te(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ae(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return Fe(e,Te(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return Ae(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=Te(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return Ae(this,"shape",i),i},checks:[]});return Fe(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const i=Te(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)o[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return Ae(this,"shape",o),o},checks:[]});return Fe(t,i)}(ao,e,t[0]),e.required=(...t)=>function(e,t,n){const i=Te(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)o[t]=new e({type:"nonoptional",innerType:i[t]});return Ae(this,"shape",o),o},checks:[]});return Fe(t,i)}(fo,e,t[0])}));function Xi(e,t){const n={type:"object",get shape(){var t;return Ae(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...Ze(t)};return new Ki(n)}const eo=G("ZodUnion",((e,t)=>{mn.init(e,t),mi.init(e,t),e.options=t.options}));const to=G("ZodIntersection",((e,t)=>{gn.init(e,t),mi.init(e,t)})),no=G("ZodEnum",((e,t)=>{_n.init(e,t),mi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new no({...t,checks:[],...Ze(i),entries:o})},e.exclude=(e,i)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new no({...t,checks:[],...Ze(i),entries:o})}}));function io(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new no({type:"enum",entries:n,...Ze(t)})}const oo=G("ZodTransform",((e,t)=>{Pn.init(e,t),mi.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new B(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(He(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(He(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then((e=>(n.value=e,n))):(n.value=o,n)}}));function ro(e){return new oo({type:"transform",transform:e})}const ao=G("ZodOptional",((e,t)=>{bn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function so(e){return new ao({type:"optional",innerType:e})}const co=G("ZodNullable",((e,t)=>{zn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function uo(e){return new co({type:"nullable",innerType:e})}const lo=G("ZodDefault",((e,t)=>{wn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap})),po=G("ZodPrefault",((e,t)=>{An.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),fo=G("ZodNonOptional",((e,t)=>{Tn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),ho=G("ZodCatch",((e,t)=>{Nn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap})),mo=G("ZodPipe",((e,t)=>{Rn.init(e,t),mi.init(e,t),e.in=t.in,e.out=t.out}));function go(e,t){return new mo({type:"pipe",in:e,out:t})}const vo=G("ZodReadonly",((e,t)=>{On.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),yo=G("ZodCustom",((e,t)=>{$n.init(e,t),mi.init(e,t)}));function _o(e,t){return go(ro(e),t)}function Po(e,t,n){const i=t.safeParse(n);return i.success?i.data:(i.error.issues.forEach((t=>{const n=t.path.join(".");e.getFieldState(n)?e.setError(n,{type:"manual",message:t.message}):e.setError("root",{type:"manual",message:t.message})})),null)}const ko=e=>_o((e=>{if(e){if("string"==typeof e){const t=Number(e);return isNaN(t)?e:t}return e}}),e),bo=e=>_o((e=>{if(!e)return;let t;return"string"==typeof e&&(t=new Date(e)),e instanceof Date&&(t=e),t?(t.setUTCHours(0,0,0,0),t):e}),e),zo=e=>yi().min(1,{error:"Required"}).max(e,`Maximum length is ${e} characters`),wo=()=>ki("Invalid email address").min(1,"Required"),Eo=()=>ko(Li("Valid amount required").positive("Positive amount required")),Ao=()=>bo(function(e){return function(e,t){return new e({type:"date",...Ze(t)})}(Wi,e)}("Valid date required").min(new Date,"Date must be in the future")),To=e=>yi().max(e,`Maximum length is ${e} characters`),Co=Xi({address1:zo(100),address2:To(100).optional(),city:zo(50),state:To(50).optional(),postcode:To(20).optional(),country:zo(50)}),No=Xi({amount:Eo(),message:To(500).nullish(),giverFirstName:zo(50),giverLastName:zo(50),giverEmail:wo(),giverPhone:zo(31),giverAddress:Co,cardHolder:zo(101),recipientFirstName:To(50).nullish(),recipientLastName:To(50).nullish(),recipientEmail:ki("Invalid email address").nullish(),recipientPhone:To(31).nullish()}),Ro=No.extend({expiry:Ao(),notes:To(500).nullish()}),Io=Xi({balance:Eo(),expiry:Ao(),message:To(500).nullish(),notes:To(500).nullish(),giverFirstName:zo(50),giverLastName:zo(50),giverEmail:wo(),giverPhone:zo(31),cardHolder:zo(101),recipientEmail:ki("Invalid email address").nullish(),recipientPhone:To(31).nullish()});let Oo;!function(e){e.Passthrough="Passthrough",e.PaymentProcessor="PaymentProcessor"}(Oo||(Oo={}));const So=Xi({companyId:Li().int().positive(),amount:Eo(),currency:zo(3).default("AUD")}),$o=Xi({sessionId:zo(100),resultCode:zo(50),pspReference:To(100).optional()}),xo=Xi({cardHolder:zo(100),cardNumberToken:To(200),cardCvcToken:To(200),cardExpiry:To(5)}),Fo=No.extend({companyId:Li().int().positive(),sendViaEmail:function(e){return function(e,t){return new e({type:"boolean",...Ze(t)})}(Hi,e)}().default(!0),payment:$o.optional(),passthroughPayment:xo.optional()}),Zo=Xi({giftCardId:Li().int().positive(),reason:To(500).optional()}),Do=Xi({companyId:Li().int().positive().nullish(),code:zo(10),password:zo(10)}),Uo=Do.extend({amount:Eo(),description:zo(200)});let jo,Lo,Mo,Go,Ho,Bo;!function(e){e.Adyen="Adyen"}(jo||(jo={})),function(e){e.Pending="Pending",e.Authorized="Authorized",e.Captured="Captured",e.Failed="Failed",e.Refunded="Refunded"}(Lo||(Lo={})),function(e){e.Authorised="Authorised",e.Refused="Refused",e.Cancelled="Cancelled",e.Pending="Pending",e.Received="Received",e.Error="Error",e.IdentifyShopper="IdentifyShopper",e.ChallengeShopper="ChallengeShopper"}(Mo||(Mo={})),function(e){e.AUTHORISATION="AUTHORISATION",e.CAPTURE="CAPTURE",e.REFUND="REFUND",e.CANCELLATION="CANCELLATION",e.REFUND_FAILED="REFUND_FAILED",e.CAPTURE_FAILED="CAPTURE_FAILED"}(Go||(Go={})),function(e){e.Purchase="Purchase",e.Redemption="Redemption",e.Adjustment="Adjustment"}(Ho||(Ho={})),function(e){e.Pending="Pending",e.Complete="Complete",e.Cancelled="Cancelled",e.Expired="Expired"}(Bo||(Bo={}));const qo=Xi({code:zo(10),token:zo(128)}),Vo=Xi({companyId:Li().int().positive(),code:zo(10),token:zo(128)}),Yo=Xi({companyId:(Wo=ji,new Wo({type:"number",coerce:!0,checks:[],...Ze(void 0)})).int().positive()});var Wo;const Qo=Xi({giftCardPaymentType:io([Oo.Passthrough,Oo.PaymentProcessor])}),Jo=Xi({merchantAccount:zo(100),clientKey:zo(100),apiKey:To(200).optional(),webhookHmacKey:To(200).optional()}),Ko=Xi({grant_type:yi().readonly().default("refresh_token"),client_id:Ln(zi,void 0),client_secret:yi(),refresh_token:yi(),scope:yi().optional()}),Xo=Xi({email:ki(),firstName:yi().max(100).optional(),lastName:yi().max(100).optional(),phone:yi().max(20).optional(),scopes:Ji(yi()).optional()});let er;!function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(er||(er={}));const tr=[er.PER_NIGHT,er.PER_PERSON_PER_NIGHT,er.PER_QUANTITY_NAME_PER_NIGHT,er.PER_ROOM_QUANTITY_PER_NIGHT,er.PER_PERSON_OCCUPANCY_PER_NIGHT,er.PER_ADULT_OCCUPANCY_PER_NIGHT,er.PER_CHILD_OCCUPANCY_PER_NIGHT,er.PER_ALL_PERSONS_PER_NIGHT];let nr,ir,or;!function(e){e.Critical="Critical",e.Error="Error",e.Warn="Warn",e.Info="Info"}(nr||(nr={})),function(e){e.Debug="Diagnostics",e.Security="Security",e.Audit="Audit"}(ir||(ir={})),function(e){e.General="General",e.Authenticated="Token Authenticated",e.Unauthorized="Unauthorized Access",e.RefreshToken="Refresh Token Created",e.AccessToken="Access Token Created",e.Revoked="Token Revoked",e.UserCreated="User Created",e.UserLinked="User Linked to Company",e.Purchase="Gift Card Purchased",e.Payment="Payment",e.Email="Email Delivery",e.Transaction="Gift Card Transaction"}(or||(or={}));const rr=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const i of n)t+=e.nights[i].total}return t},ar=require("decimal.js");var sr=e.n(ar);const cr={UP:sr().ROUND_UP,DOWN:sr().ROUND_DOWN,CEIL:sr().ROUND_CEIL,FLOOR:sr().ROUND_FLOOR,HALF_UP:sr().ROUND_HALF_UP,HALF_DOWN:sr().ROUND_HALF_DOWN,HALF_EVEN:sr().ROUND_HALF_EVEN,HALF_CEIL:sr().ROUND_HALF_CEIL,HALF_FLOOR:sr().ROUND_HALF_FLOOR},ur=(e,t)=>{const{precision:n=2,rounding:i=cr.HALF_UP}=t||{};return new(sr())(e).toDecimalPlaces(n,i).toNumber()};function dr(e,t={}){const{baseAmount:n=0,numberOfNights:i=1,feeIncludedInBaseAmount:o=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=ur(n);switch(e.feeType){case x.PercentageOfBooking:if(o)return ur(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return ur(s/(1-t)*e.amount/(100+e.amount))}return ur(s*(e.amount/100));case x.FixedChargePerRoom:case x.FixedChargePerBooking:return e.amount;case x.NightlyChargePerRoom:return ur(e.amount*i);default:return 0}}const lr=[x.FixedChargePerBooking],pr=[x.PercentageOfBooking,x.FixedChargePerRoom,x.NightlyChargePerRoom],fr=[x.PercentageOfBooking];function hr(e,t){return e.filter((e=>t.includes(e.feeType)))}function mr(e){return hr(e,lr)}function gr(e){return hr(e,pr)}function vr(e){return hr(e,fr)}function yr(e){return{includeInRates:[x.PercentageOfBooking,x.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===x.PercentageOfBooking,appliesToAddons:e===x.PercentageOfBooking,includePreviousFeesInCalculation:e===x.PercentageOfBooking}}const _r=e=>e,Pr=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},kr=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class br{}function zr(e){return e.toUpperCase()}br.calculateBaseAddonTotal=(e,t)=>{let n=0,i=0,o=0;e.price&&e.quantity&&(n=e.quantity*Number(e.price)),e.pricingType===er.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?n*=e.adultQuantity:e.pricingType===er.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(n*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(i=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(o=e.childQuantity*Number(e.childPrice));let r=n+i+o;return tr.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:n,indAdultPrice:i,indChildPrice:o,addonTotal:r}},br.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=br.calculateBaseAddonTotal(n,t);let o=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{o+=n.quantity*e.amount})):o=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{o+=n.adultQuantity*e.amount})):o+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{o+=n.childQuantity??1*e.amount})):o+=n.childQuantity*Number(n.childFee))),tr.includes(n.pricingType)&&n.nights&&!t&&(o*=n.nights),{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+o,total:e.total+i.addonTotal+o}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),br.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=br.calculateBaseAddonTotal(n,t);let o,r=n.discount||0;o=void 0!==n.total&&null!==n.total?n.total:i.addonTotal-r;let a=n.fees||0;n.itemisedFees?.length&&(a=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const s=n.itemisedFees?.length?o:o+a;return{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+o+a,displayPrice:e.displayPrice+s}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),br.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const i=Object.keys(e.nights)?.length??0;if(n+=e.fees??0,e.addons?.length){const o=(e.addons??[]).map((e=>({...e,nights:i})));n+=br.calculateReservationAddonTotal(o,t)?.total}})),ur(n)},br.calculateTotalExcludingDuplicateFees=(e,t)=>{if(!e)return 0;if("total"in e)return ur(e.total?.afterTax||0);const{reservations:n,itemisedFees:i}=e;if(!n?.length)return 0;let o=0;return n.forEach((e=>{o+=e.total.afterTax;const n=Object.keys(e.nights)?.length??0;e.addons?.forEach((e=>{const i=br.calculateBaseAddonTotal({...e,nights:n},t);o+=i.addonTotal-(e.discount||0)}))})),i?.forEach((e=>{o+=e.amount})),ur(o)},module.exports=t})();
1
+ (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};let n,i,o,r,a;e.r(t),e.d(t,{ADDON_PER_NIGHT_TYPES:()=>nr,AddGiftCardSchema:()=>Io,AdyenEventCode:()=>Bo,AdyenResultCode:()=>Go,BaseGiftCardSchema:()=>Ro,CancelGiftCardTransactionSchema:()=>Yo,CompleteGiftCardTransactionSchema:()=>Vo,CreatePaymentSessionSchema:()=>$o,DATE_FORMAT:()=>$,EAddonPricingType:()=>tr,EAdminCompanyUserRole:()=>p,EBookingFlow:()=>i,EBookingPaymentMethod:()=>o,EBookingStatus:()=>n,ECompanyProvider:()=>l,EDistanceUnitType:()=>_,EFeeType:()=>F,EGiftCardPaymentProvider:()=>Lo,EGiftCardPaymentStatus:()=>Mo,EGiftCardPaymentType:()=>So,EGiftCardTransactionType:()=>Ho,EGuaranteePolicyDepositMode:()=>A,EGuarantyPolicyPrepaymentType:()=>T,EHotelAddressRequirement:()=>f,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>m,EHotelWeekdayStartsOn:()=>g,EIntegration:()=>v,ELogCategory:()=>or,ELogSeverity:()=>ir,ELogType:()=>rr,ENewbookSyncStrategy:()=>b,EPMSSyncStatus:()=>z,EPlanpayBookingStatus:()=>a,EPromoCodeDiscountType:()=>C,EPromoCodeStayDateRangeRepeatType:()=>R,EPromoCodeStayDateRangeType:()=>N,ERMSDiscountType:()=>P,ERMSSyncStrategy:()=>k,ERoomstayEventName:()=>Z,ERoomstayEventSource:()=>I,ERoomstayImageSize:()=>w,ETransactionStatus:()=>qo,EditGiftCardSchema:()=>Oo,GetCompanyConfigSchema:()=>Wo,GuestProfile:()=>d,HttpMethod:()=>x,IAuxiliaryFilterType:()=>y,IMaintenanceStatusService:()=>E,InternationalAddressSchema:()=>No,ItineraryResponse:()=>c,META_USER_DATA_KEYS:()=>D,PCIBookingCardProcessorTypes:()=>s,Package:()=>O,PassthroughPaymentDataSchema:()=>Fo,PaymentProcessorDataSchema:()=>xo,PurchaseGiftCardSchema:()=>Zo,RedeemGiftCardSchema:()=>jo,RefreshGiftCardTokenSchema:()=>Xo,RefundGiftCardSchema:()=>Do,RegisterGiftCardAdminSchema:()=>er,Reservation:()=>u,ReservedPackage:()=>S,RoundingType:()=>ur,TotalCalculator:()=>zr,UpdateAdyenConfigSchema:()=>Ko,UpdateCompanyConfigSchema:()=>Jo,ValidateGiftCardSchema:()=>Uo,buildPixelEventOptions:()=>G,calculateFeeAmount:()=>lr,calculateTotalForMemberBooking:()=>ar,getFeeOptionValidity:()=>_r,getFilteredBookingAddonFees:()=>yr,getFilteredBookingFees:()=>gr,getFilteredBookingRateFees:()=>vr,maxString:()=>Co,nameof:()=>Pr,preprocessDate:()=>zo,preprocessNumber:()=>bo,requireEmail:()=>Eo,requireFutureDate:()=>To,requirePositiveAmount:()=>Ao,requireString:()=>wo,resizeRoomstayImageUrl:()=>br,roundMoney:()=>dr,subset:()=>kr,toMetaEventName:()=>U,transformToMetaEventData:()=>L,transformToMetaUserData:()=>M,uppercaseString:()=>wr,validateFormWithZod:()=>ko}),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(n||(n={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(i||(i={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard",e.TrueRewards="TrueRewards"}(o||(o={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave",e.Mastercard="Mastercard",e.Stripe="Stripe",e.PayPal="PayPal"}(r||(r={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const s=[];class c{constructor(){this.roomstayId=void 0,this.itineraryNumber=void 0,this.total=void 0,this.hotelFrontendId=void 0,this.reservations=[],this.payment=void 0,this.feesSummary=void 0,this.itemisedFees=void 0,this.warnings=void 0}}class u{constructor(){this.reservationNumber=void 0,this.roomType=void 0,this.roomCode=void 0,this.rate=void 0,this.rateCode=void 0,this.images=void 0,this.guaranteePolicy=void 0,this.cancellationPolicy=void 0,this.checkInDate=void 0,this.checkOutDate=void 0,this.nights={},this.guestCounts={adults:1,children:0},this.guest=new d,this.paymentCard=void 0,this.paymentMethod=void 0,this.total=void 0,this.status=void 0,this.isCancelable=void 0,this.addons=void 0,this.comments=void 0,this.specialRequests=void 0,this.promoCode=void 0,this.guaranteePolicyLongDescription=void 0,this.cancellationPolicyLongDescription=void 0,this.itemisedFees=void 0}}class d{constructor(){this.title=void 0,this.firstName=void 0,this.middleName=void 0,this.lastName=void 0,this.nameSuffix=void 0,this.phone=void 0,this.email=void 0,this.address={},this.marketingOptIn=void 0,this.country=void 0}}let l,p,f,h,m,g,v,y,_,P,k,b,z,w,E,A,T,C,N,R,I;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay",e.OHIP="OHIP",e.Newbook="Newbook"}(l||(l={})),function(e){e.SuperAdmin="SuperAdmin",e.Admin="Admin",e.Limited="Limited"}(p||(p={})),function(e){e.FullAddressRequired="FullAddressRequired",e.AddressOptionalCountryRequired="AddressOptionalCountryRequired",e.AddressOptional="AddressOptional"}(f||(f={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(h||(h={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(m||(m={})),function(e){e.Monday="monday",e.Sunday="sunday"}(g||(g={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce",e.RAC="RAC",e.AnalyticsEvents="AnalyticsEvents"}(v||(v={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(y||(y={})),function(e){e.Metric="metric",e.Imperial="imperial"}(_||(_={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(P||(P={})),function(e){e.Hotel="hotel",e.HotelImages="hotelImages",e.Cancellation="cancellation",e.Room="room",e.Rates="rates",e.OneGuaranteePolicy="oneGuaranteePolicy",e.RoomRates="roomRates",e.RoomImages="roomImages",e.BookingSources="booking-sources",e.Areas="areas",e.Dwellings="dwellings",e.AreaDwellings="areaDwellings",e.ConvertDwellingConfigToAuxInput="convertDwellingConfigToAuxInput",e.Discounts="discounts",e.PropertyDiscounts="propertyDiscounts",e.RoomDiscounts="roomDiscounts",e.PropertySundries="propertySundries",e.PropertyFees="propertyFees",e.PropertyCards="property-cards",e.Countries="countries",e.Addons="addons",e.Requirements="requirements",e.RoomAddons="room-addons",e.ClientFacingPromoSync="clientFacingPromoSync",e.ClientFacingRoomSync="clientFacingRoomSync",e.ClientFacingRateSync="clientFacingRateSync",e.NewRateFetch="newRateFetch"}(k||(k={})),function(e){e.Rates="rates",e.Rooms="rooms",e.Availability="availability"}(b||(b={})),function(e){e.New="new",e.Queued="queued",e.InProgress="in_progress",e.Success="success",e.Failure="failure",e.RequireResume="require_resume"}(z||(z={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(w||(w={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(E||(E={}));class O{constructor(){this.ratePlanCode=void 0,this.name=void 0,this.description=void 0,this.inclusive=void 0,this.image=void 0,this.url=void 0,this.pricingType=void 0,this.quantity=void 0,this.category=void 0,this.cancelPenalty=void 0,this.guaranteeDescription=void 0,this.availability={}}}class S extends O{constructor(...e){super(...e),this.code=void 0,this.price=void 0,this.fees=void 0,this.itemisedFees=void 0,this.adultQuantity=void 0,this.childQuantity=void 0,this.adultPrice=void 0,this.childPrice=void 0,this.startDate=void 0,this.startTime=void 0,this.hideDatePicker=!1,this.hideQuantity=!1,this.order=void 0,this.discount=void 0,this.total=void 0}}!function(e){e.Full="Full",e.Percentage="Percentage",e.FirstNight="FirstNight",e.None="None"}(A||(A={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(T||(T={})),function(e){e.FlatPercent="flatPercent",e.FlatQuantity="flatQuantity",e.FlatQuantityPerStay="flatQuantityPerStay"}(C||(C={})),function(e){e.Allowed="Allowed",e.Blocked="Blocked"}(N||(N={})),function(e){e.None="None",e.Weekly="Weekly",e.MonthlyDayOfWeek="MonthlyDayOfWeek",e.MonthlyDate="MonthlyDate",e.Yearly="Yearly"}(R||(R={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(I||(I={}));const $="DD/MM/YYYY";let x,F,Z;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(x||(x={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(F||(F={})),function(e){e.BasketAdd="Basket/Add",e.BasketAddAddon="Basket/AddAddon",e.ViewCheckout="View/Checkout",e.BookingCommitted="Booking/Committed"}(Z||(Z={}));const D=["em","ph","fn","ln","ct","st","zp","country","external_id"];function U(e){return{[Z.BasketAdd]:"AddToCart",[Z.BasketAddAddon]:"AddToCart",[Z.ViewCheckout]:"InitiateCheckout",[Z.BookingCommitted]:"Purchase"}[e]}function j(e,t,n){let i=0;const o=[],r=[];for(const t of e)i+=t.totalPrice,t.roomCode&&(o.push(t.roomCode),r.push({id:t.roomCode,quantity:1,item_price:t.totalPrice}));if(t)for(const e of t)i+=e.totalPrice,e.addonCode&&(o.push(e.addonCode),r.push({id:e.addonCode,quantity:e.quantity,item_price:e.unitPrice}));return{currency:n,value:i,content_ids:o,content_type:"hotel",contents:r,num_items:e.length+(t?.length??0)}}function L(e){if("addon"in e)return t=e.addon,{currency:e.currency,value:t.totalPrice,content_ids:t.addonCode?[t.addonCode]:[],content_type:"hotel",contents:t.addonCode?[{id:t.addonCode,quantity:t.quantity,item_price:t.unitPrice}]:[],num_items:1};var t;if("item"in e)return j([e.item],void 0,e.currency);if("items"in e){const t=e,n=j(t.items,t.addons,e.currency);return"itineraryNumber"in t&&(n.order_id=t.itineraryNumber),n}throw new Error("Invalid event data")}function M(e){return{em:e.email,ph:e.phone,fn:e.firstName,ln:e.lastName,ct:e.city,st:e.state,zp:e.postalCode,country:e.country,external_id:e.externalId}}function G(e,t){const n={eventID:e};if(t)for(const e of D)t[e]&&(n[e]=t[e]);return n}function B(e,t,n){function i(n,i){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,i);for(const e in a.prototype)e in n||Object.defineProperty(n,e,{value:a.prototype[e].bind(n)});n._zod.constr=a,n._zod.def=i}const o=n?.Parent??Object;class r extends o{}function a(e){var t;const o=n?.Parent?new r:this;i(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Object.freeze({status:"aborted"}),Symbol("zod_brand");class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class q extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const V={};function Y(e){return e&&Object.assign(V,e),V}const W=/^[cC][^\s-]{8,}$/,Q=/^[0-9a-z]+$/,J=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,K=/^[0-9a-vA-V]{20}$/,X=/^[A-Za-z0-9]{27}$/,ee=/^[a-zA-Z0-9_-]{21}$/,te=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ne=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,oe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ae=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,se=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ue=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,de=/^[A-Za-z0-9_-]*$/,le=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,pe=/^\+(?:[0-9]){6,14}[0-9]$/,fe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",he=new RegExp(`^${fe}$`);function me(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ge=/^\d+$/,ve=/^-?\d+(?:\.\d+)?/i,ye=/true|false/i,_e=/^[^A-Z]*$/,Pe=/^[^a-z]*$/;function ke(e,t){return"bigint"==typeof t?t.toString():t}function be(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ze(e){return null==e}function we(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Ee=Symbol("evaluating");function Ae(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Ee)return void 0===i&&(i=Ee,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ce(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ne(e){return JSON.stringify(e)}const Re="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ie(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Oe=be((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function Se(e){if(!1===Ie(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Ie(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function $e(e){return Se(e)?{...e}:e}const xe=new Set(["string","number","symbol"]);function Fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function De(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}new Set(["string","number","bigint","boolean","symbol","undefined"]);const Ue={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function je(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Le(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function Me(e){return"string"==typeof e?e:e?.message}function Ge(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const o=Me(e.inst?._zod.def?.error?.(e))??Me(t?.error?.(e))??Me(n.customError?.(e))??Me(n.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Be(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function He(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const qe=B("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),Ve={number:"number",bigint:"bigint",object:"date"},Ye=B("$ZodCheckLessThan",((e,t)=>{qe.init(e,t);const n=Ve[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),We=B("$ZodCheckGreaterThan",((e,t)=>{qe.init(e,t);const n=Ve[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Qe=B("$ZodCheckMultipleOf",((e,t)=>{qe.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let o=(i.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const r=n>o?n:o;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Je=B("$ZodCheckNumberFormat",((e,t)=>{qe.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[o,r]=Ue[t.format];e._zod.onattach.push((e=>{const i=e._zod.bag;i.format=t.format,i.minimum=o,i.maximum=r,n&&(i.pattern=ge)})),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>r&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:r,inst:e})}})),Ke=B("$ZodCheckMaxLength",((e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const o=Be(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Xe=B("$ZodCheckMinLength",((e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const o=Be(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),et=B("$ZodCheckLengthEquals",((e,t)=>{var n;qe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const r=Be(i),a=o>t.length;n.issues.push({origin:r,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),tt=B("$ZodCheckStringFormat",((e,t)=>{var n,i;qe.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})})),nt=B("$ZodCheckRegex",((e,t)=>{tt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),it=B("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=_e),tt.init(e,t)})),ot=B("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=Pe),tt.init(e,t)})),rt=B("$ZodCheckIncludes",((e,t)=>{qe.init(e,t);const n=Fe(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),at=B("$ZodCheckStartsWith",((e,t)=>{qe.init(e,t);const n=new RegExp(`^${Fe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),st=B("$ZodCheckEndsWith",((e,t)=>{qe.init(e,t);const n=new RegExp(`.*${Fe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),ct=B("$ZodCheckOverwrite",((e,t)=>{qe.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class ut{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),i=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const dt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ke,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lt=B("$ZodError",dt),pt=B("$ZodError",dt,{Parent:Error}),ft=e=>(t,n,i,o)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new H;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Ge(e,r,Y()))));throw Re(t,o?.callee),t}return a.value},ht=e=>async(t,n,i,o)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Ge(e,r,Y()))));throw Re(t,o?.callee),t}return a.value},mt=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new H;return r.issues.length?{success:!1,error:new(e??lt)(r.issues.map((e=>Ge(e,o,Y()))))}:{success:!0,data:r.value}},gt=mt(pt),vt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>Ge(e,o,Y()))))}:{success:!0,data:r.value}},yt=vt(pt),_t=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ft(e)(t,n,o)},Pt=e=>(t,n,i)=>ft(e)(t,n,i),kt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ht(e)(t,n,o)},bt=e=>async(t,n,i)=>ht(e)(t,n,i),zt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mt(e)(t,n,o)},wt=e=>(t,n,i)=>mt(e)(t,n,i),Et=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return vt(e)(t,n,o)},At=e=>async(t,n,i)=>vt(e)(t,n,i),Tt={major:4,minor:1,patch:5},Ct=B("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tt;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,o=je(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=r._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new H;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a,e.issues.length!==t&&(o||(o=je(e,t)))}));else{if(e.issues.length===t)continue;o||(o=je(e,t))}}return i?i.then((()=>e)):e},n=(n,o,r)=>{if(je(n))return n.aborted=!0,n;const a=t(o,i,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((t=>e._zod.parse(t,r)))}return e._zod.parse(a,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const t=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,o,r))):n(t,o,r)}const a=e._zod.parse(o,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((e=>t(e,i,r)))}return t(a,i,r)}}e["~standard"]={validate:t=>{try{const n=gt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return yt(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Nt=B("$ZodString",((e,t)=>{var n;Ct.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Rt=B("$ZodStringFormat",((e,t)=>{tt.init(e,t),Nt.init(e,t)})),It=B("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=ne),Rt.init(e,t)})),Ot=B("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());Rt.init(e,t)})),St=B("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=oe),Rt.init(e,t)})),$t=B("$ZodURL",((e,t)=>{Rt.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),o=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:le.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),xt=B("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Rt.init(e,t)})),Ft=B("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=ee),Rt.init(e,t)})),Zt=B("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=W),Rt.init(e,t)})),Dt=B("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=Q),Rt.init(e,t)})),Ut=B("$ZodULID",((e,t)=>{t.pattern??(t.pattern=J),Rt.init(e,t)})),jt=B("$ZodXID",((e,t)=>{t.pattern??(t.pattern=K),Rt.init(e,t)})),Lt=B("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=X),Rt.init(e,t)})),Mt=B("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=me({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${fe}T(?:${i})$`)}(t)),Rt.init(e,t)})),Gt=B("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=he),Rt.init(e,t)})),Bt=B("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${me(t)}$`)),Rt.init(e,t)})),Ht=B("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=te),Rt.init(e,t)})),qt=B("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=re),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),Vt=B("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=ae),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),Yt=B("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=se),Rt.init(e,t)})),Wt=B("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=ce),Rt.init(e,t),e._zod.check=n=>{const[i,o]=n.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function Qt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Jt=B("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=ue),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=n=>{Qt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),Kt=B("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=de),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=n=>{(function(e){if(!de.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Qt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),Xt=B("$ZodE164",((e,t)=>{t.pattern??(t.pattern=pe),Rt.init(e,t)})),en=B("$ZodJWT",((e,t)=>{Rt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),tn=B("$ZodNumber",((e,t)=>{Ct.init(e,t),e._zod.pattern=e._zod.bag.pattern??ve,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const r="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...r?{received:r}:{}}),n}})),nn=B("$ZodNumber",((e,t)=>{Je.init(e,t),tn.init(e,t)})),on=B("$ZodBoolean",((e,t)=>{Ct.init(e,t),e._zod.pattern=ye,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}})),rn=B("$ZodUnknown",((e,t)=>{Ct.init(e,t),e._zod.parse=e=>e})),an=B("$ZodNever",((e,t)=>{Ct.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),sn=B("$ZodDate",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const o=n.value,r=o instanceof Date;return r&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...r?{received:"Invalid Date"}:{},inst:e}),n}}));function cn(e,t,n){e.issues.length&&t.issues.push(...Le(n,e.issues)),t.value[n]=e.value}const un=B("$ZodArray",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const r=[];for(let e=0;e<o.length;e++){const a=o[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?r.push(s.then((t=>cn(t,n,e)))):cn(s,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function dn(e,t,n,i){e.issues.length&&t.issues.push(...Le(n,e.issues)),void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function ln(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter((e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout)));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function pn(e,t,n,i,o,r){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type;for(const o of Object.keys(t)){if(s.has(o))continue;if("never"===u){a.push(o);continue}const r=c.run({value:t[o],issues:[]},i);r instanceof Promise?e.push(r.then((e=>dn(e,n,o,t)))):dn(r,n,o,t)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:r}),e.length?Promise.all(e).then((()=>n)):n}const fn=B("$ZodObject",((e,t)=>{Ct.init(e,t);const n=be((()=>ln(t)));Ae(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n}));const i=Ie,o=t.catchall;let r;e._zod.parse=(t,a)=>{r??(r=n.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],u=r.shape;for(const e of r.keys){const n=u[e]._zod.run({value:s[e],issues:[]},a);n instanceof Promise?c.push(n.then((n=>dn(n,t,e,s)))):dn(n,t,e,s)}return o?pn(c,s,t,a,n.value,e):c.length?Promise.all(c).then((()=>t)):t}})),hn=B("$ZodObjectJIT",((e,t)=>{fn.init(e,t);const n=e._zod.parse,i=be((()=>ln(t)));let o;const r=Ie,a=!V.jitless,s=a&&Oe.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=i.value);const p=d.value;return r(p)?a&&s&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new ut(["shape","payload","ctx"]),n=i.value,o=e=>{const t=Ne(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let a=0;for(const e of n.keys)r[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys){const n=r[e],i=Ne(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=o(d,l),c?pn([],p,d,l,u,e):d):n(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}}));function mn(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter((e=>!je(e)));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Ge(e,i,Y())))))}),t)}const gn=B("$ZodUnion",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),Ae(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),Ae(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),Ae(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>we(e.source))).join("|")})$`)}}));const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(o,r)=>{if(n)return i(o,r);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},r);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then((t=>mn(t,o,e,r))):mn(s,o,e,r)}})),vn=B("$ZodIntersection",((e,t)=>{Ct.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,o=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then((([t,n])=>_n(e,t,n))):_n(e,o,r)}}));function yn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Se(e)&&Se(t)){const n=Object.keys(t),i=Object.keys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const n of i){const i=yn(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=yn(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _n(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),je(e))return e;const i=yn(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Pn=B("$ZodEnum",((e,t)=>{Ct.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((e=>xe.has(typeof e))).map((e=>"string"==typeof e?Fe(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}})),kn=B("$ZodTransform",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new q(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then((e=>(n.value=e,n)));if(o instanceof Promise)throw new H;return n.value=o,n}}));function bn(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const zn=B("$ZodOptional",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),Ae(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${we(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((t=>bn(t,e.value))):bn(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),wn=B("$ZodNullable",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),Ae(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${we(e.source)}|null)$`):void 0})),Ae(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),En=B("$ZodDefault",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>An(e,t))):An(i,t)}}));function An(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tn=B("$ZodPrefault",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Cn=B("$ZodNonOptional",((e,t)=>{Ct.init(e,t),Ae(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then((t=>Nn(t,e))):Nn(o,e)}}));function Nn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rn=B("$ZodCatch",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Ge(e,n,Y())))},input:e.value}),e.issues=[]),e))):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Ge(e,n,Y())))},input:e.value}),e.issues=[]),e)}})),In=B("$ZodPipe",((e,t)=>{Ct.init(e,t),Ae(e._zod,"values",(()=>t.in._zod.values)),Ae(e._zod,"optin",(()=>t.in._zod.optin)),Ae(e._zod,"optout",(()=>t.out._zod.optout)),Ae(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then((e=>On(e,t.in,n))):On(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then((e=>On(e,t.out,n))):On(i,t.out,n)}}));function On(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Sn=B("$ZodReadonly",((e,t)=>{Ct.init(e,t),Ae(e._zod,"propValues",(()=>t.innerType._zod.propValues)),Ae(e._zod,"values",(()=>t.innerType._zod.values)),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then($n):$n(i)}}));function $n(e){return e.value=Object.freeze(e.value),e}const xn=B("$ZodCustom",((e,t)=>{qe.init(e,t),Ct.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then((t=>Fn(t,n,i,e)));Fn(o,n,i,e)}}));function Fn(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(He(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Zn{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Dn(){return new Zn}const Un=Dn();function jn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function Ln(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function Gn(e,t){return new Ye({check:"less_than",...De(t),value:e,inclusive:!1})}function Bn(e,t){return new Ye({check:"less_than",...De(t),value:e,inclusive:!0})}function Hn(e,t){return new We({check:"greater_than",...De(t),value:e,inclusive:!1})}function qn(e,t){return new We({check:"greater_than",...De(t),value:e,inclusive:!0})}function Vn(e,t){return new Qe({check:"multiple_of",...De(t),value:e})}function Yn(e,t){return new Ke({check:"max_length",...De(t),maximum:e})}function Wn(e,t){return new Xe({check:"min_length",...De(t),minimum:e})}function Qn(e,t){return new et({check:"length_equals",...De(t),length:e})}function Jn(e){return new ct({check:"overwrite",tx:e})}const Kn=B("ZodISODateTime",((e,t)=>{Mt.init(e,t),Pi.init(e,t)}));const Xn=B("ZodISODate",((e,t)=>{Gt.init(e,t),Pi.init(e,t)}));const ei=B("ZodISOTime",((e,t)=>{Bt.init(e,t),Pi.init(e,t)}));const ti=B("ZodISODuration",((e,t)=>{Ht.init(e,t),Pi.init(e,t)}));const ni=(e,t)=>{lt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},i={_errors:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>o({issues:e})));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)i._errors.push(n(t));else{let e=i,o=0;for(;o<t.path.length;){const i=t.path[o];o===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(n(t))):e[i]=e[i]||{_errors:[]},e=e[i],o++}}};return o(e),i}(e,t)},flatten:{value:t=>function(e,t=(e=>e.message)){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ke,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ke,2)}},isEmpty:{get:()=>0===e.issues.length}})},ii=(B("ZodError",ni),B("ZodError",ni,{Parent:Error})),oi=ft(ii),ri=ht(ii),ai=mt(ii),si=vt(ii),ci=_t(ii),ui=Pt(ii),di=kt(ii),li=bt(ii),pi=zt(ii),fi=wt(ii),hi=Et(ii),mi=At(ii),gi=B("ZodType",((e,t)=>(Ct.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>Ze(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>oi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ai(e,t,n),e.parseAsync=async(t,n)=>ri(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>si(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ci(e,t,n),e.decode=(t,n)=>ui(e,t,n),e.encodeAsync=async(t,n)=>di(e,t,n),e.decodeAsync=async(t,n)=>li(e,t,n),e.safeEncode=(t,n)=>pi(e,t,n),e.safeDecode=(t,n)=>fi(e,t,n),e.safeEncodeAsync=async(t,n)=>hi(e,t,n),e.safeDecodeAsync=async(t,n)=>mi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}(_o,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e,t){const n=new qe({check:"custom",...De(void 0)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(He(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(He(i))}},e(n.value,n))));return t}(t)),e.overwrite=t=>e.check(Jn(t)),e.optional=()=>co(e),e.nullable=()=>lo(e),e.nullish=()=>co(lo(e)),e.nonoptional=t=>function(e,t){return new ho({type:"nonoptional",innerType:e,...De(t)})}(e,t),e.array=()=>Ki(e),e.or=t=>function(e,t){return new to({type:"union",options:e,...De(t)})}([e,t]),e.and=t=>new no({type:"intersection",left:e,right:t}),e.transform=t=>vo(e,ao(t)),e.default=t=>{return n=t,new po({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():$e(n)}});var n},e.prefault=t=>{return n=t,new fo({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():$e(n)}});var n},e.catch=t=>{return new mo({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>vo(e,t),e.readonly=()=>new yo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Un.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Un.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Un.get(e);const n=e.clone();return Un.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),vi=B("_ZodString",((e,t)=>{Nt.init(e,t),gi.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new nt({check:"string_format",format:"regex",...De(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new rt({check:"string_format",format:"includes",...De(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new at({check:"string_format",format:"starts_with",...De(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new st({check:"string_format",format:"ends_with",...De(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Wn(...t)),e.max=(...t)=>e.check(Yn(...t)),e.length=(...t)=>e.check(Qn(...t)),e.nonempty=(...t)=>e.check(Wn(1,...t)),e.lowercase=t=>e.check(function(e){return new it({check:"string_format",format:"lowercase",...De(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ot({check:"string_format",format:"uppercase",...De(e)})}(t)),e.trim=()=>e.check(Jn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Jn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Jn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Jn((e=>e.toUpperCase())))})),yi=B("ZodString",((e,t)=>{Nt.init(e,t),vi.init(e,t),e.email=t=>e.check(jn(ki,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}(Ei,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}(ji,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}(Ai,t)),e.guid=t=>e.check(Ln(zi,t)),e.uuid=t=>e.check(Mn(wi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}(wi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}(wi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}(wi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}(Ti,t)),e.guid=t=>e.check(Ln(zi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}(Ci,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}(Ni,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}(Ri,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}(Zi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}(Di,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}(Ii,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}(Oi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}(Si,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}($i,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}(xi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}(Fi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}(Ui,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}(Kn,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}(Xn,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}(ei,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}(ti,e)}(t))}));function _i(e){return function(e,t){return new e({type:"string",...De(t)})}(yi,e)}const Pi=B("ZodStringFormat",((e,t)=>{Rt.init(e,t),vi.init(e,t)})),ki=B("ZodEmail",((e,t)=>{St.init(e,t),Pi.init(e,t)}));function bi(e){return jn(ki,e)}const zi=B("ZodGUID",((e,t)=>{It.init(e,t),Pi.init(e,t)})),wi=B("ZodUUID",((e,t)=>{Ot.init(e,t),Pi.init(e,t)})),Ei=B("ZodURL",((e,t)=>{$t.init(e,t),Pi.init(e,t)})),Ai=B("ZodEmoji",((e,t)=>{xt.init(e,t),Pi.init(e,t)})),Ti=B("ZodNanoID",((e,t)=>{Ft.init(e,t),Pi.init(e,t)})),Ci=B("ZodCUID",((e,t)=>{Zt.init(e,t),Pi.init(e,t)})),Ni=B("ZodCUID2",((e,t)=>{Dt.init(e,t),Pi.init(e,t)})),Ri=B("ZodULID",((e,t)=>{Ut.init(e,t),Pi.init(e,t)})),Ii=B("ZodXID",((e,t)=>{jt.init(e,t),Pi.init(e,t)})),Oi=B("ZodKSUID",((e,t)=>{Lt.init(e,t),Pi.init(e,t)})),Si=B("ZodIPv4",((e,t)=>{qt.init(e,t),Pi.init(e,t)})),$i=B("ZodIPv6",((e,t)=>{Vt.init(e,t),Pi.init(e,t)})),xi=B("ZodCIDRv4",((e,t)=>{Yt.init(e,t),Pi.init(e,t)})),Fi=B("ZodCIDRv6",((e,t)=>{Wt.init(e,t),Pi.init(e,t)})),Zi=B("ZodBase64",((e,t)=>{Jt.init(e,t),Pi.init(e,t)})),Di=B("ZodBase64URL",((e,t)=>{Kt.init(e,t),Pi.init(e,t)})),Ui=B("ZodE164",((e,t)=>{Xt.init(e,t),Pi.init(e,t)})),ji=B("ZodJWT",((e,t)=>{en.init(e,t),Pi.init(e,t)})),Li=B("ZodNumber",((e,t)=>{tn.init(e,t),gi.init(e,t),e.gt=(t,n)=>e.check(Hn(t,n)),e.gte=(t,n)=>e.check(qn(t,n)),e.min=(t,n)=>e.check(qn(t,n)),e.lt=(t,n)=>e.check(Gn(t,n)),e.lte=(t,n)=>e.check(Bn(t,n)),e.max=(t,n)=>e.check(Bn(t,n)),e.int=t=>e.check(Bi(t)),e.safe=t=>e.check(Bi(t)),e.positive=t=>e.check(Hn(0,t)),e.nonnegative=t=>e.check(qn(0,t)),e.negative=t=>e.check(Gn(0,t)),e.nonpositive=t=>e.check(Bn(0,t)),e.multipleOf=(t,n)=>e.check(Vn(t,n)),e.step=(t,n)=>e.check(Vn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Mi(e){return function(e,t){return new e({type:"number",checks:[],...De(t)})}(Li,e)}const Gi=B("ZodNumberFormat",((e,t)=>{nn.init(e,t),Li.init(e,t)}));function Bi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}(Gi,e)}const Hi=B("ZodBoolean",((e,t)=>{on.init(e,t),gi.init(e,t)}));const qi=B("ZodUnknown",((e,t)=>{rn.init(e,t),gi.init(e,t)}));function Vi(){return new qi({type:"unknown"})}const Yi=B("ZodNever",((e,t)=>{an.init(e,t),gi.init(e,t)}));function Wi(e){return function(e,t){return new e({type:"never",...De(t)})}(Yi,e)}const Qi=B("ZodDate",((e,t)=>{sn.init(e,t),gi.init(e,t),e.min=(t,n)=>e.check(qn(t,n)),e.max=(t,n)=>e.check(Bn(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));const Ji=B("ZodArray",((e,t)=>{un.init(e,t),gi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Wn(t,n)),e.nonempty=t=>e.check(Wn(1,t)),e.max=(t,n)=>e.check(Yn(t,n)),e.length=(t,n)=>e.check(Qn(t,n)),e.unwrap=()=>e.element}));function Ki(e,t){return function(e,t,n){return new e({type:"array",element:t,...De(n)})}(Ji,e,t)}const Xi=B("ZodObject",((e,t)=>{hn.init(e,t),gi.init(e,t),Ae(e,"shape",(()=>t.shape)),e.keyof=()=>oo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Vi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Vi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Se(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Ce(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Te(this,"shape",n),n},checks:[]});return Ze(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!Se(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Te(this,"shape",n),n},checks:e._zod.def.checks};return Ze(e,n)}(e,t),e.merge=t=>function(e,t){const n=Ce(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Te(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ze(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return Ze(e,Ce(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return Te(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=Ce(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return Te(this,"shape",i),i},checks:[]});return Ze(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const i=Ce(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)o[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return Te(this,"shape",o),o},checks:[]});return Ze(t,i)}(so,e,t[0]),e.required=(...t)=>function(e,t,n){const i=Ce(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)o[t]=new e({type:"nonoptional",innerType:i[t]});return Te(this,"shape",o),o},checks:[]});return Ze(t,i)}(ho,e,t[0])}));function eo(e,t){const n={type:"object",get shape(){var t;return Te(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...De(t)};return new Xi(n)}const to=B("ZodUnion",((e,t)=>{gn.init(e,t),gi.init(e,t),e.options=t.options}));const no=B("ZodIntersection",((e,t)=>{vn.init(e,t),gi.init(e,t)})),io=B("ZodEnum",((e,t)=>{Pn.init(e,t),gi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new io({...t,checks:[],...De(i),entries:o})},e.exclude=(e,i)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new io({...t,checks:[],...De(i),entries:o})}}));function oo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new io({type:"enum",entries:n,...De(t)})}const ro=B("ZodTransform",((e,t)=>{kn.init(e,t),gi.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new q(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(He(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(He(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then((e=>(n.value=e,n))):(n.value=o,n)}}));function ao(e){return new ro({type:"transform",transform:e})}const so=B("ZodOptional",((e,t)=>{zn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function co(e){return new so({type:"optional",innerType:e})}const uo=B("ZodNullable",((e,t)=>{wn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function lo(e){return new uo({type:"nullable",innerType:e})}const po=B("ZodDefault",((e,t)=>{En.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap})),fo=B("ZodPrefault",((e,t)=>{Tn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),ho=B("ZodNonOptional",((e,t)=>{Cn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),mo=B("ZodCatch",((e,t)=>{Rn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap})),go=B("ZodPipe",((e,t)=>{In.init(e,t),gi.init(e,t),e.in=t.in,e.out=t.out}));function vo(e,t){return new go({type:"pipe",in:e,out:t})}const yo=B("ZodReadonly",((e,t)=>{Sn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),_o=B("ZodCustom",((e,t)=>{xn.init(e,t),gi.init(e,t)}));function Po(e,t){return vo(ao(e),t)}function ko(e,t,n){const i=t.safeParse(n);return i.success?i.data:(i.error.issues.forEach((t=>{const n=t.path.join(".");e.getFieldState(n)?e.setError(n,{type:"manual",message:t.message}):e.setError("root",{type:"manual",message:t.message})})),null)}const bo=e=>Po((e=>{if(e){if("string"==typeof e){const t=Number(e);return isNaN(t)?e:t}return e}}),e),zo=e=>Po((e=>{if(!e)return;let t;return"string"==typeof e&&(t=new Date(e)),e instanceof Date&&(t=e),t?(t.setUTCHours(0,0,0,0),t):e}),e),wo=e=>_i().min(1,{error:"Required"}).max(e,`Maximum length is ${e} characters`),Eo=()=>bi("Invalid email address").min(1,"Required"),Ao=()=>bo(Mi("Valid amount required").positive("Positive amount required")),To=()=>zo(function(e){return function(e,t){return new e({type:"date",...De(t)})}(Qi,e)}("Valid date required").min(new Date,"Date must be in the future")),Co=e=>_i().max(e,`Maximum length is ${e} characters`),No=eo({address1:wo(100),address2:Co(100).optional(),city:wo(50),state:Co(50).optional(),postcode:Co(20).optional(),country:wo(50)}),Ro=eo({amount:Ao(),message:Co(500).nullish(),giverFirstName:wo(50),giverLastName:wo(50),giverEmail:Eo(),giverPhone:wo(31),giverAddress:No,cardHolder:wo(101),recipientFirstName:Co(50).nullish(),recipientLastName:Co(50).nullish(),recipientEmail:bi("Invalid email address").nullish(),recipientPhone:Co(31).nullish()}),Io=Ro.extend({expiry:To(),notes:Co(500).nullish()}),Oo=eo({balance:Ao(),expiry:To(),message:Co(500).nullish(),notes:Co(500).nullish(),giverFirstName:wo(50),giverLastName:wo(50),giverEmail:Eo(),giverPhone:wo(31),cardHolder:wo(101),recipientEmail:bi("Invalid email address").nullish(),recipientPhone:Co(31).nullish()});let So;!function(e){e.Passthrough="Passthrough",e.PaymentProcessor="PaymentProcessor"}(So||(So={}));const $o=eo({companyId:Mi().int().positive(),amount:Ao(),currency:wo(3).default("AUD")}),xo=eo({sessionId:wo(100),resultCode:wo(50),pspReference:Co(100).optional()}),Fo=eo({cardHolder:wo(100),cardNumberToken:Co(200),cardCvcToken:Co(200),cardExpiry:Co(5)}),Zo=Ro.extend({companyId:Mi().int().positive(),sendViaEmail:function(e){return function(e,t){return new e({type:"boolean",...De(t)})}(Hi,e)}().default(!0),payment:xo.optional(),passthroughPayment:Fo.optional()}),Do=eo({giftCardId:Mi().int().positive(),reason:Co(500).optional()}),Uo=eo({companyId:Mi().int().positive().nullish(),code:wo(10),password:wo(10)}),jo=Uo.extend({amount:Ao(),description:wo(200)});let Lo,Mo,Go,Bo,Ho,qo;!function(e){e.Adyen="Adyen"}(Lo||(Lo={})),function(e){e.Pending="Pending",e.Authorized="Authorized",e.Captured="Captured",e.Failed="Failed",e.Refunded="Refunded"}(Mo||(Mo={})),function(e){e.Authorised="Authorised",e.Refused="Refused",e.Cancelled="Cancelled",e.Pending="Pending",e.Received="Received",e.Error="Error",e.IdentifyShopper="IdentifyShopper",e.ChallengeShopper="ChallengeShopper"}(Go||(Go={})),function(e){e.AUTHORISATION="AUTHORISATION",e.CAPTURE="CAPTURE",e.REFUND="REFUND",e.CANCELLATION="CANCELLATION",e.REFUND_FAILED="REFUND_FAILED",e.CAPTURE_FAILED="CAPTURE_FAILED"}(Bo||(Bo={})),function(e){e.Purchase="Purchase",e.Redemption="Redemption",e.Adjustment="Adjustment"}(Ho||(Ho={})),function(e){e.Pending="Pending",e.Complete="Complete",e.Cancelled="Cancelled",e.Expired="Expired"}(qo||(qo={}));const Vo=eo({code:wo(10),token:wo(128)}),Yo=eo({companyId:Mi().int().positive(),code:wo(10),token:wo(128)}),Wo=eo({companyId:(Qo=Li,new Qo({type:"number",coerce:!0,checks:[],...De(void 0)})).int().positive()});var Qo;const Jo=eo({giftCardPaymentType:oo([So.Passthrough,So.PaymentProcessor])}),Ko=eo({merchantAccount:wo(100),clientKey:wo(100),apiKey:Co(200).optional(),webhookHmacKey:Co(200).optional()}),Xo=eo({grant_type:_i().readonly().default("refresh_token"),client_id:Mn(wi,void 0),client_secret:_i(),refresh_token:_i(),scope:_i().optional()}),er=eo({email:bi(),firstName:_i().max(100).optional(),lastName:_i().max(100).optional(),phone:_i().max(20).optional(),scopes:Ki(_i()).optional()});let tr;!function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(tr||(tr={}));const nr=[tr.PER_NIGHT,tr.PER_PERSON_PER_NIGHT,tr.PER_QUANTITY_NAME_PER_NIGHT,tr.PER_ROOM_QUANTITY_PER_NIGHT,tr.PER_PERSON_OCCUPANCY_PER_NIGHT,tr.PER_ADULT_OCCUPANCY_PER_NIGHT,tr.PER_CHILD_OCCUPANCY_PER_NIGHT,tr.PER_ALL_PERSONS_PER_NIGHT];let ir,or,rr;!function(e){e.Critical="Critical",e.Error="Error",e.Warn="Warn",e.Info="Info"}(ir||(ir={})),function(e){e.Debug="Diagnostics",e.Security="Security",e.Audit="Audit"}(or||(or={})),function(e){e.General="General",e.Authenticated="Token Authenticated",e.Unauthorized="Unauthorized Access",e.RefreshToken="Refresh Token Created",e.AccessToken="Access Token Created",e.Revoked="Token Revoked",e.UserCreated="User Created",e.UserLinked="User Linked to Company",e.Purchase="Gift Card Purchased",e.Payment="Payment",e.Email="Email Delivery",e.Transaction="Gift Card Transaction"}(rr||(rr={}));const ar=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const i of n)t+=e.nights[i].total}return t},sr=require("decimal.js");var cr=e.n(sr);const ur={UP:cr().ROUND_UP,DOWN:cr().ROUND_DOWN,CEIL:cr().ROUND_CEIL,FLOOR:cr().ROUND_FLOOR,HALF_UP:cr().ROUND_HALF_UP,HALF_DOWN:cr().ROUND_HALF_DOWN,HALF_EVEN:cr().ROUND_HALF_EVEN,HALF_CEIL:cr().ROUND_HALF_CEIL,HALF_FLOOR:cr().ROUND_HALF_FLOOR},dr=(e,t)=>{const{precision:n=2,rounding:i=ur.HALF_UP}=t||{};return new(cr())(e).toDecimalPlaces(n,i).toNumber()};function lr(e,t={}){const{baseAmount:n=0,numberOfNights:i=1,feeIncludedInBaseAmount:o=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=dr(n);switch(e.feeType){case F.PercentageOfBooking:if(o)return dr(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return dr(s/(1-t)*e.amount/(100+e.amount))}return dr(s*(e.amount/100));case F.FixedChargePerRoom:case F.FixedChargePerBooking:return e.amount;case F.NightlyChargePerRoom:return dr(e.amount*i);default:return 0}}const pr=[F.FixedChargePerBooking],fr=[F.PercentageOfBooking,F.FixedChargePerRoom,F.NightlyChargePerRoom],hr=[F.PercentageOfBooking];function mr(e,t){return e.filter((e=>t.includes(e.feeType)))}function gr(e){return mr(e,pr)}function vr(e){return mr(e,fr)}function yr(e){return mr(e,hr)}function _r(e){return{includeInRates:[F.PercentageOfBooking,F.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===F.PercentageOfBooking,appliesToAddons:e===F.PercentageOfBooking,includePreviousFeesInCalculation:e===F.PercentageOfBooking}}const Pr=e=>e,kr=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},br=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class zr{}function wr(e){return e.toUpperCase()}zr.calculateBaseAddonTotal=(e,t)=>{let n=0,i=0,o=0;e.price&&e.quantity&&(n=e.quantity*Number(e.price)),e.pricingType===tr.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?n*=e.adultQuantity:e.pricingType===tr.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(n*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(i=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(o=e.childQuantity*Number(e.childPrice));let r=n+i+o;return nr.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:n,indAdultPrice:i,indChildPrice:o,addonTotal:r}},zr.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=zr.calculateBaseAddonTotal(n,t);let o=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{o+=n.quantity*e.amount})):o=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{o+=n.adultQuantity*e.amount})):o+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{o+=n.childQuantity??1*e.amount})):o+=n.childQuantity*Number(n.childFee))),nr.includes(n.pricingType)&&n.nights&&!t&&(o*=n.nights),{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+o,total:e.total+i.addonTotal+o}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),zr.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=zr.calculateBaseAddonTotal(n,t);let o,r=n.discount||0;o=void 0!==n.total&&null!==n.total?n.total:i.addonTotal-r;let a=n.fees||0;n.itemisedFees?.length&&(a=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const s=n.itemisedFees?.length?o:o+a;return{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+o+a,displayPrice:e.displayPrice+s}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),zr.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const i=Object.keys(e.nights)?.length??0;if(n+=e.fees??0,e.addons?.length){const o=(e.addons??[]).map((e=>({...e,nights:i})));n+=zr.calculateReservationAddonTotal(o,t)?.total}})),dr(n)},zr.calculateTotalExcludingDuplicateFees=(e,t)=>{if(!e)return 0;if("total"in e)return dr(e.total?.afterTax||0);const{reservations:n,itemisedFees:i}=e;if(!n?.length)return 0;let o=0;return n.forEach((e=>{o+=e.total.afterTax;const n=Object.keys(e.nights)?.length??0;e.addons?.forEach((e=>{const i=zr.calculateBaseAddonTotal({...e,nights:n},t);o+=i.addonTotal-(e.discount||0)}))})),i?.forEach((e=>{o+=e.amount})),dr(o)},module.exports=t})();
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * decimal.js v10.4.3
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
@@ -0,0 +1,35 @@
1
+ export type AnalyticsEventName = 'AddToCart' | 'InitiateCheckout' | 'Purchase';
2
+ export interface IAnalyticsEventData {
3
+ currency: string;
4
+ value: number;
5
+ contentIds?: string[];
6
+ contentType?: string;
7
+ contents?: Array<{
8
+ id: string;
9
+ quantity: number;
10
+ itemPrice: number;
11
+ }>;
12
+ numItems?: number;
13
+ }
14
+ export interface IAnalyticsUserData {
15
+ email?: string;
16
+ phone?: string;
17
+ firstName?: string;
18
+ lastName?: string;
19
+ city?: string;
20
+ state?: string;
21
+ zipCode?: string;
22
+ country?: string;
23
+ externalId?: string;
24
+ }
25
+ export interface IAnalyticsEvent {
26
+ eventId: string;
27
+ sessionId: string;
28
+ hotelId: string;
29
+ eventName: AnalyticsEventName;
30
+ eventTime: number;
31
+ eventData: IAnalyticsEventData;
32
+ userData?: IAnalyticsUserData;
33
+ createdAt: number;
34
+ ttl: number;
35
+ }
@@ -0,0 +1,11 @@
1
+ export interface IAnalyticsSession {
2
+ sessionId: string;
3
+ hotelId: string;
4
+ fbc?: string;
5
+ fbp?: string;
6
+ externalId?: string;
7
+ userAgent?: string;
8
+ ipAddress?: string;
9
+ createdAt: number;
10
+ ttl: number;
11
+ }
@@ -0,0 +1,24 @@
1
+ export type IDailyRevenue = {
2
+ date: string;
3
+ revenue: number;
4
+ };
5
+ export type IDailyRoomBreakdown = {
6
+ date: string;
7
+ roomName: string;
8
+ purchases: number;
9
+ };
10
+ export type IRegionBreakdown = {
11
+ country: string;
12
+ region: string;
13
+ purchases: number;
14
+ revenue: number;
15
+ };
16
+ export type IBigQueryResponse = {
17
+ purchases: number;
18
+ cancellations: number;
19
+ revenue: number;
20
+ conversionRate: number;
21
+ dailyRevenue: IDailyRevenue[];
22
+ dailyRoomsBreakdown: IDailyRoomBreakdown[];
23
+ regionBreakdown: IRegionBreakdown[];
24
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is the response body that comes down if a booking fails anywhere in the booking flow.
3
+ *
4
+ * Object will contain a public message only, with partial reservation data to be able to attempt to "resume" the booking
5
+ */
6
+ export type IBookingCreateErrorResponse = {
7
+ canRetryPayment: boolean;
8
+ isPaymentTaken: boolean;
9
+ publicMessage: string;
10
+ roomstayId: string;
11
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum IBookingStatus {
2
+ Pending = "Pending",
3
+ Committed = "Committed",
4
+ Cancelled = "Cancelled"
5
+ }
@@ -0,0 +1,7 @@
1
+ export type IPrice = {
2
+ cost: number;
3
+ discount: number;
4
+ tax: number;
5
+ fee: number;
6
+ total: number;
7
+ };
@@ -0,0 +1,89 @@
1
+ import { EHotelCardProcessor } from './IBookingPayment.type';
2
+ export declare enum ESplitPaymentState {
3
+ INITIATED = "initiated",
4
+ GIFTCARD_AUTHORIZED = "giftcard_authorized",
5
+ CC_AUTHORIZED = "cc_authorized",
6
+ CAPTURED = "captured",
7
+ FAILED = "failed",
8
+ ROLLED_BACK = "rolled_back"
9
+ }
10
+ export declare enum ESplitPaymentStatus {
11
+ PENDING = "pending",
12
+ AUTHORIZED = "authorized",
13
+ CAPTURED = "captured",
14
+ FAILED = "failed"
15
+ }
16
+ export interface IGiftCardPaymentDetails {
17
+ amount: number;
18
+ cardCode: string;
19
+ authorizationId?: string;
20
+ status: ESplitPaymentStatus;
21
+ expiresAt?: Date;
22
+ }
23
+ export interface ICreditCardPaymentDetails {
24
+ amount: number;
25
+ processor: EHotelCardProcessor;
26
+ authorizationId?: string;
27
+ status: ESplitPaymentStatus;
28
+ expiresAt?: Date;
29
+ }
30
+ export interface ISplitPayment {
31
+ splitPaymentId: string;
32
+ totalAmount: number;
33
+ giftCard: IGiftCardPaymentDetails;
34
+ creditCard: ICreditCardPaymentDetails;
35
+ sessionState: ESplitPaymentState;
36
+ createdAt: Date;
37
+ updatedAt: Date;
38
+ expiresAt: Date;
39
+ }
40
+ export interface ISplitPaymentSession {
41
+ id: string;
42
+ bookingId: number;
43
+ companyId: number;
44
+ hotelId: string;
45
+ splitPayment: ISplitPayment;
46
+ }
47
+ export interface IInitiateSplitPaymentRequest {
48
+ bookingId: number;
49
+ giftCardCode: string;
50
+ giftCardAmount: number;
51
+ creditCardAmount: number;
52
+ }
53
+ export interface IInitiateSplitPaymentResponse {
54
+ sessionId: string;
55
+ giftCardAmount: number;
56
+ creditCardAmount: number;
57
+ expiresAt: Date;
58
+ }
59
+ export interface IAuthorizationResult {
60
+ success: boolean;
61
+ authorizationId?: string;
62
+ expiresAt?: Date;
63
+ error?: string;
64
+ }
65
+ export interface ICaptureResult {
66
+ success: boolean;
67
+ giftCardCaptured: boolean;
68
+ creditCardCaptured: boolean;
69
+ error?: string;
70
+ }
71
+ export interface ISplitPaymentCheckoutDetails {
72
+ sessionId: string;
73
+ currentStep: 'giftcard' | 'creditcard' | 'capture';
74
+ giftCard: {
75
+ amount: number;
76
+ status: ESplitPaymentStatus;
77
+ authorizationId?: string;
78
+ expiresAt?: Date;
79
+ };
80
+ creditCard: {
81
+ amount: number;
82
+ status: ESplitPaymentStatus;
83
+ processor?: EHotelCardProcessor;
84
+ redirectUrl?: string;
85
+ authorizationId?: string;
86
+ expiresAt?: Date;
87
+ };
88
+ expiresAt: Date;
89
+ }
@@ -4,5 +4,6 @@ export declare enum ECompanyProvider {
4
4
  RMS = "RMS",
5
5
  Siteminder = "Siteminder",
6
6
  Roomstay = "Roomstay",
7
- OHIP = "OHIP"
7
+ OHIP = "OHIP",
8
+ Newbook = "Newbook"
8
9
  }
@@ -28,6 +28,10 @@ export interface IAdminCompany {
28
28
  apiUrl: string;
29
29
  pencilGuestId?: number;
30
30
  };
31
+ newbook?: {
32
+ apiKey: string;
33
+ instanceName: string;
34
+ };
31
35
  }[];
32
36
  enableLighthouseAvailability: boolean;
33
37
  enableDerbysoftFeed: boolean;
@@ -0,0 +1,6 @@
1
+ export interface IFeeOptions {
2
+ includeInRates: boolean;
3
+ alreadyIncludedInRates: boolean;
4
+ appliesToAddons: boolean;
5
+ includePreviousFeesInCalculation: boolean;
6
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum ENewbookSyncStrategy {
2
+ Rates = "rates",
3
+ Rooms = "rooms",
4
+ Availability = "availability"
5
+ }
@@ -0,0 +1,3 @@
1
+ export declare enum ENewbookSyncType {
2
+ Rates = "rates"
3
+ }
@@ -0,0 +1,9 @@
1
+ import { EPMSSyncStatus } from '../PMS/EPMSSyncStatus.enum';
2
+ import { ENewbookSyncStrategy } from './ENewbookSyncStrategy.enum';
3
+ export interface INewbookSyncResponse {
4
+ id: number;
5
+ status: EPMSSyncStatus;
6
+ syncData: string | null;
7
+ syncType: ENewbookSyncStrategy;
8
+ additionalData?: any;
9
+ }
@@ -0,0 +1 @@
1
+ export * from './ENewbookSyncStrategy.enum';
@@ -0,0 +1,8 @@
1
+ export declare enum EPMSSyncStatus {
2
+ New = "new",
3
+ Queued = "queued",
4
+ InProgress = "in_progress",
5
+ Success = "success",
6
+ Failure = "failure",
7
+ RequireResume = "require_resume"
8
+ }
@@ -0,0 +1,10 @@
1
+ import { ECompanyProvider } from '../Company/ECompanyProvider.enum';
2
+ import { EPMSSyncStatus } from './EPMSSyncStatus.enum';
3
+ export interface IPMSSyncResponse {
4
+ id: number;
5
+ provider: ECompanyProvider;
6
+ status: EPMSSyncStatus;
7
+ syncData: string | null;
8
+ syncType: string;
9
+ additionalData?: any;
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './EPMSSyncStatus.enum';
2
+ export * from './IPMSSyncResponse.type';
@@ -0,0 +1,8 @@
1
+ export declare enum EPMSSyncStatus {
2
+ New = "new",
3
+ Queued = "queued",
4
+ InProgress = "in_progress",
5
+ Success = "success",
6
+ Failure = "failure",
7
+ RequireResume = "require_resume"
8
+ }
@@ -0,0 +1,10 @@
1
+ import { ECompanyProvider } from '../Company/ECompanyProvider.enum';
2
+ import { EPMSSyncStatus } from './EPMSSyncStatus.enum';
3
+ export interface IPMSSyncResponse {
4
+ id: number;
5
+ provider: ECompanyProvider;
6
+ status: EPMSSyncStatus;
7
+ syncData: string | null;
8
+ syncType: string;
9
+ additionalData?: any;
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from './EPMSSyncStatus.enum';
2
+ export * from './IPMSSyncResponse.type';
@@ -42,13 +42,19 @@ export * from './Room/IRoomGroup.type';
42
42
  /**
43
43
  * RMS
44
44
  */
45
- export * from './RMS/ERMSAuthSyncHistoryStatus.type';
46
45
  export * from './RMS/ERMSDiscountType.enum';
47
46
  export * from './RMS/ERMSSyncStrategy.enum';
48
47
  export * from './RMS/IRMSPropertyDiscount.type';
49
48
  export * from './RMS/IRMSRequirement.type';
50
- export * from './RMS/IRMSSyncResponse.type';
51
49
  export * from './RMS/RMSBookingSource.type';
50
+ /**
51
+ * Newbook
52
+ */
53
+ export * from './Newbook';
54
+ /**
55
+ * PMS Sync
56
+ */
57
+ export * from './PMSSync';
52
58
  /**
53
59
  * OHIP
54
60
  */
File without changes
package/dist/web.js CHANGED
@@ -1 +1 @@
1
- define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var t={60:t=>{t.exports=e}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{let e,t,n,r,a;i.r(o),i.d(o,{ADDON_PER_NIGHT_TYPES:()=>tr,AddGiftCardSchema:()=>Ro,AdyenEventCode:()=>Go,AdyenResultCode:()=>Mo,BaseGiftCardSchema:()=>No,CancelGiftCardTransactionSchema:()=>qo,CompleteGiftCardTransactionSchema:()=>Vo,CreatePaymentSessionSchema:()=>So,DATE_FORMAT:()=>S,EAddonPricingType:()=>er,EAdminCompanyUserRole:()=>p,EBookingFlow:()=>t,EBookingPaymentMethod:()=>n,EBookingStatus:()=>e,ECompanyProvider:()=>l,EDistanceUnitType:()=>_,EFeeType:()=>$,EGiftCardPaymentProvider:()=>jo,EGiftCardPaymentStatus:()=>Lo,EGiftCardPaymentType:()=>Oo,EGiftCardTransactionType:()=>Ho,EGuaranteePolicyDepositMode:()=>E,EGuarantyPolicyPrepaymentType:()=>A,EHotelAddressRequirement:()=>f,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>m,EHotelWeekdayStartsOn:()=>g,EIntegration:()=>v,ELogCategory:()=>ir,ELogSeverity:()=>nr,ELogType:()=>or,EPlanpayBookingStatus:()=>a,EPromoCodeDiscountType:()=>T,EPromoCodeStayDateRangeRepeatType:()=>N,EPromoCodeStayDateRangeType:()=>C,ERMSAuthSyncHistoryStatus:()=>P,ERMSDiscountType:()=>k,ERMSSyncStrategy:()=>b,ERoomstayEventName:()=>F,ERoomstayEventSource:()=>R,ERoomstayImageSize:()=>z,ETransactionStatus:()=>Bo,EditGiftCardSchema:()=>Io,GetCompanyConfigSchema:()=>Yo,GuestProfile:()=>d,HttpMethod:()=>x,IAuxiliaryFilterType:()=>y,IMaintenanceStatusService:()=>w,InternationalAddressSchema:()=>Co,ItineraryResponse:()=>c,META_USER_DATA_KEYS:()=>Z,PCIBookingCardProcessorTypes:()=>s,Package:()=>I,PassthroughPaymentDataSchema:()=>$o,PaymentProcessorDataSchema:()=>xo,PurchaseGiftCardSchema:()=>Fo,RedeemGiftCardSchema:()=>Uo,RefreshGiftCardTokenSchema:()=>Ko,RefundGiftCardSchema:()=>Zo,RegisterGiftCardAdminSchema:()=>Xo,Reservation:()=>u,ReservedPackage:()=>O,RoundingType:()=>cr,TotalCalculator:()=>br,UpdateAdyenConfigSchema:()=>Jo,UpdateCompanyConfigSchema:()=>Qo,ValidateGiftCardSchema:()=>Do,buildPixelEventOptions:()=>M,calculateFeeAmount:()=>dr,calculateTotalForMemberBooking:()=>rr,getFeeOptionValidity:()=>yr,getFilteredBookingAddonFees:()=>vr,getFilteredBookingFees:()=>mr,getFilteredBookingRateFees:()=>gr,maxString:()=>To,nameof:()=>_r,preprocessDate:()=>bo,preprocessNumber:()=>ko,requireEmail:()=>wo,requireFutureDate:()=>Ao,requirePositiveAmount:()=>Eo,requireString:()=>zo,resizeRoomstayImageUrl:()=>kr,roundMoney:()=>ur,subset:()=>Pr,toMetaEventName:()=>D,transformToMetaEventData:()=>j,transformToMetaUserData:()=>L,uppercaseString:()=>zr,validateFormWithZod:()=>Po}),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(e||(e={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(t||(t={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard",e.TrueRewards="TrueRewards"}(n||(n={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave",e.Mastercard="Mastercard",e.Stripe="Stripe",e.PayPal="PayPal"}(r||(r={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const s=[];class c{constructor(){this.roomstayId=void 0,this.itineraryNumber=void 0,this.total=void 0,this.hotelFrontendId=void 0,this.reservations=[],this.payment=void 0,this.feesSummary=void 0,this.itemisedFees=void 0,this.warnings=void 0}}class u{constructor(){this.reservationNumber=void 0,this.roomType=void 0,this.roomCode=void 0,this.rate=void 0,this.rateCode=void 0,this.images=void 0,this.guaranteePolicy=void 0,this.cancellationPolicy=void 0,this.checkInDate=void 0,this.checkOutDate=void 0,this.nights={},this.guestCounts={adults:1,children:0},this.guest=new d,this.paymentCard=void 0,this.paymentMethod=void 0,this.total=void 0,this.status=void 0,this.isCancelable=void 0,this.addons=void 0,this.comments=void 0,this.specialRequests=void 0,this.promoCode=void 0,this.guaranteePolicyLongDescription=void 0,this.cancellationPolicyLongDescription=void 0,this.itemisedFees=void 0}}class d{constructor(){this.title=void 0,this.firstName=void 0,this.middleName=void 0,this.lastName=void 0,this.nameSuffix=void 0,this.phone=void 0,this.email=void 0,this.address={},this.marketingOptIn=void 0,this.country=void 0}}let l,p,f,h,m,g,v,y,_,P,k,b,z,w,E,A,T,C,N,R;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay",e.OHIP="OHIP"}(l||(l={})),function(e){e.SuperAdmin="SuperAdmin",e.Admin="Admin",e.Limited="Limited"}(p||(p={})),function(e){e.FullAddressRequired="FullAddressRequired",e.AddressOptionalCountryRequired="AddressOptionalCountryRequired",e.AddressOptional="AddressOptional"}(f||(f={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(h||(h={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(m||(m={})),function(e){e.Monday="monday",e.Sunday="sunday"}(g||(g={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce",e.RAC="RAC",e.AnalyticsEvents="AnalyticsEvents"}(v||(v={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(y||(y={})),function(e){e.Metric="metric",e.Imperial="imperial"}(_||(_={})),function(e){e.Success="success",e.Failure="failure",e.New="new",e.Queued="queued",e.InProgress="in_progress",e.RequireResume="require_resume"}(P||(P={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(k||(k={})),function(e){e.Hotel="hotel",e.HotelImages="hotelImages",e.Cancellation="cancellation",e.Room="room",e.Rates="rates",e.OneGuaranteePolicy="oneGuaranteePolicy",e.RoomRates="roomRates",e.RoomImages="roomImages",e.BookingSources="booking-sources",e.Areas="areas",e.Dwellings="dwellings",e.AreaDwellings="areaDwellings",e.ConvertDwellingConfigToAuxInput="convertDwellingConfigToAuxInput",e.Discounts="discounts",e.PropertyDiscounts="propertyDiscounts",e.RoomDiscounts="roomDiscounts",e.PropertySundries="propertySundries",e.PropertyFees="propertyFees",e.PropertyCards="property-cards",e.Countries="countries",e.Addons="addons",e.Requirements="requirements",e.RoomAddons="room-addons",e.ClientFacingPromoSync="clientFacingPromoSync",e.ClientFacingRoomSync="clientFacingRoomSync",e.ClientFacingRateSync="clientFacingRateSync",e.NewRateFetch="newRateFetch"}(b||(b={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(z||(z={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(w||(w={}));class I{constructor(){this.ratePlanCode=void 0,this.name=void 0,this.description=void 0,this.inclusive=void 0,this.image=void 0,this.url=void 0,this.pricingType=void 0,this.quantity=void 0,this.category=void 0,this.cancelPenalty=void 0,this.guaranteeDescription=void 0,this.availability={}}}class O extends I{constructor(...e){super(...e),this.code=void 0,this.price=void 0,this.fees=void 0,this.itemisedFees=void 0,this.adultQuantity=void 0,this.childQuantity=void 0,this.adultPrice=void 0,this.childPrice=void 0,this.startDate=void 0,this.startTime=void 0,this.hideDatePicker=!1,this.hideQuantity=!1,this.order=void 0,this.discount=void 0,this.total=void 0}}!function(e){e.Full="Full",e.Percentage="Percentage",e.FirstNight="FirstNight",e.None="None"}(E||(E={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(A||(A={})),function(e){e.FlatPercent="flatPercent",e.FlatQuantity="flatQuantity",e.FlatQuantityPerStay="flatQuantityPerStay"}(T||(T={})),function(e){e.Allowed="Allowed",e.Blocked="Blocked"}(C||(C={})),function(e){e.None="None",e.Weekly="Weekly",e.MonthlyDayOfWeek="MonthlyDayOfWeek",e.MonthlyDate="MonthlyDate",e.Yearly="Yearly"}(N||(N={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(R||(R={}));const S="DD/MM/YYYY";let x,$,F;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}(x||(x={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}($||($={})),function(e){e.BasketAdd="Basket/Add",e.BasketAddAddon="Basket/AddAddon",e.ViewCheckout="View/Checkout",e.BookingCommitted="Booking/Committed"}(F||(F={}));const Z=["em","ph","fn","ln","ct","st","zp","country","external_id"];function D(e){return{[F.BasketAdd]:"AddToCart",[F.BasketAddAddon]:"AddToCart",[F.ViewCheckout]:"InitiateCheckout",[F.BookingCommitted]:"Purchase"}[e]}function U(e,t,n){let i=0;const o=[],r=[];for(const t of e)i+=t.totalPrice,t.roomCode&&(o.push(t.roomCode),r.push({id:t.roomCode,quantity:1,item_price:t.totalPrice}));if(t)for(const e of t)i+=e.totalPrice,e.addonCode&&(o.push(e.addonCode),r.push({id:e.addonCode,quantity:e.quantity,item_price:e.unitPrice}));return{currency:n,value:i,content_ids:o,content_type:"hotel",contents:r,num_items:e.length+(t?.length??0)}}function j(e){if("addon"in e)return t=e.addon,{currency:e.currency,value:t.totalPrice,content_ids:t.addonCode?[t.addonCode]:[],content_type:"hotel",contents:t.addonCode?[{id:t.addonCode,quantity:t.quantity,item_price:t.unitPrice}]:[],num_items:1};var t;if("item"in e)return U([e.item],void 0,e.currency);if("items"in e){const t=e,n=U(t.items,t.addons,e.currency);return"itineraryNumber"in t&&(n.order_id=t.itineraryNumber),n}throw new Error("Invalid event data")}function L(e){return{em:e.email,ph:e.phone,fn:e.firstName,ln:e.lastName,ct:e.city,st:e.state,zp:e.postalCode,country:e.country,external_id:e.externalId}}function M(e,t){const n={eventID:e};if(t)for(const e of Z)t[e]&&(n[e]=t[e]);return n}function G(e,t,n){function i(n,i){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,i);for(const e in a.prototype)e in n||Object.defineProperty(n,e,{value:a.prototype[e].bind(n)});n._zod.constr=a,n._zod.def=i}const o=n?.Parent??Object;class r extends o{}function a(e){var t;const o=n?.Parent?new r:this;i(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Object.freeze({status:"aborted"}),Symbol("zod_brand");class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class B extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const V={};function q(e){return e&&Object.assign(V,e),V}const Y=/^[cC][^\s-]{8,}$/,W=/^[0-9a-z]+$/,Q=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,J=/^[0-9a-vA-V]{20}$/,K=/^[A-Za-z0-9]{27}$/,X=/^[a-zA-Z0-9_-]{21}$/,ee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,te=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ne=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ie=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,oe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,re=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,ae=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,se=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ue=/^[A-Za-z0-9_-]*$/,de=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,le=/^\+(?:[0-9]){6,14}[0-9]$/,pe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",fe=new RegExp(`^${pe}$`);function he(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const me=/^\d+$/,ge=/^-?\d+(?:\.\d+)?/i,ve=/true|false/i,ye=/^[^A-Z]*$/,_e=/^[^a-z]*$/;function Pe(e,t){return"bigint"==typeof t?t.toString():t}function ke(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function be(e){return null==e}function ze(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const we=Symbol("evaluating");function Ee(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==we)return void 0===i&&(i=we,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ae(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Te(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ce(e){return JSON.stringify(e)}const Ne="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Ie=ke((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function Oe(e){if(!1===Re(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Re(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function Se(e){return Oe(e)?{...e}:e}const xe=new Set(["string","number","symbol"]);function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function Ze(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}new Set(["string","number","bigint","boolean","symbol","undefined"]);const De={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ue(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function je(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function Le(e){return"string"==typeof e?e:e?.message}function Me(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const o=Le(e.inst?._zod.def?.error?.(e))??Le(t?.error?.(e))??Le(n.customError?.(e))??Le(n.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Ge(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function He(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const Be=G("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),Ve={number:"number",bigint:"bigint",object:"date"},qe=G("$ZodCheckLessThan",((e,t)=>{Be.init(e,t);const n=Ve[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Ye=G("$ZodCheckGreaterThan",((e,t)=>{Be.init(e,t);const n=Ve[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),We=G("$ZodCheckMultipleOf",((e,t)=>{Be.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let o=(i.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const r=n>o?n:o;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Qe=G("$ZodCheckNumberFormat",((e,t)=>{Be.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[o,r]=De[t.format];e._zod.onattach.push((e=>{const i=e._zod.bag;i.format=t.format,i.minimum=o,i.maximum=r,n&&(i.pattern=me)})),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>r&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:r,inst:e})}})),Je=G("$ZodCheckMaxLength",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const o=Ge(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Ke=G("$ZodCheckMinLength",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const o=Ge(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Xe=G("$ZodCheckLengthEquals",((e,t)=>{var n;Be.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!be(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const r=Ge(i),a=o>t.length;n.issues.push({origin:r,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),et=G("$ZodCheckStringFormat",((e,t)=>{var n,i;Be.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})})),tt=G("$ZodCheckRegex",((e,t)=>{et.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),nt=G("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=ye),et.init(e,t)})),it=G("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=_e),et.init(e,t)})),ot=G("$ZodCheckIncludes",((e,t)=>{Be.init(e,t);const n=$e(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),rt=G("$ZodCheckStartsWith",((e,t)=>{Be.init(e,t);const n=new RegExp(`^${$e(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),at=G("$ZodCheckEndsWith",((e,t)=>{Be.init(e,t);const n=new RegExp(`.*${$e(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),st=G("$ZodCheckOverwrite",((e,t)=>{Be.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class ct{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),i=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const ut=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},dt=G("$ZodError",ut),lt=G("$ZodError",ut,{Parent:Error}),pt=e=>(t,n,i,o)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new H;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Me(e,r,q()))));throw Ne(t,o?.callee),t}return a.value},ft=e=>async(t,n,i,o)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Me(e,r,q()))));throw Ne(t,o?.callee),t}return a.value},ht=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new H;return r.issues.length?{success:!1,error:new(e??dt)(r.issues.map((e=>Me(e,o,q()))))}:{success:!0,data:r.value}},mt=ht(lt),gt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>Me(e,o,q()))))}:{success:!0,data:r.value}},vt=gt(lt),yt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return pt(e)(t,n,o)},_t=e=>(t,n,i)=>pt(e)(t,n,i),Pt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ft(e)(t,n,o)},kt=e=>async(t,n,i)=>ft(e)(t,n,i),bt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ht(e)(t,n,o)},zt=e=>(t,n,i)=>ht(e)(t,n,i),wt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return gt(e)(t,n,o)},Et=e=>async(t,n,i)=>gt(e)(t,n,i),At={major:4,minor:1,patch:5},Tt=G("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=At;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,o=Ue(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=r._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new H;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a,e.issues.length!==t&&(o||(o=Ue(e,t)))}));else{if(e.issues.length===t)continue;o||(o=Ue(e,t))}}return i?i.then((()=>e)):e},n=(n,o,r)=>{if(Ue(n))return n.aborted=!0,n;const a=t(o,i,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((t=>e._zod.parse(t,r)))}return e._zod.parse(a,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const t=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,o,r))):n(t,o,r)}const a=e._zod.parse(o,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((e=>t(e,i,r)))}return t(a,i,r)}}e["~standard"]={validate:t=>{try{const n=mt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return vt(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Ct=G("$ZodString",((e,t)=>{var n;Tt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Nt=G("$ZodStringFormat",((e,t)=>{et.init(e,t),Ct.init(e,t)})),Rt=G("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=te),Nt.init(e,t)})),It=G("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ne(e))}else t.pattern??(t.pattern=ne());Nt.init(e,t)})),Ot=G("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=ie),Nt.init(e,t)})),St=G("$ZodURL",((e,t)=>{Nt.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),o=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:de.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),xt=G("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nt.init(e,t)})),$t=G("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=X),Nt.init(e,t)})),Ft=G("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=Y),Nt.init(e,t)})),Zt=G("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=W),Nt.init(e,t)})),Dt=G("$ZodULID",((e,t)=>{t.pattern??(t.pattern=Q),Nt.init(e,t)})),Ut=G("$ZodXID",((e,t)=>{t.pattern??(t.pattern=J),Nt.init(e,t)})),jt=G("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=K),Nt.init(e,t)})),Lt=G("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=he({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${pe}T(?:${i})$`)}(t)),Nt.init(e,t)})),Mt=G("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=fe),Nt.init(e,t)})),Gt=G("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${he(t)}$`)),Nt.init(e,t)})),Ht=G("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=ee),Nt.init(e,t)})),Bt=G("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=oe),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),Vt=G("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=re),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),qt=G("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=ae),Nt.init(e,t)})),Yt=G("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=se),Nt.init(e,t),e._zod.check=n=>{const[i,o]=n.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function Wt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qt=G("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=ce),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=n=>{Wt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),Jt=G("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=ue),Nt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=n=>{(function(e){if(!ue.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Wt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),Kt=G("$ZodE164",((e,t)=>{t.pattern??(t.pattern=le),Nt.init(e,t)})),Xt=G("$ZodJWT",((e,t)=>{Nt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),en=G("$ZodNumber",((e,t)=>{Tt.init(e,t),e._zod.pattern=e._zod.bag.pattern??ge,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const r="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...r?{received:r}:{}}),n}})),tn=G("$ZodNumber",((e,t)=>{Qe.init(e,t),en.init(e,t)})),nn=G("$ZodBoolean",((e,t)=>{Tt.init(e,t),e._zod.pattern=ve,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}})),on=G("$ZodUnknown",((e,t)=>{Tt.init(e,t),e._zod.parse=e=>e})),rn=G("$ZodNever",((e,t)=>{Tt.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),an=G("$ZodDate",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const o=n.value,r=o instanceof Date;return r&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...r?{received:"Invalid Date"}:{},inst:e}),n}}));function sn(e,t,n){e.issues.length&&t.issues.push(...je(n,e.issues)),t.value[n]=e.value}const cn=G("$ZodArray",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const r=[];for(let e=0;e<o.length;e++){const a=o[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?r.push(s.then((t=>sn(t,n,e)))):sn(s,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function un(e,t,n,i){e.issues.length&&t.issues.push(...je(n,e.issues)),void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function dn(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter((e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout)));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ln(e,t,n,i,o,r){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type;for(const o of Object.keys(t)){if(s.has(o))continue;if("never"===u){a.push(o);continue}const r=c.run({value:t[o],issues:[]},i);r instanceof Promise?e.push(r.then((e=>un(e,n,o,t)))):un(r,n,o,t)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:r}),e.length?Promise.all(e).then((()=>n)):n}const pn=G("$ZodObject",((e,t)=>{Tt.init(e,t);const n=ke((()=>dn(t)));Ee(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n}));const i=Re,o=t.catchall;let r;e._zod.parse=(t,a)=>{r??(r=n.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],u=r.shape;for(const e of r.keys){const n=u[e]._zod.run({value:s[e],issues:[]},a);n instanceof Promise?c.push(n.then((n=>un(n,t,e,s)))):un(n,t,e,s)}return o?ln(c,s,t,a,n.value,e):c.length?Promise.all(c).then((()=>t)):t}})),fn=G("$ZodObjectJIT",((e,t)=>{pn.init(e,t);const n=e._zod.parse,i=ke((()=>dn(t)));let o;const r=Re,a=!V.jitless,s=a&&Ie.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=i.value);const p=d.value;return r(p)?a&&s&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new ct(["shape","payload","ctx"]),n=i.value,o=e=>{const t=Ce(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let a=0;for(const e of n.keys)r[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys){const n=r[e],i=Ce(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=o(d,l),c?ln([],p,d,l,u,e):d):n(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}}));function hn(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter((e=>!Ue(e)));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Me(e,i,q())))))}),t)}const mn=G("$ZodUnion",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),Ee(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),Ee(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),Ee(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>ze(e.source))).join("|")})$`)}}));const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(o,r)=>{if(n)return i(o,r);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},r);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then((t=>hn(t,o,e,r))):hn(s,o,e,r)}})),gn=G("$ZodIntersection",((e,t)=>{Tt.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,o=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then((([t,n])=>yn(e,t,n))):yn(e,o,r)}}));function vn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){const n=Object.keys(t),i=Object.keys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const n of i){const i=vn(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=vn(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yn(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Ue(e))return e;const i=vn(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const _n=G("$ZodEnum",((e,t)=>{Tt.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((e=>xe.has(typeof e))).map((e=>"string"==typeof e?$e(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}})),Pn=G("$ZodTransform",((e,t)=>{Tt.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new B(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then((e=>(n.value=e,n)));if(o instanceof Promise)throw new H;return n.value=o,n}}));function kn(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const bn=G("$ZodOptional",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),Ee(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ze(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((t=>kn(t,e.value))):kn(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),zn=G("$ZodNullable",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),Ee(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ze(e.source)}|null)$`):void 0})),Ee(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),wn=G("$ZodDefault",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>En(e,t))):En(i,t)}}));function En(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const An=G("$ZodPrefault",((e,t)=>{Tt.init(e,t),e._zod.optin="optional",Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Tn=G("$ZodNonOptional",((e,t)=>{Tt.init(e,t),Ee(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then((t=>Cn(t,e))):Cn(o,e)}}));function Cn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nn=G("$ZodCatch",((e,t)=>{Tt.init(e,t),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),Ee(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Me(e,n,q())))},input:e.value}),e.issues=[]),e))):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Me(e,n,q())))},input:e.value}),e.issues=[]),e)}})),Rn=G("$ZodPipe",((e,t)=>{Tt.init(e,t),Ee(e._zod,"values",(()=>t.in._zod.values)),Ee(e._zod,"optin",(()=>t.in._zod.optin)),Ee(e._zod,"optout",(()=>t.out._zod.optout)),Ee(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then((e=>In(e,t.in,n))):In(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then((e=>In(e,t.out,n))):In(i,t.out,n)}}));function In(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const On=G("$ZodReadonly",((e,t)=>{Tt.init(e,t),Ee(e._zod,"propValues",(()=>t.innerType._zod.propValues)),Ee(e._zod,"values",(()=>t.innerType._zod.values)),Ee(e._zod,"optin",(()=>t.innerType._zod.optin)),Ee(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(Sn):Sn(i)}}));function Sn(e){return e.value=Object.freeze(e.value),e}const xn=G("$ZodCustom",((e,t)=>{Be.init(e,t),Tt.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then((t=>$n(t,n,i,e)));$n(o,n,i,e)}}));function $n(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(He(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Fn{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Zn(){return new Fn}const Dn=Zn();function Un(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ze(t)})}function jn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ze(t)})}function Ln(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ze(t)})}function Mn(e,t){return new qe({check:"less_than",...Ze(t),value:e,inclusive:!1})}function Gn(e,t){return new qe({check:"less_than",...Ze(t),value:e,inclusive:!0})}function Hn(e,t){return new Ye({check:"greater_than",...Ze(t),value:e,inclusive:!1})}function Bn(e,t){return new Ye({check:"greater_than",...Ze(t),value:e,inclusive:!0})}function Vn(e,t){return new We({check:"multiple_of",...Ze(t),value:e})}function qn(e,t){return new Je({check:"max_length",...Ze(t),maximum:e})}function Yn(e,t){return new Ke({check:"min_length",...Ze(t),minimum:e})}function Wn(e,t){return new Xe({check:"length_equals",...Ze(t),length:e})}function Qn(e){return new st({check:"overwrite",tx:e})}const Jn=G("ZodISODateTime",((e,t)=>{Lt.init(e,t),_i.init(e,t)}));const Kn=G("ZodISODate",((e,t)=>{Mt.init(e,t),_i.init(e,t)}));const Xn=G("ZodISOTime",((e,t)=>{Gt.init(e,t),_i.init(e,t)}));const ei=G("ZodISODuration",((e,t)=>{Ht.init(e,t),_i.init(e,t)}));const ti=(e,t)=>{dt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},i={_errors:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>o({issues:e})));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)i._errors.push(n(t));else{let e=i,o=0;for(;o<t.path.length;){const i=t.path[o];o===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(n(t))):e[i]=e[i]||{_errors:[]},e=e[i],o++}}};return o(e),i}(e,t)},flatten:{value:t=>function(e,t=(e=>e.message)){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Pe,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Pe,2)}},isEmpty:{get:()=>0===e.issues.length}})},ni=(G("ZodError",ti),G("ZodError",ti,{Parent:Error})),ii=pt(ni),oi=ft(ni),ri=ht(ni),ai=gt(ni),si=yt(ni),ci=_t(ni),ui=Pt(ni),di=kt(ni),li=bt(ni),pi=zt(ni),fi=wt(ni),hi=Et(ni),mi=G("ZodType",((e,t)=>(Tt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>Fe(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>ii(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ri(e,t,n),e.parseAsync=async(t,n)=>oi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ai(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>si(e,t,n),e.decode=(t,n)=>ci(e,t,n),e.encodeAsync=async(t,n)=>ui(e,t,n),e.decodeAsync=async(t,n)=>di(e,t,n),e.safeEncode=(t,n)=>li(e,t,n),e.safeDecode=(t,n)=>pi(e,t,n),e.safeEncodeAsync=async(t,n)=>fi(e,t,n),e.safeDecodeAsync=async(t,n)=>hi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ze(n)})}(yo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e,t){const n=new Be({check:"custom",...Ze(void 0)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(He(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(He(i))}},e(n.value,n))));return t}(t)),e.overwrite=t=>e.check(Qn(t)),e.optional=()=>so(e),e.nullable=()=>uo(e),e.nullish=()=>so(uo(e)),e.nonoptional=t=>function(e,t){return new fo({type:"nonoptional",innerType:e,...Ze(t)})}(e,t),e.array=()=>Ji(e),e.or=t=>function(e,t){return new eo({type:"union",options:e,...Ze(t)})}([e,t]),e.and=t=>new to({type:"intersection",left:e,right:t}),e.transform=t=>go(e,ro(t)),e.default=t=>{return n=t,new lo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():Se(n)}});var n},e.prefault=t=>{return n=t,new po({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():Se(n)}});var n},e.catch=t=>{return new ho({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>go(e,t),e.readonly=()=>new vo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Dn.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Dn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Dn.get(e);const n=e.clone();return Dn.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),gi=G("_ZodString",((e,t)=>{Ct.init(e,t),mi.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new tt({check:"string_format",format:"regex",...Ze(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ot({check:"string_format",format:"includes",...Ze(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new rt({check:"string_format",format:"starts_with",...Ze(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new at({check:"string_format",format:"ends_with",...Ze(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Yn(...t)),e.max=(...t)=>e.check(qn(...t)),e.length=(...t)=>e.check(Wn(...t)),e.nonempty=(...t)=>e.check(Yn(1,...t)),e.lowercase=t=>e.check(function(e){return new nt({check:"string_format",format:"lowercase",...Ze(e)})}(t)),e.uppercase=t=>e.check(function(e){return new it({check:"string_format",format:"uppercase",...Ze(e)})}(t)),e.trim=()=>e.check(Qn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Qn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Qn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Qn((e=>e.toUpperCase())))})),vi=G("ZodString",((e,t)=>{Ct.init(e,t),gi.init(e,t),e.email=t=>e.check(Un(Pi,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ze(t)})}(wi,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ze(t)})}(Ui,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ze(t)})}(Ei,t)),e.guid=t=>e.check(jn(bi,t)),e.uuid=t=>e.check(Ln(zi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ze(t)})}(zi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ze(t)})}(zi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ze(t)})}(zi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ze(t)})}(Ai,t)),e.guid=t=>e.check(jn(bi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ze(t)})}(Ti,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ze(t)})}(Ci,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ze(t)})}(Ni,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ze(t)})}(Fi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ze(t)})}(Zi,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ze(t)})}(Ri,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ze(t)})}(Ii,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ze(t)})}(Oi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ze(t)})}(Si,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ze(t)})}(xi,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ze(t)})}($i,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ze(t)})}(Di,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ze(t)})}(Jn,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Ze(t)})}(Kn,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ze(t)})}(Xn,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ze(t)})}(ei,e)}(t))}));function yi(e){return function(e,t){return new e({type:"string",...Ze(t)})}(vi,e)}const _i=G("ZodStringFormat",((e,t)=>{Nt.init(e,t),gi.init(e,t)})),Pi=G("ZodEmail",((e,t)=>{Ot.init(e,t),_i.init(e,t)}));function ki(e){return Un(Pi,e)}const bi=G("ZodGUID",((e,t)=>{Rt.init(e,t),_i.init(e,t)})),zi=G("ZodUUID",((e,t)=>{It.init(e,t),_i.init(e,t)})),wi=G("ZodURL",((e,t)=>{St.init(e,t),_i.init(e,t)})),Ei=G("ZodEmoji",((e,t)=>{xt.init(e,t),_i.init(e,t)})),Ai=G("ZodNanoID",((e,t)=>{$t.init(e,t),_i.init(e,t)})),Ti=G("ZodCUID",((e,t)=>{Ft.init(e,t),_i.init(e,t)})),Ci=G("ZodCUID2",((e,t)=>{Zt.init(e,t),_i.init(e,t)})),Ni=G("ZodULID",((e,t)=>{Dt.init(e,t),_i.init(e,t)})),Ri=G("ZodXID",((e,t)=>{Ut.init(e,t),_i.init(e,t)})),Ii=G("ZodKSUID",((e,t)=>{jt.init(e,t),_i.init(e,t)})),Oi=G("ZodIPv4",((e,t)=>{Bt.init(e,t),_i.init(e,t)})),Si=G("ZodIPv6",((e,t)=>{Vt.init(e,t),_i.init(e,t)})),xi=G("ZodCIDRv4",((e,t)=>{qt.init(e,t),_i.init(e,t)})),$i=G("ZodCIDRv6",((e,t)=>{Yt.init(e,t),_i.init(e,t)})),Fi=G("ZodBase64",((e,t)=>{Qt.init(e,t),_i.init(e,t)})),Zi=G("ZodBase64URL",((e,t)=>{Jt.init(e,t),_i.init(e,t)})),Di=G("ZodE164",((e,t)=>{Kt.init(e,t),_i.init(e,t)})),Ui=G("ZodJWT",((e,t)=>{Xt.init(e,t),_i.init(e,t)})),ji=G("ZodNumber",((e,t)=>{en.init(e,t),mi.init(e,t),e.gt=(t,n)=>e.check(Hn(t,n)),e.gte=(t,n)=>e.check(Bn(t,n)),e.min=(t,n)=>e.check(Bn(t,n)),e.lt=(t,n)=>e.check(Mn(t,n)),e.lte=(t,n)=>e.check(Gn(t,n)),e.max=(t,n)=>e.check(Gn(t,n)),e.int=t=>e.check(Gi(t)),e.safe=t=>e.check(Gi(t)),e.positive=t=>e.check(Hn(0,t)),e.nonnegative=t=>e.check(Bn(0,t)),e.negative=t=>e.check(Mn(0,t)),e.nonpositive=t=>e.check(Gn(0,t)),e.multipleOf=(t,n)=>e.check(Vn(t,n)),e.step=(t,n)=>e.check(Vn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Li(e){return function(e,t){return new e({type:"number",checks:[],...Ze(t)})}(ji,e)}const Mi=G("ZodNumberFormat",((e,t)=>{tn.init(e,t),ji.init(e,t)}));function Gi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ze(t)})}(Mi,e)}const Hi=G("ZodBoolean",((e,t)=>{nn.init(e,t),mi.init(e,t)}));const Bi=G("ZodUnknown",((e,t)=>{on.init(e,t),mi.init(e,t)}));function Vi(){return new Bi({type:"unknown"})}const qi=G("ZodNever",((e,t)=>{rn.init(e,t),mi.init(e,t)}));function Yi(e){return function(e,t){return new e({type:"never",...Ze(t)})}(qi,e)}const Wi=G("ZodDate",((e,t)=>{an.init(e,t),mi.init(e,t),e.min=(t,n)=>e.check(Bn(t,n)),e.max=(t,n)=>e.check(Gn(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));const Qi=G("ZodArray",((e,t)=>{cn.init(e,t),mi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Yn(t,n)),e.nonempty=t=>e.check(Yn(1,t)),e.max=(t,n)=>e.check(qn(t,n)),e.length=(t,n)=>e.check(Wn(t,n)),e.unwrap=()=>e.element}));function Ji(e,t){return function(e,t,n){return new e({type:"array",element:t,...Ze(n)})}(Qi,e,t)}const Ki=G("ZodObject",((e,t)=>{fn.init(e,t),mi.init(e,t),Ee(e,"shape",(()=>t.shape)),e.keyof=()=>io(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Vi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Vi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Yi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Oe(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Te(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:[]});return Fe(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!Oe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Ae(this,"shape",n),n},checks:e._zod.def.checks};return Fe(e,n)}(e,t),e.merge=t=>function(e,t){const n=Te(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ae(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return Fe(e,Te(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return Ae(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=Te(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return Ae(this,"shape",i),i},checks:[]});return Fe(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const i=Te(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)o[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return Ae(this,"shape",o),o},checks:[]});return Fe(t,i)}(ao,e,t[0]),e.required=(...t)=>function(e,t,n){const i=Te(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)o[t]=new e({type:"nonoptional",innerType:i[t]});return Ae(this,"shape",o),o},checks:[]});return Fe(t,i)}(fo,e,t[0])}));function Xi(e,t){const n={type:"object",get shape(){var t;return Ae(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...Ze(t)};return new Ki(n)}const eo=G("ZodUnion",((e,t)=>{mn.init(e,t),mi.init(e,t),e.options=t.options}));const to=G("ZodIntersection",((e,t)=>{gn.init(e,t),mi.init(e,t)})),no=G("ZodEnum",((e,t)=>{_n.init(e,t),mi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new no({...t,checks:[],...Ze(i),entries:o})},e.exclude=(e,i)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new no({...t,checks:[],...Ze(i),entries:o})}}));function io(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new no({type:"enum",entries:n,...Ze(t)})}const oo=G("ZodTransform",((e,t)=>{Pn.init(e,t),mi.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new B(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(He(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(He(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then((e=>(n.value=e,n))):(n.value=o,n)}}));function ro(e){return new oo({type:"transform",transform:e})}const ao=G("ZodOptional",((e,t)=>{bn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function so(e){return new ao({type:"optional",innerType:e})}const co=G("ZodNullable",((e,t)=>{zn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function uo(e){return new co({type:"nullable",innerType:e})}const lo=G("ZodDefault",((e,t)=>{wn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap})),po=G("ZodPrefault",((e,t)=>{An.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),fo=G("ZodNonOptional",((e,t)=>{Tn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),ho=G("ZodCatch",((e,t)=>{Nn.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap})),mo=G("ZodPipe",((e,t)=>{Rn.init(e,t),mi.init(e,t),e.in=t.in,e.out=t.out}));function go(e,t){return new mo({type:"pipe",in:e,out:t})}const vo=G("ZodReadonly",((e,t)=>{On.init(e,t),mi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),yo=G("ZodCustom",((e,t)=>{xn.init(e,t),mi.init(e,t)}));function _o(e,t){return go(ro(e),t)}function Po(e,t,n){const i=t.safeParse(n);return i.success?i.data:(i.error.issues.forEach((t=>{const n=t.path.join(".");e.getFieldState(n)?e.setError(n,{type:"manual",message:t.message}):e.setError("root",{type:"manual",message:t.message})})),null)}const ko=e=>_o((e=>{if(e){if("string"==typeof e){const t=Number(e);return isNaN(t)?e:t}return e}}),e),bo=e=>_o((e=>{if(!e)return;let t;return"string"==typeof e&&(t=new Date(e)),e instanceof Date&&(t=e),t?(t.setUTCHours(0,0,0,0),t):e}),e),zo=e=>yi().min(1,{error:"Required"}).max(e,`Maximum length is ${e} characters`),wo=()=>ki("Invalid email address").min(1,"Required"),Eo=()=>ko(Li("Valid amount required").positive("Positive amount required")),Ao=()=>bo(function(e){return function(e,t){return new e({type:"date",...Ze(t)})}(Wi,e)}("Valid date required").min(new Date,"Date must be in the future")),To=e=>yi().max(e,`Maximum length is ${e} characters`),Co=Xi({address1:zo(100),address2:To(100).optional(),city:zo(50),state:To(50).optional(),postcode:To(20).optional(),country:zo(50)}),No=Xi({amount:Eo(),message:To(500).nullish(),giverFirstName:zo(50),giverLastName:zo(50),giverEmail:wo(),giverPhone:zo(31),giverAddress:Co,cardHolder:zo(101),recipientFirstName:To(50).nullish(),recipientLastName:To(50).nullish(),recipientEmail:ki("Invalid email address").nullish(),recipientPhone:To(31).nullish()}),Ro=No.extend({expiry:Ao(),notes:To(500).nullish()}),Io=Xi({balance:Eo(),expiry:Ao(),message:To(500).nullish(),notes:To(500).nullish(),giverFirstName:zo(50),giverLastName:zo(50),giverEmail:wo(),giverPhone:zo(31),cardHolder:zo(101),recipientEmail:ki("Invalid email address").nullish(),recipientPhone:To(31).nullish()});let Oo;!function(e){e.Passthrough="Passthrough",e.PaymentProcessor="PaymentProcessor"}(Oo||(Oo={}));const So=Xi({companyId:Li().int().positive(),amount:Eo(),currency:zo(3).default("AUD")}),xo=Xi({sessionId:zo(100),resultCode:zo(50),pspReference:To(100).optional()}),$o=Xi({cardHolder:zo(100),cardNumberToken:To(200),cardCvcToken:To(200),cardExpiry:To(5)}),Fo=No.extend({companyId:Li().int().positive(),sendViaEmail:function(e){return function(e,t){return new e({type:"boolean",...Ze(t)})}(Hi,e)}().default(!0),payment:xo.optional(),passthroughPayment:$o.optional()}),Zo=Xi({giftCardId:Li().int().positive(),reason:To(500).optional()}),Do=Xi({companyId:Li().int().positive().nullish(),code:zo(10),password:zo(10)}),Uo=Do.extend({amount:Eo(),description:zo(200)});let jo,Lo,Mo,Go,Ho,Bo;!function(e){e.Adyen="Adyen"}(jo||(jo={})),function(e){e.Pending="Pending",e.Authorized="Authorized",e.Captured="Captured",e.Failed="Failed",e.Refunded="Refunded"}(Lo||(Lo={})),function(e){e.Authorised="Authorised",e.Refused="Refused",e.Cancelled="Cancelled",e.Pending="Pending",e.Received="Received",e.Error="Error",e.IdentifyShopper="IdentifyShopper",e.ChallengeShopper="ChallengeShopper"}(Mo||(Mo={})),function(e){e.AUTHORISATION="AUTHORISATION",e.CAPTURE="CAPTURE",e.REFUND="REFUND",e.CANCELLATION="CANCELLATION",e.REFUND_FAILED="REFUND_FAILED",e.CAPTURE_FAILED="CAPTURE_FAILED"}(Go||(Go={})),function(e){e.Purchase="Purchase",e.Redemption="Redemption",e.Adjustment="Adjustment"}(Ho||(Ho={})),function(e){e.Pending="Pending",e.Complete="Complete",e.Cancelled="Cancelled",e.Expired="Expired"}(Bo||(Bo={}));const Vo=Xi({code:zo(10),token:zo(128)}),qo=Xi({companyId:Li().int().positive(),code:zo(10),token:zo(128)}),Yo=Xi({companyId:(Wo=ji,new Wo({type:"number",coerce:!0,checks:[],...Ze(void 0)})).int().positive()});var Wo;const Qo=Xi({giftCardPaymentType:io([Oo.Passthrough,Oo.PaymentProcessor])}),Jo=Xi({merchantAccount:zo(100),clientKey:zo(100),apiKey:To(200).optional(),webhookHmacKey:To(200).optional()}),Ko=Xi({grant_type:yi().readonly().default("refresh_token"),client_id:Ln(zi,void 0),client_secret:yi(),refresh_token:yi(),scope:yi().optional()}),Xo=Xi({email:ki(),firstName:yi().max(100).optional(),lastName:yi().max(100).optional(),phone:yi().max(20).optional(),scopes:Ji(yi()).optional()});let er;!function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(er||(er={}));const tr=[er.PER_NIGHT,er.PER_PERSON_PER_NIGHT,er.PER_QUANTITY_NAME_PER_NIGHT,er.PER_ROOM_QUANTITY_PER_NIGHT,er.PER_PERSON_OCCUPANCY_PER_NIGHT,er.PER_ADULT_OCCUPANCY_PER_NIGHT,er.PER_CHILD_OCCUPANCY_PER_NIGHT,er.PER_ALL_PERSONS_PER_NIGHT];let nr,ir,or;!function(e){e.Critical="Critical",e.Error="Error",e.Warn="Warn",e.Info="Info"}(nr||(nr={})),function(e){e.Debug="Diagnostics",e.Security="Security",e.Audit="Audit"}(ir||(ir={})),function(e){e.General="General",e.Authenticated="Token Authenticated",e.Unauthorized="Unauthorized Access",e.RefreshToken="Refresh Token Created",e.AccessToken="Access Token Created",e.Revoked="Token Revoked",e.UserCreated="User Created",e.UserLinked="User Linked to Company",e.Purchase="Gift Card Purchased",e.Payment="Payment",e.Email="Email Delivery",e.Transaction="Gift Card Transaction"}(or||(or={}));const rr=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const i of n)t+=e.nights[i].total}return t};var ar=i(60),sr=i.n(ar);const cr={UP:sr().ROUND_UP,DOWN:sr().ROUND_DOWN,CEIL:sr().ROUND_CEIL,FLOOR:sr().ROUND_FLOOR,HALF_UP:sr().ROUND_HALF_UP,HALF_DOWN:sr().ROUND_HALF_DOWN,HALF_EVEN:sr().ROUND_HALF_EVEN,HALF_CEIL:sr().ROUND_HALF_CEIL,HALF_FLOOR:sr().ROUND_HALF_FLOOR},ur=(e,t)=>{const{precision:n=2,rounding:i=cr.HALF_UP}=t||{};return new(sr())(e).toDecimalPlaces(n,i).toNumber()};function dr(e,t={}){const{baseAmount:n=0,numberOfNights:i=1,feeIncludedInBaseAmount:o=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=ur(n);switch(e.feeType){case $.PercentageOfBooking:if(o)return ur(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return ur(s/(1-t)*e.amount/(100+e.amount))}return ur(s*(e.amount/100));case $.FixedChargePerRoom:case $.FixedChargePerBooking:return e.amount;case $.NightlyChargePerRoom:return ur(e.amount*i);default:return 0}}const lr=[$.FixedChargePerBooking],pr=[$.PercentageOfBooking,$.FixedChargePerRoom,$.NightlyChargePerRoom],fr=[$.PercentageOfBooking];function hr(e,t){return e.filter((e=>t.includes(e.feeType)))}function mr(e){return hr(e,lr)}function gr(e){return hr(e,pr)}function vr(e){return hr(e,fr)}function yr(e){return{includeInRates:[$.PercentageOfBooking,$.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===$.PercentageOfBooking,appliesToAddons:e===$.PercentageOfBooking,includePreviousFeesInCalculation:e===$.PercentageOfBooking}}const _r=e=>e,Pr=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},kr=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class br{}function zr(e){return e.toUpperCase()}br.calculateBaseAddonTotal=(e,t)=>{let n=0,i=0,o=0;e.price&&e.quantity&&(n=e.quantity*Number(e.price)),e.pricingType===er.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?n*=e.adultQuantity:e.pricingType===er.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(n*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(i=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(o=e.childQuantity*Number(e.childPrice));let r=n+i+o;return tr.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:n,indAdultPrice:i,indChildPrice:o,addonTotal:r}},br.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=br.calculateBaseAddonTotal(n,t);let o=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{o+=n.quantity*e.amount})):o=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{o+=n.adultQuantity*e.amount})):o+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{o+=n.childQuantity??1*e.amount})):o+=n.childQuantity*Number(n.childFee))),tr.includes(n.pricingType)&&n.nights&&!t&&(o*=n.nights),{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+o,total:e.total+i.addonTotal+o}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),br.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=br.calculateBaseAddonTotal(n,t);let o,r=n.discount||0;o=void 0!==n.total&&null!==n.total?n.total:i.addonTotal-r;let a=n.fees||0;n.itemisedFees?.length&&(a=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const s=n.itemisedFees?.length?o:o+a;return{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+o+a,displayPrice:e.displayPrice+s}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),br.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const i=Object.keys(e.nights)?.length??0;if(n+=e.fees??0,e.addons?.length){const o=(e.addons??[]).map((e=>({...e,nights:i})));n+=br.calculateReservationAddonTotal(o,t)?.total}})),ur(n)},br.calculateTotalExcludingDuplicateFees=(e,t)=>{if(!e)return 0;if("total"in e)return ur(e.total?.afterTax||0);const{reservations:n,itemisedFees:i}=e;if(!n?.length)return 0;let o=0;return n.forEach((e=>{o+=e.total.afterTax;const n=Object.keys(e.nights)?.length??0;e.addons?.forEach((e=>{const i=br.calculateBaseAddonTotal({...e,nights:n},t);o+=i.addonTotal-(e.discount||0)}))})),i?.forEach((e=>{o+=e.amount})),ur(o)}})(),o})()));
1
+ define("@roomstay/core",["decimal.js"],(e=>(()=>{"use strict";var t={60:t=>{t.exports=e}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{let e,t,n,r,a;i.r(o),i.d(o,{ADDON_PER_NIGHT_TYPES:()=>nr,AddGiftCardSchema:()=>Io,AdyenEventCode:()=>Bo,AdyenResultCode:()=>Go,BaseGiftCardSchema:()=>Ro,CancelGiftCardTransactionSchema:()=>Yo,CompleteGiftCardTransactionSchema:()=>qo,CreatePaymentSessionSchema:()=>xo,DATE_FORMAT:()=>x,EAddonPricingType:()=>tr,EAdminCompanyUserRole:()=>p,EBookingFlow:()=>t,EBookingPaymentMethod:()=>n,EBookingStatus:()=>e,ECompanyProvider:()=>l,EDistanceUnitType:()=>_,EFeeType:()=>F,EGiftCardPaymentProvider:()=>Lo,EGiftCardPaymentStatus:()=>Mo,EGiftCardPaymentType:()=>So,EGiftCardTransactionType:()=>Ho,EGuaranteePolicyDepositMode:()=>A,EGuarantyPolicyPrepaymentType:()=>T,EHotelAddressRequirement:()=>f,EHotelCardProcessor:()=>r,EHotelPriceModel:()=>h,EHotelStateFieldConfiguration:()=>m,EHotelWeekdayStartsOn:()=>g,EIntegration:()=>v,ELogCategory:()=>or,ELogSeverity:()=>ir,ELogType:()=>rr,ENewbookSyncStrategy:()=>b,EPMSSyncStatus:()=>z,EPlanpayBookingStatus:()=>a,EPromoCodeDiscountType:()=>C,EPromoCodeStayDateRangeRepeatType:()=>R,EPromoCodeStayDateRangeType:()=>N,ERMSDiscountType:()=>P,ERMSSyncStrategy:()=>k,ERoomstayEventName:()=>Z,ERoomstayEventSource:()=>I,ERoomstayImageSize:()=>w,ETransactionStatus:()=>Vo,EditGiftCardSchema:()=>Oo,GetCompanyConfigSchema:()=>Wo,GuestProfile:()=>d,HttpMethod:()=>$,IAuxiliaryFilterType:()=>y,IMaintenanceStatusService:()=>E,InternationalAddressSchema:()=>No,ItineraryResponse:()=>c,META_USER_DATA_KEYS:()=>D,PCIBookingCardProcessorTypes:()=>s,Package:()=>O,PassthroughPaymentDataSchema:()=>Fo,PaymentProcessorDataSchema:()=>$o,PurchaseGiftCardSchema:()=>Zo,RedeemGiftCardSchema:()=>jo,RefreshGiftCardTokenSchema:()=>Xo,RefundGiftCardSchema:()=>Do,RegisterGiftCardAdminSchema:()=>er,Reservation:()=>u,ReservedPackage:()=>S,RoundingType:()=>ur,TotalCalculator:()=>zr,UpdateAdyenConfigSchema:()=>Ko,UpdateCompanyConfigSchema:()=>Jo,ValidateGiftCardSchema:()=>Uo,buildPixelEventOptions:()=>G,calculateFeeAmount:()=>lr,calculateTotalForMemberBooking:()=>ar,getFeeOptionValidity:()=>_r,getFilteredBookingAddonFees:()=>yr,getFilteredBookingFees:()=>gr,getFilteredBookingRateFees:()=>vr,maxString:()=>Co,nameof:()=>Pr,preprocessDate:()=>zo,preprocessNumber:()=>bo,requireEmail:()=>Eo,requireFutureDate:()=>To,requirePositiveAmount:()=>Ao,requireString:()=>wo,resizeRoomstayImageUrl:()=>br,roundMoney:()=>dr,subset:()=>kr,toMetaEventName:()=>U,transformToMetaEventData:()=>L,transformToMetaUserData:()=>M,uppercaseString:()=>wr,validateFormWithZod:()=>ko}),function(e){e.Pending="Pending",e.Processing="Processing",e.Committed="Committed",e.Cancelled="Cancelled",e.Reverted="Reverted"}(e||(e={})),function(e){e.Default="Default",e.PreCheckoutPencil="PreCheckoutPencil",e.PostCheckoutPencil="PostCheckoutPencil"}(t||(t={})),function(e){e.Card="Card",e.SavedCard="SavedCard",e.Planpay="Planpay",e.Adyen="Adyen",e.Afterpay="Afterpay",e.PCIBookingCard="PCIBookingCard",e.TrueRewards="TrueRewards"}(n||(n={})),function(e){e.Passthrough="Passthrough",e.Adyen="Adyen",e.Till="Till",e.RMSPay="RMSPay",e.Windcave="Windcave",e.Mastercard="Mastercard",e.Stripe="Stripe",e.PayPal="PayPal"}(r||(r={})),function(e){e.Unknown="unknown",e.Unpaid="unpaid",e.Accepted="accepted",e.Cancelled="cancelled",e.Refunded="refunded",e.Rejected="rejected"}(a||(a={}));const s=[];class c{constructor(){this.roomstayId=void 0,this.itineraryNumber=void 0,this.total=void 0,this.hotelFrontendId=void 0,this.reservations=[],this.payment=void 0,this.feesSummary=void 0,this.itemisedFees=void 0,this.warnings=void 0}}class u{constructor(){this.reservationNumber=void 0,this.roomType=void 0,this.roomCode=void 0,this.rate=void 0,this.rateCode=void 0,this.images=void 0,this.guaranteePolicy=void 0,this.cancellationPolicy=void 0,this.checkInDate=void 0,this.checkOutDate=void 0,this.nights={},this.guestCounts={adults:1,children:0},this.guest=new d,this.paymentCard=void 0,this.paymentMethod=void 0,this.total=void 0,this.status=void 0,this.isCancelable=void 0,this.addons=void 0,this.comments=void 0,this.specialRequests=void 0,this.promoCode=void 0,this.guaranteePolicyLongDescription=void 0,this.cancellationPolicyLongDescription=void 0,this.itemisedFees=void 0}}class d{constructor(){this.title=void 0,this.firstName=void 0,this.middleName=void 0,this.lastName=void 0,this.nameSuffix=void 0,this.phone=void 0,this.email=void 0,this.address={},this.marketingOptIn=void 0,this.country=void 0}}let l,p,f,h,m,g,v,y,_,P,k,b,z,w,E,A,T,C,N,R,I;!function(e){e.Synxis="Synxis",e.Availpro="Availpro",e.RMS="RMS",e.Siteminder="Siteminder",e.Roomstay="Roomstay",e.OHIP="OHIP",e.Newbook="Newbook"}(l||(l={})),function(e){e.SuperAdmin="SuperAdmin",e.Admin="Admin",e.Limited="Limited"}(p||(p={})),function(e){e.FullAddressRequired="FullAddressRequired",e.AddressOptionalCountryRequired="AddressOptionalCountryRequired",e.AddressOptional="AddressOptional"}(f||(f={})),function(e){e.PerPerson="PerPerson",e.PerDay="PerDay",e.PerOccupancy="PerOccupancy"}(h||(h={})),function(e){e.NotIncluded="NotIncluded",e.Optional="Optional",e.Required="Required"}(m||(m={})),function(e){e.Monday="monday",e.Sunday="sunday"}(g||(g={})),function(e){e.Big4="Big4",e.RmsTop10="Top10",e.Top10="NewTop10",e.Gday="Gday",e.Salesforce="Salesforce",e.RAC="RAC",e.AnalyticsEvents="AnalyticsEvents"}(v||(v={})),function(e){e.AreaDwellingLength="AreaDwellingLength",e.AreaDwellingType="AreaDwellingType"}(y||(y={})),function(e){e.Metric="metric",e.Imperial="imperial"}(_||(_={})),function(e){e.Percentage="Percentage",e.Amount="Amount",e.Bogo="BOGO",e.NightlyRateOverride="NightlyRateOverride"}(P||(P={})),function(e){e.Hotel="hotel",e.HotelImages="hotelImages",e.Cancellation="cancellation",e.Room="room",e.Rates="rates",e.OneGuaranteePolicy="oneGuaranteePolicy",e.RoomRates="roomRates",e.RoomImages="roomImages",e.BookingSources="booking-sources",e.Areas="areas",e.Dwellings="dwellings",e.AreaDwellings="areaDwellings",e.ConvertDwellingConfigToAuxInput="convertDwellingConfigToAuxInput",e.Discounts="discounts",e.PropertyDiscounts="propertyDiscounts",e.RoomDiscounts="roomDiscounts",e.PropertySundries="propertySundries",e.PropertyFees="propertyFees",e.PropertyCards="property-cards",e.Countries="countries",e.Addons="addons",e.Requirements="requirements",e.RoomAddons="room-addons",e.ClientFacingPromoSync="clientFacingPromoSync",e.ClientFacingRoomSync="clientFacingRoomSync",e.ClientFacingRateSync="clientFacingRateSync",e.NewRateFetch="newRateFetch"}(k||(k={})),function(e){e.Rates="rates",e.Rooms="rooms",e.Availability="availability"}(b||(b={})),function(e){e.New="new",e.Queued="queued",e.InProgress="in_progress",e.Success="success",e.Failure="failure",e.RequireResume="require_resume"}(z||(z={})),function(e){e[e.Icon=128]="Icon",e[e.Tiny=256]="Tiny",e[e.Small=512]="Small",e[e.Medium=768]="Medium",e[e.Large=1024]="Large",e[e.ExtraLarge=1600]="ExtraLarge"}(w||(w={})),function(e){e.Frontend="frontend",e.Hotel="hotel",e.Events="events"}(E||(E={}));class O{constructor(){this.ratePlanCode=void 0,this.name=void 0,this.description=void 0,this.inclusive=void 0,this.image=void 0,this.url=void 0,this.pricingType=void 0,this.quantity=void 0,this.category=void 0,this.cancelPenalty=void 0,this.guaranteeDescription=void 0,this.availability={}}}class S extends O{constructor(...e){super(...e),this.code=void 0,this.price=void 0,this.fees=void 0,this.itemisedFees=void 0,this.adultQuantity=void 0,this.childQuantity=void 0,this.adultPrice=void 0,this.childPrice=void 0,this.startDate=void 0,this.startTime=void 0,this.hideDatePicker=!1,this.hideQuantity=!1,this.order=void 0,this.discount=void 0,this.total=void 0}}!function(e){e.Full="Full",e.Percentage="Percentage",e.FirstNight="FirstNight",e.None="None"}(A||(A={})),function(e){e.FixedAmount="fixed",e.Percentage="percentage",e.Nights="nights"}(T||(T={})),function(e){e.FlatPercent="flatPercent",e.FlatQuantity="flatQuantity",e.FlatQuantityPerStay="flatQuantityPerStay"}(C||(C={})),function(e){e.Allowed="Allowed",e.Blocked="Blocked"}(N||(N={})),function(e){e.None="None",e.Weekly="Weekly",e.MonthlyDayOfWeek="MonthlyDayOfWeek",e.MonthlyDate="MonthlyDate",e.Yearly="Yearly"}(R||(R={})),function(e){e.Eventbrite="eventbrite",e.ATDW="atdw"}(I||(I={}));const x="DD/MM/YYYY";let $,F,Z;!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.HEAD="HEAD"}($||($={})),function(e){e.PercentageOfBooking="PercentageOfBooking",e.FixedChargePerRoom="FixedChargePerRoom",e.NightlyChargePerRoom="NightlyChargePerRoom",e.FixedChargePerBooking="FixedChargePerBooking",e.DepositSurcharge="DepositSurcharge"}(F||(F={})),function(e){e.BasketAdd="Basket/Add",e.BasketAddAddon="Basket/AddAddon",e.ViewCheckout="View/Checkout",e.BookingCommitted="Booking/Committed"}(Z||(Z={}));const D=["em","ph","fn","ln","ct","st","zp","country","external_id"];function U(e){return{[Z.BasketAdd]:"AddToCart",[Z.BasketAddAddon]:"AddToCart",[Z.ViewCheckout]:"InitiateCheckout",[Z.BookingCommitted]:"Purchase"}[e]}function j(e,t,n){let i=0;const o=[],r=[];for(const t of e)i+=t.totalPrice,t.roomCode&&(o.push(t.roomCode),r.push({id:t.roomCode,quantity:1,item_price:t.totalPrice}));if(t)for(const e of t)i+=e.totalPrice,e.addonCode&&(o.push(e.addonCode),r.push({id:e.addonCode,quantity:e.quantity,item_price:e.unitPrice}));return{currency:n,value:i,content_ids:o,content_type:"hotel",contents:r,num_items:e.length+(t?.length??0)}}function L(e){if("addon"in e)return t=e.addon,{currency:e.currency,value:t.totalPrice,content_ids:t.addonCode?[t.addonCode]:[],content_type:"hotel",contents:t.addonCode?[{id:t.addonCode,quantity:t.quantity,item_price:t.unitPrice}]:[],num_items:1};var t;if("item"in e)return j([e.item],void 0,e.currency);if("items"in e){const t=e,n=j(t.items,t.addons,e.currency);return"itineraryNumber"in t&&(n.order_id=t.itineraryNumber),n}throw new Error("Invalid event data")}function M(e){return{em:e.email,ph:e.phone,fn:e.firstName,ln:e.lastName,ct:e.city,st:e.state,zp:e.postalCode,country:e.country,external_id:e.externalId}}function G(e,t){const n={eventID:e};if(t)for(const e of D)t[e]&&(n[e]=t[e]);return n}function B(e,t,n){function i(n,i){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,i);for(const e in a.prototype)e in n||Object.defineProperty(n,e,{value:a.prototype[e].bind(n)});n._zod.constr=a,n._zod.def=i}const o=n?.Parent??Object;class r extends o{}function a(e){var t;const o=n?.Parent?new r:this;i(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const e of o._zod.deferred)e();return o}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}Object.freeze({status:"aborted"}),Symbol("zod_brand");class H extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class V extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const q={};function Y(e){return e&&Object.assign(q,e),q}const W=/^[cC][^\s-]{8,}$/,Q=/^[0-9a-z]+$/,J=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,K=/^[0-9a-vA-V]{20}$/,X=/^[A-Za-z0-9]{27}$/,ee=/^[a-zA-Z0-9_-]{21}$/,te=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ne=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,oe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,re=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ae=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,se=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ce=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ue=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,de=/^[A-Za-z0-9_-]*$/,le=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,pe=/^\+(?:[0-9]){6,14}[0-9]$/,fe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",he=new RegExp(`^${fe}$`);function me(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ge=/^\d+$/,ve=/^-?\d+(?:\.\d+)?/i,ye=/true|false/i,_e=/^[^A-Z]*$/,Pe=/^[^a-z]*$/;function ke(e,t){return"bigint"==typeof t?t.toString():t}function be(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ze(e){return null==e}function we(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Ee=Symbol("evaluating");function Ae(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Ee)return void 0===i&&(i=Ee,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Te(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ce(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ne(e){return JSON.stringify(e)}const Re="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ie(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const Oe=be((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function Se(e){if(!1===Ie(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==Ie(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function xe(e){return Se(e)?{...e}:e}const $e=new Set(["string","number","symbol"]);function Fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function De(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}new Set(["string","number","bigint","boolean","symbol","undefined"]);const Ue={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function je(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Le(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function Me(e){return"string"==typeof e?e:e?.message}function Ge(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const o=Me(e.inst?._zod.def?.error?.(e))??Me(t?.error?.(e))??Me(n.customError?.(e))??Me(n.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Be(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function He(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const Ve=B("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),qe={number:"number",bigint:"bigint",object:"date"},Ye=B("$ZodCheckLessThan",((e,t)=>{Ve.init(e,t);const n=qe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),We=B("$ZodCheckGreaterThan",((e,t)=>{Ve.init(e,t);const n=qe[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),Qe=B("$ZodCheckMultipleOf",((e,t)=>{Ve.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let o=(i.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const r=n>o?n:o;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),Je=B("$ZodCheckNumberFormat",((e,t)=>{Ve.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[o,r]=Ue[t.format];e._zod.onattach.push((e=>{const i=e._zod.bag;i.format=t.format,i.minimum=o,i.maximum=r,n&&(i.pattern=ge)})),e._zod.check=a=>{const s=a.value;if(n){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>r&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:r,inst:e})}})),Ke=B("$ZodCheckMaxLength",((e,t)=>{var n;Ve.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const o=Be(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),Xe=B("$ZodCheckMinLength",((e,t)=>{var n;Ve.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const o=Be(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}})),et=B("$ZodCheckLengthEquals",((e,t)=>{var n;Ve.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ze(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const r=Be(i),a=o>t.length;n.issues.push({origin:r,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),tt=B("$ZodCheckStringFormat",((e,t)=>{var n,i;Ve.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})})),nt=B("$ZodCheckRegex",((e,t)=>{tt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),it=B("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=_e),tt.init(e,t)})),ot=B("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=Pe),tt.init(e,t)})),rt=B("$ZodCheckIncludes",((e,t)=>{Ve.init(e,t);const n=Fe(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),at=B("$ZodCheckStartsWith",((e,t)=>{Ve.init(e,t);const n=new RegExp(`^${Fe(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),st=B("$ZodCheckEndsWith",((e,t)=>{Ve.init(e,t);const n=new RegExp(`.*${Fe(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}})),ct=B("$ZodCheckOverwrite",((e,t)=>{Ve.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class ut{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),i=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const dt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ke,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lt=B("$ZodError",dt),pt=B("$ZodError",dt,{Parent:Error}),ft=e=>(t,n,i,o)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise)throw new H;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Ge(e,r,Y()))));throw Re(t,o?.callee),t}return a.value},ht=e=>async(t,n,i,o)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},r);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map((e=>Ge(e,r,Y()))));throw Re(t,o?.callee),t}return a.value},mt=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new H;return r.issues.length?{success:!1,error:new(e??lt)(r.issues.map((e=>Ge(e,o,Y()))))}:{success:!0,data:r.value}},gt=mt(pt),vt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>Ge(e,o,Y()))))}:{success:!0,data:r.value}},yt=vt(pt),_t=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ft(e)(t,n,o)},Pt=e=>(t,n,i)=>ft(e)(t,n,i),kt=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ht(e)(t,n,o)},bt=e=>async(t,n,i)=>ht(e)(t,n,i),zt=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return mt(e)(t,n,o)},wt=e=>(t,n,i)=>mt(e)(t,n,i),Et=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return vt(e)(t,n,o)},At=e=>async(t,n,i)=>vt(e)(t,n,i),Tt={major:4,minor:1,patch:5},Ct=B("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tt;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let i,o=je(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=r._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new H;if(i||a instanceof Promise)i=(i??Promise.resolve()).then((async()=>{await a,e.issues.length!==t&&(o||(o=je(e,t)))}));else{if(e.issues.length===t)continue;o||(o=je(e,t))}}return i?i.then((()=>e)):e},n=(n,o,r)=>{if(je(n))return n.aborted=!0,n;const a=t(o,i,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((t=>e._zod.parse(t,r)))}return e._zod.parse(a,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const t=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,o,r))):n(t,o,r)}const a=e._zod.parse(o,r);if(a instanceof Promise){if(!1===r.async)throw new H;return a.then((e=>t(e,i,r)))}return t(a,i,r)}}e["~standard"]={validate:t=>{try{const n=gt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return yt(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1}})),Nt=B("$ZodString",((e,t)=>{var n;Ct.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),Rt=B("$ZodStringFormat",((e,t)=>{tt.init(e,t),Nt.init(e,t)})),It=B("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=ne),Rt.init(e,t)})),Ot=B("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(e))}else t.pattern??(t.pattern=ie());Rt.init(e,t)})),St=B("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=oe),Rt.init(e,t)})),xt=B("$ZodURL",((e,t)=>{Rt.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),o=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:le.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),$t=B("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Rt.init(e,t)})),Ft=B("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=ee),Rt.init(e,t)})),Zt=B("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=W),Rt.init(e,t)})),Dt=B("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=Q),Rt.init(e,t)})),Ut=B("$ZodULID",((e,t)=>{t.pattern??(t.pattern=J),Rt.init(e,t)})),jt=B("$ZodXID",((e,t)=>{t.pattern??(t.pattern=K),Rt.init(e,t)})),Lt=B("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=X),Rt.init(e,t)})),Mt=B("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=function(e){const t=me({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${fe}T(?:${i})$`)}(t)),Rt.init(e,t)})),Gt=B("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=he),Rt.init(e,t)})),Bt=B("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=new RegExp(`^${me(t)}$`)),Rt.init(e,t)})),Ht=B("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=te),Rt.init(e,t)})),Vt=B("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=re),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv4"}))})),qt=B("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=ae),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.format="ipv6"})),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),Yt=B("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=se),Rt.init(e,t)})),Wt=B("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=ce),Rt.init(e,t),e._zod.check=n=>{const[i,o]=n.value.split("/");try{if(!o)throw new Error;const e=Number(o);if(`${e}`!==o)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function Qt(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Jt=B("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=ue),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64"})),e._zod.check=n=>{Qt(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),Kt=B("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=de),Rt.init(e,t),e._zod.onattach.push((e=>{e._zod.bag.contentEncoding="base64url"})),e._zod.check=n=>{(function(e){if(!de.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Qt(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),Xt=B("$ZodE164",((e,t)=>{t.pattern??(t.pattern=pe),Rt.init(e,t)})),en=B("$ZodJWT",((e,t)=>{Rt.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),tn=B("$ZodNumber",((e,t)=>{Ct.init(e,t),e._zod.pattern=e._zod.bag.pattern??ve,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const r="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...r?{received:r}:{}}),n}})),nn=B("$ZodNumber",((e,t)=>{Je.init(e,t),tn.init(e,t)})),on=B("$ZodBoolean",((e,t)=>{Ct.init(e,t),e._zod.pattern=ye,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}})),rn=B("$ZodUnknown",((e,t)=>{Ct.init(e,t),e._zod.parse=e=>e})),an=B("$ZodNever",((e,t)=>{Ct.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),sn=B("$ZodDate",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const o=n.value,r=o instanceof Date;return r&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...r?{received:"Invalid Date"}:{},inst:e}),n}}));function cn(e,t,n){e.issues.length&&t.issues.push(...Le(n,e.issues)),t.value[n]=e.value}const un=B("$ZodArray",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const r=[];for(let e=0;e<o.length;e++){const a=o[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?r.push(s.then((t=>cn(t,n,e)))):cn(s,n,e)}return r.length?Promise.all(r).then((()=>n)):n}}));function dn(e,t,n,i){e.issues.length&&t.issues.push(...Le(n,e.issues)),void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function ln(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape[n]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter((e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout)));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function pn(e,t,n,i,o,r){const a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type;for(const o of Object.keys(t)){if(s.has(o))continue;if("never"===u){a.push(o);continue}const r=c.run({value:t[o],issues:[]},i);r instanceof Promise?e.push(r.then((e=>dn(e,n,o,t)))):dn(r,n,o,t)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:r}),e.length?Promise.all(e).then((()=>n)):n}const fn=B("$ZodObject",((e,t)=>{Ct.init(e,t);const n=be((()=>ln(t)));Ae(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n}));const i=Ie,o=t.catchall;let r;e._zod.parse=(t,a)=>{r??(r=n.value);const s=t.value;if(!i(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const c=[],u=r.shape;for(const e of r.keys){const n=u[e]._zod.run({value:s[e],issues:[]},a);n instanceof Promise?c.push(n.then((n=>dn(n,t,e,s)))):dn(n,t,e,s)}return o?pn(c,s,t,a,n.value,e):c.length?Promise.all(c).then((()=>t)):t}})),hn=B("$ZodObjectJIT",((e,t)=>{fn.init(e,t);const n=e._zod.parse,i=be((()=>ln(t)));let o;const r=Ie,a=!q.jitless,s=a&&Oe.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=i.value);const p=d.value;return r(p)?a&&s&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new ut(["shape","payload","ctx"]),n=i.value,o=e=>{const t=Ne(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let a=0;for(const e of n.keys)r[e]="key_"+a++;t.write("const newResult = {}");for(const e of n.keys){const n=r[e],i=Ne(e);t.write(`const ${n} = ${o(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)})(t.shape)),d=o(d,l),c?pn([],p,d,l,u,e):d):n(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}}));function mn(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const o=e.filter((e=>!je(e)));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Ge(e,i,Y())))))}),t)}const gn=B("$ZodUnion",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),Ae(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),Ae(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),Ae(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>we(e.source))).join("|")})$`)}}));const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(o,r)=>{if(n)return i(o,r);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},r);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then((t=>mn(t,o,e,r))):mn(s,o,e,r)}})),vn=B("$ZodIntersection",((e,t)=>{Ct.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,o=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then((([t,n])=>_n(e,t,n))):_n(e,o,r)}}));function yn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Se(e)&&Se(t)){const n=Object.keys(t),i=Object.keys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const n of i){const i=yn(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};o[n]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=yn(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _n(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),je(e))return e;const i=yn(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Pn=B("$ZodEnum",((e,t)=>{Ct.init(e,t);const n=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter((e=>$e.has(typeof e))).map((e=>"string"==typeof e?Fe(e):e.toString())).join("|")})$`),e._zod.parse=(t,o)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}})),kn=B("$ZodTransform",((e,t)=>{Ct.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new V(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then((e=>(n.value=e,n)));if(o instanceof Promise)throw new H;return n.value=o,n}}));function bn(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const zn=B("$ZodOptional",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),Ae(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${we(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((t=>bn(t,e.value))):bn(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),wn=B("$ZodNullable",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),Ae(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${we(e.source)}|null)$`):void 0})),Ae(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),En=B("$ZodDefault",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((e=>An(e,t))):An(i,t)}}));function An(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tn=B("$ZodPrefault",((e,t)=>{Ct.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Cn=B("$ZodNonOptional",((e,t)=>{Ct.init(e,t),Ae(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then((t=>Nn(t,e))):Nn(o,e)}}));function Nn(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Rn=B("$ZodCatch",((e,t)=>{Ct.init(e,t),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),Ae(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then((i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Ge(e,n,Y())))},input:e.value}),e.issues=[]),e))):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map((e=>Ge(e,n,Y())))},input:e.value}),e.issues=[]),e)}})),In=B("$ZodPipe",((e,t)=>{Ct.init(e,t),Ae(e._zod,"values",(()=>t.in._zod.values)),Ae(e._zod,"optin",(()=>t.in._zod.optin)),Ae(e._zod,"optout",(()=>t.out._zod.optout)),Ae(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then((e=>On(e,t.in,n))):On(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then((e=>On(e,t.out,n))):On(i,t.out,n)}}));function On(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Sn=B("$ZodReadonly",((e,t)=>{Ct.init(e,t),Ae(e._zod,"propValues",(()=>t.innerType._zod.propValues)),Ae(e._zod,"values",(()=>t.innerType._zod.values)),Ae(e._zod,"optin",(()=>t.innerType._zod.optin)),Ae(e._zod,"optout",(()=>t.innerType._zod.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(xn):xn(i)}}));function xn(e){return e.value=Object.freeze(e.value),e}const $n=B("$ZodCustom",((e,t)=>{Ve.init(e,t),Ct.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then((t=>Fn(t,n,i,e)));Fn(o,n,i,e)}}));function Fn(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(He(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class Zn{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Dn(){return new Zn}const Un=Dn();function jn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function Ln(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function Mn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function Gn(e,t){return new Ye({check:"less_than",...De(t),value:e,inclusive:!1})}function Bn(e,t){return new Ye({check:"less_than",...De(t),value:e,inclusive:!0})}function Hn(e,t){return new We({check:"greater_than",...De(t),value:e,inclusive:!1})}function Vn(e,t){return new We({check:"greater_than",...De(t),value:e,inclusive:!0})}function qn(e,t){return new Qe({check:"multiple_of",...De(t),value:e})}function Yn(e,t){return new Ke({check:"max_length",...De(t),maximum:e})}function Wn(e,t){return new Xe({check:"min_length",...De(t),minimum:e})}function Qn(e,t){return new et({check:"length_equals",...De(t),length:e})}function Jn(e){return new ct({check:"overwrite",tx:e})}const Kn=B("ZodISODateTime",((e,t)=>{Mt.init(e,t),Pi.init(e,t)}));const Xn=B("ZodISODate",((e,t)=>{Gt.init(e,t),Pi.init(e,t)}));const ei=B("ZodISOTime",((e,t)=>{Bt.init(e,t),Pi.init(e,t)}));const ti=B("ZodISODuration",((e,t)=>{Ht.init(e,t),Pi.init(e,t)}));const ni=(e,t)=>{lt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},i={_errors:[]},o=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map((e=>o({issues:e})));else if("invalid_key"===t.code)o({issues:t.issues});else if("invalid_element"===t.code)o({issues:t.issues});else if(0===t.path.length)i._errors.push(n(t));else{let e=i,o=0;for(;o<t.path.length;){const i=t.path[o];o===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(n(t))):e[i]=e[i]||{_errors:[]},e=e[i],o++}}};return o(e),i}(e,t)},flatten:{value:t=>function(e,t=(e=>e.message)){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ke,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ke,2)}},isEmpty:{get:()=>0===e.issues.length}})},ii=(B("ZodError",ni),B("ZodError",ni,{Parent:Error})),oi=ft(ii),ri=ht(ii),ai=mt(ii),si=vt(ii),ci=_t(ii),ui=Pt(ii),di=kt(ii),li=bt(ii),pi=zt(ii),fi=wt(ii),hi=Et(ii),mi=At(ii),gi=B("ZodType",((e,t)=>(Ct.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),e.clone=(t,n)=>Ze(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>oi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ai(e,t,n),e.parseAsync=async(t,n)=>ri(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>si(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ci(e,t,n),e.decode=(t,n)=>ui(e,t,n),e.encodeAsync=async(t,n)=>di(e,t,n),e.decodeAsync=async(t,n)=>li(e,t,n),e.safeEncode=(t,n)=>pi(e,t,n),e.safeDecode=(t,n)=>fi(e,t,n),e.safeEncodeAsync=async(t,n)=>hi(e,t,n),e.safeDecodeAsync=async(t,n)=>mi(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}(_o,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e,t){const n=new Ve({check:"custom",...De(void 0)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(He(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(He(i))}},e(n.value,n))));return t}(t)),e.overwrite=t=>e.check(Jn(t)),e.optional=()=>co(e),e.nullable=()=>lo(e),e.nullish=()=>co(lo(e)),e.nonoptional=t=>function(e,t){return new ho({type:"nonoptional",innerType:e,...De(t)})}(e,t),e.array=()=>Ki(e),e.or=t=>function(e,t){return new to({type:"union",options:e,...De(t)})}([e,t]),e.and=t=>new no({type:"intersection",left:e,right:t}),e.transform=t=>vo(e,ao(t)),e.default=t=>{return n=t,new po({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():xe(n)}});var n},e.prefault=t=>{return n=t,new fo({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():xe(n)}});var n},e.catch=t=>{return new mo({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>vo(e,t),e.readonly=()=>new yo({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Un.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Un.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Un.get(e);const n=e.clone();return Un.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e))),vi=B("_ZodString",((e,t)=>{Nt.init(e,t),gi.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new nt({check:"string_format",format:"regex",...De(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new rt({check:"string_format",format:"includes",...De(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new at({check:"string_format",format:"starts_with",...De(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new st({check:"string_format",format:"ends_with",...De(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Wn(...t)),e.max=(...t)=>e.check(Yn(...t)),e.length=(...t)=>e.check(Qn(...t)),e.nonempty=(...t)=>e.check(Wn(1,...t)),e.lowercase=t=>e.check(function(e){return new it({check:"string_format",format:"lowercase",...De(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ot({check:"string_format",format:"uppercase",...De(e)})}(t)),e.trim=()=>e.check(Jn((e=>e.trim()))),e.normalize=(...t)=>e.check(function(e){return Jn((t=>t.normalize(e)))}(...t)),e.toLowerCase=()=>e.check(Jn((e=>e.toLowerCase()))),e.toUpperCase=()=>e.check(Jn((e=>e.toUpperCase())))})),yi=B("ZodString",((e,t)=>{Nt.init(e,t),vi.init(e,t),e.email=t=>e.check(jn(ki,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}(Ei,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}(ji,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}(Ai,t)),e.guid=t=>e.check(Ln(zi,t)),e.uuid=t=>e.check(Mn(wi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}(wi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}(wi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}(wi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}(Ti,t)),e.guid=t=>e.check(Ln(zi,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}(Ci,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}(Ni,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}(Ri,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}(Zi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}(Di,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}(Ii,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}(Oi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}(Si,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}(xi,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}($i,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}(Fi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}(Ui,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}(Kn,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}(Xn,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}(ei,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}(ti,e)}(t))}));function _i(e){return function(e,t){return new e({type:"string",...De(t)})}(yi,e)}const Pi=B("ZodStringFormat",((e,t)=>{Rt.init(e,t),vi.init(e,t)})),ki=B("ZodEmail",((e,t)=>{St.init(e,t),Pi.init(e,t)}));function bi(e){return jn(ki,e)}const zi=B("ZodGUID",((e,t)=>{It.init(e,t),Pi.init(e,t)})),wi=B("ZodUUID",((e,t)=>{Ot.init(e,t),Pi.init(e,t)})),Ei=B("ZodURL",((e,t)=>{xt.init(e,t),Pi.init(e,t)})),Ai=B("ZodEmoji",((e,t)=>{$t.init(e,t),Pi.init(e,t)})),Ti=B("ZodNanoID",((e,t)=>{Ft.init(e,t),Pi.init(e,t)})),Ci=B("ZodCUID",((e,t)=>{Zt.init(e,t),Pi.init(e,t)})),Ni=B("ZodCUID2",((e,t)=>{Dt.init(e,t),Pi.init(e,t)})),Ri=B("ZodULID",((e,t)=>{Ut.init(e,t),Pi.init(e,t)})),Ii=B("ZodXID",((e,t)=>{jt.init(e,t),Pi.init(e,t)})),Oi=B("ZodKSUID",((e,t)=>{Lt.init(e,t),Pi.init(e,t)})),Si=B("ZodIPv4",((e,t)=>{Vt.init(e,t),Pi.init(e,t)})),xi=B("ZodIPv6",((e,t)=>{qt.init(e,t),Pi.init(e,t)})),$i=B("ZodCIDRv4",((e,t)=>{Yt.init(e,t),Pi.init(e,t)})),Fi=B("ZodCIDRv6",((e,t)=>{Wt.init(e,t),Pi.init(e,t)})),Zi=B("ZodBase64",((e,t)=>{Jt.init(e,t),Pi.init(e,t)})),Di=B("ZodBase64URL",((e,t)=>{Kt.init(e,t),Pi.init(e,t)})),Ui=B("ZodE164",((e,t)=>{Xt.init(e,t),Pi.init(e,t)})),ji=B("ZodJWT",((e,t)=>{en.init(e,t),Pi.init(e,t)})),Li=B("ZodNumber",((e,t)=>{tn.init(e,t),gi.init(e,t),e.gt=(t,n)=>e.check(Hn(t,n)),e.gte=(t,n)=>e.check(Vn(t,n)),e.min=(t,n)=>e.check(Vn(t,n)),e.lt=(t,n)=>e.check(Gn(t,n)),e.lte=(t,n)=>e.check(Bn(t,n)),e.max=(t,n)=>e.check(Bn(t,n)),e.int=t=>e.check(Bi(t)),e.safe=t=>e.check(Bi(t)),e.positive=t=>e.check(Hn(0,t)),e.nonnegative=t=>e.check(Vn(0,t)),e.negative=t=>e.check(Gn(0,t)),e.nonpositive=t=>e.check(Bn(0,t)),e.multipleOf=(t,n)=>e.check(qn(t,n)),e.step=(t,n)=>e.check(qn(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Mi(e){return function(e,t){return new e({type:"number",checks:[],...De(t)})}(Li,e)}const Gi=B("ZodNumberFormat",((e,t)=>{nn.init(e,t),Li.init(e,t)}));function Bi(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}(Gi,e)}const Hi=B("ZodBoolean",((e,t)=>{on.init(e,t),gi.init(e,t)}));const Vi=B("ZodUnknown",((e,t)=>{rn.init(e,t),gi.init(e,t)}));function qi(){return new Vi({type:"unknown"})}const Yi=B("ZodNever",((e,t)=>{an.init(e,t),gi.init(e,t)}));function Wi(e){return function(e,t){return new e({type:"never",...De(t)})}(Yi,e)}const Qi=B("ZodDate",((e,t)=>{sn.init(e,t),gi.init(e,t),e.min=(t,n)=>e.check(Vn(t,n)),e.max=(t,n)=>e.check(Bn(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));const Ji=B("ZodArray",((e,t)=>{un.init(e,t),gi.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(Wn(t,n)),e.nonempty=t=>e.check(Wn(1,t)),e.max=(t,n)=>e.check(Yn(t,n)),e.length=(t,n)=>e.check(Qn(t,n)),e.unwrap=()=>e.element}));function Ki(e,t){return function(e,t,n){return new e({type:"array",element:t,...De(n)})}(Ji,e,t)}const Xi=B("ZodObject",((e,t)=>{hn.init(e,t),gi.init(e,t),Ae(e,"shape",(()=>t.shape)),e.keyof=()=>oo(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:qi()}),e.loose=()=>e.clone({...e._zod.def,catchall:qi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!Se(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=Ce(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Te(this,"shape",n),n},checks:[]});return Ze(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!Se(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Te(this,"shape",n),n},checks:e._zod.def.checks};return Ze(e,n)}(e,t),e.merge=t=>function(e,t){const n=Ce(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Te(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ze(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return Ze(e,Ce(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return Te(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=Ce(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return Te(this,"shape",i),i},checks:[]});return Ze(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const i=Ce(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)o[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return Te(this,"shape",o),o},checks:[]});return Ze(t,i)}(so,e,t[0]),e.required=(...t)=>function(e,t,n){const i=Ce(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)o[t]=new e({type:"nonoptional",innerType:i[t]});return Te(this,"shape",o),o},checks:[]});return Ze(t,i)}(ho,e,t[0])}));function eo(e,t){const n={type:"object",get shape(){var t;return Te(this,"shape",e?(t=e,Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))):{}),this.shape},...De(t)};return new Xi(n)}const to=B("ZodUnion",((e,t)=>{gn.init(e,t),gi.init(e,t),e.options=t.options}));const no=B("ZodIntersection",((e,t)=>{vn.init(e,t),gi.init(e,t)})),io=B("ZodEnum",((e,t)=>{Pn.init(e,t),gi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const o={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new io({...t,checks:[],...De(i),entries:o})},e.exclude=(e,i)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new io({...t,checks:[],...De(i),entries:o})}}));function oo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new io({type:"enum",entries:n,...De(t)})}const ro=B("ZodTransform",((e,t)=>{kn.init(e,t),gi.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new V(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(He(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(He(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then((e=>(n.value=e,n))):(n.value=o,n)}}));function ao(e){return new ro({type:"transform",transform:e})}const so=B("ZodOptional",((e,t)=>{zn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function co(e){return new so({type:"optional",innerType:e})}const uo=B("ZodNullable",((e,t)=>{wn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType}));function lo(e){return new uo({type:"nullable",innerType:e})}const po=B("ZodDefault",((e,t)=>{En.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap})),fo=B("ZodPrefault",((e,t)=>{Tn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),ho=B("ZodNonOptional",((e,t)=>{Cn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),mo=B("ZodCatch",((e,t)=>{Rn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap})),go=B("ZodPipe",((e,t)=>{In.init(e,t),gi.init(e,t),e.in=t.in,e.out=t.out}));function vo(e,t){return new go({type:"pipe",in:e,out:t})}const yo=B("ZodReadonly",((e,t)=>{Sn.init(e,t),gi.init(e,t),e.unwrap=()=>e._zod.def.innerType})),_o=B("ZodCustom",((e,t)=>{$n.init(e,t),gi.init(e,t)}));function Po(e,t){return vo(ao(e),t)}function ko(e,t,n){const i=t.safeParse(n);return i.success?i.data:(i.error.issues.forEach((t=>{const n=t.path.join(".");e.getFieldState(n)?e.setError(n,{type:"manual",message:t.message}):e.setError("root",{type:"manual",message:t.message})})),null)}const bo=e=>Po((e=>{if(e){if("string"==typeof e){const t=Number(e);return isNaN(t)?e:t}return e}}),e),zo=e=>Po((e=>{if(!e)return;let t;return"string"==typeof e&&(t=new Date(e)),e instanceof Date&&(t=e),t?(t.setUTCHours(0,0,0,0),t):e}),e),wo=e=>_i().min(1,{error:"Required"}).max(e,`Maximum length is ${e} characters`),Eo=()=>bi("Invalid email address").min(1,"Required"),Ao=()=>bo(Mi("Valid amount required").positive("Positive amount required")),To=()=>zo(function(e){return function(e,t){return new e({type:"date",...De(t)})}(Qi,e)}("Valid date required").min(new Date,"Date must be in the future")),Co=e=>_i().max(e,`Maximum length is ${e} characters`),No=eo({address1:wo(100),address2:Co(100).optional(),city:wo(50),state:Co(50).optional(),postcode:Co(20).optional(),country:wo(50)}),Ro=eo({amount:Ao(),message:Co(500).nullish(),giverFirstName:wo(50),giverLastName:wo(50),giverEmail:Eo(),giverPhone:wo(31),giverAddress:No,cardHolder:wo(101),recipientFirstName:Co(50).nullish(),recipientLastName:Co(50).nullish(),recipientEmail:bi("Invalid email address").nullish(),recipientPhone:Co(31).nullish()}),Io=Ro.extend({expiry:To(),notes:Co(500).nullish()}),Oo=eo({balance:Ao(),expiry:To(),message:Co(500).nullish(),notes:Co(500).nullish(),giverFirstName:wo(50),giverLastName:wo(50),giverEmail:Eo(),giverPhone:wo(31),cardHolder:wo(101),recipientEmail:bi("Invalid email address").nullish(),recipientPhone:Co(31).nullish()});let So;!function(e){e.Passthrough="Passthrough",e.PaymentProcessor="PaymentProcessor"}(So||(So={}));const xo=eo({companyId:Mi().int().positive(),amount:Ao(),currency:wo(3).default("AUD")}),$o=eo({sessionId:wo(100),resultCode:wo(50),pspReference:Co(100).optional()}),Fo=eo({cardHolder:wo(100),cardNumberToken:Co(200),cardCvcToken:Co(200),cardExpiry:Co(5)}),Zo=Ro.extend({companyId:Mi().int().positive(),sendViaEmail:function(e){return function(e,t){return new e({type:"boolean",...De(t)})}(Hi,e)}().default(!0),payment:$o.optional(),passthroughPayment:Fo.optional()}),Do=eo({giftCardId:Mi().int().positive(),reason:Co(500).optional()}),Uo=eo({companyId:Mi().int().positive().nullish(),code:wo(10),password:wo(10)}),jo=Uo.extend({amount:Ao(),description:wo(200)});let Lo,Mo,Go,Bo,Ho,Vo;!function(e){e.Adyen="Adyen"}(Lo||(Lo={})),function(e){e.Pending="Pending",e.Authorized="Authorized",e.Captured="Captured",e.Failed="Failed",e.Refunded="Refunded"}(Mo||(Mo={})),function(e){e.Authorised="Authorised",e.Refused="Refused",e.Cancelled="Cancelled",e.Pending="Pending",e.Received="Received",e.Error="Error",e.IdentifyShopper="IdentifyShopper",e.ChallengeShopper="ChallengeShopper"}(Go||(Go={})),function(e){e.AUTHORISATION="AUTHORISATION",e.CAPTURE="CAPTURE",e.REFUND="REFUND",e.CANCELLATION="CANCELLATION",e.REFUND_FAILED="REFUND_FAILED",e.CAPTURE_FAILED="CAPTURE_FAILED"}(Bo||(Bo={})),function(e){e.Purchase="Purchase",e.Redemption="Redemption",e.Adjustment="Adjustment"}(Ho||(Ho={})),function(e){e.Pending="Pending",e.Complete="Complete",e.Cancelled="Cancelled",e.Expired="Expired"}(Vo||(Vo={}));const qo=eo({code:wo(10),token:wo(128)}),Yo=eo({companyId:Mi().int().positive(),code:wo(10),token:wo(128)}),Wo=eo({companyId:(Qo=Li,new Qo({type:"number",coerce:!0,checks:[],...De(void 0)})).int().positive()});var Qo;const Jo=eo({giftCardPaymentType:oo([So.Passthrough,So.PaymentProcessor])}),Ko=eo({merchantAccount:wo(100),clientKey:wo(100),apiKey:Co(200).optional(),webhookHmacKey:Co(200).optional()}),Xo=eo({grant_type:_i().readonly().default("refresh_token"),client_id:Mn(wi,void 0),client_secret:_i(),refresh_token:_i(),scope:_i().optional()}),er=eo({email:bi(),firstName:_i().max(100).optional(),lastName:_i().max(100).optional(),phone:_i().max(20).optional(),scopes:Ki(_i()).optional()});let tr;!function(e){e.PER_STAY="Per stay",e.PER_NIGHT="Per night",e.PER_PERSON="Per person",e.PER_PERSON_PER_NIGHT="Per person per night",e.PER_ALL_PERSONS="Per all persons",e.PER_ALL_PERSONS_PER_NIGHT="Per all persons per night",e.PER_QUANTITY_NAME_PER_NIGHT="Per Quantity Name Per Night",e.PER_ROOM_QUANTITY_PER_NIGHT="Per Room Quantity Per Night",e.PER_PERSON_OCCUPANCY_PER_NIGHT="Per Person Occupancy Per Night",e.PER_ADULT_OCCUPANCY_PER_NIGHT="Per Adult Occupancy Per Night",e.PER_CHILD_OCCUPANCY_PER_NIGHT="Per Child Occupancy Per Night"}(tr||(tr={}));const nr=[tr.PER_NIGHT,tr.PER_PERSON_PER_NIGHT,tr.PER_QUANTITY_NAME_PER_NIGHT,tr.PER_ROOM_QUANTITY_PER_NIGHT,tr.PER_PERSON_OCCUPANCY_PER_NIGHT,tr.PER_ADULT_OCCUPANCY_PER_NIGHT,tr.PER_CHILD_OCCUPANCY_PER_NIGHT,tr.PER_ALL_PERSONS_PER_NIGHT];let ir,or,rr;!function(e){e.Critical="Critical",e.Error="Error",e.Warn="Warn",e.Info="Info"}(ir||(ir={})),function(e){e.Debug="Diagnostics",e.Security="Security",e.Audit="Audit"}(or||(or={})),function(e){e.General="General",e.Authenticated="Token Authenticated",e.Unauthorized="Unauthorized Access",e.RefreshToken="Refresh Token Created",e.AccessToken="Access Token Created",e.Revoked="Token Revoked",e.UserCreated="User Created",e.UserLinked="User Linked to Company",e.Purchase="Gift Card Purchased",e.Payment="Payment",e.Email="Email Delivery",e.Transaction="Gift Card Transaction"}(rr||(rr={}));const ar=e=>{let t=0;const n=Object.values(e.itinerary);for(const e of n){const n=Object.keys(e.nights);for(const i of n)t+=e.nights[i].total}return t};var sr=i(60),cr=i.n(sr);const ur={UP:cr().ROUND_UP,DOWN:cr().ROUND_DOWN,CEIL:cr().ROUND_CEIL,FLOOR:cr().ROUND_FLOOR,HALF_UP:cr().ROUND_HALF_UP,HALF_DOWN:cr().ROUND_HALF_DOWN,HALF_EVEN:cr().ROUND_HALF_EVEN,HALF_CEIL:cr().ROUND_HALF_CEIL,HALF_FLOOR:cr().ROUND_HALF_FLOOR},dr=(e,t)=>{const{precision:n=2,rounding:i=ur.HALF_UP}=t||{};return new(cr())(e).toDecimalPlaces(n,i).toNumber()};function lr(e,t={}){const{baseAmount:n=0,numberOfNights:i=1,feeIncludedInBaseAmount:o=!1,extractedFromRates:r=!1,removedPercentages:a=[]}=t,s=dr(n);switch(e.feeType){case F.PercentageOfBooking:if(o)return dr(s*e.amount/(100+e.amount));if(r){const t=a.reduce(((e,t)=>e+t/(100+t)),0);return dr(s/(1-t)*e.amount/(100+e.amount))}return dr(s*(e.amount/100));case F.FixedChargePerRoom:case F.FixedChargePerBooking:return e.amount;case F.NightlyChargePerRoom:return dr(e.amount*i);default:return 0}}const pr=[F.FixedChargePerBooking],fr=[F.PercentageOfBooking,F.FixedChargePerRoom,F.NightlyChargePerRoom],hr=[F.PercentageOfBooking];function mr(e,t){return e.filter((e=>t.includes(e.feeType)))}function gr(e){return mr(e,pr)}function vr(e){return mr(e,fr)}function yr(e){return mr(e,hr)}function _r(e){return{includeInRates:[F.PercentageOfBooking,F.NightlyChargePerRoom].includes(e),extractFeeFromRates:e===F.PercentageOfBooking,appliesToAddons:e===F.PercentageOfBooking,includePreviousFeesInCalculation:e===F.PercentageOfBooking}}const Pr=e=>e,kr=(e,t)=>{const n={};return t.forEach((t=>{t in e&&(n[t]=e[t])})),n},br=(e,t)=>e.includes("cdn.app.roomstay.io")?e+"?w="+t:e;class zr{}function wr(e){return e.toUpperCase()}zr.calculateBaseAddonTotal=(e,t)=>{let n=0,i=0,o=0;e.price&&e.quantity&&(n=e.quantity*Number(e.price)),e.pricingType===tr.PER_ADULT_OCCUPANCY_PER_NIGHT&&e.adultQuantity?n*=e.adultQuantity:e.pricingType===tr.PER_CHILD_OCCUPANCY_PER_NIGHT&&e.childQuantity&&(n*=e.childQuantity),e.adultPrice&&e.adultQuantity&&(i=e.adultQuantity*Number(e.adultPrice)),e.childPrice&&e.childQuantity&&(o=e.childQuantity*Number(e.childPrice));let r=n+i+o;return nr.includes(e.pricingType)&&e.nights&&!t&&(r*=e.nights),{indPrice:n,indAdultPrice:i,indChildPrice:o,addonTotal:r}},zr.calculateBasketAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=zr.calculateBaseAddonTotal(n,t);let o=0;return(n.fee||n.fees?.length)&&n.quantity?n.fees?.length?n.fees.forEach((e=>{o+=n.quantity*e.amount})):o=n.quantity*Number(n.fee):((n.adultFee||n.adultFees?.length)&&n.adultQuantity&&(n.adultFees?.length?n.adultFees.forEach((e=>{o+=n.adultQuantity*e.amount})):o+=n.adultQuantity??1*Number(n.adultFee)),(n.childFee||n.childFees?.length)&&n.childQuantity&&(n.childFees?.length?n.childFees.forEach((e=>{o+=n.childQuantity??1*e.amount})):o+=n.childQuantity*Number(n.childFee))),nr.includes(n.pricingType)&&n.nights&&!t&&(o*=n.nights),{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+o,total:e.total+i.addonTotal+o}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0})),zr.calculateReservationAddonTotal=(e,t=!1)=>(Array.isArray(e)||(e=[e]),e.reduce(((e,n)=>{const i=zr.calculateBaseAddonTotal(n,t);let o,r=n.discount||0;o=void 0!==n.total&&null!==n.total?n.total:i.addonTotal-r;let a=n.fees||0;n.itemisedFees?.length&&(a=n.itemisedFees.reduce(((e,t)=>e+t.amount),0));const s=n.itemisedFees?.length?o:o+a;return{price:e.price+i.indPrice,adultPrice:e.adultPrice+i.indAdultPrice,childPrice:e.childPrice+i.indChildPrice,totalFees:e.totalFees+a,total:e.total+o+a,displayPrice:e.displayPrice+s}}),{price:0,adultPrice:0,childPrice:0,totalFees:0,total:0,displayPrice:0})),zr.calculateTotalForReservation=(e,t=!1)=>{let n=0;return e.itemisedFees?.forEach((e=>{n+=e.amount})),e.reservations.forEach((e=>{n+=e.total.afterTax;const i=Object.keys(e.nights)?.length??0;if(n+=e.fees??0,e.addons?.length){const o=(e.addons??[]).map((e=>({...e,nights:i})));n+=zr.calculateReservationAddonTotal(o,t)?.total}})),dr(n)},zr.calculateTotalExcludingDuplicateFees=(e,t)=>{if(!e)return 0;if("total"in e)return dr(e.total?.afterTax||0);const{reservations:n,itemisedFees:i}=e;if(!n?.length)return 0;let o=0;return n.forEach((e=>{o+=e.total.afterTax;const n=Object.keys(e.nights)?.length??0;e.addons?.forEach((e=>{const i=zr.calculateBaseAddonTotal({...e,nights:n},t);o+=i.addonTotal-(e.discount||0)}))})),i?.forEach((e=>{o+=e.amount})),dr(o)}})(),o})()));
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * decimal.js v10.4.3
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomstay/core",
3
- "version": "0.1.77-0",
3
+ "version": "0.1.77-2",
4
4
  "description": "Details shared between Roomstay libraries. Anything from Currency, to Generic types",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [