mppx 0.15.0 → 0.16.0

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cli/cli.js +137 -131
  3. package/dist/cli/plugins/index.js +11 -11
  4. package/dist/cli/validate/payment.d.ts +12 -0
  5. package/dist/cli/validate/payment.js +113 -14
  6. package/dist/client/Mppx.d.ts +13 -3
  7. package/dist/client/Mppx.js +47 -22
  8. package/dist/client/internal/Fetch.d.ts +11 -0
  9. package/dist/client/internal/Fetch.js +46 -8
  10. package/dist/client/internal/ProofRealm.d.ts +21 -0
  11. package/dist/client/internal/ProofRealm.js +55 -0
  12. package/dist/{attestation → extensions/identity}/Constants.d.ts +2 -2
  13. package/dist/{attestation → extensions/identity}/Constants.js +2 -2
  14. package/dist/extensions/identity/Types.d.ts +21 -0
  15. package/dist/extensions/identity/index.d.ts +7 -0
  16. package/dist/extensions/identity/index.js +6 -0
  17. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.d.ts +3 -3
  18. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.js +10 -10
  19. package/dist/extensions/identity/internal/SigningContext.d.ts +6 -0
  20. package/dist/{attestation → extensions/identity}/internal/SigningContext.js +3 -3
  21. package/dist/extensions/identity/internal/Verification.d.ts +9 -0
  22. package/dist/extensions/identity/internal/Verification.js +10 -0
  23. package/dist/{tap → extensions/identity/tap}/Constants.js +1 -1
  24. package/dist/extensions/identity/tap/client/index.d.ts +32 -0
  25. package/dist/{tap → extensions/identity/tap}/client/index.js +13 -9
  26. package/dist/extensions/identity/tap/server/index.d.ts +27 -0
  27. package/dist/{tap → extensions/identity/tap}/server/index.js +12 -4
  28. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.js +1 -1
  29. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.d.ts +6 -5
  30. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.js +5 -5
  31. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.d.ts +6 -5
  32. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.js +6 -4
  33. package/dist/identity/Client.d.ts +34 -0
  34. package/dist/identity/Client.js +133 -0
  35. package/dist/identity/Server.d.ts +46 -0
  36. package/dist/identity/Server.js +145 -0
  37. package/dist/identity/Types.d.ts +90 -0
  38. package/dist/identity/Types.js +2 -0
  39. package/dist/{attestation → identity}/index.d.ts +2 -2
  40. package/dist/{attestation → identity}/index.js +1 -2
  41. package/dist/identity/internal/SigningContext.d.ts +6 -0
  42. package/dist/identity/internal/SigningContext.js +11 -0
  43. package/dist/integrations/x402/Evm.d.ts +1 -0
  44. package/dist/internal/version.d.ts +2 -2
  45. package/dist/internal/version.js +1 -1
  46. package/dist/mcp/client/McpClient.d.ts +5 -0
  47. package/dist/mcp/client/McpClient.js +2 -0
  48. package/dist/proxy/Proxy.js +10 -5
  49. package/dist/proxy/Service.d.ts +42 -4
  50. package/dist/proxy/Service.js +21 -5
  51. package/dist/server/Mppx.d.ts +27 -8
  52. package/dist/server/Mppx.js +136 -51
  53. package/dist/stripe/server/internal/html.gen.js +1 -1
  54. package/dist/tempo/internal/charge.js +2 -1
  55. package/dist/tempo/internal/fee-payer.d.ts +0 -2
  56. package/dist/tempo/internal/fee-payer.js +0 -4
  57. package/dist/tempo/server/Subscription.js +0 -1
  58. package/dist/tempo/server/internal/html.gen.js +1 -1
  59. package/dist/tempo/session/client/Runtime.d.ts +2 -0
  60. package/dist/tempo/session/client/Session.js +1 -1
  61. package/dist/tempo/session/client/SessionManager.d.ts +6 -0
  62. package/dist/tempo/session/client/SessionManager.js +14 -7
  63. package/dist/tempo/session/client/Transports.d.ts +12 -3
  64. package/dist/tempo/session/client/Transports.js +37 -11
  65. package/dist/tempo/session/precompile/Chain.js +0 -3
  66. package/dist/tempo/subscription/Store.js +10 -9
  67. package/package.json +15 -11
  68. package/dist/attestation/Client.d.ts +0 -17
  69. package/dist/attestation/Client.js +0 -28
  70. package/dist/attestation/Server.d.ts +0 -4
  71. package/dist/attestation/Server.js +0 -8
  72. package/dist/attestation/Types.d.ts +0 -76
  73. package/dist/attestation/internal/SigningContext.d.ts +0 -4
  74. package/dist/tap/client/index.d.ts +0 -26
  75. package/dist/tap/server/index.d.ts +0 -20
  76. /package/dist/{attestation → extensions/identity}/Types.js +0 -0
  77. /package/dist/{tap → extensions/identity/tap}/Constants.d.ts +0 -0
  78. /package/dist/{tap → extensions/identity/tap}/Types.d.ts +0 -0
  79. /package/dist/{tap → extensions/identity/tap}/Types.js +0 -0
  80. /package/dist/{tap → extensions/identity/tap}/index.d.ts +0 -0
  81. /package/dist/{tap → extensions/identity/tap}/index.js +0 -0
  82. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.d.ts +0 -0
  83. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.d.ts +0 -0
  84. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.js +0 -0
  85. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.d.ts +0 -0
  86. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.js +0 -0
  87. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.d.ts +0 -0
  88. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.js +0 -0
  89. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.d.ts +0 -0
  90. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.js +0 -0
@@ -1,3 +1,3 @@
1
1
  // Generated — do not edit.
