mppx 0.9.0 → 0.9.1
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/CHANGELOG.md +8 -0
- package/dist/Errors.d.ts +10 -0
- package/dist/Errors.js +12 -0
- package/dist/Mcp.d.ts +9 -1
- package/dist/Mcp.js +18 -0
- package/dist/Method.d.ts +7 -0
- package/dist/cli/cli.js +134 -134
- package/dist/cli/plugins/index.js +12 -12
- package/dist/client/internal/protocols/Mcp.js +2 -1
- package/dist/mcp/client/McpClient.js +22 -10
- package/dist/mcp/server/Transport.d.ts +2 -2
- package/dist/mcp/server/Transport.js +11 -4
- package/dist/server/Mppx.d.ts +6 -0
- package/dist/server/Mppx.js +75 -6
- package/dist/server/Transport.js +8 -15
- package/dist/stripe/Methods.d.ts +6 -0
- package/dist/stripe/Methods.js +3 -1
- package/dist/stripe/client/Charge.d.ts +6 -0
- package/dist/stripe/client/Methods.d.ts +6 -0
- package/dist/stripe/internal/payment-intent.d.ts +7 -0
- package/dist/stripe/internal/payment-intent.js +6 -0
- package/dist/stripe/server/Charge.d.ts +6 -0
- package/dist/stripe/server/Charge.js +8 -3
- package/dist/stripe/server/Methods.js +62 -7
- package/dist/stripe/server/internal/html.gen.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/Tokens.d.ts +13 -0
- package/dist/tempo/Tokens.js +13 -0
- package/dist/tempo/client/Charge.d.ts +1 -1
- package/dist/tempo/client/Charge.js +17 -0
- package/dist/tempo/index.d.ts +1 -0
- package/dist/tempo/index.js +1 -0
- package/dist/tempo/internal/fee-payer.d.ts +1 -1
- package/dist/tempo/internal/fee-payer.js +2 -12
- package/dist/tempo/internal/fee-token.d.ts +2 -0
- package/dist/tempo/internal/fee-token.js +7 -0
- package/dist/tempo/server/internal/html.gen.d.ts +1 -1
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/SessionManager.js +1 -2
- package/dist/tempo/session/server/Session.js +5 -2
- package/dist/x402/mcp.js +4 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare 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.13.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},v=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.13.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},y=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)},b,x=!1,S=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return _(b).then(function(e){return v(e,t,r)})};S.setLoadParameters=function(e){if(x&&b){var t=y(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===b?.[n]},!0))return}if(x)throw Error(`You cannot change load parameters after calling loadStripe`);b=y(e)},e.loadStripe=S})),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(b(e)>t)throw new S({givenSize:b(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 C({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((()=>{te()}));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 v(e,t={}){let{size:n}=t,r=x.encode(e);return typeof n==`number`?(f(r,n),y(r,n)):r}function y(e,t){return p(e,{dir:`right`,size:t})}function b(e){return e.length}var x,S,C,te=e((()=>{d(),m(),_(),x=new TextEncoder,S=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`})}},C=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`})}}}));te();let ne=new TextDecoder,w=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 re(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]=w[r>>18],i[t+1]=w[r>>12&63],i[t+2]=w[r>>6&63],i[t+3]=w[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ne.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function T(e,t={}){return re(v(e),t)}_();function E(e){return T(h(e),{pad:!1,url:!0})}var D;function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,\"_zod\",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,\"name\",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,\"init\",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,\"name\",{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ie=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});let ae=globalThis.__zod_globalConfig;function A(e){return e&&Object.assign(ae,e),ae}function oe(e,t){return typeof t==`bigint`?t.toString():t}function se(e){return{get value(){{let t=e();return Object.defineProperty(this,\"value\",{value:t}),t}}}}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}let ue=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ue)return r===void 0&&(r=ue,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}let de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fe(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return M(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function P(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 he(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 F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function L(e,t,n){let r=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}let R=(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,oe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},_e=O(`$ZodError`,R),z=O(`$ZodError`,R,{Parent:Error}),ve=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),ye=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),be=(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 k;return a.issues.length?{success:!1,error:new(e??_e)(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),xe=(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?{success:!1,error:new e(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),Se=e=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\\\s\\\\S]*`;return RegExp(`^${t}$`)},Ce=/^-?\\d+(?:\\.\\d+)?$/,B=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),we=O(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ge(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Te=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(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})}):(r=e._zod).check??(r.check=()=>{})}),Ee=O(`$ZodCheckRegex`,(e,t)=>{Te.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})}}),De={major:4,minor:4,patch:3},V=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=De;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(he(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Oe=O(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Se(e._zod.bag),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}}),ke=O(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ce,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function Ae(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}let je=O(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ae(t,n,e))):Ae(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...F(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Me(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let n=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ne(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,u,d))):H(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Pe=O(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let n={...e};return Object.defineProperty(t,\"shape\",{value:n}),n}})}let n=se(()=>Me(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=M,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>H(n,t,e,s,r,i))):H(a,t,e,s,r,i)}return i?Ne(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fe=O(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!fe(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>L(e,r,A())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...F(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...F(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ce.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>L(e,r,A())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ie=O(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ie(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.fallback=!0,n));if(i instanceof Promise)throw new k;return n.value=i,n.fallback=!0,n}});function Le(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Re=O(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Le(e,r)):Le(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ze=O(`$ZodPipe`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.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.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function Be(e,t){return new e({type:`string`,...N(t)})}function Ve(e,t){return new e({type:`number`,checks:[],...N(t)})}function He(e,t){return new we({check:`min_length`,...N(t),minimum:e})}function Ue(e,t){return new Ee({check:`string_format`,format:`regex`,...N(t),pattern:e})}let W=O(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>be(e,t,n),e.parseAsync=async(t,n)=>ye(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xe(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>pe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),We=O(`ZodMiniString`,(e,t)=>{Oe.init(e,t),W.init(e,t)});function G(e){return Be(We,e)}let Ge=O(`ZodMiniNumber`,(e,t)=>{ke.init(e,t),W.init(e,t)});function Ke(e){return Ve(Ge,e)}let qe=O(`ZodMiniArray`,(e,t)=>{je.init(e,t),W.init(e,t)});function Je(e,t){return new qe({type:`array`,element:e,...N(t)})}let Ye=O(`ZodMiniObject`,(e,t)=>{Pe.init(e,t),W.init(e,t),j(e,`shape`,()=>t.shape)});function K(e,t){let n={type:`object`,shape:e??{},...N(t)};return new Ye(n)}let Xe=O(`ZodMiniRecord`,(e,t)=>{Fe.init(e,t),W.init(e,t)});function Ze(e,t,n){return!t||!t._zod?new Xe({type:`record`,keyType:G(),valueType:e,...N(t)}):new Xe({type:`record`,keyType:e,valueType:t,...N(n)})}let Qe=O(`ZodMiniTransform`,(e,t)=>{Ie.init(e,t),W.init(e,t)});function $e(e){return new Qe({type:`transform`,transform:e})}let et=O(`ZodMiniOptional`,(e,t)=>{Re.init(e,t),W.init(e,t)});function q(e){return new et({type:`optional`,innerType:e})}let tt=O(`ZodMiniPipe`,(e,t)=>{ze.init(e,t),W.init(e,t)});function nt(e,t){return new tt({type:`pipe`,in:e,out:t})}function rt(){return G().check(Ue(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function it(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:E(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:E(r)},payload:e.payload,...e.source&&{source:e.source}},c=T(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function at(e,t=0){if(!Number.isInteger(t)||t<0)throw new ct({decimals:t});if(!/^-?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)$/.test(e))throw new st({value:e});let[n=``,r=`0`]=e.split(`.`),i=n.startsWith(`-`);if(i&&(n=n.slice(1)),n===``&&(n=`0`),r=r.replace(/(0+)$/,``),t===0)r.length>0&&Number.parseInt(r[0],10)>=5&&(n=`${BigInt(n)+1n}`),r=``;else if(r.length>t){let e=r.slice(0,t);if(Number.parseInt(r.slice(t,t+1),10)>=5){let i=ot(e);i.length>t?(r=i.slice(1),n=`${BigInt(n)+1n}`):r=i}else r=e}else r=r.padEnd(t,`0`);return BigInt(`${i?`-`:``}${n}${r}`)}function ot(e){let t=e.split(``),n=t.length-1;for(;n>=0;){let e=Number.parseInt(t[n],10)+1;if(e<10)return t[n]=String(e),t.join(``);t[n]=`0`,n--}return`1${t.join(``)}`}var st,ct;e((()=>{st=class extends Error{constructor({value:e}){super(`Value \\`${e}\\` is not a valid decimal number.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalNumberError`})}},ct=class extends Error{constructor({decimals:e}){super(`\\`decimals\\` must be a non-negative integer. Got \\`${e}\\`.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalsError`})}}}))();function lt(e,t){return at(e,t)}function ut(e){return e}function dt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}let ft=ut({name:`stripe`,intent:`charge`,schema:{credential:{payload:K({externalId:q(G()),spt:G()})},request:nt(K({amount:rt(),currency:G(),decimals:Ke(),description:q(G()),externalId:q(G()),metadata:q(Ze(G(),G())),networkId:G(),paymentMethodTypes:Je(G()).check(He(1)),recipient:q(G())}),$e(({amount:e,decimals:t,metadata:n,networkId:r,paymentMethodTypes:i,...a})=>({...a,amount:lt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:i,...n!==void 0&&{metadata:n}}})))}});function pt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return dt(ft,{context:K({paymentMethod:q(G())}),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 it({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function mt(e){return[pt(e)]}(function(e){e.charge=pt})(mt||={});var ht=r();let J={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},gt={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},Y={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var X=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let _t={accent:new X(`accent`),background:new X(`background`),border:new X(`border`),foreground:new X(`foreground`),muted:new X(`muted`),negative:new X(`negative`),positive:new X(`positive`),surface:new X(`surface`),fontFamily:new X(`font-family`),fontSizeBase:new X(`font-size-base`),radius:new X(`radius`),spacingUnit:new X(`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 vt(e,t){if(t==null)return e;if(!Z(e)||!Z(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]=Z(t)&&Z(r)?vt(t,r):r}return n}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function yt(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(gt.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 bt(e){let t=document.getElementById(J.data),n=ee(t.textContent),r=t.getAttribute(Y.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(Y.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(Y.challengeId),o=a?(i.removeAttribute(Y.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(J.error)?.remove();return}let t=document.getElementById(J.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=J.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>yt(e,o.challenge.header),vars:_t}}let Q=bt(`stripe`),xt=String.raw,$=document.createElement(`style`);$.textContent=xt`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${Q.vars.spacingUnit} * 8);\n }\n button {\n background: ${Q.vars.accent};\n border-radius: ${Q.vars.radius};\n color: ${Q.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${Q.vars.spacingUnit} * 4) calc(${Q.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`,Q.root.append($),(async()=>{let e=await(0,ht.loadStripe)(Q.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if(Q.config.elements?.options?.appearance?.theme)return Q.config.elements?.options?.appearance?.theme;switch(Q.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return vt({disableAnimations:!0,theme:e,variables:{borderRadius:Q.theme.radius,colorBackground:Q.theme.surface[n],colorDanger:Q.theme.negative[n],colorPrimary:Q.theme.accent[n],colorText:Q.theme.foreground[n],colorTextSecondary:Q.theme.muted[n],fontSizeBase:Q.theme.fontSizeBase,fontFamily:Q.theme.fontFamily,spacingUnit:Q.theme.spacingUnit}},Q.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...Q.config.elements?.options,amount:Number(Q.challenge.request.amount),currency:Q.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:Q.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,Q.config.elements?.paymentOptions).mount(i),Q.root.appendChild(i);let a=document.createElement(`button`);a.textContent=Q.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),Q.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...Q.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await mt({client:e,createToken:St})[0].createCredential({challenge:Q.challenge,context:{paymentMethod:t.id}});await Q.submit(i)}catch(e){Q.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function St(e){let t=new URL(Q.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>";
|
|
1
|
+
export declare 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.13.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},v=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.13.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},y=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)},b,x=!1,S=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return _(b).then(function(e){return v(e,t,r)})};S.setLoadParameters=function(e){if(x&&b){var t=y(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===b?.[n]},!0))return}if(x)throw Error(`You cannot change load parameters after calling loadStripe`);b=y(e)},e.loadStripe=S})),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(b(e)>t)throw new S({givenSize:b(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 C({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((()=>{te()}));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 v(e,t={}){let{size:n}=t,r=x.encode(e);return typeof n==`number`?(f(r,n),y(r,n)):r}function y(e,t){return p(e,{dir:`right`,size:t})}function b(e){return e.length}var x,S,C,te=e((()=>{d(),m(),_(),x=new TextEncoder,S=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`})}},C=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`})}}}));te();let ne=new TextDecoder,w=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 re(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]=w[r>>18],i[t+1]=w[r>>12&63],i[t+2]=w[r>>6&63],i[t+3]=w[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ne.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function T(e,t={}){return re(v(e),t)}_();function E(e){return T(h(e),{pad:!1,url:!0})}var D;function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,\"_zod\",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,\"name\",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,\"init\",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,\"name\",{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ie=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});let ae=globalThis.__zod_globalConfig;function A(e){return e&&Object.assign(ae,e),ae}function oe(e,t){return typeof t==`bigint`?t.toString():t}function se(e){return{get value(){{let t=e();return Object.defineProperty(this,\"value\",{value:t}),t}}}}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}let ue=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ue)return r===void 0&&(r=ue,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}let de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fe(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return M(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function P(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 he(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 F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function L(e,t,n){let r=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}let R=(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,oe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},_e=O(`$ZodError`,R),z=O(`$ZodError`,R,{Parent:Error}),ve=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),ye=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),be=(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 k;return a.issues.length?{success:!1,error:new(e??_e)(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),xe=(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?{success:!1,error:new e(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),Se=e=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\\\s\\\\S]*`;return RegExp(`^${t}$`)},Ce=/^-?\\d+(?:\\.\\d+)?$/,B=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),we=O(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ge(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Te=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(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})}):(r=e._zod).check??(r.check=()=>{})}),Ee=O(`$ZodCheckRegex`,(e,t)=>{Te.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})}}),De={major:4,minor:4,patch:3},V=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=De;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(he(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Oe=O(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Se(e._zod.bag),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}}),ke=O(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ce,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function Ae(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}let je=O(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ae(t,n,e))):Ae(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...F(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Me(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let n=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ne(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,u,d))):H(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Pe=O(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let n={...e};return Object.defineProperty(t,\"shape\",{value:n}),n}})}let n=se(()=>Me(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=M,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>H(n,t,e,s,r,i))):H(a,t,e,s,r,i)}return i?Ne(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fe=O(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!fe(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>L(e,r,A())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...F(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...F(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ce.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>L(e,r,A())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ie=O(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ie(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.fallback=!0,n));if(i instanceof Promise)throw new k;return n.value=i,n.fallback=!0,n}});function Le(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Re=O(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Le(e,r)):Le(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ze=O(`$ZodPipe`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.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.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function Be(e,t){return new e({type:`string`,...N(t)})}function Ve(e,t){return new e({type:`number`,checks:[],...N(t)})}function He(e,t){return new we({check:`min_length`,...N(t),minimum:e})}function Ue(e,t){return new Ee({check:`string_format`,format:`regex`,...N(t),pattern:e})}let W=O(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>be(e,t,n),e.parseAsync=async(t,n)=>ye(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xe(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>pe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),We=O(`ZodMiniString`,(e,t)=>{Oe.init(e,t),W.init(e,t)});function G(e){return Be(We,e)}let Ge=O(`ZodMiniNumber`,(e,t)=>{ke.init(e,t),W.init(e,t)});function Ke(e){return Ve(Ge,e)}let qe=O(`ZodMiniArray`,(e,t)=>{je.init(e,t),W.init(e,t)});function Je(e,t){return new qe({type:`array`,element:e,...N(t)})}let Ye=O(`ZodMiniObject`,(e,t)=>{Pe.init(e,t),W.init(e,t),j(e,`shape`,()=>t.shape)});function K(e,t){let n={type:`object`,shape:e??{},...N(t)};return new Ye(n)}let Xe=O(`ZodMiniRecord`,(e,t)=>{Fe.init(e,t),W.init(e,t)});function Ze(e,t,n){return!t||!t._zod?new Xe({type:`record`,keyType:G(),valueType:e,...N(t)}):new Xe({type:`record`,keyType:e,valueType:t,...N(n)})}let Qe=O(`ZodMiniTransform`,(e,t)=>{Ie.init(e,t),W.init(e,t)});function $e(e){return new Qe({type:`transform`,transform:e})}let et=O(`ZodMiniOptional`,(e,t)=>{Re.init(e,t),W.init(e,t)});function q(e){return new et({type:`optional`,innerType:e})}let tt=O(`ZodMiniPipe`,(e,t)=>{ze.init(e,t),W.init(e,t)});function nt(e,t){return new tt({type:`pipe`,in:e,out:t})}function rt(){return G().check(Ue(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function it(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:E(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:E(r)},payload:e.payload,...e.source&&{source:e.source}},c=T(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function at(e,t=0){if(!Number.isInteger(t)||t<0)throw new ct({decimals:t});if(!/^-?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)$/.test(e))throw new st({value:e});let[n=``,r=`0`]=e.split(`.`),i=n.startsWith(`-`);if(i&&(n=n.slice(1)),n===``&&(n=`0`),r=r.replace(/(0+)$/,``),t===0)r.length>0&&Number.parseInt(r[0],10)>=5&&(n=`${BigInt(n)+1n}`),r=``;else if(r.length>t){let e=r.slice(0,t);if(Number.parseInt(r.slice(t,t+1),10)>=5){let i=ot(e);i.length>t?(r=i.slice(1),n=`${BigInt(n)+1n}`):r=i}else r=e}else r=r.padEnd(t,`0`);return BigInt(`${i?`-`:``}${n}${r}`)}function ot(e){let t=e.split(``),n=t.length-1;for(;n>=0;){let e=Number.parseInt(t[n],10)+1;if(e<10)return t[n]=String(e),t.join(``);t[n]=`0`,n--}return`1${t.join(``)}`}var st,ct;e((()=>{st=class extends Error{constructor({value:e}){super(`Value \\`${e}\\` is not a valid decimal number.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalNumberError`})}},ct=class extends Error{constructor({decimals:e}){super(`\\`decimals\\` must be a non-negative integer. Got \\`${e}\\`.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalsError`})}}}))();function lt(e,t){return at(e,t)}function ut(e){return e}function dt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}let ft=K({metadata:Ze(G(),G())}),pt=ut({name:`stripe`,intent:`charge`,schema:{credential:{payload:K({externalId:q(G()),spt:G()})},request:nt(K({amount:rt(),currency:G(),decimals:Ke(),description:q(G()),externalId:q(G()),metadata:q(Ze(G(),G())),networkId:G(),paymentIntentOptions:q(ft),paymentMethodTypes:Je(G()).check(He(1)),recipient:q(G())}),$e(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:lt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function mt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return dt(pt,{context:K({paymentMethod:q(G())}),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 it({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function ht(e){return[mt(e)]}(function(e){e.charge=mt})(ht||={});var gt=r();let J={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},_t={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},Y={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var X=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let vt={accent:new X(`accent`),background:new X(`background`),border:new X(`border`),foreground:new X(`foreground`),muted:new X(`muted`),negative:new X(`negative`),positive:new X(`positive`),surface:new X(`surface`),fontFamily:new X(`font-family`),fontSizeBase:new X(`font-size-base`),radius:new X(`radius`),spacingUnit:new X(`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: ${vt.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 yt(e,t){if(t==null)return e;if(!Z(e)||!Z(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]=Z(t)&&Z(r)?yt(t,r):r}return n}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function bt(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(_t.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 xt(e){let t=document.getElementById(J.data),n=ee(t.textContent),r=t.getAttribute(Y.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(Y.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(Y.challengeId),o=a?(i.removeAttribute(Y.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(J.error)?.remove();return}let t=document.getElementById(J.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=J.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>bt(e,o.challenge.header),vars:vt}}let Q=xt(`stripe`),St=String.raw,$=document.createElement(`style`);$.textContent=St`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${Q.vars.spacingUnit} * 8);\n }\n button {\n background: ${Q.vars.accent};\n border-radius: ${Q.vars.radius};\n color: ${Q.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${Q.vars.spacingUnit} * 4) calc(${Q.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`,Q.root.append($),(async()=>{let e=await(0,gt.loadStripe)(Q.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if(Q.config.elements?.options?.appearance?.theme)return Q.config.elements?.options?.appearance?.theme;switch(Q.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return yt({disableAnimations:!0,theme:e,variables:{borderRadius:Q.theme.radius,colorBackground:Q.theme.surface[n],colorDanger:Q.theme.negative[n],colorPrimary:Q.theme.accent[n],colorText:Q.theme.foreground[n],colorTextSecondary:Q.theme.muted[n],fontSizeBase:Q.theme.fontSizeBase,fontFamily:Q.theme.fontFamily,spacingUnit:Q.theme.spacingUnit}},Q.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...Q.config.elements?.options,amount:Number(Q.challenge.request.amount),currency:Q.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:Q.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,Q.config.elements?.paymentOptions).mount(i),Q.root.appendChild(i);let a=document.createElement(`button`);a.textContent=Q.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),Q.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...Q.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await ht({client:e,createToken:Ct})[0].createCredential({challenge:Q.challenge,context:{paymentMethod:t.id}});await Q.submit(i)}catch(e){Q.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function Ct(e){let t=new URL(Q.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
2
|
//# sourceMappingURL=html.gen.d.ts.map
|
|
@@ -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.13.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},v=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.13.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},y=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)},b,x=!1,S=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return _(b).then(function(e){return v(e,t,r)})};S.setLoadParameters=function(e){if(x&&b){var t=y(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===b?.[n]},!0))return}if(x)throw Error(`You cannot change load parameters after calling loadStripe`);b=y(e)},e.loadStripe=S})),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(b(e)>t)throw new S({givenSize:b(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 C({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((()=>{te()}));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 v(e,t={}){let{size:n}=t,r=x.encode(e);return typeof n==`number`?(f(r,n),y(r,n)):r}function y(e,t){return p(e,{dir:`right`,size:t})}function b(e){return e.length}var x,S,C,te=e((()=>{d(),m(),_(),x=new TextEncoder,S=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`})}},C=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`})}}}));te();let ne=new TextDecoder,w=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 re(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]=w[r>>18],i[t+1]=w[r>>12&63],i[t+2]=w[r>>6&63],i[t+3]=w[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ne.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function T(e,t={}){return re(v(e),t)}_();function E(e){return T(h(e),{pad:!1,url:!0})}var D;function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,\"_zod\",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,\"name\",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,\"init\",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,\"name\",{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ie=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});let ae=globalThis.__zod_globalConfig;function A(e){return e&&Object.assign(ae,e),ae}function oe(e,t){return typeof t==`bigint`?t.toString():t}function se(e){return{get value(){{let t=e();return Object.defineProperty(this,\"value\",{value:t}),t}}}}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}let ue=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ue)return r===void 0&&(r=ue,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}let de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fe(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return M(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function P(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 he(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 F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function L(e,t,n){let r=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}let R=(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,oe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},_e=O(`$ZodError`,R),z=O(`$ZodError`,R,{Parent:Error}),ve=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),ye=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),be=(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 k;return a.issues.length?{success:!1,error:new(e??_e)(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),xe=(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?{success:!1,error:new e(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),Se=e=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\\\s\\\\S]*`;return RegExp(`^${t}$`)},Ce=/^-?\\d+(?:\\.\\d+)?$/,B=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),we=O(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ge(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Te=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(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})}):(r=e._zod).check??(r.check=()=>{})}),Ee=O(`$ZodCheckRegex`,(e,t)=>{Te.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})}}),De={major:4,minor:4,patch:3},V=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=De;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(he(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Oe=O(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Se(e._zod.bag),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}}),ke=O(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ce,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function Ae(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}let je=O(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ae(t,n,e))):Ae(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...F(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Me(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let n=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ne(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,u,d))):H(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Pe=O(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let n={...e};return Object.defineProperty(t,\"shape\",{value:n}),n}})}let n=se(()=>Me(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=M,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>H(n,t,e,s,r,i))):H(a,t,e,s,r,i)}return i?Ne(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fe=O(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!fe(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>L(e,r,A())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...F(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...F(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ce.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>L(e,r,A())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ie=O(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ie(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.fallback=!0,n));if(i instanceof Promise)throw new k;return n.value=i,n.fallback=!0,n}});function Le(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Re=O(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Le(e,r)):Le(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ze=O(`$ZodPipe`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.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.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function Be(e,t){return new e({type:`string`,...N(t)})}function Ve(e,t){return new e({type:`number`,checks:[],...N(t)})}function He(e,t){return new we({check:`min_length`,...N(t),minimum:e})}function Ue(e,t){return new Ee({check:`string_format`,format:`regex`,...N(t),pattern:e})}let W=O(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>be(e,t,n),e.parseAsync=async(t,n)=>ye(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xe(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>pe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),We=O(`ZodMiniString`,(e,t)=>{Oe.init(e,t),W.init(e,t)});function G(e){return Be(We,e)}let Ge=O(`ZodMiniNumber`,(e,t)=>{ke.init(e,t),W.init(e,t)});function Ke(e){return Ve(Ge,e)}let qe=O(`ZodMiniArray`,(e,t)=>{je.init(e,t),W.init(e,t)});function Je(e,t){return new qe({type:`array`,element:e,...N(t)})}let Ye=O(`ZodMiniObject`,(e,t)=>{Pe.init(e,t),W.init(e,t),j(e,`shape`,()=>t.shape)});function K(e,t){let n={type:`object`,shape:e??{},...N(t)};return new Ye(n)}let Xe=O(`ZodMiniRecord`,(e,t)=>{Fe.init(e,t),W.init(e,t)});function Ze(e,t,n){return!t||!t._zod?new Xe({type:`record`,keyType:G(),valueType:e,...N(t)}):new Xe({type:`record`,keyType:e,valueType:t,...N(n)})}let Qe=O(`ZodMiniTransform`,(e,t)=>{Ie.init(e,t),W.init(e,t)});function $e(e){return new Qe({type:`transform`,transform:e})}let et=O(`ZodMiniOptional`,(e,t)=>{Re.init(e,t),W.init(e,t)});function q(e){return new et({type:`optional`,innerType:e})}let tt=O(`ZodMiniPipe`,(e,t)=>{ze.init(e,t),W.init(e,t)});function nt(e,t){return new tt({type:`pipe`,in:e,out:t})}function rt(){return G().check(Ue(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function it(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:E(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:E(r)},payload:e.payload,...e.source&&{source:e.source}},c=T(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function at(e,t=0){if(!Number.isInteger(t)||t<0)throw new ct({decimals:t});if(!/^-?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)$/.test(e))throw new st({value:e});let[n=``,r=`0`]=e.split(`.`),i=n.startsWith(`-`);if(i&&(n=n.slice(1)),n===``&&(n=`0`),r=r.replace(/(0+)$/,``),t===0)r.length>0&&Number.parseInt(r[0],10)>=5&&(n=`${BigInt(n)+1n}`),r=``;else if(r.length>t){let e=r.slice(0,t);if(Number.parseInt(r.slice(t,t+1),10)>=5){let i=ot(e);i.length>t?(r=i.slice(1),n=`${BigInt(n)+1n}`):r=i}else r=e}else r=r.padEnd(t,`0`);return BigInt(`${i?`-`:``}${n}${r}`)}function ot(e){let t=e.split(``),n=t.length-1;for(;n>=0;){let e=Number.parseInt(t[n],10)+1;if(e<10)return t[n]=String(e),t.join(``);t[n]=`0`,n--}return`1${t.join(``)}`}var st,ct;e((()=>{st=class extends Error{constructor({value:e}){super(`Value \\`${e}\\` is not a valid decimal number.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalNumberError`})}},ct=class extends Error{constructor({decimals:e}){super(`\\`decimals\\` must be a non-negative integer. Got \\`${e}\\`.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalsError`})}}}))();function lt(e,t){return at(e,t)}function ut(e){return e}function dt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}let ft=ut({name:`stripe`,intent:`charge`,schema:{credential:{payload:K({externalId:q(G()),spt:G()})},request:nt(K({amount:rt(),currency:G(),decimals:Ke(),description:q(G()),externalId:q(G()),metadata:q(Ze(G(),G())),networkId:G(),paymentMethodTypes:Je(G()).check(He(1)),recipient:q(G())}),$e(({amount:e,decimals:t,metadata:n,networkId:r,paymentMethodTypes:i,...a})=>({...a,amount:lt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:i,...n!==void 0&&{metadata:n}}})))}});function pt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return dt(ft,{context:K({paymentMethod:q(G())}),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 it({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function mt(e){return[pt(e)]}(function(e){e.charge=pt})(mt||={});var ht=r();let J={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},gt={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},Y={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var X=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let _t={accent:new X(`accent`),background:new X(`background`),border:new X(`border`),foreground:new X(`foreground`),muted:new X(`muted`),negative:new X(`negative`),positive:new X(`positive`),surface:new X(`surface`),fontFamily:new X(`font-family`),fontSizeBase:new X(`font-size-base`),radius:new X(`radius`),spacingUnit:new X(`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 vt(e,t){if(t==null)return e;if(!Z(e)||!Z(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]=Z(t)&&Z(r)?vt(t,r):r}return n}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function yt(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(gt.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 bt(e){let t=document.getElementById(J.data),n=ee(t.textContent),r=t.getAttribute(Y.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(Y.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(Y.challengeId),o=a?(i.removeAttribute(Y.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(J.error)?.remove();return}let t=document.getElementById(J.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=J.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>yt(e,o.challenge.header),vars:_t}}let Q=bt(`stripe`),xt=String.raw,$=document.createElement(`style`);$.textContent=xt`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${Q.vars.spacingUnit} * 8);\n }\n button {\n background: ${Q.vars.accent};\n border-radius: ${Q.vars.radius};\n color: ${Q.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${Q.vars.spacingUnit} * 4) calc(${Q.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`,Q.root.append($),(async()=>{let e=await(0,ht.loadStripe)(Q.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if(Q.config.elements?.options?.appearance?.theme)return Q.config.elements?.options?.appearance?.theme;switch(Q.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return vt({disableAnimations:!0,theme:e,variables:{borderRadius:Q.theme.radius,colorBackground:Q.theme.surface[n],colorDanger:Q.theme.negative[n],colorPrimary:Q.theme.accent[n],colorText:Q.theme.foreground[n],colorTextSecondary:Q.theme.muted[n],fontSizeBase:Q.theme.fontSizeBase,fontFamily:Q.theme.fontFamily,spacingUnit:Q.theme.spacingUnit}},Q.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...Q.config.elements?.options,amount:Number(Q.challenge.request.amount),currency:Q.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:Q.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,Q.config.elements?.paymentOptions).mount(i),Q.root.appendChild(i);let a=document.createElement(`button`);a.textContent=Q.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),Q.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...Q.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await mt({client:e,createToken:St})[0].createCredential({challenge:Q.challenge,context:{paymentMethod:t.id}});await Q.submit(i)}catch(e){Q.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function St(e){let t=new URL(Q.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.13.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},v=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.13.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},y=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)},b,x=!1,S=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return _(b).then(function(e){return v(e,t,r)})};S.setLoadParameters=function(e){if(x&&b){var t=y(e);if(Object.keys(t).reduce(function(t,n){return t&&e[n]===b?.[n]},!0))return}if(x)throw Error(`You cannot change load parameters after calling loadStripe`);b=y(e)},e.loadStripe=S})),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(b(e)>t)throw new S({givenSize:b(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 C({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((()=>{te()}));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 v(e,t={}){let{size:n}=t,r=x.encode(e);return typeof n==`number`?(f(r,n),y(r,n)):r}function y(e,t){return p(e,{dir:`right`,size:t})}function b(e){return e.length}var x,S,C,te=e((()=>{d(),m(),_(),x=new TextEncoder,S=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`})}},C=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`})}}}));te();let ne=new TextDecoder,w=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 re(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]=w[r>>18],i[t+1]=w[r>>12&63],i[t+2]=w[r>>6&63],i[t+3]=w[r&63]}let a=e.length%3,o=Math.floor(e.length/3)*4+(a&&a+1),s=ne.decode(new Uint8Array(i.buffer,0,o));return n&&a===1&&(s+=`==`),n&&a===2&&(s+=`=`),r&&(s=s.replaceAll(`+`,`-`).replaceAll(`/`,`_`)),s}function T(e,t={}){return re(v(e),t)}_();function E(e){return T(h(e),{pad:!1,url:!0})}var D;function O(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,\"_zod\",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,\"name\",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,\"init\",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,\"name\",{value:e}),o}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ie=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(D=globalThis).__zod_globalConfig??(D.__zod_globalConfig={});let ae=globalThis.__zod_globalConfig;function A(e){return e&&Object.assign(ae,e),ae}function oe(e,t){return typeof t==`bigint`?t.toString():t}function se(e){return{get value(){{let t=e();return Object.defineProperty(this,\"value\",{value:t}),t}}}}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}let ue=Symbol(`evaluating`);function j(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ue)return r===void 0&&(r=ue,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}let de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fe(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return M(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function P(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 he(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 F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function L(e,t,n){let r=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}let R=(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,oe,2),Object.defineProperty(e,\"toString\",{value:()=>e.message,enumerable:!1})},_e=O(`$ZodError`,R),z=O(`$ZodError`,R,{Parent:Error}),ve=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new k;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),ye=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>L(e,a,A())));throw de(t,i?.callee),t}return o.value})(z),be=(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 k;return a.issues.length?{success:!1,error:new(e??_e)(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),xe=(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?{success:!1,error:new e(a.issues.map(e=>L(e,i,A())))}:{success:!0,data:a.value}})(z),Se=e=>{let t=e?`[\\\\s\\\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\\\s\\\\S]*`;return RegExp(`^${t}$`)},Ce=/^-?\\d+(?:\\.\\d+)?$/,B=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),we=O(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ge(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Te=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(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})}):(r=e._zod).check??(r.check=()=>{})}),Ee=O(`$ZodCheckRegex`,(e,t)=>{Te.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})}}),De={major:4,minor:4,patch:3},V=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=De;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=P(e),i;for(let a of t){if(a._zod.def.when){if(he(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new k;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=P(e,t))});else{if(e.issues.length===t)continue;r||=P(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(P(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,r,a))}return t(o,r,a)}}j(e,`~standard`,()=>({validate:t=>{try{let n=be(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return xe(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Oe=O(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Se(e._zod.bag),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}}),ke=O(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ce,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}});function Ae(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}let je=O(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ae(t,n,e))):Ae(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function H(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...F(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Me(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key \"${n}\": expected a Zod schema`);let n=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ne(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>H(e,n,i,t,u,d))):H(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let Pe=O(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,\"shape\",{get:()=>{let n={...e};return Object.defineProperty(t,\"shape\",{value:n}),n}})}let n=se(()=>Me(t));j(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=M,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>H(n,t,e,s,r,i))):H(a,t,e,s,r,i)}return i?Ne(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Fe=O(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!fe(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>L(e,r,A())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...F(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...F(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Ce.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>L(e,r,A())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...F(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...F(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Ie=O(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ie(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.fallback=!0,n));if(i instanceof Promise)throw new k;return n.value=i,n.fallback=!0,n}});function Le(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let Re=O(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,j(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),j(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Le(e,r)):Le(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ze=O(`$ZodPipe`,(e,t)=>{V.init(e,t),j(e._zod,`values`,()=>t.in._zod.values),j(e._zod,`optin`,()=>t.in._zod.optin),j(e._zod,`optout`,()=>t.out._zod.optout),j(e._zod,`propValues`,()=>t.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.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}function Be(e,t){return new e({type:`string`,...N(t)})}function Ve(e,t){return new e({type:`number`,checks:[],...N(t)})}function He(e,t){return new we({check:`min_length`,...N(t),minimum:e})}function Ue(e,t){return new Ee({check:`string_format`,format:`regex`,...N(t),pattern:e})}let W=O(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);V.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>ve(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>be(e,t,n),e.parseAsync=async(t,n)=>ye(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xe(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>pe(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),We=O(`ZodMiniString`,(e,t)=>{Oe.init(e,t),W.init(e,t)});function G(e){return Be(We,e)}let Ge=O(`ZodMiniNumber`,(e,t)=>{ke.init(e,t),W.init(e,t)});function Ke(e){return Ve(Ge,e)}let qe=O(`ZodMiniArray`,(e,t)=>{je.init(e,t),W.init(e,t)});function Je(e,t){return new qe({type:`array`,element:e,...N(t)})}let Ye=O(`ZodMiniObject`,(e,t)=>{Pe.init(e,t),W.init(e,t),j(e,`shape`,()=>t.shape)});function K(e,t){let n={type:`object`,shape:e??{},...N(t)};return new Ye(n)}let Xe=O(`ZodMiniRecord`,(e,t)=>{Fe.init(e,t),W.init(e,t)});function Ze(e,t,n){return!t||!t._zod?new Xe({type:`record`,keyType:G(),valueType:e,...N(t)}):new Xe({type:`record`,keyType:e,valueType:t,...N(n)})}let Qe=O(`ZodMiniTransform`,(e,t)=>{Ie.init(e,t),W.init(e,t)});function $e(e){return new Qe({type:`transform`,transform:e})}let et=O(`ZodMiniOptional`,(e,t)=>{Re.init(e,t),W.init(e,t)});function q(e){return new et({type:`optional`,innerType:e})}let tt=O(`ZodMiniPipe`,(e,t)=>{ze.init(e,t),W.init(e,t)});function nt(e,t){return new tt({type:`pipe`,in:e,out:t})}function rt(){return G().check(Ue(/^\\d+(\\.\\d+)?$/,`Invalid amount`))}function it(e){let{meta:t,opaque:n,request:r,...a}=e.challenge,o=n??(t===void 0?void 0:E(t)),s={challenge:{...a,...o!==void 0&&{opaque:o},request:E(r)},payload:e.payload,...e.source&&{source:e.source}},c=T(JSON.stringify(s),{pad:!1,url:!0});return`${i.payment} ${c}`}function at(e,t=0){if(!Number.isInteger(t)||t<0)throw new ct({decimals:t});if(!/^-?(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)$/.test(e))throw new st({value:e});let[n=``,r=`0`]=e.split(`.`),i=n.startsWith(`-`);if(i&&(n=n.slice(1)),n===``&&(n=`0`),r=r.replace(/(0+)$/,``),t===0)r.length>0&&Number.parseInt(r[0],10)>=5&&(n=`${BigInt(n)+1n}`),r=``;else if(r.length>t){let e=r.slice(0,t);if(Number.parseInt(r.slice(t,t+1),10)>=5){let i=ot(e);i.length>t?(r=i.slice(1),n=`${BigInt(n)+1n}`):r=i}else r=e}else r=r.padEnd(t,`0`);return BigInt(`${i?`-`:``}${n}${r}`)}function ot(e){let t=e.split(``),n=t.length-1;for(;n>=0;){let e=Number.parseInt(t[n],10)+1;if(e<10)return t[n]=String(e),t.join(``);t[n]=`0`,n--}return`1${t.join(``)}`}var st,ct;e((()=>{st=class extends Error{constructor({value:e}){super(`Value \\`${e}\\` is not a valid decimal number.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalNumberError`})}},ct=class extends Error{constructor({decimals:e}){super(`\\`decimals\\` must be a non-negative integer. Got \\`${e}\\`.`),Object.defineProperty(this,\"name\",{enumerable:!0,configurable:!0,writable:!0,value:`Value.InvalidDecimalsError`})}}}))();function lt(e,t){return at(e,t)}function ut(e){return e}function dt(e,t){let{canHandleChallenge:n,context:r,createCredential:i}=t;return{...e,canHandleChallenge:n,context:r,createCredential:i}}let ft=K({metadata:Ze(G(),G())}),pt=ut({name:`stripe`,intent:`charge`,schema:{credential:{payload:K({externalId:q(G()),spt:G()})},request:nt(K({amount:rt(),currency:G(),decimals:Ke(),description:q(G()),externalId:q(G()),metadata:q(Ze(G(),G())),networkId:G(),paymentIntentOptions:q(ft),paymentMethodTypes:Je(G()).check(He(1)),recipient:q(G())}),$e(({amount:e,decimals:t,metadata:n,networkId:r,paymentIntentOptions:i,paymentMethodTypes:a,...o})=>({...o,amount:lt(e,t).toString(),methodDetails:{networkId:r,paymentMethodTypes:a,...n!==void 0&&{metadata:n}}})))}});function mt(e){let{client:t,createToken:n,externalId:r,paymentMethod:i}=e;return dt(pt,{context:K({paymentMethod:q(G())}),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 it({challenge:e,payload:{spt:p,...m===void 0?{}:{externalId:m}}})}})}function ht(e){return[mt(e)]}(function(e){e.charge=mt})(ht||={});var gt=r();let J={data:`__MPPX_DATA__`,error:`root_error`,root:`root`},_t={serviceWorker:`__mppx_worker`,tab:`__mppx_tab`},Y={challengeId:`data-mppx-challenge-id`,remaining:`data-remaining`};var X=class{name;constructor(e){this.name=`--mppx-${e}`}toString(){return`var(${this.name})`}};let vt={accent:new X(`accent`),background:new X(`background`),border:new X(`border`),foreground:new X(`foreground`),muted:new X(`muted`),negative:new X(`negative`),positive:new X(`positive`),surface:new X(`surface`),fontFamily:new X(`font-family`),fontSizeBase:new X(`font-size-base`),radius:new X(`radius`),spacingUnit:new X(`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: ${vt.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 yt(e,t){if(t==null)return e;if(!Z(e)||!Z(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]=Z(t)&&Z(r)?yt(t,r):r}return n}function Z(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function bt(e,t=`Authorization`){let n=new URL(location.href);n.searchParams.set(_t.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 xt(e){let t=document.getElementById(J.data),n=ee(t.textContent),r=t.getAttribute(Y.remaining);!r||Number(r)<=1?t.remove():t.setAttribute(Y.remaining,String(Number(r)-1));let i=document.currentScript,a=i?.getAttribute(Y.challengeId),o=a?(i.removeAttribute(Y.challengeId),n[a]):Object.values(n).find(t=>t.challenge.method===e);return{...o,error(e){if(!e){document.getElementById(J.error)?.remove();return}let t=document.getElementById(J.error);if(t){t.textContent=e;return}let n=document.createElement(`p`);n.id=J.error,n.className=`mppx-error`,n.role=`alert`,n.textContent=e,document.getElementById(o.rootId)?.after(n)},root:document.getElementById(o.rootId),submit:e=>bt(e,o.challenge.header),vars:vt}}let Q=xt(`stripe`),St=String.raw,$=document.createElement(`style`);$.textContent=St`\n form {\n display: flex;\n flex-direction: column;\n gap: calc(${Q.vars.spacingUnit} * 8);\n }\n button {\n background: ${Q.vars.accent};\n border-radius: ${Q.vars.radius};\n color: ${Q.vars.background};\n cursor: pointer;\n font-weight: 500;\n padding: calc(${Q.vars.spacingUnit} * 4) calc(${Q.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`,Q.root.append($),(async()=>{let e=await(0,gt.loadStripe)(Q.config.publishableKey);if(!e)throw Error(`Failed to loadStripe`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=(()=>{if(Q.config.elements?.options?.appearance?.theme)return Q.config.elements?.options?.appearance?.theme;switch(Q.theme.colorScheme){case`light dark`:return t.matches?`night`:`stripe`;case`light`:return`stripe`;case`dark`:return`night`}})(),n=+!!t.matches;return yt({disableAnimations:!0,theme:e,variables:{borderRadius:Q.theme.radius,colorBackground:Q.theme.surface[n],colorDanger:Q.theme.negative[n],colorPrimary:Q.theme.accent[n],colorText:Q.theme.foreground[n],colorTextSecondary:Q.theme.muted[n],fontSizeBase:Q.theme.fontSizeBase,fontFamily:Q.theme.fontFamily,spacingUnit:Q.theme.spacingUnit}},Q.config.elements?.options?.appearance??{})},r=e.elements({appearance:n(),...Q.config.elements?.options,amount:Number(Q.challenge.request.amount),currency:Q.challenge.request.currency,mode:`payment`,paymentMethodCreation:`manual`,paymentMethodTypes:Q.challenge.request.methodDetails.paymentMethodTypes});t.addEventListener(`change`,()=>{r.update({appearance:n()})});let i=document.createElement(`form`);r.create(`payment`,Q.config.elements?.paymentOptions).mount(i),Q.root.appendChild(i);let a=document.createElement(`button`);a.textContent=Q.text.pay,a.type=`submit`,i.appendChild(a),i.onsubmit=async t=>{t.preventDefault(),Q.error(),a.disabled=!0;try{await r.submit();let{paymentMethod:t,error:n}=await e.createPaymentMethod({...Q.config.elements?.createPaymentMethodOptions,elements:r});if(n||!t)throw n??Error(`Failed to create payment method`);let i=await ht({client:e,createToken:Ct})[0].createCredential({challenge:Q.challenge,context:{paymentMethod:t.id}});await Q.submit(i)}catch(e){Q.error(e instanceof Error?e.message:`Payment failed`)}finally{a.disabled=!1}}})();async function Ct(e){let t=new URL(Q.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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineToken } from 'viem/tokens';
|
|
2
|
+
/** MACH token metadata and deployed addresses. */
|
|
3
|
+
export declare const mach: defineToken.ReturnType<{
|
|
4
|
+
readonly addresses: {
|
|
5
|
+
readonly 4217: "0x20c000000000000000000000f37de3740ADec032";
|
|
6
|
+
readonly 42431: "0x20c000000000000000000000f37de3740ADec032";
|
|
7
|
+
};
|
|
8
|
+
readonly currency: "USD";
|
|
9
|
+
readonly decimals: 6;
|
|
10
|
+
readonly name: "MACH";
|
|
11
|
+
readonly symbol: "MACH";
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=Tokens.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineToken } from 'viem/tokens';
|
|
2
|
+
/** MACH token metadata and deployed addresses. */
|
|
3
|
+
export const mach = defineToken({
|
|
4
|
+
addresses: {
|
|
5
|
+
4217: '0x20c000000000000000000000f37de3740ADec032',
|
|
6
|
+
42431: '0x20c000000000000000000000f37de3740ADec032',
|
|
7
|
+
},
|
|
8
|
+
currency: 'USD',
|
|
9
|
+
decimals: 6,
|
|
10
|
+
name: 'MACH',
|
|
11
|
+
symbol: 'MACH',
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=Tokens.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isAddressEqual } from 'viem';
|
|
1
2
|
import { prepareTransactionRequest, sendCallsSync, sendTransactionSync, signTypedData, signTransaction, } from 'viem/actions';
|
|
2
3
|
import { Actions } from 'viem/tempo';
|
|
3
4
|
import { tempo as tempo_chain } from 'viem/tempo/chains';
|
|
@@ -10,8 +11,10 @@ import * as Attribution from '../Attribution.js';
|
|
|
10
11
|
import * as AutoSwap from '../internal/auto-swap.js';
|
|
11
12
|
import * as Charge_internal from '../internal/charge.js';
|
|
12
13
|
import * as defaults from '../internal/defaults.js';
|
|
14
|
+
import { defaultFeeTokens, resolveFeeToken } from '../internal/fee-token.js';
|
|
13
15
|
import * as Proof from '../internal/proof.js';
|
|
14
16
|
import * as Methods from '../Methods.js';
|
|
17
|
+
import { mach } from '../Tokens.js';
|
|
15
18
|
const chargeContextSchema = z.object({
|
|
16
19
|
account: z.optional(z.custom()),
|
|
17
20
|
autoSwap: z.optional(z.custom()),
|
|
@@ -135,6 +138,17 @@ export function charge(parameters = {}) {
|
|
|
135
138
|
})
|
|
136
139
|
: undefined;
|
|
137
140
|
const calls = [...(swapCalls ?? []), ...transferCalls];
|
|
141
|
+
const machAddress = mach.addresses[chainId];
|
|
142
|
+
const allowedFeeTokens = defaultFeeTokens(chainId);
|
|
143
|
+
const feeToken = machAddress && isAddressEqual(currency, machAddress)
|
|
144
|
+
? await resolveFeeToken({
|
|
145
|
+
account: account.address,
|
|
146
|
+
allowedTokens: allowedFeeTokens,
|
|
147
|
+
candidateTokens: allowedFeeTokens,
|
|
148
|
+
client,
|
|
149
|
+
prioritizeCandidates: true,
|
|
150
|
+
})
|
|
151
|
+
: undefined;
|
|
138
152
|
const validBefore = (() => {
|
|
139
153
|
const defaultExpiry = Math.floor(Date.now() / 1000) + 25;
|
|
140
154
|
if (!challenge.expires)
|
|
@@ -149,6 +163,7 @@ export function charge(parameters = {}) {
|
|
|
149
163
|
await sendTransactionSync(client, {
|
|
150
164
|
account,
|
|
151
165
|
calls,
|
|
166
|
+
...(feeToken ? { feeToken } : {}),
|
|
152
167
|
nonceKey: 'expiring',
|
|
153
168
|
validBefore,
|
|
154
169
|
}),
|
|
@@ -156,6 +171,7 @@ export function charge(parameters = {}) {
|
|
|
156
171
|
}
|
|
157
172
|
: await sendCallsSync(client, {
|
|
158
173
|
account,
|
|
174
|
+
...(feeToken ? { capabilities: { feeToken } } : {}),
|
|
159
175
|
calls: calls,
|
|
160
176
|
experimental_fallback: calls.length === 1,
|
|
161
177
|
forceAtomic: calls.length > 1,
|
|
@@ -172,6 +188,7 @@ export function charge(parameters = {}) {
|
|
|
172
188
|
const prepared = await prepareTransactionRequest(client, {
|
|
173
189
|
account,
|
|
174
190
|
calls,
|
|
191
|
+
...(feeToken ? { feeToken } : {}),
|
|
175
192
|
nonceKey: 'expiring',
|
|
176
193
|
validBefore,
|
|
177
194
|
});
|
package/dist/tempo/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export * as Methods from './Methods.js';
|
|
|
3
3
|
export * as Session from './session/index.js';
|
|
4
4
|
export * as SessionLegacy from './legacy/index.js';
|
|
5
5
|
export * as Subscription from './subscription/index.js';
|
|
6
|
+
export { mach } from './Tokens.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tempo/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export * as Methods from './Methods.js';
|
|
|
3
3
|
export * as Session from './session/index.js';
|
|
4
4
|
export * as SessionLegacy from './legacy/index.js';
|
|
5
5
|
export * as Subscription from './subscription/index.js';
|
|
6
|
+
export { mach } from './Tokens.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -24,7 +24,7 @@ type ExpectedTransfer = {
|
|
|
24
24
|
recipient: TempoAddress.Address;
|
|
25
25
|
};
|
|
26
26
|
/** Returns fee tokens that mppx allows sponsored transactions to charge. */
|
|
27
|
-
export declare function defaultAllowedFeeTokens(chainId: number | undefined):
|
|
27
|
+
export declare function defaultAllowedFeeTokens(chainId: number | undefined): `0x${string}`[];
|
|
28
28
|
/** Rejects a sponsored fee token outside the server's allowlist. */
|
|
29
29
|
export declare function assertAllowedFeeToken(transaction: {
|
|
30
30
|
feeToken?: unknown;
|
|
@@ -4,6 +4,7 @@ import { decodeFunctionData, encodeFunctionData, maxUint256, toHex } from 'viem'
|
|
|
4
4
|
import { Abis, Addresses, Transaction } from 'viem/tempo';
|
|
5
5
|
import * as TempoAddress_internal from './address.js';
|
|
6
6
|
import * as defaults from './defaults.js';
|
|
7
|
+
import { defaultFeeTokens } from './fee-token.js';
|
|
7
8
|
import * as Selectors from './selectors.js';
|
|
8
9
|
/** Returns true if the serialized transaction has a Tempo envelope prefix. */
|
|
9
10
|
export function isTempoTransaction(serialized) {
|
|
@@ -58,20 +59,9 @@ const supportedTransactionKeys = new Set([
|
|
|
58
59
|
...rejectedTransactionKeys,
|
|
59
60
|
...rewrittenTransactionKeys,
|
|
60
61
|
]);
|
|
61
|
-
function pushAllowedFeeToken(tokens, token) {
|
|
62
|
-
if (!token)
|
|
63
|
-
return;
|
|
64
|
-
const normalized = token;
|
|
65
|
-
if (tokens.some((existing) => TempoAddress_internal.isEqual(existing, normalized)))
|
|
66
|
-
return;
|
|
67
|
-
tokens.push(normalized);
|
|
68
|
-
}
|
|
69
62
|
/** Returns fee tokens that mppx allows sponsored transactions to charge. */
|
|
70
63
|
export function defaultAllowedFeeTokens(chainId) {
|
|
71
|
-
|
|
72
|
-
pushAllowedFeeToken(tokens, defaults.tokens.pathUsd);
|
|
73
|
-
pushAllowedFeeToken(tokens, defaults.currency[chainId]);
|
|
74
|
-
return tokens;
|
|
64
|
+
return defaultFeeTokens(chainId);
|
|
75
65
|
}
|
|
76
66
|
/** Rejects a sponsored fee token outside the server's allowlist. */
|
|
77
67
|
export function assertAllowedFeeToken(transaction, allowedFeeTokens) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Address, Client } from 'viem';
|
|
2
|
+
/** Returns the stablecoins mppx supports for Tempo transaction fees. */
|
|
3
|
+
export declare function defaultFeeTokens(chainId: number | undefined): Address[];
|
|
2
4
|
/**
|
|
3
5
|
* Resolves a funded fee token from account, chain, and caller-supplied preferences.
|
|
4
6
|
*
|
|
@@ -27,6 +27,13 @@ function getChainFeeToken(client) {
|
|
|
27
27
|
const chainId = client.chain?.id;
|
|
28
28
|
return chainId ? defaults.currency[chainId] : undefined;
|
|
29
29
|
}
|
|
30
|
+
/** Returns the stablecoins mppx supports for Tempo transaction fees. */
|
|
31
|
+
export function defaultFeeTokens(chainId) {
|
|
32
|
+
const tokens = [];
|
|
33
|
+
pushUnique(tokens, defaults.tokens.pathUsd);
|
|
34
|
+
pushUnique(tokens, defaults.currency[chainId]);
|
|
35
|
+
return tokens;
|
|
36
|
+
}
|
|
30
37
|
/**
|
|
31
38
|
* Resolves a funded fee token from account, chain, and caller-supplied preferences.
|
|
32
39
|
*
|