2
- export const html = "<script>(function(){var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=t((e=>{Object.defineProperty(e,\"__esModule\",{value:!0});function t(e){\"@babel/helpers - typeof\";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}var n=`dahlia`,r=function(e){return e===3?`v3`:e},i=`https://js.stripe.com`,a=`${i}/${n}/stripe.js`,o=/^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/,s=/^https:\\/\\/js\\.stripe\\.com\\/(v3|[a-z]+)\\/stripe\\.js(\\?.*)?$/,c=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,l=function(e){return o.test(e)||s.test(e)},u=function(){for(var e=document.querySelectorAll(`script[src^=\"${i}\"]`),t=0;t<e.length;t++){var n=e[t];if(l(n.src))return n}return null},d=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${a}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},f=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`9.17.0`,startTime:t})},p=null,m=null,h=null,ee=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},g=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},_=function(e){return p===null?(p=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(c),window.Stripe){t(window.Stripe);return}try{var r=u();if(r&&e)console.warn(c);else if(!r)r=d(e);else if(r&&h!==null&&m!==null){var i;r.removeEventListener(`load`,h),r.removeEventListener(`error`,m),(i=r.parentNode)==null||i.removeChild(r),r=d(e)}h=g(t,n),m=ee(n),r.addEventListener(`load`,h),r.addEventListener(`error`,m)}catch(e){n(e);return}}),p.catch(function(e){return p=null,Promise.reject(e)})):p},te=function(e,i,a){if(e===null)return null;var o=i[0];if(typeof o!=`string`)throw Error(`Expected publishable key to be of type string, got type ${t(o)} instead.`);var s=o.match(/^pk_test/),c=r(e.version),l=n;s&&c!==l&&console.warn(`Stripe.js@${c} was loaded on the page, but @stripe/stripe-js@9.17.0 expected Stripe.js@${l}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var u=e.apply(void 0,i);return f(u,a),u},v=function(e){var n=`invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ${JSON.stringify(e)}\n`;if(e===null||t(e)!==`object`)throw Error(n);if(Object.keys(e).length===1&&typeof e.advancedFraudSignals==`boolean`)return e;throw Error(n)},y,b=!1,x=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b=!0;var r=Date.now();return _(y).then(function(e){return te(e,t,r)})};x.setLoadParameters=function(e){if(b&&y){var t=v(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===y?.[n]},!0))return}if(b)throw Error(`You cannot change load parameters after calling loadStripe`);y=v(e)},e.loadStripe=x})),r=t(((e,t)=>{t.exports=n()}));let i={payment:`Payment`};var a,o=e((()=>{a=`0.1.1`}));function s(){return a}var c=e((()=>{o()}));function l(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause?l(e.cause,t):t?null:e}var u,d=e((()=>{c(),u=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,n={}){let r=(()=>{if(n.cause instanceof e){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&`details`in n.cause&&typeof n.cause.details==`string`?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=n.docsOrigin??e.prototype.docsOrigin,o=`${a}${i??``}`,s=!!(n.version??e.prototype.showVersion),c=n.version??e.prototype.version,l=[t||`An error occurred.`,...n.metaMessages?[``,...n.metaMessages]:[],...r||i||s?[``,r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,s?`Version: ${c}`:void 0]:[]].filter(e=>typeof e==`string`).join(`\n`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,\"details\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docs\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsOrigin\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsPath\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"shortMessage\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"showVersion\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"cause\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=a,this.docsPath=i,this.shortMessage=t,this.showVersion=s,this.version=c}walk(e){return l(this,e)}},Object.defineProperty(u,\"defaultStaticOptions\",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:`https://oxlib.sh`,showVersion:!1,version:`ox@${s()}`}}),u.setStaticOptions(u.defaultStaticOptions)}));function f(e,t){if(y(e)>t)throw new x({givenSize:y(e),maxSize:t})}function p(e,t={}){let{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ne({size:e.length,targetSize:r,type:`Bytes`});let i=new Uint8Array(r);for(let t=0;t<r;t++){let a=n===`right`;i[a?t:r-t-1]=e[a?t:e.length-t-1]}return i}var m=e((()=>{re()}));function h(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw TypeError(`Cannot canonicalize non-finite number`);return Object.is(e,-0)?`0`:JSON.stringify(e)}if(typeof e==`bigint`)throw TypeError(`Cannot canonicalize bigint`);if(Array.isArray(e))return`[${e.map(e=>h(e)).join(`,`)}]`;if(typeof e==`object`)return`{${Object.keys(e).sort().reduce((t,n)=>{let r=e[n];return r!==void 0&&t.push(`${JSON.stringify(n)}:${h(r)}`),t},[]).join(`,`)}}`}function ee(e,t){return JSON.parse(e,(e,n)=>{let r=n;return typeof r==`string`&&r.endsWith(g)?BigInt(r.slice(0,-9)):typeof t==`function`?t(e,r):r})}var g,_=e((()=>{g=`#__bigint`}));function te(e,t={}){let{size:n}=t,r=b.encode(e);return typeof n==`number`?(f(r,n),v(r,n)):r}function v(e,t){return p(e,{dir:`right`,size:t})}function y(e){return e.length}var b,x,ne,re=e((()=>{d(),m(),_(),b=new TextEncoder,x=class extends u{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \\`${t}\\` bytes. Given size: \\`${e}\\` bytes.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeOverflowError`})}},ne=class extends u{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\\`${e}\\`) exceeds padding size (\\`${t}\\`).`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeExceedsPaddingSizeError`})}}}));re();let ie=new TextDecoder,S=Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[e.charCodeAt(0),t]))});function ae(e,t={}){let{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let t=0,n=0;n<e.length;t+=4,n+=3){let r=(e[n]<<16)+(e[n+1]<<8)+(e[n+2]|0);i[t]=S[r>>18],i[t+1]=S[r>>12&63],i[t+2]=S[r>>6&63],i[t+3]=S[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ie.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function oe(e,t={}){return ae(te(e),t)}_();function se(e){return oe(h(e),{pad:!1,url:!0})}function ce(e,t){return typeof t==`bigint`?t.toString():t}var le=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ue(e){return new le(e)}function de(e){return e==null}function fe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}let me=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function he(e){if(C(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return C(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ge(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function w(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function T(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function E(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function D(e){return typeof e==`string`?e:e?.message}function ye(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function O(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:D(e.inst?._zod.def?.error?.(e))??D(a?.(e))??D(t?.error?.(e))??D(n.customError?.(e))??D(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let be=/[\\uD800-\\uDBFF]/;function xe(e){let t=e.length;if(!be.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Se(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ce(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function we(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ee(e,n,r.value)}}function k(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Te(e,t,n){return k(e,t,n,!1)}function Ee(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:k(this,t,n.bind(this))},set(e){k(this,t,e)}})}function De(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let A,j=!1,Oe={configurable:!0,get(){j=!0}};function M(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&A!==e._zod){A=void 0;return}A=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Oe);let e=j;j=!1;try{let r=n(this);return j?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),j||=e,r}catch(n){throw delete this[t],j||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ke(e,t,n,r){let i=De(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ae;let N={value:void 0,enumerable:!1},je=`captureStackTrace`in Error?Error:null;function Me(e){let t=je;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return je=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){N.value=new a(r);try{Object.defineProperty(n,\"_zod\",N)}finally{N.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),we(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function d(e){let t=r?.Parent?Me(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,\"init\",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,\"name\",{value:e}),d}var F=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ne=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ae=globalThis).__zod_globalConfig??(Ae.__zod_globalConfig={});let I=globalThis.__zod_globalConfig;function L(e){return e&&Object.assign(I,e),I}function Pe(){let e=this._zod;return e.message??=JSON.stringify(e.def,ce,2),e.message}function Fe(e){this._zod.message=e}let Ie={get:Pe,set:Fe,enumerable:!0,configurable:!0},R={value:void 0,enumerable:!1},Le=new WeakSet([Object.prototype,Error.prototype]),Re=(e,t)=>{e.name=`$ZodError`,R.value=t,Object.defineProperty(e,\"issues\",R),R.value=void 0,Object.defineProperty(e,\"message\",Ie);let n=Object.getPrototypeOf(e);Le.has(n)||(Le.add(n),Object.defineProperty(n,\"toString\",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0})}}))};P(`$ZodError`,Re);let z=P(`$ZodError`,Re,void 0,{Parent:Error}),ze=(e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new F;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),Be=(e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),Ve=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new F;return a.issues.length?He(e,a.issues,i):{success:!0,data:a.value}})(z);function He(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>O(e,n,L()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let Ue=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?He(e,a.issues,i):{success:!0,data:a.value}})(z),We=/^[\\s\\S]{0,}$/,Ge=/^-?\\d+(?:\\.\\d+)?$/,B=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ke=e=>{let t=e.value;return!de(t)&&t.length!==void 0},qe=P(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=Ke),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?xe(r):i)>=t.minimum)return;let a=Se(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Je=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),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})}):(r=e._zod).check??(r.check=()=>{})}),Ye=P(`$ZodCheckRegex`,(e,t)=>{Je.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})}}),Xe={major:4,minor:6,patch:5},V=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Xe;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=T(t),a;for(let o of n){if(o._zod.def.when){if(ve(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new F;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(ye(t.issues,n,e),i||=T(t,n))});else{if(t.issues.length===n)continue;ye(t.issues,n,e),i||=T(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(T(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get\"~standard\"(){return Te(this,`~standard`,$e(this))},set\"~standard\"(e){k(this,`~standard`,e)}}),Ze=(e,t)=>e.issues.length?{issues:e.issues.map(e=>O(e,t,L()))}:{value:e.value};async function Qe(e,t){let n={async:!0};return Ze(await e._zod.run({value:t,issues:[]},n),n)}function $e(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ze(r,n)}catch{}return Qe(e,t)},vendor:`zod`,version:1}}let et=P(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=t.pattern??We,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),tt=P(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function nt(e,t,n){e.issues.length&&t.issues.push(...E(n,e.issues)),t.value[n]=e.value}let rt=P(`$ZodArray`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>nt(t,r,e)));else if(nt(c,r,e),s&&c.issues.length!==0&&T(c))break}return o.length?Promise.all(o).then(()=>r):r}});function H(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...E(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let it=[];function at(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:it,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${String(t)}\": expected a Zod schema`);let a=_e(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ot(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(T(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,d,f))):H(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let st=P(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,\"shape\",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,\"shape\",{get:e})}let i=ue(()=>at(t));M(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||pe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=C,o=t.catchall,s,c=I.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(T(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>H(n,t,e,r,a,o))):H(s,t,e,r,a,o)}return o?ot(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function ct(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!T(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>O(e,r,L())))}),t)}let lt=P(`$ZodUnion`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),M(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),M(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>fe(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ct(t,r,e,i)):ct(o,r,e,i)}}),ut=P(`$ZodRecord`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!he(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...E(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...E(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ge.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...E(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...E(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),dt=P(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,I.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ne(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new F;return n.value=i,n}});function ft(e,t){return e.value=t.issues.length?void 0:t.value,e}let pt=P(`$ZodOptional`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,M(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),M(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fe(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ft(e,t)):ft(e,r)}return t.innerType._zod.run(e,n)}}),mt=P(`$ZodPipe`,(e,t)=>{V.init(e,t),M(e,`values`,e=>e.def.in._zod.values),M(e,`optin`,e=>e.def.in._zod.optin),M(e,`optout`,e=>e.def.out._zod.optout),M(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.in,n)):U(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.out,n)):U(r,t.out,n)}});function U(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let ht=P(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>gt(t,n,r,e));gt(i,n,r,e)}});function gt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ce(e))}}function _t(e){return e.checks&&=[...e.checks],e}function vt(e,t){return new e(_t({type:`string`,...w(t)}))}function yt(e,t){return new e(_t({type:`number`,checks:[],...w(t)}))}function W(e,t){return new qe({check:`min_length`,...w(t),minimum:e})}function bt(e,t){return new Ye({check:`string_format`,format:`regex`,...w(t),pattern:e})}function xt(e,t,n){let r=w(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}let G=P(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){k(this,`with`,e)},parse(e,t){return ze(this,e,t,{callee:this.parse})},parseAsync(e,t){return Be(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ve(this,e,t)},safeParseAsync(e,t){return Ue(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),St=P(`ZodMiniString`,(e,t)=>{et.init(e,t),G.init(e,t)});function K(e){return vt(St,e)}let Ct=P(`ZodMiniNumber`,(e,t)=>{tt.init(e,t),G.init(e,t)});function wt(e){return yt(Ct,e)}let Tt=P(`ZodMiniArray`,(e,t)=>{rt.init(e,t),G.init(e,t)});function Et(e,t){return new Tt({type:`array`,element:e,...w(t)})}let Dt=P(`ZodMiniObject`,(e,t)=>{st.init(e,t),G.init(e,t),ke(e,`shape`,e=>e._zod.def.shape,!1)});function q(e,t){let n={type:`object`,shape:e??{},...w(t)};return new Dt(n)}let Ot=P(`ZodMiniUnion`,(e,t)=>{lt.init(e,t),G.init(e,t)});function kt(e,t){return new Ot({type:`union`,options:e,...w(t)})}let At=P(`ZodMiniRecord`,(e,t)=>{ut.init(e,t),G.init(e,t)});function jt(e,t,n){return!t||!t._zod?new At({type:`record`,keyType:K(),valueType:e,...w(t)}):new At({type:`record`,keyType:e,valueType:t,...w(n)})}let Mt=P(`ZodMiniTransform`,(e,t)=>{dt.init(e,t),G.init(e,t)});function Nt(e){return new Mt({type:`transform`,transform:e})}let Pt=P(`ZodMiniOptional`,(e,t)=>{pt.init(e,t),G.init(e,t)});function J(e){return new Pt({type:`optional`,innerType:e})}let Ft=P(`ZodMiniPipe`,(e,t)=>{mt.init(e,t),G.init(e,t)});function It(e,t){return new Ft({type:`pipe`,in:e,out:t})}let Lt=P(`ZodMiniCustom`,(e,t)=>{ht.init(e,t),G.init(e,t)});function Rt(e,t){return xt(Lt,e??(()=>!0),t)}function zt(){return K().check(bt(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function Bt(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:se(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:se(r)},payload:e.payload,...e.source&&{source:e.source}},c=oe(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function Vt(e){return e}function Ht(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}function Ut(e,t){if(!Number.isInteger(t)||t<0)throw RangeError(`Decimals must be a non-negative integer.`);if(!/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/.test(e))throw TypeError(`Value \\`${e}\\` is not a valid decimal number.`);let n=e.startsWith(`-`),[r=`0`,i=``]=(n?e.slice(1):e).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(`${r||`0`}${a}`);return i.length>t&&i[t]>=`5`&&(o+=1n),n?-o:o}let Wt=kt([q({customer:J(K().check(W(1))),hooks:J(q({inputs:q({tax:q({calculation:K().check(W(1))})})})),metadata:J(jt(K(),K())),receipt_email:J(K().check(W(1)))}),Rt(e=>typeof e==`function`)]),Gt=Vt({name:`stripe`,intent:`charge`,schema:{credential:{payload:q({externalId:J(K()),spt:K()})},request:It(q({amount:zt(),currency:K(),decimals:wt(),description:J(K()),externalId:J(K()),metadata:J(jt(K(),K())),networkId:K(),paymentIntentOptions:J(Wt),paymentMethodTypes:Et(K()).check(W(1)),recipient:J(K())}),Nt(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:Ut(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function Kt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return Ht(Gt,{context:q({paymentMethod:J(K())}),async createCredential({challenge:e,context:a}){let o=a?.paymentMethod??i;if(!o)throw Error(`paymentMethod is required (pass via context or parameters)`);let s=e.request.amount,c=e.request.currency,l=typeof e.request.externalId==`string`?e.request.externalId:void 0,u=e.request.methodDetails?.networkId;if(!u)throw Error(`networkId is required in challenge.methodDetails`);let d=e.request.methodDetails?.metadata;if(d?.externalId)throw Error(`methodDetails.metadata.externalId is reserved; use credential externalId instead`);let f=e.expires?Math.floor(new Date(e.expires).getTime()/1e3):Math.floor(Date.now()/1e3)+3600,p=await n({amount:s,challenge:e,client:t,currency:c,expiresAt:f,metadata:d,networkId:u,paymentMethod:o}),m=l??r;return Bt({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function qt(e){return[Kt(e)]}(function(e){e.charge=Kt})(qt||={});var Jt=r();let Y={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},Yt={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},X={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var Z=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let Xt={accent:new Z(`accent`),background:new Z(`background`),border:new Z(`border`),foreground:new Z(`foreground`),muted:new Z(`muted`),negative:new Z(`negative`),positive:new Z(`positive`),surface:new Z(`surface`),fontFamily:new Z(`font-family`),fontSizeBase:new Z(`font-size-base`),radius:new Z(`radius`),spacingUnit:new Z(`spacing-unit`)};String.raw`<style>\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n border-color: ${Xt.border};\n }\n html,\n :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n -webkit-tap-highlight-color: transparent;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b,\n strong {\n font-weight: bolder;\n }\n code,\n kbd,\n samp,\n pre {\n font-family:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n ol,\n ul,\n menu {\n list-style: none;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n vertical-align: middle;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button,\n input:where([type='button'], [type='reset'], [type='submit']),\n ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n }\n</style>`;function Zt(e,t){if(t==null)return e;if(!Q(e)||!Q(t))return t??e;let n={...e};for(let[e,r]of Object.entries(t)){if(r==null||r===``)continue;let t=n[e];n[e]=Q(t)&&Q(r)?Zt(t,r):r}return n}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function Qt(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(Yt.serviceWorker,``);let r=await navigator.serviceWorker.register(n.pathname+n.search),i=await new Promise(e=>{let t=r.installing??r.waiting??r.active;if(t?.state===`activated`)return e(t);let n=t??r;n.addEventListener(`statechange`,function t(){let i=r.active;i?.state===`activated`&&(n.removeEventListener(`statechange`,t),e(i))})});await new Promise(n=>{let r=new MessageChannel;r.port1.onmessage=()=>n(),i.postMessage({credential:e,header:t},[r.port2])}),location.reload()}_();function $t(e){let t=document.getElementById(Y.data),n=ee(t.textContent),r=t.getAttribute(X.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(X.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(X.challengeId),o=a?(i.removeAttribute(X.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(Y.error)?.remove();return}let t=document.getElementById(Y.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=Y.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>Qt(e,o.challenge.header),vars:Xt}}let $=$t(`stripe`),en=String.raw,tn=document.createElement(`style`);tn.textContent=en`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${$.vars.spacingUnit} * 8);\n }\n button {\n background: ${$.vars.accent};\n border-radius: ${$.vars.radius};\n color: ${$.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${$.vars.spacingUnit} * 4) calc(${$.vars.spacingUnit} * 8);\n width: 100%;\n }\n button:hover:not(:disabled) {\n opacity: 0.85;\n }\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n`,$.root.append(tn),(async()=>{let e=await(0,Jt.loadStripe)($.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if($.config.elements?.options?.appearance?.theme)return $.config.elements?.options?.appearance?.theme;switch($.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return Zt({disableAnimations:!0,theme:e,variables:{borderRadius:$.theme.radius,colorBackground:$.theme.surface[n],colorDanger:$.theme.negative[n],colorPrimary:$.theme.accent[n],colorText:$.theme.foreground[n],colorTextSecondary:$.theme.muted[n],fontSizeBase:$.theme.fontSizeBase,fontFamily:$.theme.fontFamily,spacingUnit:$.theme.spacingUnit}},$.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...$.config.elements?.options,amount:Number($.challenge.request.amount),currency:$.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:$.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,$.config.elements?.paymentOptions).mount(i),$.root.appendChild(i);let a=document.createElement(`button`);a.textContent=$.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),$.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...$.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await qt({client:e,createToken:nn})[0].createCredential({challenge:$.challenge,context:{paymentMethod:t.id}});await $.submit(i)}catch(e){$.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function nn(e){let t=new URL($.config.createTokenUrl,location.origin);if(t.origin!==location.origin)throw Error(`createTokenUrl must be same-origin`);let n=await fetch(t,{method:`POST`,headers:{\"Content-Type\":`application/json`},body:JSON.stringify(e)});if(!n.ok){let e=await n.text().catch(()=>`<response body unavailable>`);throw Error(`Failed to create SPT (${n.status}): ${e}`)}return(await n.json()).spt}})();</script>";
2
+ export const html = "<script>(function(){var e=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},t=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),n=t((e=>{Object.defineProperty(e,\"__esModule\",{value:!0});function t(e){\"@babel/helpers - typeof\";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}var n=`dahlia`,r=function(e){return e===3?`v3`:e},i=`https://js.stripe.com`,a=`${i}/${n}/stripe.js`,o=/^https:\\/\\/js\\.stripe\\.com\\/v3\\/?(\\?.*)?$/,s=/^https:\\/\\/js\\.stripe\\.com\\/(v3|[a-z]+)\\/stripe\\.js(\\?.*)?$/,c=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,l=function(e){return o.test(e)||s.test(e)},u=function(){for(var e=document.querySelectorAll(`script[src^=\"${i}\"]`),t=0;t<e.length;t++){var n=e[t];if(l(n.src))return n}return null},d=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${a}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},f=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:`stripe-js`,version:`9.17.0`,startTime:t})},p=null,m=null,h=null,ee=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},g=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},_=function(e){return p===null?(p=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(c),window.Stripe){t(window.Stripe);return}try{var r=u();if(r&&e)console.warn(c);else if(!r)r=d(e);else if(r&&h!==null&&m!==null){var i;r.removeEventListener(`load`,h),r.removeEventListener(`error`,m),(i=r.parentNode)==null||i.removeChild(r),r=d(e)}h=g(t,n),m=ee(n),r.addEventListener(`load`,h),r.addEventListener(`error`,m)}catch(e){n(e);return}}),p.catch(function(e){return p=null,Promise.reject(e)})):p},te=function(e,i,a){if(e===null)return null;var o=i[0];if(typeof o!=`string`)throw Error(`Expected publishable key to be of type string, got type ${t(o)} instead.`);var s=o.match(/^pk_test/),c=r(e.version),l=n;s&&c!==l&&console.warn(`Stripe.js@${c} was loaded on the page, but @stripe/stripe-js@9.17.0 expected Stripe.js@${l}. This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning`);var u=e.apply(void 0,i);return f(u,a),u},v=function(e){var n=`invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ${JSON.stringify(e)}\n`;if(e===null||t(e)!==`object`)throw Error(n);if(Object.keys(e).length===1&&typeof e.advancedFraudSignals==`boolean`)return e;throw Error(n)},y,b=!1,x=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];b=!0;var r=Date.now();return _(y).then(function(e){return te(e,t,r)})};x.setLoadParameters=function(e){if(b&&y){var t=v(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===y?.[n]},!0))return}if(b)throw Error(`You cannot change load parameters after calling loadStripe`);y=v(e)},e.loadStripe=x})),r=t(((e,t)=>{t.exports=n()}));let i={payment:`Payment`};var a,o=e((()=>{a=`0.1.1`}));function s(){return a}var c=e((()=>{o()}));function l(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause?l(e.cause,t):t?null:e}var u,d=e((()=>{c(),u=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,n={}){let r=(()=>{if(n.cause instanceof e){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&`details`in n.cause&&typeof n.cause.details==`string`?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=n.docsOrigin??e.prototype.docsOrigin,o=`${a}${i??``}`,s=!!(n.version??e.prototype.showVersion),c=n.version??e.prototype.version,l=[t||`An error occurred.`,...n.metaMessages?[``,...n.metaMessages]:[],...r||i||s?[``,r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,s?`Version: ${c}`:void 0]:[]].filter(e=>typeof e==`string`).join(`\n`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,\"details\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docs\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsOrigin\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"docsPath\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"shortMessage\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"showVersion\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"version\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"cause\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=a,this.docsPath=i,this.shortMessage=t,this.showVersion=s,this.version=c}walk(e){return l(this,e)}},Object.defineProperty(u,\"defaultStaticOptions\",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:`https://oxlib.sh`,showVersion:!1,version:`ox@${s()}`}}),u.setStaticOptions(u.defaultStaticOptions)}));function f(e,t){if(y(e)>t)throw new x({givenSize:y(e),maxSize:t})}function p(e,t={}){let{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ne({size:e.length,targetSize:r,type:`Bytes`});let i=new Uint8Array(r);for(let t=0;t<r;t++){let a=n===`right`;i[a?t:r-t-1]=e[a?t:e.length-t-1]}return i}var m=e((()=>{re()}));function h(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw TypeError(`Cannot canonicalize non-finite number`);return Object.is(e,-0)?`0`:JSON.stringify(e)}if(typeof e==`bigint`)throw TypeError(`Cannot canonicalize bigint`);if(Array.isArray(e))return`[${e.map(e=>h(e)).join(`,`)}]`;if(typeof e==`object`)return`{${Object.keys(e).sort().reduce((t,n)=>{let r=e[n];return r!==void 0&&t.push(`${JSON.stringify(n)}:${h(r)}`),t},[]).join(`,`)}}`}function ee(e,t){return JSON.parse(e,(e,n)=>{let r=n;return typeof r==`string`&&r.endsWith(g)?BigInt(r.slice(0,-9)):typeof t==`function`?t(e,r):r})}var g,_=e((()=>{g=`#__bigint`}));function te(e,t={}){let{size:n}=t,r=b.encode(e);return typeof n==`number`?(f(r,n),v(r,n)):r}function v(e,t){return p(e,{dir:`right`,size:t})}function y(e){return e.length}var b,x,ne,re=e((()=>{d(),m(),_(),b=new TextEncoder,x=class extends u{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \\`${t}\\` bytes. Given size: \\`${e}\\` bytes.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeOverflowError`})}},ne=class extends u{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\\`${e}\\`) exceeds padding size (\\`${t}\\`).`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Bytes.SizeExceedsPaddingSizeError`})}}}));re();let ie=new TextDecoder,S=Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[t,e.charCodeAt(0)]));({...Object.fromEntries(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`).map((e,t)=>[e.charCodeAt(0),t]))});function ae(e,t={}){let{pad:n=!0,url:r=!1}=t,i=new Uint8Array(Math.ceil(e.length/3)*4);for(let t=0,n=0;n<e.length;t+=4,n+=3){let r=(e[n]<<16)+(e[n+1]<<8)+(e[n+2]|0);i[t]=S[r>>18],i[t+1]=S[r>>12&63],i[t+2]=S[r>>6&63],i[t+3]=S[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ie.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function oe(e,t={}){return ae(te(e),t)}_();function se(e){return oe(h(e),{pad:!1,url:!0})}function ce(e,t){return typeof t==`bigint`?t.toString():t}var le=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ue(e){return new le(e)}function de(e){return e==null}function fe(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function pe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}let me=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function he(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ge(e){if(he(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return he(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function _e(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ve(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function E(e){return typeof e==`string`?e:e?.message}function be(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function D(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function O(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:E(e.inst?._zod.def?.error?.(e))??E(a?.(e))??E(t?.error?.(e))??E(n.customError?.(e))??E(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let xe=/[\\uD800-\\uDBFF]/;function Se(e){let t=e.length;if(!xe.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ce(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function we(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Te(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):De(e,n,r.value)}}function k(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ee(e,t,n){return k(e,t,n,!1)}function De(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:k(this,t,n.bind(this))},set(e){k(this,t,e)}})}function Oe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let A,j=!1,ke={configurable:!0,get(){j=!0}};function M(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&A!==e._zod){A=void 0;return}A=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ke);let e=j;j=!1;try{let r=n(this);return j?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),j||=e,r}catch(n){throw delete this[t],j||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ae(e,t,n,r){let i=Oe(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var je;let N={value:void 0,enumerable:!1},Me=`captureStackTrace`in Error?Error:null;function Ne(e){let t=Me;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Me=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function P(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){N.value=new a(r);try{Object.defineProperty(n,\"_zod\",N)}finally{N.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Te(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,\"name\",{value:e});function d(e){let t=r?.Parent?Ne(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,\"init\",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,\"name\",{value:e}),d}var F=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Pe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(je=globalThis).__zod_globalConfig??(je.__zod_globalConfig={});let I=globalThis.__zod_globalConfig;function L(e){return e&&Object.assign(I,e),I}function Fe(){let e=this._zod;return e.message??=JSON.stringify(e.def,ce,2),e.message}function Ie(e){this._zod.message=e}let Le={get:Fe,set:Ie,enumerable:!0,configurable:!0},R={value:void 0,enumerable:!1},Re=new WeakSet([Object.prototype,Error.prototype]),ze=(e,t)=>{e.name=`$ZodError`,R.value=t,Object.defineProperty(e,\"issues\",R),R.value=void 0,Object.defineProperty(e,\"message\",Le);let n=Object.getPrototypeOf(e);Re.has(n)||(Re.add(n),Object.defineProperty(n,\"toString\",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,\"toString\",{value:e,configurable:!0,writable:!0})}}))};P(`$ZodError`,ze);let z=P(`$ZodError`,ze,void 0,{Parent:Error}),Be=(e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new F;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),Ve=(e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>O(e,o,L())));throw me(n,a?.callee??t),n}return s.value};return t})(z),He=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new F;return a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z);function Ue(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>O(e,n,L()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let We=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Ue(e,a.issues,i):{success:!0,data:a.value}})(z),Ge=/^[\\s\\S]{0,}$/,Ke=/^-?\\d+(?:\\.\\d+)?$/,B=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qe=e=>{let t=e.value;return!de(t)&&t.length!==void 0},Je=P(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=qe),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Se(r):i)>=t.minimum)return;let a=Ce(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ye=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),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})}):(r=e._zod).check??(r.check=()=>{})}),Xe=P(`$ZodCheckRegex`,(e,t)=>{Ye.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})}}),Ze={major:4,minor:6,patch:7},V=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ze;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=w(t),a;for(let o of n){if(o._zod.def.when){if(ye(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new F;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(D(t.issues,n,e),i||=w(t,n))});else{if(t.issues.length===n)continue;D(t.issues,n,e),i||=w(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(w(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new F;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get\"~standard\"(){return Ee(this,`~standard`,et(this))},set\"~standard\"(e){k(this,`~standard`,e)}}),Qe=(e,t)=>e.issues.length?{issues:e.issues.map(e=>O(e,t,L()))}:{value:e.value};async function $e(e,t){let n={async:!0};return Qe(await e._zod.run({value:t,issues:[]},n),n)}function et(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Qe(r,n)}catch{}return $e(e,t)},vendor:`zod`,version:1}}let tt=P(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=t.pattern??Ge,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),nt=P(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=Ke,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function rt(e,t){let n=be(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of be(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,D(n.issues,t,e),n}}return i(n,a)}}let it=e=>Array.isArray(e)?e.length:-1;function at(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}let ot=P(`$ZodArray`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>at(t,r,e)));else if(at(c,r,e),s&&c.issues.length!==0&&w(c))break}return o.length?Promise.all(o).then(()=>r):r},rt(e,it)});function H(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...T(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let st=[];function ct(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:st,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${String(t)}\": expected a Zod schema`);let a=ve(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function lt(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(w(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,d,f))):H(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let ut=P(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,\"shape\",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,\"shape\",{get:e})}let i=ue(()=>ct(t));M(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||pe(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=he,o=t.catchall,s,c=I.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(w(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>H(n,t,e,r,a,o))):H(s,t,e,r,a,o)}return o?lt(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function dt(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!w(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>O(e,r,L())))}),t)}let ft=P(`$ZodUnion`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),M(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),M(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>fe(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>dt(t,r,e,i)):dt(o,r,e,i)}}),pt=P(`$ZodRecord`,(e,t)=>{V.init(e,t);let n=I.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ge(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...T(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Ke.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>O(e,i,L())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...T(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...T(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),mt=P(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,I.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Pe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new F;return n.value=i,n}});function ht(e,t){return e.value=t.issues.length?void 0:t.value,e}let gt=P(`$ZodOptional`,(e,t)=>{V.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,M(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),M(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${fe(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ht(e,t)):ht(e,r)}return t.innerType._zod.run(e,n)}}),_t=P(`$ZodPipe`,(e,t)=>{V.init(e,t),M(e,`values`,e=>e.def.in._zod.values),M(e,`optin`,e=>e.def.in._zod.optin),M(e,`optout`,e=>e.def.out._zod.optout),M(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.in,n)):U(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>U(e,t.out,n)):U(r,t.out,n)}});function U(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let vt=P(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>yt(t,n,r,e));yt(i,n,r,e)}});function yt(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(we(e))}}function bt(e){return e.checks&&=[...e.checks],e}function xt(e,t){return new e(bt({type:`string`,...C(t)}))}function St(e,t){return new e(bt({type:`number`,checks:[],...C(t)}))}function W(e,t){return new Je({check:`min_length`,...C(t),minimum:e})}function Ct(e,t){return new Xe({check:`string_format`,format:`regex`,...C(t),pattern:e})}function wt(e,t,n){let r=C(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}let G=P(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){k(this,`with`,e)},parse(e,t){return Be(this,e,t,{callee:this.parse})},parseAsync(e,t){return Ve(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return He(this,e,t)},safeParseAsync(e,t){return We(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return _e(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Tt=P(`ZodMiniString`,(e,t)=>{tt.init(e,t),G.init(e,t)});function K(e){return xt(Tt,e)}let Et=P(`ZodMiniNumber`,(e,t)=>{nt.init(e,t),G.init(e,t)});function Dt(e){return St(Et,e)}let Ot=P(`ZodMiniArray`,(e,t)=>{ot.init(e,t),G.init(e,t)});function kt(e,t){return new Ot({type:`array`,element:e,...C(t)})}let At=P(`ZodMiniObject`,(e,t)=>{ut.init(e,t),G.init(e,t),Ae(e,`shape`,e=>e._zod.def.shape,!1)});function q(e,t){let n={type:`object`,shape:e??{},...C(t)};return new At(n)}let jt=P(`ZodMiniUnion`,(e,t)=>{ft.init(e,t),G.init(e,t)});function Mt(e,t){return new jt({type:`union`,options:e,...C(t)})}let Nt=P(`ZodMiniRecord`,(e,t)=>{pt.init(e,t),G.init(e,t)});function Pt(e,t,n){return!t||!t._zod?new Nt({type:`record`,keyType:K(),valueType:e,...C(t)}):new Nt({type:`record`,keyType:e,valueType:t,...C(n)})}let Ft=P(`ZodMiniTransform`,(e,t)=>{mt.init(e,t),G.init(e,t)});function It(e){return new Ft({type:`transform`,transform:e})}let Lt=P(`ZodMiniOptional`,(e,t)=>{gt.init(e,t),G.init(e,t)});function J(e){return new Lt({type:`optional`,innerType:e})}let Rt=P(`ZodMiniPipe`,(e,t)=>{_t.init(e,t),G.init(e,t)});function zt(e,t){return new Rt({type:`pipe`,in:e,out:t})}let Bt=P(`ZodMiniCustom`,(e,t)=>{vt.init(e,t),G.init(e,t)});function Vt(e,t){return wt(Bt,e??(()=>!0),t)}function Ht(){return K().check(Ct(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function Ut(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:se(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:se(r)},payload:e.payload,...e.source&&{source:e.source}},c=oe(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function Wt(e){return e}function Gt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}function Kt(e,t){if(!Number.isInteger(t)||t<0)throw RangeError(`Decimals must be a non-negative integer.`);if(!/^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)$/.test(e))throw TypeError(`Value \\`${e}\\` is not a valid decimal number.`);let n=e.startsWith(`-`),[r=`0`,i=``]=(n?e.slice(1):e).split(`.`),a=i.slice(0,t).padEnd(t,`0`),o=BigInt(`${r||`0`}${a}`);return i.length>t&&i[t]>=`5`&&(o+=1n),n?-o:o}let qt=Mt([q({customer:J(K().check(W(1))),hooks:J(q({inputs:q({tax:q({calculation:K().check(W(1))})})})),metadata:J(Pt(K(),K())),receipt_email:J(K().check(W(1)))}),Vt(e=>typeof e==`function`)]),Jt=Wt({name:`stripe`,intent:`charge`,schema:{credential:{payload:q({externalId:J(K()),spt:K()})},request:zt(q({amount:Ht(),currency:K(),decimals:Dt(),description:J(K()),externalId:J(K()),metadata:J(Pt(K(),K())),networkId:K(),paymentIntentOptions:J(qt),paymentMethodTypes:kt(K()).check(W(1)),recipient:J(K())}),It(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:Kt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function Yt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return Gt(Jt,{context:q({paymentMethod:J(K())}),async createCredential({challenge:e,context:a}){let o=a?.paymentMethod??i;if(!o)throw Error(`paymentMethod is required (pass via context or parameters)`);let s=e.request.amount,c=e.request.currency,l=typeof e.request.externalId==`string`?e.request.externalId:void 0,u=e.request.methodDetails?.networkId;if(!u)throw Error(`networkId is required in challenge.methodDetails`);let d=e.request.methodDetails?.metadata;if(d?.externalId)throw Error(`methodDetails.metadata.externalId is reserved; use credential externalId instead`);let f=e.expires?Math.floor(new Date(e.expires).getTime()/1e3):Math.floor(Date.now()/1e3)+3600,p=await n({amount:s,challenge:e,client:t,currency:c,expiresAt:f,metadata:d,networkId:u,paymentMethod:o}),m=l??r;return Ut({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function Xt(e){return[Yt(e)]}(function(e){e.charge=Yt})(Xt||={});var Zt=r();let Y={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},Qt={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},X={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var Z=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let $t={accent:new Z(`accent`),background:new Z(`background`),border:new Z(`border`),foreground:new Z(`foreground`),muted:new Z(`muted`),negative:new Z(`negative`),positive:new Z(`positive`),surface:new Z(`surface`),fontFamily:new Z(`font-family`),fontSizeBase:new Z(`font-size-base`),radius:new Z(`radius`),spacingUnit:new Z(`spacing-unit`)};String.raw`<style>\n *,\n ::after,\n ::before,\n ::backdrop,\n ::file-selector-button {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n border-color: ${$t.border};\n }\n html,\n :host {\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n -webkit-tap-highlight-color: transparent;\n }\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n b,\n strong {\n font-weight: bolder;\n }\n code,\n kbd,\n samp,\n pre {\n font-family:\n ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',\n monospace;\n font-size: 1em;\n }\n small {\n font-size: 80%;\n }\n ol,\n ul,\n menu {\n list-style: none;\n }\n img,\n svg,\n video,\n canvas,\n audio,\n iframe,\n embed,\n object {\n display: block;\n vertical-align: middle;\n }\n img,\n video {\n max-width: 100%;\n height: auto;\n }\n button,\n input,\n select,\n optgroup,\n textarea,\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n border-radius: 0;\n background-color: transparent;\n opacity: 1;\n }\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n ::placeholder {\n opacity: 1;\n }\n @supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n textarea {\n resize: vertical;\n }\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n :-moz-ui-invalid {\n box-shadow: none;\n }\n button,\n input:where([type='button'], [type='reset'], [type='submit']),\n ::file-selector-button {\n appearance: button;\n }\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n height: auto;\n }\n [hidden]:where(:not([hidden='until-found'])) {\n display: none !important;\n }\n</style>`;function en(e,t){if(t==null)return e;if(!Q(e)||!Q(t))return t??e;let n={...e};for(let[e,r]of Object.entries(t)){if(r==null||r===``)continue;let t=n[e];n[e]=Q(t)&&Q(r)?en(t,r):r}return n}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function tn(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(Qt.serviceWorker,``);let r=await navigator.serviceWorker.register(n.pathname+n.search),i=await new Promise(e=>{let t=r.installing??r.waiting??r.active;if(t?.state===`activated`)return e(t);let n=t??r;n.addEventListener(`statechange`,function t(){let i=r.active;i?.state===`activated`&&(n.removeEventListener(`statechange`,t),e(i))})});await new Promise(n=>{let r=new MessageChannel;r.port1.onmessage=()=>n(),i.postMessage({credential:e,header:t},[r.port2])}),location.reload()}_();function nn(e){let t=document.getElementById(Y.data),n=ee(t.textContent),r=t.getAttribute(X.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(X.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(X.challengeId),o=a?(i.removeAttribute(X.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(Y.error)?.remove();return}let t=document.getElementById(Y.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=Y.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>tn(e,o.challenge.header),vars:$t}}let $=nn(`stripe`),rn=String.raw,an=document.createElement(`style`);an.textContent=rn`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${$.vars.spacingUnit} * 8);\n }\n button {\n background: ${$.vars.accent};\n border-radius: ${$.vars.radius};\n color: ${$.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${$.vars.spacingUnit} * 4) calc(${$.vars.spacingUnit} * 8);\n width: 100%;\n }\n button:hover:not(:disabled) {\n opacity: 0.85;\n }\n button:disabled {\n cursor: default;\n opacity: 0.5;\n }\n`,$.root.append(an),(async()=>{let e=await(0,Zt.loadStripe)($.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if($.config.elements?.options?.appearance?.theme)return $.config.elements?.options?.appearance?.theme;switch($.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return en({disableAnimations:!0,theme:e,variables:{borderRadius:$.theme.radius,colorBackground:$.theme.surface[n],colorDanger:$.theme.negative[n],colorPrimary:$.theme.accent[n],colorText:$.theme.foreground[n],colorTextSecondary:$.theme.muted[n],fontSizeBase:$.theme.fontSizeBase,fontFamily:$.theme.fontFamily,spacingUnit:$.theme.spacingUnit}},$.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...$.config.elements?.options,amount:Number($.challenge.request.amount),currency:$.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:$.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,$.config.elements?.paymentOptions).mount(i),$.root.appendChild(i);let a=document.createElement(`button`);a.textContent=$.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),$.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...$.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await Xt({client:e,createToken:on})[0].createCredential({challenge:$.challenge,context:{paymentMethod:t.id}});await $.submit(i)}catch(e){$.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function on(e){let t=new URL($.config.createTokenUrl,location.origin);if(t.origin!==location.origin)throw Error(`createTokenUrl must be same-origin`);let n=await fetch(t,{method:`POST`,headers:{\"Content-Type\":`application/json`},body:JSON.stringify(e)});if(!n.ok){let e=await n.text().catch(()=>`<response body unavailable>`);throw Error(`Failed to create SPT (${n.status}): ${e}`)}return(await n.json()).spt}})();</script>";
3
3
  //# sourceMappingURL=html.gen.js.map
@@ -13,8 +13,9 @@ export function getTransfers(request) {
13
13
  memo: request.methodDetails?.memo,
14
14
  recipient: request.recipient,
15
15
  },
16
+ // Canonical integer form, so a split such as "0300" matches a 300 transfer.
16
17
  ...splits.map((split) => ({
17
- amount: split.amount,
18
+ amount: BigInt(split.amount).toString(),
18
19
  memo: split.memo,
19
20
  recipient: split.recipient,
20
21
  })),
@@ -10,8 +10,6 @@ export declare function isTempoTransaction(serialized: string | undefined): bool
10
10
  */
11
11
  export declare const callScopes: `0x${string}`[][];
12
12
  export type Policy = {
13
- /** Allows a sponsored transaction to install a new access key. @default false */
14
- allowKeyAuthorization: boolean;
15
13
  maxGas: bigint;
16
14
  maxFeePerGas: bigint;
17
15
  maxPriorityFeePerGas: bigint;
@@ -235,7 +235,6 @@ export async function preflightSponsorship(parameters) {
235
235
  * swap transactions at peak gas prices. Bumped from 0.01 ETH in #327.
236
236
  */
237
237
  const defaultPolicy = {
238
- allowKeyAuthorization: false,
239
238
  maxGas: 2000000n,
240
239
  maxFeePerGas: 100000000000n,
241
240
  maxPriorityFeePerGas: 10000000000n,
@@ -255,7 +254,6 @@ function getPolicy(chainId, overrides) {
255
254
  if (!overrides)
256
255
  return base;
257
256
  return {
258
- allowKeyAuthorization: overrides.allowKeyAuthorization ?? base.allowKeyAuthorization,
259
257
  maxGas: overrides.maxGas ?? base.maxGas,
260
258
  maxFeePerGas: overrides.maxFeePerGas ?? base.maxFeePerGas,
261
259
  maxPriorityFeePerGas: overrides.maxPriorityFeePerGas ?? base.maxPriorityFeePerGas,
@@ -467,8 +465,6 @@ export function assertTransactionPolicy(parameters) {
467
465
  chainId: String(transactionChainId),
468
466
  });
469
467
  assertCanonicalSponsoredTransaction(transaction, fail);
470
- if (transaction.keyAuthorization !== undefined && !policy.allowKeyAuthorization)
471
- fail('fee-sponsored transaction keyAuthorization is not allowed');
472
468
  if (gas === undefined || gas <= 0n)
473
469
  fail('fee-sponsored transaction must declare gas');
474
470
  const gasLimit = gas;
@@ -314,7 +314,6 @@ export function subscription(p) {
314
314
  }
315
315
  // Access-key provisioning can cost around 4M gas.
316
316
  const defaultFeePayerPolicy = {
317
- allowKeyAuthorization: true,
318
317
  maxGas: 5000000n,
319
318
  maxTotalFee: 200000000000000000n,
320
319
  };