@tinkerlandai/longplay-sdk 0.10.35 → 0.10.36
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/README.md +34 -3
- package/README.zh-CN.md +6 -0
- package/dist/{ai-usage-T62xehqa.d.ts → ai-usage-DXwAGTxT.d.ts} +1 -1
- package/dist/{api-Do-6AyWa.d.ts → api-r6FfVQpg.d.ts} +6 -1
- package/dist/check-response-DHY6T5Z2.js +1 -0
- package/dist/{chunk-7MNJH5GB.js → chunk-2HSD2SEU.js} +1 -1
- package/dist/{chunk-CKKIB2HC.js → chunk-2KKLY323.js} +1 -1
- package/dist/{chunk-VEX2FOFZ.js → chunk-35VG2IYD.js} +1 -1
- package/dist/{chunk-SXBM3DWK.js → chunk-5XIKN35D.js} +1 -1
- package/dist/{chunk-CIP5SQ5Y.js → chunk-5XKFUFXK.js} +1 -1
- package/dist/{chunk-V7MMTILA.js → chunk-7ZEXY4GC.js} +1 -1
- package/dist/chunk-BL7E4RZ2.js +1 -0
- package/dist/{chunk-LF2UIJYD.js → chunk-BTPEXSNY.js} +1 -1
- package/dist/{chunk-TOTRALYQ.js → chunk-C4GBV32U.js} +1 -1
- package/dist/{chunk-V7PFLFHE.js → chunk-CGXNU5BC.js} +1 -1
- package/dist/{chunk-YVXLCQGM.js → chunk-DB4EO3JG.js} +1 -1
- package/dist/{chunk-TJGIT5CU.js → chunk-DHT3AWJQ.js} +1 -1
- package/dist/{chunk-TAFALMQN.js → chunk-GLYFT5WW.js} +1 -1
- package/dist/chunk-HS56A4IK.js +1 -0
- package/dist/{chunk-56BYGPQ6.js → chunk-HVVJGLYZ.js} +1 -1
- package/dist/chunk-HYE2YQYM.js +1 -0
- package/dist/chunk-I6D25FWU.js +1 -0
- package/dist/{chunk-FMDC6N4W.js → chunk-IOBB6KFK.js} +1 -1
- package/dist/{chunk-PUR5CYWX.js → chunk-JOIPLLHK.js} +1 -1
- package/dist/{chunk-KE26KWIU.js → chunk-LAGGWYH3.js} +1 -1
- package/dist/{chunk-TLZP7BW6.js → chunk-LVG5ED52.js} +1 -1
- package/dist/{chunk-KPDHY76A.js → chunk-M3GGR53D.js} +1 -1
- package/dist/{chunk-EUTWY7A2.js → chunk-MHWPEMX7.js} +1 -1
- package/dist/chunk-MYBUQFTC.js +1 -0
- package/dist/{chunk-7QL4GF4C.js → chunk-O4KXODTJ.js} +1 -1
- package/dist/chunk-OL2AI6DA.js +1 -0
- package/dist/chunk-QHJWVLJC.js +1 -0
- package/dist/{chunk-W6OQTXLL.js → chunk-R3YVDRTB.js} +1 -1
- package/dist/{chunk-EM3MGDPG.js → chunk-RHF4NFCZ.js} +1 -1
- package/dist/{chunk-5HJYR6Z4.js → chunk-RHWZRHK7.js} +1 -1
- package/dist/{chunk-OX7PA64E.js → chunk-TIQS5DUF.js} +1 -1
- package/dist/{chunk-BOVN2BE3.js → chunk-U4WUX3WB.js} +1 -1
- package/dist/{chunk-44U3FOBB.js → chunk-UHTTCVSL.js} +1 -1
- package/dist/{chunk-MSK3VZ3A.js → chunk-UVUFJO2V.js} +1 -1
- package/dist/{chunk-RML52BOR.js → chunk-VKG6BB3Z.js} +1 -1
- package/dist/{chunk-73NP72FV.js → chunk-VWMFR22O.js} +1 -1
- package/dist/chunk-W3K5ARMY.js +1 -0
- package/dist/chunk-WRLVPHPE.js +1 -0
- package/dist/{chunk-U4RSRFZY.js → chunk-XE7GU6FZ.js} +1 -1
- package/dist/{chunk-WZR2XCSJ.js → chunk-XQTCEQXI.js} +1 -1
- package/dist/chunk-YQX27SBG.js +1 -0
- package/dist/{chunk-VYFSRHXM.js → chunk-ZYF6TRJ3.js} +1 -1
- package/dist/{configuration-sync-DdTRUv7A.d.ts → configuration-sync-BHrAf-ql.d.ts} +10 -1
- package/dist/{content-AJDTSI7A.js → content-RGKTEV23.js} +1 -1
- package/dist/{funnel-host-purchase-Z7FCJ5CX.js → funnel-host-purchase-M7MM33EC.js} +1 -1
- package/dist/{funnel-local-client-Dz1dTgES.d.ts → funnel-local-client-DR8OpKGU.d.ts} +145 -3
- package/dist/funnel-paywall-prerender-OSBI4VMY.js +1 -0
- package/dist/{funnel-process-client-D6qjStm2.d.ts → funnel-process-client-C87U4r_G.d.ts} +17 -3
- package/dist/funnel-runtime-host-AMJXEASH.js +1 -0
- package/dist/index.d.ts +26 -9
- package/dist/index.js +1 -1
- package/dist/merchant-bridge-contracts-GJQVKEAG.js +1 -0
- package/dist/native-shell.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/operation-contracts-MFK2KORK.js +1 -0
- package/dist/page.d.ts +2 -2
- package/dist/page.js +1 -1
- package/dist/paywall-ATZ2IZPS.js +1 -0
- package/dist/paywall-content-XERXGNND.js +1 -0
- package/dist/paywall-session-EMMF6IYS.js +1 -0
- package/dist/popup.d.ts +3 -3
- package/dist/popup.js +1 -1
- package/dist/{presentation-loading-CFSiS0VX.d.ts → presentation-loading-B_v5XZtM.d.ts} +11 -1
- package/dist/react-native.d.ts +7 -7
- package/dist/react-native.js +1 -1
- package/dist/{screen-CGCJ46b1.d.ts → screen-qUBRsUi9.d.ts} +26 -21
- package/dist/screen-renderer-B7LUTPTJ.js +1 -0
- package/dist/server.d.ts +37 -7
- package/dist/server.js +1 -1
- package/dist/{visual-dom-6DCUZGPB.js → visual-dom-5LUN4AHO.js} +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/check-response-GZZRWBEA.js +0 -1
- package/dist/chunk-2FE4FTPH.js +0 -1
- package/dist/chunk-BLVBUN2R.js +0 -1
- package/dist/chunk-BQRS7Y4K.js +0 -1
- package/dist/chunk-ETK6GC5P.js +0 -1
- package/dist/chunk-GZRRVHYK.js +0 -1
- package/dist/chunk-RNEF4MZW.js +0 -1
- package/dist/chunk-SFHIFCXG.js +0 -1
- package/dist/chunk-UVRT4MY6.js +0 -1
- package/dist/chunk-XUGEOELU.js +0 -1
- package/dist/chunk-ZGCKQWQ5.js +0 -1
- package/dist/funnel-paywall-prerender-QHCUZZY3.js +0 -1
- package/dist/funnel-runtime-host-UKSOOA4H.js +0 -1
- package/dist/merchant-bridge-contracts-EAE4HQE4.js +0 -1
- package/dist/operation-contracts-HS4M2UXN.js +0 -1
- package/dist/paywall-VYUBYBUI.js +0 -1
- package/dist/paywall-content-YQAVSO2T.js +0 -1
- package/dist/paywall-session-E5V42XUT.js +0 -1
- package/dist/screen-renderer-R5GH7XLV.js +0 -1
- /package/dist/{chunk-BID4UGWB.js → chunk-CILM5XMH.js} +0 -0
- /package/dist/{chunk-UKMEW5I7.js → chunk-OJM6ORHE.js} +0 -0
- /package/dist/{chunk-VF6QMMEA.js → chunk-ZYN4CRHS.js} +0 -0
package/dist/chunk-BQRS7Y4K.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as C,c as ie,j as Ie}from"./chunk-U4RSRFZY.js";import{c as J,d as k,f as T,g as $}from"./chunk-TJGIT5CU.js";import{b as e}from"./chunk-VF6QMMEA.js";var ke=e.number().int().min(0).max(1e8),ae=e.strictObject({kind:e.enum(["graduated","volume"]),tiers:e.array(e.strictObject({upTo:e.number().int().min(1).max(1e4).nullable(),unitAmountMinor:ke,flatAmountMinor:ke.optional()})).min(1).max(12)}).refine(t=>t.tiers.at(-1)?.upTo===null&&t.tiers.slice(0,-1).every((n,i)=>{let r=t.tiers[i-1]?.upTo;return n.upTo!==null&&(i===0||r!=null&&n.upTo>r)}),"Tier ceilings must increase and end unbounded").refine(t=>!t.tiers.some(n=>(n.flatAmountMinor??0)>0)||t.kind==="volume"&&t.tiers.length>1,"Tier flat fees require volume pricing with multiple tiers");function oe(t,n){if(!Number.isInteger(n)||n<0||n>1e4)throw new Error("Invalid purchased pack quantity");let i=t.pricing?ae.parse(t.pricing):void 0;if(n===0)return 0;let r=0n,a=0;if(!i)r=BigInt(t.amountMinor)*BigInt(n);else for(let o of i.tiers){let s=o.upTo??1e4;if(i.kind==="volume"){if(n<=s){r=BigInt(n)*BigInt(o.unitAmountMinor)+BigInt(o.flatAmountMinor??0);break}}else n>a&&(r+=BigInt(Math.min(n,s)-a)*BigInt(o.unitAmountMinor));a=s}if(r>200000000n)throw new Error("Purchased price exceeds the payment amount limit");return Number(r)}function we(t){return oe({amountMinor:t.unitAmountMinor,...t.pricing?{pricing:t.pricing}:{}},t.quantity)}var ot=k.refine(t=>/[1-9]/.test(t)),_e=e.strictObject({units:ot,prices:e.array(e.strictObject({currency:C,amountMinor:e.number().int().min(0).max(1e8),pricing:ae.optional()})).min(1).max(20).refine(t=>new Set(t.map(n=>n.currency)).size===t.length,"Currencies must be unique").refine(t=>t.every(n=>!n.pricing||n.amountMinor===0),"Tiered prices specify their rates in tiers"),minimumQuantity:e.number().int().min(0).max(1e4),maximumQuantity:e.number().int().min(0).max(1e4)}).refine(t=>t.maximumQuantity>=t.minimumQuantity,"Purchased quantity must fit its published bounds").refine(t=>{try{for(let n of t.prices)for(let i of[t.maximumQuantity,...n.pricing?.tiers.flatMap(r=>r.upTo===null?[]:[r.upTo,r.upTo+1])??[]])i<=t.maximumQuantity&&oe({amountMinor:n.amountMinor,...n.pricing===void 0?{}:{pricing:n.pricing}},i);return!0}catch{return!1}},"Every purchasable quantity must fit the payment amount limit");function je(t){if(!/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/.test(t))throw new Error("Invalid quantity");let[n,i=""]=t.split(".");if(n===void 0||n==="")throw new Error("Invalid decimal value");return BigInt(n)*1000000n+BigInt(i.padEnd(6,"0"))}function ze(t,n,i){if(!Number.isSafeInteger(i)||i<0||i>1e4)throw new Error("Invalid purchased quantity");let r=je(t)+je(n)*BigInt(i);if(r>999999999999999999n)throw new Error("Purchased allowance exceeds the ledger quantity limit");let a=(r%1000000n).toString().padStart(6,"0").replace(/0+$/,"");return(r/1000000n).toString()+(a?"."+a:"")}var se=e.strictObject({internalFeatureId:e.uuid(),name:e.string().min(1).max(120),includedAmount:e.string().regex(/^(0|[1-9]\d{0,11})(\.\d{1,6})?$/),reset:e.enum(["hour","day","week","month","year","lifetime"]),resetCount:e.number().int().min(1).max(100),terms:_e});var st=["plan.name","plan.price","plan.period","plan.price_per_month","trial.headline","trial.terms","offer.headline","offer.name","offer.description","offer.eligibility","offer.validity","offer.terms","offer.discount","offer.price","offer.original_price","offer.months","offer.code","offer.ends_at","offer.expires_at","paywall.feature","paywall.message","paywall.action"],X=e.object({plan:e.string().min(1).max(200).optional(),coupon:e.uuid().optional(),promotionCode:e.uuid().optional(),picker:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/).optional()}).strict(),Ae=e.object({text:e.string().optional(),label:e.string().optional(),alt:e.string().optional(),html:e.string().max(32768).optional(),price:e.object({current:e.string(),original:e.string().nullable(),period:e.string()}).optional(),code:e.string().optional(),countdownAt:e.iso.datetime().optional(),planId:e.string().min(1).max(200).optional(),planVersionId:e.string().min(1).max(200).optional(),currency:C.optional(),couponId:e.uuid().optional(),offerId:e.uuid().optional(),unavailable:e.boolean().optional(),unavailableReason:e.string().optional(),missing:e.array(e.string()).optional()}).strict(),Mn=e.object({paywall:Ie.optional(),nodes:e.record(e.string(),e.object({base:Ae,picker:e.string().optional(),byPlan:e.record(e.string(),Ae).optional()}).strict()),plans:e.record(e.string(),e.object({id:e.string().min(1).max(200),versionId:e.string().min(1).max(200),available:e.boolean(),name:e.string(),price:e.string(),period:e.string(),currency:C.optional(),amountMinor:e.number().int().nonnegative().optional(),interval:e.enum(["free","week","month","year","one_time"]).optional(),intervalCount:e.number().int().positive().optional(),prepaid:e.array(se).max(100).optional()}).strict()),pickers:e.record(e.string(),e.object({options:e.array(e.string().min(1).max(200)).max(20),selected:e.string().min(1).max(200).nullable()}).strict()),quantities:e.record(e.string(),e.strictObject({minimum:e.number().int().nonnegative(),maximum:e.number().int().nonnegative(),step:e.number().int().positive(),value:e.number().int().nonnegative(),label:e.string(),available:e.boolean()})).optional(),diagnostics:e.array(e.object({nodeId:e.string(),message:e.string()}).strict())}).strict();function ve(t){return[...t.matchAll(/\{\{\s*([^{}]+?)\s*\}\}/g)].flatMap(n=>n[1]===void 0?[]:[n[1].trim()])}function ce(t){let n=ve(t).filter(r=>!st.includes(r)&&!/^variables\.[A-Za-z0-9_][A-Za-z0-9_.:-]*$/.test(r)),i=t.replace(/\{\{\s*[^{}]+?\s*\}\}/g,"");return(i.includes("{{")||i.includes("}}"))&&n.push("\u65E0\u6548\u53D8\u91CF\u8BED\u6CD5"),[...new Set(n)]}function Qn(t,n,i={}){let r=t?.nodes[n];if(!r)return;let a=r.picker?i[r.picker]??t?.pickers[r.picker]?.selected:void 0;return typeof a=="string"?r.byPlan?.[a]??r.base:r.base}var ct=["credit_balance","credit_transactions","membership","billing","billing_controls","customer_plans","credit_packs","credit_pack_orders","offer_history"],Oe=e.enum(ct),Pe=e.object({source:Oe,layout:e.enum(["full","compact"]),resourceKey:T.optional(),pageSize:e.number().int().min(1).max(50),showSources:e.boolean(),allowPurchase:e.boolean(),outputs:e.object({billing_adjustment:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),billing_authorization:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),buy_pack:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),billing_portal:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),cancel_membership:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional(),resume_membership:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/).optional()}).strict().optional()}).strict().superRefine((t,n)=>{(t.outputs?.billing_authorization||t.outputs?.billing_adjustment)&&t.source!=="billing_controls"&&n.addIssue({code:"custom",message:"Payment authorization routes belong to the billing controls component."}),t.resourceKey&&!["credit_balance","credit_transactions"].includes(t.source)&&n.addIssue({code:"custom",message:"\u8FD9\u4E2A\u6570\u636E\u6E90\u4E0D\u80FD\u7ED1\u5B9A\u79EF\u5206\u8D44\u6E90\u3002"}),t.showSources&&t.source!=="credit_balance"&&n.addIssue({code:"custom",message:"\u53EA\u6709\u79EF\u5206\u4F59\u989D\u53EF\u4EE5\u5C55\u5F00\u6765\u6E90\u3002"}),t.allowPurchase&&!["credit_packs","customer_plans","membership"].includes(t.source)&&n.addIssue({code:"custom",message:"\u53EA\u6709\u79EF\u5206\u5305\u3001\u5957\u9910\u4E0E\u4F1A\u5458\u7EC4\u4EF6\u53EF\u4EE5\u542F\u7528\u4EA4\u6613\u3002"})}),S=e.string().max(2e3),Ne=e.object({id:e.string().max(100),label:S,detail:e.array(S).max(12),value:S.optional(),status:S.optional(),facts:e.array(e.object({label:S,value:S}).strict()).max(1e3),purchaseId:e.uuid().optional(),invoiceUrl:e.url().max(2048).refine(t=>{let n=new URL(t);return n.protocol==="https:"&&!n.username&&!n.password}).optional(),billingActions:e.array(e.strictObject({action:e.literal("invoice_open"),label:S})).max(1).optional(),membershipActions:e.array(e.object({value:e.string().max(100),label:S}).strict()).max(3).optional()}).strict(),ut=e.object({key:T,name:S,spendable:S,reserved:S,available:S,expiry:S.nullable(),sources:e.array(Ne).max(50),sourceCount:e.number().int().nonnegative(),sourcePage:e.number().int().positive(),hasNextSources:e.boolean(),hasPreviousSources:e.boolean()}).strict(),lt=e.object({source:Oe,status:e.enum(["idle","loading","ready","error"]),stale:e.boolean(),preview:e.boolean(),errorCode:e.string().max(80).optional(),errorMessage:S.optional(),resources:e.array(ut).max(500),rows:e.array(Ne).max(50),hasNext:e.boolean(),hasPrevious:e.boolean(),page:e.number().int().positive(),filter:e.string().max(40),updatedAt:e.iso.datetime().optional(),buyingId:e.uuid().optional(),membershipBusy:e.boolean().optional(),billingBusy:e.boolean().optional(),membershipReview:e.object({title:S,note:S,facts:e.array(e.object({label:S,value:S}).strict()).max(100)}).strict().optional(),membershipResult:S.optional()}).strict(),Kn=e.object({nodes:e.record(e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),lt)}).strict(),Hn=e.object({nodeId:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),action:e.enum(["refresh","next","previous","filter","buy_pack","billing_portal","billing_authorization","billing_adjustment","invoice_open","membership_preview","membership_confirm","membership_dismiss","sources_next","sources_previous"]),value:e.string().max(100).optional()}).strict();var pt=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),Xn=e.discriminatedUnion("type",[e.object({type:e.literal("fixed"),productVersionId:e.string().min(1).max(200)}).strict(),e.object({type:e.literal("picker"),pickerId:pt,allowedProductVersionIds:e.array(e.string().min(1).max(200)).min(1).max(20)}).strict().refine(t=>new Set(t.allowedProductVersionIds).size===t.allowedProductVersionIds.length,"Product choices must be unique")]),mt=e.strictObject({min:e.number().finite().min(1).max(1800),max:e.number().finite().min(1).max(1800),viewport:e.number().finite().min(1).max(100)}).refine(t=>t.min<=t.max,"Desktop width range is reversed"),$e={desktopWidth:mt.optional(),mobile:e.enum(["sheet","fullscreen"]).optional(),backdrop:e.enum(["none","scrim","dim","strong-dim","blur"]).optional()},Ce=e.discriminatedUnion("type",[e.strictObject({type:e.literal("modal"),size:e.enum(["sm","md","lg"]),...$e}),e.strictObject({type:e.literal("sheet"),size:e.enum(["sm","md","lg"]),...$e}),e.strictObject({type:e.literal("fullscreen")}),e.strictObject({type:e.literal("inline")})]),dt={sm:360,md:420,lg:560};function De(t){return t.type==="stack"&&t.interaction?.type==="select"&&t.interaction.purpose==="product"&&!!t.interaction.pickerId}function Ee(t){let n={};function i(r){if(De(r)){let a=n[r.interaction.pickerId]??={ids:[],defaultId:null};for(let s of r.children){let c=s.type==="stack"?s.bind?.plan:void 0;c&&!a.ids.includes(c)&&a.ids.push(c)}let o=r.children[r.interaction.defaultIndex];!a.defaultId&&o?.type==="stack"&&(a.defaultId=o.bind?.plan??null)}r.type==="stack"&&r.children.forEach(i)}return t.pages.forEach(r=>i(r.root)),n}function Re(t,n,i){let r={};function a(l){if(l.hidden)return;if(l.type==="plan_picker"){let b=i.pickers[l.id];r[l.id]={ids:b?.options??[],defaults:b?.selected?[b.selected]:[],remembered:[]};return}if(l.type!=="stack")return;let d=l.children.filter(b=>!b.hidden),u=l.interaction;if(De(l)){let b=r[l.interaction.pickerId]??={ids:[],defaults:[],remembered:[]},h=i.pickers[l.interaction.pickerId]?.options??[];for(let p of d){let f=p.type==="stack"?p.bind?.plan:void 0;f&&h.includes(f)&&!b.ids.includes(f)&&b.ids.push(f),f&&p.id===n[l.id]&&b.remembered.push(f)}let m=l.children[l.interaction.defaultIndex];m?.type==="stack"&&!m.hidden&&m.bind?.plan&&b.defaults.push(m.bind.plan)}if(u?.type==="tabs"){let b=d.find(h=>h.id===n[l.id])??l.children[u.defaultIndex];b&&a(b)}else if(u?.type==="toggle"){let b=typeof n[l.id]=="boolean"?n[l.id]:u.defaultEnabled,h=l.children[b?0:1];h&&a(h)}else d.forEach(a)}let o=typeof n.__page=="string"?n.__page:t.initialPageId??t.pages[0]?.id,s=t.pages.find(l=>l.id===o);s&&a(s.root);let c={};for(let[l,d]of Object.entries(r)){let u=n[l],b=d.remembered[0]??(d.ids.includes(i.pickers[l]?.selected??"")?i.pickers[l]?.selected:d.defaults[0]);c[l]=typeof u=="string"?d.ids.includes(u)?u:"":b&&d.ids.includes(b)?b:""}for(let l of Object.keys(Ee(t)))c[l]??="";return c}var Ue=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),Le=e.strictObject({tiers:e.array(e.strictObject({id:Ue,name:e.string().trim().min(1).max(80)})).min(1).max(8),assignments:e.array(e.strictObject({productVersionId:e.string().min(1).max(200),tierId:Ue,period:e.enum(["month","year"])})).max(20)}).superRefine((t,n)=>{let i=t.tiers.map(r=>r.id);(new Set(i).size!==i.length||new Set(t.assignments.map(r=>r.productVersionId)).size!==t.assignments.length||new Set(t.assignments.map(r=>`${r.tierId}:${r.period}`)).size!==t.assignments.length||t.assignments.some(r=>!i.includes(r.tierId)))&&n.addIssue({code:"custom",message:"Each product and tier/period cell must have one unambiguous assignment"})});function Te(t,n){return t.assignments.length===n.length&&t.assignments.every(i=>n.includes(i.productVersionId))}function ir(t){let n=ce(t).map(i=>`\u672A\u77E5\u53D8\u91CF\uFF1A${i}`);for(let i=0;i<t.length;i++){if(t[i]!=="<"||!/[A-Za-z!/?{]/.test(t[i+1]??""))continue;let r=i;if(t.startsWith("<!--",i)){let a=t.indexOf("-->",i+4);i=a<0?t.length:a+2}else{let a="";for(i++;i<t.length;i++){let o=t[i];if(a)o===a&&(a="");else if(o==='"'||o==="'")a=o;else if(o===">")break}}/\{\{|\}\}/.test(t.slice(r,i+1))&&n.push("\u53D8\u91CF\u53EA\u80FD\u653E\u5728 HTML \u6587\u5B57\u4E2D\uFF0C\u4E0D\u80FD\u653E\u5165\u6807\u7B7E\u3001\u5C5E\u6027\u6216\u6CE8\u91CA")}return[...new Set(n)]}var x={state:32,enumValues:64,derived:96,bindings:256,controls:64,timers:4,effects:8,depth:12,expressionNodes:2e3},qe=new Set([...Object.getOwnPropertyNames(Object.prototype),"prototype"]),I=e.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,63}$/).refine(t=>!qe.has(t),"Reserved UI identifier"),ue=e.union([e.string().max(2e3),e.number().finite(),e.boolean(),e.null()]),ft=e.discriminatedUnion("type",[e.strictObject({type:e.literal("enum"),values:e.array(ue).min(1).max(x.enumValues),default:ue}),e.strictObject({type:e.literal("number"),min:e.number().finite(),max:e.number().finite(),step:e.number().finite().positive(),default:e.number().finite()}),e.strictObject({type:e.literal("text"),maxLength:e.number().int().min(0).max(2e3),default:e.string().max(2e3).nullable()}),e.strictObject({type:e.literal("boolean"),default:e.boolean()})]);function Y(t,n){if(t.type==="enum")return t.values.some(r=>r===n);if(t.type==="boolean")return typeof n=="boolean";if(t.type==="text")return n===null||typeof n=="string"&&n.length<=t.maxLength;if(typeof n!="number"||!Number.isFinite(n)||n<t.min||n>t.max)return!1;let i=(n-t.min)/t.step;return Number.isFinite(i)&&Math.abs(i-Math.round(i))<=Math.min(1e-7,Math.max(1,Math.abs(i))*Number.EPSILON*8)}var gt=ft.superRefine((t,n)=>{t.type==="enum"&&new Set(t.values).size!==t.values.length&&n.addIssue({code:"custom",path:["values"],message:"UI enum values must be unique"}),t.type==="number"&&t.min>t.max&&n.addIssue({code:"custom",path:["max"],message:"UI number range is reversed"}),Y(t,t.default)||n.addIssue({code:"custom",path:["default"],message:"UI default must match its state definition"})}),bt=["add","sub","mul","div","min","max","round","floor","eq","ne","gt","gte","lt","lte","and","or","not","if","concat","number","parse_number","money","lookup","now","duration"];function yt(t,n){return t==="now"?n===0:t==="concat"?!0:t==="lookup"?n>=4&&n%2===0:t==="if"?n===3:["sub","div","eq","ne","gt","gte","lt","lte"].includes(t)?n===2:["round","floor","not","number","parse_number","money","duration"].includes(t)?n===1:n>=1}var R=e.lazy(()=>e.union([ue,e.strictObject({ref:I}),e.strictObject({op:e.enum(bt),args:e.array(R).max(x.expressionNodes)}).superRefine((t,n)=>{yt(t.op,t.args.length)||n.addIssue({code:"custom",path:["args"],message:"Invalid UI expression arity"})})]));function z(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===null||n===Object.prototype}function E(t,n,i){if(!t||typeof t!="object")return!0;if(!z(t))return n.addIssue({code:"custom",path:i,message:"UI objects must be plain data"}),!1;for(let r of Object.keys(t)){if(qe.has(r))return n.addIssue({code:"custom",path:[...i,r],message:"Reserved UI object key"}),!1;let a=Object.getOwnPropertyDescriptor(t,r);if(a&&!Object.hasOwn(a,"value"))return n.addIssue({code:"custom",path:[...i,r],message:"UI objects cannot contain accessors"}),!1}return!0}function F(t,n,i,r){let a=[{value:t,depth:1,path:i}];for(;a.length;){let o=a.pop();if(++r.nodes>x.expressionNodes||o.depth>x.depth){n.addIssue({code:"custom",path:o.path,message:"UI expression budget exceeded"});return}if(!E(o.value,n,o.path))return;if(z(o.value)&&Array.isArray(o.value.args)){if(o.value.args.length>x.expressionNodes){n.addIssue({code:"custom",path:[...o.path,"args"],message:"UI expression budget exceeded"});return}for(let s=o.value.args.length-1;s>=0;s--)a.push({value:o.value.args[s],depth:o.depth+1,path:[...o.path,"args",s]})}}}var sr=e.unknown().superRefine((t,n)=>{F(t,n,[],{nodes:0})}).pipe(R),le=e.record(I,R).refine(t=>Object.keys(t).length>0&&Object.keys(t).length<=x.state,"UI assignments need 1\u201332 state keys"),ht=e.strictObject({target:I,property:e.enum(["text","visible","disabled","checked","value","class","aria-label","aria-selected","aria-checked","aria-valuetext","tabindex"]),expression:R,className:I.optional()}).superRefine((t,n)=>{t.property==="class"!=(t.className!==void 0)&&n.addIssue({code:"custom",path:["className"],message:"Only class bindings require a safe className"})}),xt=e.discriminatedUnion("type",[e.strictObject({type:e.literal("scroll_latch"),target:I,state:I}),e.strictObject({type:e.literal("input"),target:I,state:I,set:le.optional()}),e.strictObject({type:e.literal("action"),target:I,set:le}),e.strictObject({type:e.literal("carousel"),target:I,state:I,initialIndex:e.number().int().nonnegative().optional(),maxWidth:e.number().int().min(1).max(1e4).optional(),previousTarget:I.optional(),nextTarget:I.optional(),inactiveTargets:e.array(I).max(20).optional(),inactiveMaxWidth:e.number().int().min(1).max(1e4).optional()})]),St=e.strictObject({afterMs:e.number().int().min(0).max(6e4),set:le}),It=e.strictObject({type:e.literal("mosaic_waves"),target:I,color:e.string().regex(/^#[0-9a-fA-F]{6}$/),hotColor:e.string().regex(/^#[0-9a-fA-F]{6}$/),enabled:R.optional(),speed:e.number().min(0).max(4).optional(),pitch:e.number().min(.05).max(4).optional(),fill:e.number().min(.05).max(1).optional(),feather:e.number().min(0).max(1).optional(),warp:e.number().min(0).max(4).optional(),warpScale:e.number().min(0).max(32).optional(),detailScale:e.number().min(0).max(32).optional(),waveScale:e.number().min(0).max(32).optional(),falloff:e.number().min(.1).max(32).optional(),brightness:e.number().min(0).max(32).optional(),ambient:e.number().min(0).max(1).optional(),gamma:e.number().min(.05).max(8).optional(),vignette:e.number().min(0).max(1).optional(),opacity:e.number().min(0).max(1).optional()}),kt=e.strictObject({type:e.literal("number_counter"),target:I,value:R,prefix:e.string().max(20).optional(),format:e.enum(["number","short"]).optional()}),wt=e.strictObject({state:e.record(I,gt).refine(t=>Object.keys(t).length<=x.state,"Too many UI state keys").optional(),derived:e.record(I,R).refine(t=>Object.keys(t).length<=x.derived,"Too many UI derived keys").optional(),bindings:e.array(ht).max(x.bindings).optional(),controls:e.array(xt).max(x.controls).optional(),timers:e.array(St).max(x.timers).optional(),effects:e.array(e.discriminatedUnion("type",[It,kt])).max(x.effects).optional(),clock:e.boolean().optional()});function jt(t,n){if(!E(t,n,[])||!z(t))return;for(let[r,a]of[["state",x.state],["derived",x.derived]]){let o=t[r];if(!E(o,n,[r]))return;if(z(o)&&Object.keys(o).length>a){n.addIssue({code:"custom",path:[r],message:"UI declaration budget exceeded"});return}}for(let[r,a]of[["bindings",x.bindings],["controls",x.controls],["timers",x.timers],["effects",x.effects]])if(Array.isArray(t[r])&&t[r].length>a){n.addIssue({code:"custom",path:[r],message:"UI declaration budget exceeded"});return}if(Array.isArray(t.effects)){for(let[r,a]of t.effects.entries())if(!E(a,n,["effects",r]))return}if(z(t.state))for(let[r,a]of Object.entries(t.state)){if(!E(a,n,["state",r]))return;if(z(a)&&Array.isArray(a.values)&&a.values.length>x.enumValues){n.addIssue({code:"custom",path:["state",r,"values"],message:"Too many UI enum values"});return}}let i={nodes:0};if(z(t.derived))for(let[r,a]of Object.entries(t.derived))F(a,n,["derived",r],i);for(let r of["bindings","controls","timers"]){let a=t[r];if(Array.isArray(a)){for(let[o,s]of a.entries())if(!(!E(s,n,[r,o])||!z(s))){if(r==="bindings")F(s.expression,n,[r,o,"expression"],i);else if(E(s.set,n,[r,o,"set"])&&z(s.set)){if(Object.keys(s.set).length>x.state){n.addIssue({code:"custom",path:[r,o,"set"],message:"Too many UI assignments"});return}for(let[c,l]of Object.entries(s.set))F(l,n,[r,o,"set",c],i)}if(i.nodes>x.expressionNodes)return}}}if(Array.isArray(t.effects))for(let[r,a]of t.effects.entries())z(a)&&a.type==="number_counter"?F(a.value,n,["effects",r,"value"],i):z(a)&&a.enabled!==void 0&&F(a.enabled,n,["effects",r,"enabled"],i)}function Fe(t){let n=[],i=[t];for(;i.length;){let r=i.pop();!r||typeof r!="object"||("ref"in r?n.push(r.ref):i.push(...r.args))}return n}var Ve=e.unknown().superRefine(jt).pipe(wt).superRefine((t,n)=>{let i=t.state??{},r=t.derived??{},a=new Set([...Object.keys(i),...Object.keys(r)]),o=(m,p)=>{for(let f of Fe(m))a.has(f)||n.addIssue({code:"custom",path:p,message:`Unknown UI reference: ${f}`})};for(let[m,p]of Object.entries(t.derived??{}))Object.hasOwn(i,m)&&n.addIssue({code:"custom",path:["derived",m],message:"UI state and derived identifiers must be distinct"}),o(p,["derived",m]);let s=new Set,c=new Set,l=m=>{if(s.has(m))return!1;if(c.has(m))return!0;s.add(m);for(let p of Fe(r[m]))if(Object.hasOwn(r,p)&&!l(p))return!1;return s.delete(m),c.add(m),!0};for(let m of Object.keys(r))if(!l(m)){n.addIssue({code:"custom",path:["derived",m],message:"Cyclic UI derived references"});break}for(let[m,p]of(t.bindings??[]).entries())o(p.expression,["bindings",m,"expression"]);let d=new Set;for(let[m,p]of(t.effects??[]).entries())d.has(p.target)&&n.addIssue({code:"custom",path:["effects",m,"target"],message:"Effect targets must be unique"}),d.add(p.target),p.type==="number_counter"?(o(p.value,["effects",m,"value"]),typeof p.value=="number"&&Math.abs(p.value)>1e12&&n.addIssue({code:"custom",path:["effects",m,"value"],message:"Counter values must be within the display bound"})):p.enabled!==void 0&&o(p.enabled,["effects",m,"enabled"]);let u=(m,p)=>{for(let[f,w]of Object.entries(m))Object.hasOwn(i,f)||n.addIssue({code:"custom",path:[...p,f],message:"UI assignments can only update declared state"}),o(w,[...p,f])},b=new Set,h=new Set;for(let[m,p]of(t.controls??[]).entries()){if(p.type==="carousel"&&p.inactiveMaxWidth!==void 0&&p.inactiveTargets===void 0&&n.addIssue({code:"custom",path:["controls",m,"inactiveMaxWidth"],message:"Inactive width requires inactive article targets"}),p.type==="carousel")for(let f of p.inactiveTargets??[])(f===p.target||h.has(f))&&n.addIssue({code:"custom",path:["controls",m,"inactiveTargets"],message:"Inactive article targets must have one carousel owner"}),h.add(f);if(p.type==="carousel")for(let f of["previousTarget","nextTarget"]){let w=p[f];w!==void 0&&((w===p.target||b.has(w)||(t.controls??[]).some(W=>W.target===w))&&n.addIssue({code:"custom",path:["controls",m,f],message:"Carousel navigation needs a distinct, exclusive button target"}),b.add(w))}if(p.type!=="action"){let f=Object.hasOwn(i,p.state)?i[p.state]:void 0;(!f||p.type==="input"&&f.type==="enum"&&f.values.some(w=>typeof w!="string"))&&n.addIssue({code:"custom",path:["controls",m,"state"],message:"Control needs a supported declared UI state"}),p.type==="carousel"&&(f?.type!=="number"||!Number.isInteger(f.min)||f.min<0||!Number.isInteger(f.max)||f.step!==1||p.initialIndex!==void 0&&!Y(f,p.initialIndex))&&n.addIssue({code:"custom",path:["controls",m],message:"Carousel needs bounded nonnegative integer index state"}),p.type==="scroll_latch"&&f?.type!=="boolean"&&n.addIssue({code:"custom",path:["controls",m,"state"],message:"Scroll latches require boolean UI state"})}(p.type==="input"||p.type==="action")&&p.set&&u(p.set,["controls",m,"set"])}for(let[m,p]of(t.timers??[]).entries())u(p.set,["timers",m,"set"])});var Qe=/^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$/,q=e.string().max(16).regex(Qe,"\u8BED\u8A00\u4EE3\u7801\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u4F8B\u5982 zh-CN\u3001en").refine(t=>{try{return Intl.getCanonicalLocales(t)[0]===t}catch{return!1}},"\u6301\u4E45\u5316\u8BED\u8A00\u4EE3\u7801\u5FC5\u987B\u4F7F\u7528\u89C4\u8303\u5199\u6CD5");function pe(t){if(typeof t!="string")return null;try{let n=Intl.getCanonicalLocales(t.trim().replaceAll("_","-"))[0];if(!n)return null;let{language:i,script:r,region:a}=new Intl.Locale(n),o=[i,r,a].filter(Boolean).join("-");return Qe.test(o)?o:null}catch{return null}}var _t=new Set(["TW","HK","MO"]);function Me(t){let[n,i,r]=t.split("-");if(n!=="zh")return`${n}-${new Intl.Locale(t).maximize().script??""}`;let a=i?.length===4?i:void 0,o=i?.length===4?r:i;return a?`zh-${a}`:o&&_t.has(o)?"zh-Hant":"zh-Hans"}function Be(t,n,i){let r=n.map(a=>({code:q.parse(a),normalized:a}));for(let a of t){let o=pe(a);if(!o)continue;let s=r.find(u=>u.normalized===o);if(s)return s.code;let c=Me(o),l=r.filter(u=>Me(u.normalized)===c),d=l.find(u=>!u.normalized.includes("-")||u.normalized===c)??l[0];if(d)return d.code}return i}var zt=4,v={nodes:150,depth:8,children:50,locales:20,actions:40,pages:10,stringLength:2e3,customHtml:32768,customCss:32768,documentBytes:2e5},Q=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),y=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),At=e.enum(["none","xs","sm","md","lg","xl"]),vt=e.enum(["none","sm","md","lg","full"]),me=e.string().regex(/^#[0-9a-fA-F]{6}$/),fe=e.string().max(2048).refine(t=>{try{let n=new URL(t);return n.protocol==="https:"&&n.hostname.length>0}catch{return!1}},"\u53EA\u652F\u6301 https \u94FE\u63A5"),de=e.union([fe,e.string().max(32768).regex(/^data:image\/svg\+xml;base64,[A-Za-z0-9+/]+={0,2}$/),e.string().max(131072).regex(/^data:image\/jpeg;base64,\/9j\/[A-Za-z0-9+/]+={0,2}$/),e.string().max(131072).regex(/^data:image\/png;base64,iVBORw0KGgo[A-Za-z0-9+/]+={0,2}$/)]),Ze=e.object({primary:me,background:me,text:me,radius:vt,font:e.enum(["system","serif","rounded","mono"]),fontAssets:e.object({family:e.string().regex(/^[A-Za-z][A-Za-z0-9 -]{0,39}$/),faces:e.array(e.object({url:fe,weight:e.number().int().min(100).max(900).multipleOf(100),family:e.string().regex(/^[A-Za-z][A-Za-z0-9 -]{0,39}$/).optional()}).strict()).min(1).max(4)}).strict().optional()}).strict(),B=e.union([e.enum(["primary","text","muted","background","surface"]),e.string().regex(/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/)]),g=(t,n)=>e.number().int().min(t).max(n),Ge=e.union([e.enum(["fit","fill"]),g(1,1200)]),Ot=e.object({top:g(0,200),right:g(0,200),bottom:g(0,200),left:g(0,200)}).strict(),Pt=e.object({top:g(-100,200),right:g(-100,200),bottom:g(-100,200),left:g(-100,200)}).strict(),Ke=e.object({x:g(0,100),y:g(0,100)}).strict(),Nt=e.discriminatedUnion("type",[e.object({type:e.literal("color"),color:B}).strict(),e.object({type:e.literal("linear"),angle:g(0,360),stops:e.array(e.object({color:B,at:g(0,100)}).strict()).min(2).max(4)}).strict(),e.object({type:e.literal("image"),src:de,fit:e.enum(["cover","contain"]),position:Ke.optional()}).strict()]),$t=e.discriminatedUnion("type",[e.object({type:e.literal("rect"),radius:e.union([g(0,200),e.object({topLeft:g(0,200),topRight:g(0,200),bottomRight:g(0,200),bottomLeft:g(0,200)}).strict()])}).strict(),e.object({type:e.literal("pill")}).strict()]),Ct=e.object({width:g(0,12),color:B,style:e.enum(["solid","dashed"])}).strict(),Dt=e.object({x:g(-40,40),y:g(-40,40),blur:g(0,80),spread:g(-20,40),color:B}).strict(),Et=e.object({font:e.enum(["system","serif","rounded","mono"]),size:g(8,96),weight:e.number().int().min(100).max(900).multipleOf(100),lineHeight:e.number().min(.8).max(3),letterSpacing:e.number().min(-5).max(20),color:B,align:e.enum(["start","center","end"]),italic:e.boolean(),decoration:e.enum(["none","underline","line-through"]),transform:e.enum(["none","uppercase"])}).strict().partial(),U=e.object({width:Ge,height:Ge,padding:Ot,margin:Pt,gap:g(0,120),grow:e.union([e.boolean(),e.number().min(0).max(12)]),background:Nt,opacity:e.number().min(0).max(1),clipContent:e.boolean(),shape:$t,border:Ct,shadow:Dt,text:Et}).strict().partial(),j={id:Q,name:e.string().trim().min(1).max(60).optional(),hidden:e.boolean().optional(),style:U.optional(),fallback:y.optional()},Rt=e.object({...j,type:e.literal("text"),productField:e.enum(["name","price","trial","period"]).optional(),feature:e.object({id:e.uuid(),field:e.enum(["name","allowance"])}).strict().optional(),text:y,variant:e.enum(["title","heading","body","caption"])}).strict(),Ut=e.object({...j,type:e.literal("image"),src:de,localizedSrc:e.record(q,de).optional(),alt:y,aspect:e.enum(["auto","1:1","4:3","16:9","3:1"]),fit:e.enum(["cover","contain"]),position:Ke.optional()}).strict(),Lt=e.object({...j,type:e.literal("button"),label:y,variant:e.enum(["primary","secondary","link"]),action:y,purpose:e.enum(["purchase","navigation","close"]).optional(),bind:X.optional()}).strict(),Tt=e.object({...j,type:e.literal("divider")}).strict(),Ft=e.object({...j,type:e.literal("customer_data"),title:y,data:Pe}).strict(),qt=e.object({...j,type:e.literal("spacer"),size:At}).strict(),Vt=e.object({...j,type:e.literal("custom_html"),html:e.record(q,e.string().max(v.customHtml)),css:e.string().max(v.customCss),ui:Ve.optional()}).strict(),Mt=e.object({...j,type:e.literal("price"),fallback:y,parts:e.object({current:U.optional(),original:U.optional(),period:U.optional()}).strict().optional()}).strict(),Qt=e.object({...j,type:e.literal("coupon_code"),label:y,fallback:y}).strict(),Bt=e.object({...j,type:e.literal("countdown"),source:e.enum(["offer.ends_at","offer.expires_at","fixed"]),at:e.iso.datetime().optional(),granularity:e.enum(["day","hour","minute","second"]),expired:y,fallback:y}).strict().refine(t=>t.source!=="fixed"||!!t.at,"\u56FA\u5B9A\u5012\u8BA1\u65F6\u9700\u8981\u7ED3\u675F\u65F6\u95F4"),Zt=e.object({...j,type:e.literal("plan_picker"),label:y,fallback:y,planIds:e.array(e.string().min(1).max(200)).min(1).max(20).refine(t=>new Set(t).size===t.length,"\u5957\u9910\u4E0D\u80FD\u91CD\u590D").optional(),defaultPlan:e.string().min(1).max(200).optional(),grouping:Le.safeExtend({monthLabel:y,yearLabel:y,unavailableLabel:y}).optional(),states:e.object({selected:U.optional()}).strict().optional()}).strict().superRefine((t,n)=>{t.grouping&&(!t.planIds||!Te(t.grouping,t.planIds))&&n.addIssue({code:"custom",message:"Grouped picker assignments must match its product allowlist"})}),Gt=e.object({...j,type:e.literal("quantity_picker"),bind:X.optional(),label:y,fallback:y,internalFeatureId:e.uuid(),minimumQuantity:g(0,1e4),maximumQuantity:g(0,1e4),defaultQuantity:g(0,1e4),step:g(1,1e4)}).strict().refine(t=>t.minimumQuantity<=t.defaultQuantity&&t.defaultQuantity<=t.maximumQuantity&&(t.defaultQuantity-t.minimumQuantity)%t.step===0,"Quantity controls require a Product binding and valid bounds"),Kt=e.discriminatedUnion("type",[e.object({type:e.literal("input"),label:y,keyboard:e.enum(["text","email","tel","url"]),maxLength:g(1,500)}).strict(),e.object({type:e.literal("multiselect"),label:y,min:g(0,50),max:g(1,50)}).strict(),e.object({type:e.literal("select"),label:y,defaultIndex:g(0,49),purpose:e.enum(["option","product","tier"]).optional(),pickerId:Q.optional(),selectedStyle:U.optional()}).strict(),e.object({type:e.literal("tabs"),label:y,defaultIndex:g(0,49),purpose:e.literal("tier").optional()}).strict(),e.object({type:e.literal("toggle"),label:y,defaultEnabled:e.boolean()}).strict(),e.object({type:e.literal("carousel"),label:y}).strict()]),A={...j,type:e.literal("stack"),direction:e.enum(["vertical","horizontal","overlay"]),align:e.enum(["start","center","end","stretch"]),justify:e.enum(["start","center","end","between"]),productSlot:e.object({index:g(0,19),period:e.enum(["month","year"]).optional(),requireBinding:e.boolean().optional()}).strict().optional(),interaction:Kt.optional(),states:e.object({selected:U.optional()}).strict().optional(),purpose:e.literal("benefits").optional(),purchaseAction:y.optional(),buttonVariant:e.enum(["primary","secondary","link"]).optional(),bind:X.optional()},He=e.lazy(()=>e.object({...j,type:A.type,direction:A.direction,align:A.align,justify:A.justify,children:e.array(Ht).max(v.children),productSlot:A.productSlot,interaction:A.interaction,states:A.states,purpose:A.purpose,purchaseAction:A.purchaseAction,buttonVariant:A.buttonVariant,bind:A.bind}).strict()),Ht=e.lazy(()=>e.union([He,Rt,Ut,Lt,Tt,qt,Vt,Mt,Qt,Bt,Zt,Gt,Ft])),Wt=e.union([e.string().max(500),e.number().finite(),e.boolean(),e.null()]),M={id:y,event:y,properties:e.record(y,Wt).refine(t=>Object.keys(t).length<=20,"\u6700\u591A 20 \u4E2A\u53C2\u6570")},Jt=e.discriminatedUnion("type",[e.object({...M,type:e.literal("navigate"),close:e.literal(!1),pageId:Q}).strict(),e.object({...M,type:e.literal("event"),close:e.boolean()}).strict(),e.object({...M,type:e.literal("close"),close:e.literal(!0)}).strict(),e.object({...M,type:e.literal("open_url"),close:e.boolean(),url:fe}).strict(),e.object({...M,type:e.literal("claim_offer"),close:e.boolean(),couponId:e.uuid()}).strict()]),Xt=e.object({defaultLocale:q,locales:e.record(q,e.record(y,e.string().max(v.stringLength)))}).strict(),Yt=e.enum(["popup","paywall","onboarding","page","banner"]);var en=e.object({kind:e.literal("screen"),schemaVersion:e.literal(zt),name:e.string().trim().min(1).max(80),surface:Yt,initialPageId:Q.optional(),presentation:Ce,theme:Ze,pages:e.array(e.object({id:Q,name:e.string().trim().min(1).max(60),root:He,theme:Ze.optional(),editorPosition:e.object({x:e.number().finite().min(-1e5).max(1e5),y:e.number().finite().min(-1e5).max(1e5)}).strict().optional()}).strict()).min(1).max(v.pages),strings:Xt,actions:e.array(Jt).max(v.actions)}).strict();function P(t,n){for(let i of t.pages)ge(i.root,n)}var xr=en.superRefine((t,n)=>{let i=v;t.surface!=="paywall"&&t.pages.length!==1&&n.addIssue({code:"custom",message:"Only a Paywall can contain multiple screens"}),t.initialPageId&&!t.pages.some(u=>u.id===t.initialPageId)&&n.addIssue({code:"custom",message:"Initial screen does not exist"});for(let u of t.actions)u.type==="navigate"&&(t.surface!=="paywall"||!t.pages.some(b=>b.id===u.pageId))&&n.addIssue({code:"custom",message:"Navigation screen does not exist"});t.pages.length>i.pages&&n.addIssue({code:"custom",message:`\u9875\u9762\u6700\u591A ${i.pages} \u4E2A`}),t.actions.length>i.actions&&n.addIssue({code:"custom",message:`\u52A8\u4F5C\u6700\u591A ${i.actions} \u4E2A`});let r=u=>n.addIssue({code:"custom",message:u}),a=Object.keys(t.strings.locales);a.includes(t.strings.defaultLocale)||r("\u9ED8\u8BA4\u8BED\u8A00\u5FC5\u987B\u5728\u8BED\u8A00\u5217\u8868\u91CC"),a.length>v.locales&&r(`\u6700\u591A ${v.locales} \u79CD\u8BED\u8A00`);let o=new Set;for(let u of t.actions)o.has(u.id)&&r(`\u52A8\u4F5C\u6807\u8BC6\u91CD\u590D\uFF1A${u.id}`),o.add(u.id);let s=new Set;for(let u of t.pages)["next","back"].includes(u.id)&&r(`\u9875\u9762 id \u4E0D\u80FD\u4F7F\u7528\u4FDD\u7559\u540D\u79F0\uFF1A${u.id}`),s.has(u.id)&&r(`\u9875\u9762 id \u91CD\u590D\uFF1A${u.id}`),s.add(u.id);let c=new Set,l=0,d=!1;P(t,(u,b)=>{if(l++,b>v.depth&&(d=!0),c.has(u.id)&&r(`\u7EC4\u4EF6 id \u91CD\u590D\uFF1A${u.id}`),c.add(u.id),u.type==="button"&&!o.has(u.action)&&r(`\u6309\u94AE ${u.id} \u5F15\u7528\u7684\u52A8\u4F5C\u4E0D\u5B58\u5728\uFF1A${u.action}`),u.type==="custom_html")for(let h of Object.keys(u.html))a.includes(h)||r(`\u81EA\u5B9A\u4E49 HTML ${u.id} \u542B\u6709\u672A\u542F\u7528\u7684\u8BED\u8A00\uFF1A${h}`);if(u.type==="image")for(let h of Object.keys(u.localizedSrc??{}))a.includes(h)||r(`\u56FE\u7247 ${u.id} \u542B\u6709\u672A\u542F\u7528\u7684\u8BED\u8A00\uFF1A${h}`)}),l>i.nodes&&r(`\u7EC4\u4EF6\u6700\u591A ${i.nodes} \u4E2A`),d&&r(`\u5C42\u7EA7\u6700\u591A ${v.depth} \u5C42`)});function ge(t,n,i=1,r=null){if(n(t,i,r)!==!1&&t.type==="stack")for(let a of t.children)ge(a,n,i+1,t)}function We(t){let n=[],i=new Set;return P(t,r=>{let a=(o,s,c)=>{i.has(o)||(i.add(o),n.push({key:o,nodeId:r.id,nodeType:r.type,field:s,required:c}))};r.type==="stack"&&r.interaction&&a(r.interaction.label,"label",!0),r.fallback&&a(r.fallback,"text",!0),r.type==="text"&&a(r.text,"text",!0),r.type==="customer_data"&&a(r.title,"title",!0),(r.type==="plan_picker"||r.type==="quantity_picker"||r.type==="coupon_code")&&a(r.label,"label",!0),r.type==="plan_picker"&&r.grouping&&(a(r.grouping.monthLabel,"label",!0),a(r.grouping.yearLabel,"label",!0),a(r.grouping.unavailableLabel,"text",!0)),r.type==="countdown"&&a(r.expired,"text",!0),r.type==="button"&&a(r.label,"label",!0),r.type==="image"&&(a(`image:${r.id}`,"src",!1),a(r.alt,"alt",!1)),r.type==="custom_html"&&a(`html:${r.id}`,"html",!0)}),n}function tn(t,n,i){if(n.field==="html"){let r;return P(t,a=>{a.id===n.nodeId&&a.type==="custom_html"&&(r=a.html[i])}),r}if(n.field==="src"){let r=be(t,n.nodeId);return r?.type==="image"?r.localizedSrc?.[i]??(i===t.strings.defaultLocale?r.src:void 0):void 0}return t.strings.locales[i]?.[n.key]}function nn(t){let n=We(t).filter(r=>r.required);return Object.keys(t.strings.locales).sort((r,a)=>r===t.strings.defaultLocale?-1:a===t.strings.defaultLocale?1:0).map(r=>{let a=n.filter(o=>!tn(t,o,r)?.trim()).map(o=>o.key);return{locale:r,total:n.length,filled:n.length-a.length,missing:a,complete:a.length===0}})}function rn(t){return nn(t).filter(n=>n.complete||n.locale===t.strings.defaultLocale).map(n=>n.locale)}function Sr(t,n){return Be(n,rn(t),t.strings.defaultLocale)}function Ir(t,n){let i=t.strings.locales[n]??{},r=t.strings.locales[t.strings.defaultLocale]??{},a={};for(let s of We(t)){if(s.field==="html"||s.field==="src")continue;let c=i[s.key]?.trim()?i[s.key]:r[s.key];c!==void 0&&(a[s.key]=c)}let o=s=>{if(s.type==="stack")return{...s,children:s.children.map(o)};if(s.type==="custom_html"){let c=s.html[n]?.trim()?s.html[n]:s.html[t.strings.defaultLocale];return{...s,html:c===void 0?{}:{[n]:c}}}if(s.type==="image"){let{localizedSrc:c,...l}=s;return{...l,src:c?.[n]??c?.[t.strings.defaultLocale]??s.src}}return s};return{...t,pages:t.pages.map(s=>({...s,root:o(s.root)})),strings:{defaultLocale:n,locales:{[n]:a}}}}function an(t,n){let i=null;return ge(t,r=>{if(i)return!1;r.id===n&&(i=r)}),i}function be(t,n){for(let i of t.pages){let r=an(i.root,n);if(r)return r}return null}function kr(t){let n=pe(t)?.split("-")[0];return n!==void 0&&["ar","he","fa","ur"].includes(n)}function wr(t,n,i){let r={};if(!n||typeof n!="object"||Array.isArray(n))return r;let a=n;if(P(t,o=>{if(o.type==="quantity_picker"){let c=a[o.id];typeof c=="number"&&Number.isSafeInteger(c)&&c>=o.minimumQuantity&&c<=o.maximumQuantity&&(c-o.minimumQuantity)%o.step===0&&(r[o.id]=c);return}if(o.type==="plan_picker"){let c=a[o.id];typeof c=="string"&&(r[o.id]=i?.pickers[o.id]?.options.includes(c)?c:"");return}if(o.type==="custom_html"&&o.ui)for(let[c,l]of Object.entries(o.ui.state??{})){let d=`${o.id}.${c}`,u=a[d];u!==null&&Y(l,u)&&(r[d]=u)}if(o.type!=="stack"||!o.interaction)return;let s=Object.hasOwn(a,o.id)?a[o.id]:void 0;["select","tabs"].includes(o.interaction.type)&&typeof s=="string"&&o.children.some(c=>c.id===s)&&(r[o.id]=s),o.interaction.type==="toggle"&&typeof s=="boolean"&&(r[o.id]=s)}),t.surface==="paywall"&&typeof a.__page=="string"&&t.pages.some(o=>o.id===a.__page)&&(r.__page=a.__page),i){let o={...r};for(let[s,c]of Object.entries(a))(typeof c=="string"||typeof c=="boolean")&&(o[s]=c);Object.assign(r,Re(t,o,i))}return r}var D=e.json().superRefine((t,n)=>{let i=0;function r(a,o){if(++i>1e4||o>20){n.addIssue({code:"custom",message:"JSON exceeds its depth or node budget"});return}if(typeof a=="string"&&(a.includes("\0")||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(a))&&n.addIssue({code:"custom",message:"JSON text must contain valid Unicode without NUL"}),Array.isArray(a))a.forEach(s=>r(s,o+1));else if(a&&typeof a=="object")for(let[s,c]of Object.entries(a))(s.includes("\0")||/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u.test(s)||["__proto__","prototype","constructor"].includes(s))&&n.addIssue({code:"custom",message:"Reserved JSON property"}),r(c,o+1)}r(t,0),new TextEncoder().encode(JSON.stringify(t)).byteLength>65536&&n.addIssue({code:"custom",message:"JSON exceeds 64 KiB"})}),he=e.record(e.string().min(1).max(128),D).superRefine((t,n)=>{(!D.safeParse(t).success||Object.keys(t).length>128||new TextEncoder().encode(JSON.stringify(t)).byteLength>65536||["__proto__","constructor","prototype"].some(i=>Object.hasOwn(t,i)))&&n.addIssue({code:"custom",message:"Attribute document exceeds its budget or uses a reserved key"})}),on=new Set(["$in","$ini","$inGroup","$nin","$nini","$notInGroup","$gt","$gte","$lt","$lte","$regex","$regexi","$ne","$eq","$size","$elemMatch","$all","$alli","$not","$type","$exists","$vgt","$vgte","$vlt","$vlte","$vne","$veq","$and","$or","$nor","$savedGroup"]),ee=he.superRefine((t,n)=>{function i(r){if(Array.isArray(r))r.forEach(i);else if(r&&typeof r=="object")for(let[a,o]of Object.entries(r)){if(a==="$savedGroup"&&!e.strictObject({id:e.uuid(),attributeKey:e.string().min(1).max(128).optional()}).safeParse(o).success&&n.addIssue({code:"custom",message:"Saved groups use v2 object references"}),!a.startsWith("$")&&a.split(".").some(s=>["__proto__","prototype","constructor"].includes(s))&&n.addIssue({code:"custom",message:"Reserved attribute path"}),a.startsWith("$")&&!on.has(a)&&n.addIssue({code:"custom",message:`Unknown GrowthBook operator: ${a}`}),["$regex","$regexi"].includes(a)&&typeof o=="string"){(/\(\?[<!=]|\\[0-9]|\\k</.test(o)||[...o.matchAll(/\{(\d+)(?:,(\d*))?\}/g)].some(s=>Number(s[1])>255||Number(s[2]||0)>255)||a==="$regexi"&&/[^\x00-\x7f]/.test(o.replace(/\\u([0-9a-f]{4})/gi,(s,c)=>String.fromCharCode(Number.parseInt(c,16)))))&&n.addIssue({code:"custom",message:"Regex is outside the shared TS/SQL subset"});try{new RegExp(o)}catch{n.addIssue({code:"custom",message:"Invalid regular expression"})}}i(o)}}typeof t.source=="string"&&["all","any","group","parameter","answer","attribute","result"].includes(t.source)&&("operator"in t||"predicates"in t||"groupId"in t)&&n.addIssue({code:"custom",message:"Obsolete condition protocol"}),i(t)}),sn=e.discriminatedUnion("type",[e.strictObject({type:e.literal("condition"),condition:ee}),e.strictObject({type:e.literal("list"),attributeKey:e.string().min(1).max(128),values:e.array(e.union([e.string(),e.number().finite()])).max(1e5)})]).refine(t=>t.type!=="list"||new TextEncoder().encode(JSON.stringify(t.values)).byteLength<=1048576,"Saved group list exceeds 1 MiB");function cn(t){let n=new Set;function i(r){if(Array.isArray(r))r.forEach(i);else if(r&&typeof r=="object")for(let[a,o]of Object.entries(r))a==="$savedGroup"&&o&&typeof o=="object"&&!Array.isArray(o)&&typeof o.id=="string"?n.add(o.id):["$inGroup","$notInGroup"].includes(a)&&typeof o=="string"?n.add(o):["$eq","$ne","$in","$nin","$ini","$nini"].includes(a)||i(o)}return i(t),[...n]}var un=e.record(e.uuid(),sn).superRefine((t,n)=>{let i=new Set,r=new Set;function a(o){if(i.has(o)){n.addIssue({code:"custom",message:"Cyclic saved group dependency"});return}if(r.has(o))return;let s=t[o];if(!s){n.addIssue({code:"custom",message:"Missing saved group dependency"});return}i.add(o),s.type==="condition"&&cn(s.condition).forEach(a),i.delete(o),r.add(o)}Object.keys(t).forEach(a)}),xe=e.tuple([e.number().min(0).max(1),e.number().min(0).max(1)]).refine(([t,n])=>t<=n),Je=e.strictObject({attribute:e.string().optional(),seed:e.string().min(1),hashVersion:e.literal(2),ranges:e.array(xe).min(1).max(100)}),ln=e.strictObject({id:e.string().min(1).max(128),condition:ee,gate:e.boolean().optional()}),ye={id:e.string().max(128).optional(),condition:ee.optional(),parentConditions:e.array(ln).max(50).optional(),filters:e.array(Je).max(20).optional()},pn=e.union([e.strictObject({...ye}),e.strictObject({...ye,force:D,coverage:e.number().min(0).max(1).optional(),range:xe.optional(),seed:e.string().min(1).optional(),hashAttribute:e.string().optional(),hashVersion:e.literal(2).optional()}),e.strictObject({...ye,type:e.literal("experiment-ref"),experimentId:e.uuid(),values:e.record(e.string().min(1),D),meta:e.record(e.string().min(1),e.strictObject({passthrough:e.boolean()})).optional()})]),mn=e.strictObject({defaultValue:D,rules:e.array(pn).max(100)}),$r=e.record(e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,127}$/),mn).superRefine((t,n)=>{Object.keys(t).length>100&&n.addIssue({code:"custom",message:"Too many Features"});let i=new Set,r=new Set;function a(o){if(i.has(o)){n.addIssue({code:"custom",message:`Cyclic Feature dependency: ${o}`});return}if(r.has(o))return;let s=t[o];if(!s){n.addIssue({code:"custom",message:`Unknown prerequisite Feature: ${o}`});return}i.add(o);for(let c of s.rules)for(let l of c.parentConditions??[])a(l.id);i.delete(o),r.add(o)}Object.keys(t).forEach(a)}),dn=e.strictObject({name:e.string().max(80),reason:e.string().max(500),dateStarted:e.iso.datetime({offset:!0}),dateEnded:e.iso.datetime({offset:!0}).nullable(),coverage:e.number().min(0).max(1),variationWeights:e.array(e.number().min(0).max(1)).min(2).max(20).refine(t=>Math.abs(t.reduce((n,i)=>n+i,0)-1)<=.01),condition:ee,savedGroups:e.array(e.strictObject({match:e.enum(["any","all","none"]),ids:e.array(e.uuid()).min(1)})).max(50),namespace:e.strictObject({id:e.uuid(),ranges:e.array(xe).min(1)}).nullable(),seed:e.string().min(1).max(128)}),fn=e.strictObject({key:e.string().min(1).max(128),name:e.string().min(1).max(80),hypothesis:e.string().max(2e3),status:e.enum(["draft","running","stopped"]),hashAttribute:e.string().min(1).max(128),fallbackAttribute:e.string().max(128).nullable(),hashVersion:e.literal(2),disableStickyBucketing:e.boolean(),bucketVersion:e.number().int().min(0).max(1e3),minBucketVersion:e.number().int().min(0).max(1e3),variations:e.array(e.strictObject({id:e.string().min(1),key:e.string().min(1),name:e.string().max(80),description:e.string().max(500)})).min(2).max(20),phases:e.array(dn).min(1).max(100),releasedVariationId:e.string().nullable(),excludeFromPayload:e.boolean(),statusSchedule:e.strictObject({startAt:e.iso.datetime({offset:!0}).nullable(),stopAt:e.iso.datetime({offset:!0}).nullable(),stopAfter:e.strictObject({value:e.number().int().positive().max(36500),unit:e.enum(["hours","days"])}).nullable().optional()}).nullable()}).superRefine((t,n)=>{(t.minBucketVersion>t.bucketVersion||t.statusSchedule?.stopAt&&t.statusSchedule?.stopAfter||t.phases.some((i,r)=>{if(r===0)return!1;let a=t.phases[r-1];return!a?.dateEnded||Date.parse(i.dateStarted)<Date.parse(a.dateStarted)||Date.parse(a.dateEnded)>Date.parse(i.dateStarted)})||new Set(t.variations.map(i=>i.key)).size!==t.variations.length||new Set(t.variations.map(i=>i.id)).size!==t.variations.length||t.releasedVariationId!==null&&!t.variations.some(i=>i.id===t.releasedVariationId)||t.statusSchedule?.startAt&&t.statusSchedule?.stopAt&&Date.parse(t.statusSchedule.startAt)>=Date.parse(t.statusSchedule.stopAt)||t.phases.some(i=>i.dateEnded&&Date.parse(i.dateStarted)>=Date.parse(i.dateEnded)||i.namespace?.ranges.some(([r,a],o,s)=>r>=a||s.some(([c,l],d)=>d!==o&&r<l&&c<a)))||t.phases.some(i=>i.variationWeights.length!==t.variations.length))&&n.addIssue({code:"custom",message:"Invalid experiment versions, variation keys or weights"})});var gn=fn.safeExtend({filters:e.array(Je).optional()}),bn=e.strictObject({experiments:e.record(e.uuid(),gn),savedGroups:un}),yn=e.strictObject({attributeName:e.string(),attributeValue:e.string(),assignments:e.record(e.string(),e.string())}),Cr=e.strictObject({snapshot:bn,attributes:he,results:he,stickyBucketAssignmentDocs:e.record(e.string(),yn)}),Dr=e.strictObject({variantKey:e.string().nullable(),bucketVersion:e.number().int().min(0),source:e.enum(["unknownFeature","defaultValue","force","override","experiment","prerequisite","cyclicPrerequisite"]),bucket:e.number().min(0).max(1).optional(),stickyBucketUsed:e.boolean().optional(),hashUsed:e.boolean().optional()});var L=k.refine(t=>/[1-9]/.test(t),"Quantity must be positive"),Z=e.string().min(1).max(120),te=e.enum(["cap","overflow"]),_=(t,n)=>{let[i,r=""]=t.split(".");if(i===void 0||i==="")throw new Error("Invalid decimal value");return BigInt(i)*10n**BigInt(n)+BigInt(r.padEnd(n,"0"))},G=t=>{try{return t()}catch{return!1}},Lr=e.discriminatedUnion("operation",[e.object({operation:e.literal("quote"),overageBehavior:te.optional(),internal_feature_id:e.uuid(),entityId:e.uuid().optional(),quantity:L,properties:$}).strict(),e.object({operation:e.literal("consume"),overageBehavior:te.optional(),occurredAt:e.iso.datetime({offset:!0}).optional(),internal_feature_id:e.uuid(),entityId:e.uuid().optional(),quantity:k,properties:$,idempotencyKey:Z}).strict(),e.object({operation:e.literal("reserve"),occurredAt:e.iso.datetime({offset:!0}).optional(),internal_feature_id:e.uuid(),entityId:e.uuid().optional(),quantity:L,properties:$,idempotencyKey:Z,expiresInSeconds:e.number().int().min(1).max(86400)}).strict(),e.object({operation:e.literal("confirm"),operationId:e.uuid(),quantity:L,properties:$.optional(),idempotencyKey:Z}).strict(),e.object({operation:e.literal("refund"),operationId:e.uuid(),quantity:L,idempotencyKey:Z}).strict(),e.object({operation:e.literal("release"),operationId:e.uuid(),idempotencyKey:Z}).strict()]),hn=e.object({internal_credit_feature_id:e.uuid().nullable(),internal_metered_feature_id:e.uuid(),dimension:e.string().min(1).max(64),counterKey:e.string().min(1).max(240),cycleStart:e.iso.datetime({offset:!0}),unitCost:k,units:L,amount:J,tier:e.number().int().min(1).max(12).nullable()}).strict(),K=e.string().regex(/^(0|[1-9]\d{0,17})(\.\d{1,12})?$/);function Xe(t,n){let i=t.reduce((r,a)=>r+_(a.units,12),0n)-_(n,12);return t.some(r=>r.funding==="balance")?i>=-100n&&i<=100n:i===0n}var Ye=e.discriminatedUnion("funding",[e.strictObject({funding:e.literal("balance"),sourceId:e.uuid(),rolloverId:e.uuid().nullable(),units:K.refine(t=>/[1-9]/.test(t)),amount:J}),e.strictObject({funding:e.literal("unbilled"),units:K.refine(t=>/[1-9]/.test(t))}),e.object({funding:e.literal("prepaid"),sourceId:e.uuid(),units:L,amount:J,pricing:e.array(hn).min(1).max(12)}).strict().refine(t=>G(()=>t.pricing.reduce((n,i)=>n+_(i.units,6),0n)===_(t.units,6)&&t.pricing.reduce((n,i)=>n+_(i.amount,12),0n)===_(t.amount,12)&&t.pricing.every(n=>_(n.unitCost,6)*_(n.units,6)===_(n.amount,12))),"Frozen pricing must conserve allocated units and amounts"),e.object({funding:e.literal("postpaid"),invoiceLineId:e.uuid().nullable(),units:L,authorizationId:e.uuid()}).strict()]),ne=e.enum(["unavailable","insufficient_balance","limit_exceeded","awaiting_topup","authorization_required","payment_blocked","cash_budget_exceeded"]),Tr=e.object({allowed:e.boolean(),internal_feature_id:e.uuid(),quantity:k,requestedQuantity:k.optional(),overageBehavior:te.optional(),reason:ne.nullable(),allocations:e.array(Ye).max(500)}).strict().refine(t=>G(()=>t.allowed?t.reason===null&&Xe(t.allocations,t.quantity):t.reason!==null&&t.allocations.length===0),"A quote must conserve its accepted units").refine(t=>G(()=>t.overageBehavior===void 0?t.requestedQuantity===void 0&&/[1-9]/.test(t.quantity):t.requestedQuantity!==void 0&&_(t.requestedQuantity,6)>=_(t.quantity,6)&&(t.overageBehavior==="cap"||t.requestedQuantity===t.quantity)),"Explicit overage behavior must retain the requested quantity"),Fr=e.object({id:e.uuid(),internal_feature_id:e.uuid(),kind:e.enum(["consume","reserve","confirm","refund","release","expire"]),originalId:e.uuid().nullable(),quantity:k,requestedQuantity:k.optional(),overageBehavior:te.optional(),accepted:e.boolean(),reason:e.enum([...ne.options,"expired"]).nullable(),createdAt:e.iso.datetime({offset:!0}),reservationStatus:e.enum(["pending","confirmed","released","expired"]).nullable(),expiresAt:e.iso.datetime({offset:!0}).nullable(),allocations:e.array(Ye).max(500)}).strict().refine(t=>G(()=>t.accepted?t.reason===null&&Xe(t.allocations,t.quantity):t.reason!==null&&t.allocations.length===0),"An operation must conserve its requested units").refine(t=>G(()=>t.overageBehavior===void 0?t.requestedQuantity===void 0:t.kind==="consume"&&t.requestedQuantity!==void 0&&_(t.requestedQuantity,6)>=_(t.quantity,6)&&(t.overageBehavior==="cap"||t.requestedQuantity===t.quantity)),"Overage metadata belongs to consumption and preserves requested units").refine(t=>/[1-9]/.test(t.quantity)||t.kind==="consume","Only consumption can record a zero cost event").refine(t=>t.allocations.every(n=>n.funding!=="postpaid"||n.invoiceLineId!==null),"Accepted operations must reference persisted invoice lines").refine(t=>t.originalId!==null===["confirm","refund","release","expire"].includes(t.kind)&&t.expiresAt!==null==(t.reservationStatus!==null)&&(t.kind!=="reserve"||!t.accepted||t.reservationStatus!==null),"Operation provenance and reservation state must be explicit");var xn=e.string().max(40).regex(/^(0|[1-9]\d*)(\.\d{1,12})?$/),Sn=e.string().max(41).regex(/^-?(0|[1-9]\d*)(\.\d{1,12})?$/),et=e.strictObject({internal_feature_id:e.uuid(),entityId:e.uuid().nullable()}),Qr=et.extend({quantity:k,expectedRevision:e.number().int().min(0).max(Number.MAX_SAFE_INTEGER),idempotencyKey:e.string().min(1).max(120),properties:$.refine(t=>Object.keys(t).length<=13&&!Object.keys(t).some(n=>n.startsWith("usage_")),"Usage accounting reserves three properties")}).strict(),tt=et.extend({operationId:e.uuid().nullable(),usage:k,capacity:xn.nullable(),remaining:Sn.nullable(),withinLimit:e.boolean(),revision:e.number().int().min(0).max(Number.MAX_SAFE_INTEGER),updatedAt:e.iso.datetime({offset:!0}).nullable()}).strict().superRefine((t,n)=>{let i=r=>{let a=r.startsWith("-"),[o,s=""]=(a?r.slice(1):r).split(".");if(o===void 0||o==="")throw new Error("Invalid decimal value");return(a?-1n:1n)*(BigInt(o)*10n**12n+BigInt(s.padEnd(12,"0")))};(t.capacity===null!=(t.remaining===null)||(t.capacity===null?!t.withinLimit:t.remaining===null||i(t.remaining)!==i(t.capacity)-i(t.usage)||t.withinLimit!==i(t.remaining)>=0n)||t.revision===0!=(t.operationId===null)||t.operationId===null!=(t.updatedAt===null))&&n.addIssue({code:"custom",message:"Absolute usage must conserve capacity and its immutable revision"})});var N=e.string().regex(/^(0|[1-9]\d{0,17})(\.\d{1,12})?$/),O=e.iso.datetime({offset:!0}),In=e.enum(["access","metered","credit"]),H={internal_feature_id:e.uuid(),key:T,name:e.string().min(1).max(120),kind:In},Jr=e.object({customerId:e.uuid(),snapshotAt:O,memberships:e.array(e.object({id:e.uuid(),productId:e.string().min(1).max(255),productVersionId:e.uuid(),billingProductVersionId:e.uuid(),version:e.number().int().positive(),key:e.string().min(1).max(64),name:e.string().min(1).max(120),groupId:e.string().max(255).nullable(),membershipType:e.enum(["main","addon"]),status:e.enum(["trial","active","past_due","ended","expired","trialing","paused","pending","scheduled","unknown"]),cancelAtPeriodEnd:e.boolean(),accessEnabled:e.boolean(),renewalChange:e.object({productVersionId:e.uuid(),name:e.string().min(1).max(120),version:e.number().int().positive(),effectiveAt:O,benefitsAppliedAt:O.nullable(),timing:e.enum(["immediate","renewal"]),changeKind:e.enum(["plan","seats","quantity"]),feature:e.strictObject({internal_feature_id:e.uuid(),name:e.string().min(1).max(80),fromQuantity:e.number().int().min(0).max(1e4),toQuantity:e.number().int().min(0).max(1e4)}).optional(),seat:e.object({key:e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),fromQuantity:e.number().int().min(0).max(1e4),toQuantity:e.number().int().min(0).max(1e4)}).strict().nullable(),status:e.enum(["prepared","quoted","confirmed","pending","scheduled"])}).strict().refine(t=>t.changeKind==="seats"==(t.seat!==null)&&t.changeKind==="quantity"==(t.feature!==void 0),"Quantity changes require their fixed component identities and quantities").nullable(),period:e.object({phase:e.enum(["paid","trial"]),startsAt:O,endsAt:O.nullable()}).strict().nullable()}).strict()).max(100),membershipsLimited:e.boolean(),balances:e.array(e.object({...H,usageType:e.enum(["consumable","non_consumable"]).nullable(),accessible:e.boolean(),unlimited:e.boolean(),available:N,held:N,debt:N,nextExpiresAt:O.nullable(),usage:tt.nullable()}).strict().refine(t=>t.kind==="metered"==(t.usageType!==null)&&(t.accessible||t.available==="0"&&t.held==="0")&&(t.usageType==="non_consumable"?t.usage!==null&&t.usage.internal_feature_id===t.internal_feature_id&&t.unlimited===(t.usage.capacity===null)&&t.available===(t.usage.remaining===null||t.usage.remaining.startsWith("-")?"0":t.usage.remaining)&&t.held==="0"&&t.debt==="0":t.usage===null),"Balances must expose their actual spendable or non-consumable state")).max(500),balancesLimited:e.boolean()}).strict(),nt=e.enum(["source","usage","transaction","invoice","debt","settlement"]),re=e.object({at:O,id:e.uuid(),type:nt}).strict(),Xr=e.object({type:nt.nullable(),resourceKey:T.optional(),kind:e.enum(["purchase","refund"]).optional(),topup:e.boolean().optional(),from:e.iso.date().nullable(),to:e.iso.date().nullable(),after:re.nullable(),limit:e.number().int().min(1).max(50)}).strict().refine(t=>!t.from||!t.to||t.from<=t.to,"Date range is reversed"),V={id:e.uuid(),occurredAt:O},kn=e.discriminatedUnion("type",[e.strictObject({...V,type:e.literal("invoice"),status:e.string().min(1).max(80),paid:N,refunded:N,currency:C,externalId:e.string().nullable()}),e.object({...V,...H,type:e.literal("source"),reason:e.enum(["membership","trial","topup","manual","rollover","upgrade_carry","seat"]),quantity:N,unlimited:e.boolean(),status:e.enum(["scheduled","active","expired","revoked","unavailable"]),startsAt:O,expiresAt:O.nullable(),orderId:e.uuid().nullable(),parentSourceId:e.uuid().nullable()}).strict(),e.object({...V,type:e.literal("usage"),internal_feature_id:e.uuid(),name:e.string().min(1).max(120),kind:e.enum(["consume","set_usage","reserve","confirm","refund","release","expire"]),originalId:e.uuid().nullable(),quantity:k,accepted:e.boolean(),reason:e.enum([...ne.options,"expired"]).nullable(),properties:$,reservationStatus:e.enum(["pending","confirmed","released","expired"]).nullable(),expiresAt:O.nullable(),charges:e.array(e.discriminatedUnion("funding",[e.strictObject({funding:e.literal("balance"),sourceId:e.uuid(),rolloverId:e.uuid().nullable(),units:K,amount:N}),e.strictObject({funding:e.literal("unbilled"),units:K}),e.object({...H,funding:e.literal("prepaid"),amount:N}).strict(),e.object({funding:e.literal("postpaid"),invoiceId:e.uuid(),invoiceLineId:e.uuid(),authorizationId:e.uuid(),units:k,currency:C}).strict()])).max(500)}).strict().refine(t=>(t.kind==="set_usage"||t.kind==="consume"&&t.quantity==="0"?t.accepted&&t.reason===null&&t.charges.length===0&&t.reservationStatus===null:t.accepted?t.reason===null&&t.charges.length>0:t.reason!==null&&t.charges.length===0)&&t.originalId!==null===["confirm","refund","release","expire"].includes(t.kind)&&t.expiresAt!==null==(t.reservationStatus!==null),"Usage facts must retain their original outcome and receipt"),e.object({...V,type:e.literal("transaction"),purpose:e.enum(["product","invoice"]),productVersionId:e.uuid().nullable(),productName:e.string().min(1).max(120).nullable(),productVersion:e.number().int().positive().nullable(),invoiceId:e.uuid().nullable(),orderId:e.uuid(),originalId:e.uuid().nullable(),kind:e.enum(["purchase","refund"]),amountMinor:e.number().int().nonnegative().max(2e8).nullable(),currency:C.nullable()}).strict().refine(t=>t.currency===null==(t.amountMinor===null)&&(t.purpose==="product"?t.productVersionId!==null&&t.productName!==null&&t.productVersion!==null&&t.invoiceId===null:t.productVersionId===null&&t.productName===null&&t.productVersion===null&&t.invoiceId!==null)&&t.kind==="refund"==(t.originalId!==null)&&(t.kind!=="refund"||t.amountMinor===null||t.amountMinor>0),"Payment fact provenance is incomplete"),e.object({...V,...H,type:e.literal("debt"),sourceId:e.uuid(),transactionId:e.uuid(),amount:N}).strict(),e.object({...V,...H,type:e.literal("settlement"),sourceId:e.uuid(),debtId:e.uuid(),kind:e.enum(["payment","usage_refund","payment_return"]),amount:N}).strict()]),Yr=e.object({customerId:e.uuid(),rows:e.array(kn).max(50),nextCursor:re.nullable()}).strict().refine(t=>new Set(t.rows.map(n=>n.type+n.id)).size===t.rows.length,"A page cannot repeat a fact").refine(t=>{let n=t.rows.at(-1);return!t.nextCursor||!!(n&&n.id===t.nextCursor.id&&n.type===t.nextCursor.type&&n.occurredAt===t.nextCursor.at)},"Cursor must name the final displayed fact");var ii=e.discriminatedUnion("kind",[e.object({kind:e.literal("ledger"),cursor:re}).strict(),e.object({kind:e.literal("billing"),cursor:e.uuid()}).strict()]),wn=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/),jn=e.record(e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),e.union([e.string().max(500),e.boolean(),e.array(e.string().max(500)).max(50)])).refine(t=>Object.keys(t).length<=40,"Too many answers"),_n=/^(?:api_?key|authorization|password|(?:customer|run|visitor|access|purchase)_?token|client_?secret|signed_?transaction|raw_?proof)$/i;function Se(t,n=0){return n>20?!0:!!t&&typeof t=="object"&&(Array.isArray(t)?t.some(i=>Se(i,n+1)):Object.entries(t).some(([i,r])=>["__proto__","constructor","prototype"].includes(i)||_n.test(i)||Se(r,n+1)))}var zn=/gg_(?:sk|ct|fr|fv|gc)_[A-Za-z0-9_-]{20,}/,ai=e.record(wn,D).refine(t=>Object.keys(t).length<=20,"Too many parameters").refine(t=>!Se(t)&&!zn.test(JSON.stringify(t)),"Credentials cannot be screen parameters");var rt=e.string().regex(/^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$/),An=e.array(e.object({variable:rt,componentId:rt,required:e.boolean()}).strict()).max(40).refine(t=>new Set(t.map(n=>n.variable)).size===t.length&&new Set(t.map(n=>n.componentId)).size===t.length,"Input bindings must be unique"),oi=e.object({bindings:An,answers:jn,values:e.record(e.string(),D).optional()}).strict();function it(t,n,i=1){if(t==="free")return"";if(t==="one_time")return n.startsWith("zh")?" \xB7 \u4E00\u6B21\u4ED8\u6B3E":" \xB7 one-time";let r=n.split("-")[0]??"en",a={zh:["/\u6708","/\u5E74"],en:["/month","/year"],ja:["/\u6708","/\u5E74"],ko:["/\uC6D4","/\uB144"],es:["/mes","/a\xF1o"],fr:["/mois","/an"],de:["/Monat","/Jahr"],pt:["/m\xEAs","/ano"],it:["/mese","/anno"],ar:["/\u0634\u0647\u0631","/\u0633\u0646\u0629"]},o={zh:"\u5468",en:"week",ja:"\u9031",ko:"\uC8FC",es:"semana",fr:"semaine",de:"Woche",pt:"semana",it:"settimana",ar:"\u0623\u0633\u0628\u0648\u0639"},s=t==="week"?`/${o[r]??o.en}`:(a[r]??a.en)[t==="month"?0:1];return i===1?s:`/${i} ${s.slice(1)}${r==="en"?"s":""}`}function fi(t,n){let i=[],r={};P(t,a=>{if(a.hidden)return!1;if(a.type!=="quantity_picker")return;let o=a.bind?.plan?[a.bind.plan]:[];a.bind?.picker&&P(t,s=>{if(s.type==="plan_picker"&&s.id===a.bind?.picker&&o.push(...s.planIds??[]),s.type==="stack"&&s.interaction?.type==="select"&&s.interaction.pickerId===a.bind?.picker)for(let c of s.children)c.type==="stack"&&c.bind?.plan&&o.push(c.bind.plan)}),o.length||i.push(`Quantity control ${a.id} needs a Product binding`);for(let s of new Set(o)){let c=n[s]?.prepaid?.find(d=>d.internalFeatureId===a.internalFeatureId)?.terms,l=r[s]??=new Set;(!c||l.has(a.internalFeatureId)||a.minimumQuantity<c.minimumQuantity||a.maximumQuantity>c.maximumQuantity)&&i.push(`Quantity control ${a.id} must match its Product's prepaid Feature and bounds`),l.add(a.internalFeatureId)}});for(let[a,o]of Object.entries(n))for(let s of o.prepaid??[])r[a]?.has(s.internalFeatureId)||i.push(`Product ${a} needs a quantity control for ${s.internalFeatureId}`);return i}function gi(t,n,i,r){let a=r.plans[n];if(!a?.available)throw new Error("Selected Product is unavailable");let o={};if(P(t,s=>{if(s.hidden)return!1;if(s.type!=="quantity_picker"||s.hidden||(s.bind?.plan??(s.bind?.picker?i[s.bind.picker]:void 0))!==n)return;let l=a.prepaid?.find(u=>u.internalFeatureId===s.internalFeatureId)?.terms,d=i[s.id];if(!l||typeof d!="number"||!Number.isSafeInteger(d)||d<Math.max(l.minimumQuantity,s.minimumQuantity)||d>Math.min(l.maximumQuantity,s.maximumQuantity)||(d-s.minimumQuantity)%s.step!==0||o[s.internalFeatureId]!==void 0)throw new Error("Choose a valid quantity for each prepaid Feature");o[s.internalFeatureId]=d}),(a.prepaid??[]).some(s=>o[s.internalFeatureId]===void 0))throw new Error("Choose a quantity for each prepaid Feature");return o}function vn(t,n,i){let r=t.terms.prices.find(a=>a.currency===n);if(!r||i<t.terms.minimumQuantity||i>t.terms.maximumQuantity)throw new Error("Quantity or currency is unavailable");return{amountMinor:we({quantity:i,unitAmountMinor:r.amountMinor,...r.pricing?{pricing:r.pricing}:{}}),allowance:ze(t.includedAmount,t.terms.units,i)}}function bi(t,n,i,r){let a=!1;if(P(t,c=>{c.type==="quantity_picker"&&(a=!0)}),!a)return n;let o=structuredClone(n);o.quantities={};let s=new Map;P(t,c=>{if(c.hidden)return!1;if(c.type!=="quantity_picker")return;let l=c.bind?.plan??(c.bind?.picker?i[c.bind.picker]??o.pickers[c.bind.picker]?.selected:void 0),d=typeof l=="string"?o.plans[l]:void 0,u=d?.prepaid?.find(at=>at.internalFeatureId===c.internalFeatureId),b=Math.max(c.minimumQuantity,u?.terms.minimumQuantity??0),h=Math.min(c.maximumQuantity,u?.terms.maximumQuantity??0),m=i[c.id]??c.defaultQuantity,p=typeof m=="number"&&Number.isSafeInteger(m)?m:c.defaultQuantity,f=!!u&&!!d?.available&&p>=b&&p<=h&&(p-c.minimumQuantity)%c.step===0,w=o.quantities[c.id]={minimum:b,maximum:Math.max(b,h),step:c.step,value:p,label:"",available:f};if(!f||!u||!d?.currency||d.amountMinor===void 0)return;let W=vn(u,d.currency,p);w.label=`${new Intl.NumberFormat(r).format(Number(W.allowance))} ${u.name}${["week","month","year"].includes(u.reset)?it(u.reset,r,u.resetCount):u.reset==="lifetime"?"":` / ${u.resetCount} ${u.reset}`}`,s.set(String(l),(s.get(String(l))??d.amountMinor)+W.amountMinor)});for(let[c,l]of s){let d=o.plans[c];if(!d?.currency)continue;let u=ie(l,d.currency,r);d.price=u;for(let[b,h]of Object.entries(o.nodes)){let m=be(t,b),p=f=>{if(f.price&&(f.price={...f.price,current:u,original:null}),m?.type==="text"){let w=t.strings.locales[r]?.[m.text]??t.strings.locales[t.strings.defaultLocale]?.[m.text];w?.includes("{{plan.price")&&(f.text=w.replace(/\{\{\s*plan.price\s*\}\}/g,u).replace(/\{\{\s*plan.price_per_month\s*\}\}/g,ie(Math.round(l/((d.interval==="year"?12:1)*(d.intervalCount??1))),d.currency,r)))}};h.byPlan?.[c]&&p(h.byPlan[c]),(h.base.planVersionId===c||m&&"bind"in m&&m.bind?.plan===c)&&p(h.base)}}return o}export{ae as a,we as b,_e as c,ze as d,se as e,Ae as f,Mn as g,ve as h,Qn as i,Ee as j,Le as k,Te as l,Kn as m,Hn as n,ir as o,Xn as p,Ce as q,dt as r,q as s,pe as t,v as u,y as v,de as w,P as x,xr as y,ge as z,We as A,nn as B,Sr as C,Ir as D,be as E,kr as F,wr as G,D as H,he as I,ee as J,cn as K,yn as L,Lr as M,hn as N,K as O,Tr as P,Fr as Q,et as R,Qr as S,tt as T,N as U,Jr as V,Xr as W,Yr as X,ii as Y,jn as Z,ai as _,An as $,oi as aa,it as ba,fi as ca,gi as da,bi as ea};
|
package/dist/chunk-ETK6GC5P.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Vn,b as Un,c as ln,d as un,e as Ue,f as Mn,g as $n,h as xn,i as Gn}from"./chunk-SFHIFCXG.js";import{b as Qn}from"./chunk-YVXLCQGM.js";import{b as En,c as Jn}from"./chunk-73NP72FV.js";import{a as Sn}from"./chunk-W32FI2A2.js";import{c as On,e as An,f as _n,h as Ln,i as Ae,j as Ze,k as Hn,l as Ke}from"./chunk-XUGEOELU.js";import{$ as Xe}from"./chunk-TAFALMQN.js";import{a as Ve,d as qn}from"./chunk-3NCMYTNG.js";import{b as Pn}from"./chunk-VEX2FOFZ.js";import{a as Dn,c as kn,d as Tn,e as Nn,f as Fn}from"./chunk-V7PFLFHE.js";import{E as Cn,da as Rn}from"./chunk-BQRS7Y4K.js";import{a as m}from"./chunk-OX7PA64E.js";import{a as Ce}from"./chunk-DSPLGTQI.js";async function dn(t){let{session:b,load:C}=nt(t);try{return await C(),b}catch(e){throw b.destroy(),e}}function nt(t){let b=t.view;if(!b?.paywall)throw new m("INVALID_REQUEST","The current node is not a Paywall");let C=b.paywall.receiptId,e=b.nodeId,w=b.visit,k=b.paywall.resolution,o=b.paywall,F="document"in k?{document:k.document,offering:k.offering,capabilities:k.capabilities}:null;function c(){let i=o.resolution;return"document"in i?i:F&&{...i,document:F.document,offering:F.offering,capabilities:Dn(i.capabilities,F.capabilities)}}function I(i){if(!kn(i,k))throw new m("INVALID_RESPONSE","The pinned Paywall binding changed")}let P=!1,U=new Set,ne=null;function f(){let i=c();if(i&&!P)for(let u of U)Ce(u,structuredClone(i))}async function L(){T();let i=c();if(i)return structuredClone(i);if(!ne){let u=(async()=>{if("document"in o.resolution||!t.resolvePaywall)throw new m("INVALID_RESPONSE","Public Paywall reader is unavailable");let g=await En(t,o.resolution);return T(),I(g),F={document:g.document,offering:g.offering,capabilities:g.capabilities},f(),c()})();ne=u;let a=()=>{ne===u&&(ne=null)};u.then(a,a)}return ne.then(u=>structuredClone(u))}let s=new AbortController,S=(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).find(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===w&&i.input.type==="paywall_quote")?.requestId??b.paywall.purchaseRequestId,Y=0,Q=null,G=new Set,E=null,J=new Map;function D(i){if(i.purchase&&i.purchase.receiptId!==C)throw new m("INVALID_RESPONSE","Purchase receipt changed");let u=i.run.paywall;return i.purchase??(u?.receiptId===C?u:null)}function T(){if(P)throw new m("IDENTITY_CHANGED","Paywall presentation has closed")}function N(i,u,a){if(T(),u!==Y||a!==void 0&&o.quote?.operationId!==a)return!1;let g=o.selectionGeneration??0,d=i.run.paywall;if(d?.receiptId===C){if((d.selectionGeneration??0)<(o.selectionGeneration??0))return!1;I(d.resolution)}let l=D(i),H=d?.receiptId===C&&(d.selectionGeneration??0)>g,V=H?l?.quote??null:l?.quote??o.quote,O=l?.operation??(V?.operationId===o.quote?.operationId?o.operation:null);return V&&O&&Tn(O,{operationId:V.operationId},"Purchase operation changed"),(H||V?.operationId!==o.quote?.operationId)&&(Y++,d?.receiptId===C&&(S=d.purchaseRequestId)),d?.canReselect===!0&&d.purchaseRequestId===E&&!(t.pendingCommands??[t.pendingCommand]).some(te=>te?.requestId===E)&&(E=null),o={...o,...d?.receiptId===C?d:{},...a!==void 0&&!H&&l?.canReselect!==void 0?{canReselect:l.canReselect}:{},quote:V,operation:Fn(o.operation,O,!0)},f(),!0}function ce(i,u,a){return new Promise((g,d)=>{let l=!1,H=()=>{clearTimeout(Te),s.signal.removeEventListener("abort",te)},V=Ee=>{l||(l=!0,H(),g(Ee))},O=Ee=>{l||(l=!0,H(),d(Ee))},te=()=>O(new m("IDENTITY_CHANGED","Paywall presentation has closed")),Te=setTimeout(()=>O(new m("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,a)),Math.max(0,u-Date.now()));s.signal.addEventListener("abort",te,{once:!0}),s.signal.aborted&&te(),i.then(V,O)})}function pe(i){return new Promise(u=>{let a=()=>{clearTimeout(g),s.signal.removeEventListener("abort",a),u()},g=setTimeout(a,i);s.signal.addEventListener("abort",a,{once:!0}),s.signal.aborted&&a()})}function B(i,u){T();let a=J.get(i)??t.pendingCommands?.find(l=>l.requestId===i)??t.pendingCommand;if(a?.operation==="submit"&&a.requestId===i&&a.nodeId===e&&a.visit===w){u.type==="paywall_quote"&&a.input.type==="paywall_quote"&&a.input.predecessor&&!u.predecessor&&(u={...u,predecessor:a.input.predecessor});let l=Xe.parse(a),H=Xe.parse({...a,input:u});if(l.operation!=="submit"||H.operation!=="submit"||JSON.stringify(l.input)!==JSON.stringify(H.input))throw new m("CONFLICT","A purchase request cannot change its input");return J.set(i,l),l}let g=t.view;if(!g||g.nodeId!==e||g.visit!==w||g.paywall?.receiptId!==C)throw new m("PRECONDITION_FAILED","The Paywall visit has changed");let d=Xe.parse({operation:"submit",requestId:i,nodeId:e,visit:w,revision:g.revision,input:structuredClone(u)});if(d.operation!=="submit")throw new m("INVALID_REQUEST","A purchase submission is required");return J.set(i,d),d}async function Pe(i,u){T();let{requestId:a,input:g}=i,d=Date.now()+3e4;G.add(a);try{let l=await ce(t.submit(i),d,a);for(;l.run.pendingRequest?.requestId===a&&Date.now()<d&&!P&&(await pe(Math.min(1e3,d-Date.now())),!(P||Date.now()>=d));)l=await ce(t.resume(a),d,a);if(P)throw new m("IDENTITY_CHANGED","Paywall presentation has closed");if(l.run.pendingRequest?.requestId===a)throw new m("COMMAND_PENDING","The purchase command is still pending; retry the original request",202,a);if(!N(l,u,g.type==="paywall_confirm"||g.type==="paywall_cancel"?g.operationId:void 0))throw new m("PRECONDITION_FAILED","The purchase selection has changed");E===a&&(E=null)}catch(l){if(E=a,g.type==="paywall_quote"&&t.settle&&!P&&l instanceof m&&l.status!==void 0&&![401,425].includes(l.status)&&!l.retryable&&l.recovery!=="recover_operation")try{if((await ce(t.settle(a),d,a)).settlement?.state==="settled"){let V=await ce(t.get(),d,a);N(V,u)&&V.run.paywall?.purchaseRequestId===a&&o.canReselect===!0&&J.delete(a)}}catch{}throw l instanceof m&&l.code==="COMMAND_PENDING"&&l.status===void 0&&J.delete(a),l}finally{G.delete(a)}}async function X(i){if(!o.quote)throw new m("INVALID_REQUEST","A quoted purchase is required");let u=i==="confirm"?"paywall_confirm":"paywall_cancel",a=[...J.values(),...t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])].find(d=>d.operation==="submit"&&d.input.type===u&&"operationId"in d.input&&d.input.operationId===o.quote.operationId),g=a?.operation==="submit"&&a.input.type===u&&"operationId"in a.input&&a.input.operationId===o.quote.operationId?a.requestId:crypto.randomUUID();if(await Pe(B(g,{type:i==="confirm"?"paywall_confirm":"paywall_cancel",operationId:o.quote.operationId}),Y),!o.operation)throw new m("INVALID_RESPONSE","The accepted purchase result is missing");return structuredClone(o.operation)}let M={get view(){return structuredClone(c())},get quote(){return o.quote?structuredClone(o.quote):null},get operation(){return o.operation?structuredClone(o.operation):null},get webViewUrl(){return t.webViewUrl},get canReselect(){return o.canReselect===!0&&E===null},get recovery(){let i=t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[]),u=t.pendingPurchase;if(u&&(u.receiptId!==C||u.operationId!==o.quote?.operationId))return{type:"recover",operationId:u.operationId,requestId:i[0]?.requestId??null};let a=Ve({quote:o.quote,operation:o.operation,requestId:i[0]?.requestId??E??S,pending:G.size>0||i.length>0||E!==null,destroyed:P,canReselect:o.canReselect});return a.type==="recover"&&a.requestId===null&&!P&&t.hasDurableJournal===!0&&!o.quote&&!o.operation&&(o.selectionGeneration??0)===0&&!u&&!i.length&&!G.size&&!S?{type:"native",operationId:null}:a},get pendingCancellation(){return!P&&(t.pendingCommands??(t.pendingCommand?[t.pendingCommand]:[])).some(i=>i.operation==="submit"&&i.nodeId===e&&i.visit===w&&i.input.type==="paywall_cancel"&&i.input.operationId===o.quote?.operationId)},subscribe(i){return P?()=>{}:(U.add(i),()=>U.delete(i))},async refresh(){T();let i=Y,u=await t.get();if(N(u,i),u.run.paywall?.receiptId!==C)throw new m("PRECONDITION_FAILED","Paywall presentation has changed");return L()},preview(i){let u=c();if(!u)return Promise.reject(new m("PRECONDITION_FAILED","Load the Paywall presentation first"));if(S&&S!==i.requestId&&(Q||o.canReselect!==!0))return Promise.reject(new m("COMMAND_PENDING","Retry the original purchase before starting another"));let a=u.document.buttons[i.actionId],g=a?.type==="checkout"?Pn(a.product,i.selection,u.capabilities):null;if(!g)return Promise.reject(new m("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));let d=Rn(u.document.screen,g,i.selection,u.capabilities),l=S!==i.requestId&&(o.selectionGeneration??0)>0?{operationId:o.quote?.operationId??null,generation:o.selectionGeneration??0}:void 0;if(l&&o.canReselect!==!0)return Promise.reject(new m("COMMAND_PENDING","Original purchase requires authoritative termination"));let H;try{H=B(i.requestId,{type:"paywall_quote",actionId:i.actionId,productVersionId:g,...Object.keys(d).length?{featureQuantities:d}:{},...l?{predecessor:l}:{},...i.offerId?{offerId:i.offerId}:{},...i.nativeOffer?{nativeOffer:i.nativeOffer}:{}})}catch(te){return Promise.reject(te)}if(S===i.requestId&&Q)return Q;S!==i.requestId&&Y++;let V=Y;S=i.requestId;let O=(async()=>{if(await Pe(H,V),!o.quote)throw new m("INVALID_RESPONSE","The accepted quote is missing");return Nn(o.quote,{productVersionId:g,featureQuantities:d},"The selected purchase changed"),structuredClone(o.quote)})();return Q=O,O.then(()=>{Q===O&&(Q=null)},te=>{Q===O&&(Q=null),S===i.requestId&&t.pendingCommand?.requestId!==i.requestId&&te instanceof m&&te.status!==void 0&&te.status<500&&![401,425].includes(te.status)&&(S=null)}),O},confirm:()=>X("confirm"),cancel:()=>X("cancel"),async read(){if(T(),!o.quote)throw new m("INVALID_REQUEST","A quoted purchase is required");let i=o.quote.operationId,u=Y,a=t.pendingCommands?.find(V=>V.operation==="submit"&&(V.input.type==="paywall_confirm"||V.input.type==="paywall_cancel")&&V.input.operationId===i)??t.pendingCommand;a?.operation==="submit"&&(a.input.type==="paywall_confirm"||a.input.type==="paywall_cancel")&&a.input.operationId===i&&await t.settle?.(a.requestId);let g=await t.get(void 0,{receiptId:C,operationId:i});T();let d=D(g);if(d?.quote&&d.quote.operationId!==i||d?.operation&&d.operation.operationId!==i)throw new m("INVALID_RESPONSE","Purchase operation changed");let l=N(g,u,i),H=l?o.operation:d?.operation;if(!H)throw new m("INVALID_RESPONSE","The current purchase result is missing");return l&&G.size===0&&!(t.pendingCommands?.length??(t.pendingCommand?1:0))&&(E=null),structuredClone(H)},destroy(){P=!0,j(),U.clear(),s.abort(),J.clear()}},j=t.subscribe(i=>{P||i.nodeId!==e||i.visit!==w||i.paywall?.receiptId!==C||(i.paywall.selectionGeneration??0)<(o.selectionGeneration??0)||(I(i.paywall.resolution),o={...o,resolution:i.paywall.resolution},f())});return{session:M,load:L}}function zn(t){let b=new Set,C=new Set,e=null;async function w(c,I){let P=!1;for(;!t.stopped&&t.key===c&&t.client.pendingCommand?.requestId===I;){if(!t.client.settle)throw new m("COMMAND_PENDING","The original display acknowledgement is still pending");await t.client.settle(I),P=!0,t.client.pendingCommand?.requestId===I&&await new Promise(U=>setTimeout(U,1500))}t.stopped||t.key!==c||(P&&await t.client.get(),!(t.stopped||t.key!==c)&&b.add(c))}function k(c,I){e=I;let P=()=>{e===I&&(e=null),C.delete(c)};return I.then(P,U=>{P(),t.busy||t.fail(U)}),I}function o(c){if(t.reviewing||b.has(c)||C.has(c)||t.stopped)return;C.add(c);let I=async()=>{if(t.reviewing||t.stopped||t.key!==c||b.has(c)){C.delete(c);return}if(t.busy||t.client.pendingCommand){setTimeout(()=>{I()},250);return}let P=(async()=>{if(t.staleRead){if(await t.staleRead,t.stopped||t.key!==c)return;if(t.client.pendingCommand){setTimeout(()=>{I()},250);return}}let U=t.client.view,ne=t.expected(),f=ne.requestId;try{await t.client.submit({operation:"shown",...ne})}catch(L){if(!(L instanceof m)||L.code!=="CONFLICT"||L.status!==409||t.client.pendingCommand)throw L;await t.client.get();let s=t.client.view;if(t.stopped||t.reviewing||t.key!==c||!s||!U||s.id!==U.id||s.source.versionId!==U.source.versionId||s.nodeId!==ne.nodeId||s.visit!==ne.visit||s.revision<=ne.revision||s.stopped||!s.screen&&(!s.paywall||s.paywall.receiptId!==U.paywall?.receiptId)||!["running","waiting"].includes(s.status)||t.client.pendingCommand)throw L;let R=t.expected();f=R.requestId,await t.client.submit({operation:"shown",...R})}await w(c,f)})();k(c,P)};I()}function F(){if(e)return e;let c=t.client.pendingCommand;if(c?.operation!=="shown")return null;let I=t.key;return C.add(I),k(I,(async()=>{await t.client.retry(),await w(I,c.requestId)})())}return{report:o,settled:F,get inFlight(){return e}}}function Bn(t){let b={},C=new Map;async function e(w){let k=t.client.view,o=k?.screen,F=o?.customerData.nodes[w.nodeId];if(t.stopped||t.busy||!k||!o||!F)return;if(!["refresh","next","previous","filter","sources_next","sources_previous"].includes(w.action)){let L=t.document,s=L?Cn(L,w.nodeId):null,R=s?.type==="customer_data"?s.data.outputs?.[w.action]:void 0;R&&o.outputs.includes(R)?await t.perform(()=>t.client.submit({operation:"submit",...t.expected(),input:{type:"screen",output:R,answers:t.answers,selection:w.value?{[w.nodeId]:w.value}:{}}})):await t.onIntent?.(w,k);return}let I=w.action.startsWith("sources_")?F.resources.find(L=>L.key===w.value):null;if(w.action.startsWith("sources_")&&!I)throw new m("INVALID_REQUEST","Choose a current resource");let P=`${k.visit}:${w.nodeId}:${I?.key??""}`,U=C.get(P)??[null],f=b[w.nodeId]??{page:1,after:null,filter:"all",...I?{resourceKey:I.key}:{}};if(w.action==="filter"){let L=w.value;if(!L||!(F.source==="offer_history"?["all","issued","reserved","redeemed","expired","revoked"]:["all","purchase","refund","source","usage","debt","settlement"]).includes(L))throw new m("INVALID_REQUEST","Unknown data filter");f={page:1,after:null,filter:L},U.splice(0,U.length,null)}else if(w.action==="next"||w.action==="sources_next"){let L=I?.sources.at(-1),s=I?L?{kind:"ledger",cursor:{at:L.detail[0],id:L.id,type:"source"}}:null:o.dataCursors[w.nodeId];if(!s||!I&&!F.hasNext)return;U[f.page]=s,f={...f,page:f.page+1,after:s}}else if(w.action==="previous"||w.action==="sources_previous"){if(f.page<=1)return;f={...f,page:f.page-1,after:U[f.page-2]??null}}C.set(P,U),b={...b,[w.nodeId]:f},await t.perform(()=>t.client.get({nodeId:k.nodeId,visit:k.visit,revision:k.revision,components:b}))}return{get queries(){return b},intent:e,reset(){b={},C.clear()}}}function jn(t){let{doc:b,holder:C,reviewHolder:e,mountScreenPreview:w}=t,k=!1,o,F=0,c=null,I="",P,U=new Map,ne=s=>s?`${s.id}:${s.nodeId}:${s.visit}:${s.revision}:${s.paywall?.quote?.operationId??""}`:"";async function f(s){if(t.stopped||!t.client.review||k&&s===o&&P?.active)return;let R=!k||s!==o;k||(I=ne(t.client.view),U.set(I,structuredClone(t.answers))),k=!0,o=s,C.hidden=!0,t.suspend(!0),e.hidden=!1;let S=++F;R&&(P?.finish("dismissed"),c?.destroy(),c=null,e.replaceChildren(),P=Ze(e,t.loadingOptions,"funnel",()=>{L()}));let Y=R?P:void 0;try{if(Y?.start(!1,t.client.view?.locale),S!==F||t.stopped)return;let Q=t.client.review(s),G=await(Y?.wait(Q,Ae)??Q);if(t.stopped||S!==F||!k)return;if(!G.review)throw new m("INVALID_RESPONSE","Historical projection is missing");c?.destroy(),c=null,Y||e.replaceChildren();let E=b.createElement("div"),J=Y?Ke(E,e):()=>{};e.append(E);let D=G.run.locale.startsWith("zh"),T=t.chrome;E.style.cssText=T.history;let N=b.createElement("p");N.textContent=D?"\u53EA\u8BFB\u56DE\u770B":"Read-only history",N.style.cssText=T.historyTitle,E.append(N);let ce=b.createElement("p");ce.style.cssText=T.historyNote,ce.textContent=G.review.pages.length?D?"\u9009\u62E9\u4E00\u9875\u67E5\u770B\u5F53\u65F6\u7684\u5185\u5BB9\uFF0C\u56DE\u770B\u4E0D\u4F1A\u6539\u52A8\u4EFB\u4F55\u4FE1\u606F\u3002":"Choose a page to see it as it was. Nothing here can be changed.":D?"\u8FD8\u6CA1\u6709\u53EF\u56DE\u770B\u7684\u9875\u9762\u3002":"There are no earlier pages yet.",E.append(ce);let pe=G.review.page?.receiptId,B=b.createElement("div");B.style.cssText=T.historyPages;for(let[M,j]of G.review.pages.entries()){let i=b.createElement("button");i.type="button",i.textContent=D?`\u7B2C ${M+1} \u9875`:`Page ${M+1}`;let u=pe!==void 0&&j.receiptId===pe;i.style.cssText=u?T.primary:T.secondary,u&&i.setAttribute("aria-current","page"),Ue(i,()=>t.chrome.focus),i.onclick=()=>{f(j.receiptId)},B.append(i)}if(B.childElementCount&&E.append(B),G.review.page){let M=G.review.page,j=b.createElement("div");j.inert=!0,j.style.cssText=T.historyPage,E.append(j),c=w(j,{mode:"live",rendererUrl:t.client.webViewUrl,title:M.document.name,onAction:()=>{},onAnswers:()=>{},onCustomerDataIntent:()=>{},onRendered:()=>{S===F&&!t.stopped&&Y?.present(J)},onError:u=>{if(S!==F||t.stopped)return;let a=new Error(u);Y?.finish("error",a),c?.destroy(),c=null,E.remove(),t.fail(a)},onEscape:()=>{L()}});let i=c;if(i.update(M.document,G.run.locale,{serverInput:{bindings:M.inputs,answers:M.answers,values:M.values}}),await i.ready,t.stopped||S!==F||!k)return}let Pe=D?{issued:"\u5DF2\u9886\u53D6",reserved:"\u5DF2\u9884\u7559",redeemed:"\u5DF2\u4F7F\u7528",expired:"\u5DF2\u8FC7\u671F",revoked:"\u5DF2\u64A4\u9500",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"}:{issued:"Issued",reserved:"Reserved",redeemed:"Used",expired:"Expired",revoked:"Revoked",unknown:"Status unconfirmed"},X=b.createElement("div");X.style.cssText=T.historyRecords;for(let M of[...G.review.coupons.map((j,i)=>`${D?"\u4F18\u60E0\u5238":"Coupon"} ${i+1}: ${Pe[j.status]}`),...G.review.purchases.map((j,i)=>`${D?"\u8D2D\u4E70":"Purchase"} ${i+1}: ${Gn(j.status,D)}`)]){let j=b.createElement("p");j.textContent=M,j.style.margin="0",X.append(j)}X.childElementCount&&E.append(X),G.review.page||Y?.present(J),t.client.view&&await t.enqueue(t.client.view)}catch(Q){if(S!==F||t.stopped)return;Y?.finish("error",Q),c?.destroy(),c=null,e.replaceChildren(),t.fail(Q)}}async function L(){if(!k||t.stopped||!t.client.review)return;let s=++F;P?.finish("dismissed");try{if(await t.client.review(),t.stopped||s!==F)return;k=!1,F++,P?.finish("dismissed"),c?.destroy(),c=null,e.replaceChildren(),e.hidden=!0,C.hidden=!1;let R=t.client.view;ne(R)!==I?(U.set(I,structuredClone(t.answers)),t.resetScreen()):(U.delete(I),t.suspend(!1)),R&&await t.enqueue(R)}catch(R){if(s!==F||t.stopped)return;c?.destroy(),c=null,e.replaceChildren(),t.fail(R)}}return{get active(){return k},get receipt(){return o},open:f,exit:L,get drafts(){return new Map([...U].map(([s,R])=>[s,structuredClone(R)]))},stop(){k=!1,F++,P?.finish("dismissed"),c?.destroy(),c=null,e.replaceChildren(),e.hidden=!0,C.hidden=!1}}}var cn=5e3;async function tt(t,b,C){let e=b,w=e.prepared&&Qn(e.prepared),k=()=>{};function o(){e.prepared&&e.prepared.state!=="adopted"&&w?.release()}let F=()=>e.prepared?.state==="shown"&&!!w?.modal,c=e.client.identitySignal,I;try{I=await Promise.all([import("./screen-renderer-R5GH7XLV.js"),import("./paywall-VYUBYBUI.js")]),e.signal?.throwIfAborted(),c?.throwIfAborted()}catch(n){throw o(),n}let[{mountScreenPreview:P},{showPaywall:U}]=I,ne=(typeof INDIANA_NATIVE_SHELL_BUILD>"u"||!INDIANA_NATIVE_SHELL_BUILD)&&e.appManifestRelease?Jn({client:e.client,appManifestRelease:e.appManifestRelease,onError:e.onError}):void 0;ne?.start();let f=t.ownerDocument,L=Ln(f),s=f.createElement("section"),R=f.createElement("div"),S=f.createElement("div"),Y=f.createElement("div"),Q=f.createElement("button");Y.hidden=!0,Q.type="button";let G=f.createElement("p"),E=f.createElement("p"),J=f.createElement("button"),D=f.createElement("button"),T=f.createElement("button"),N=f.createElement("dialog"),ce;s.dataset.indianaFunnel="",s.setAttribute("aria-busy","false"),G.setAttribute("role","status"),E.setAttribute("role","alert"),E.hidden=!0,J.type=D.type=T.type="button",S.append(J,Q,G,E,T,D),s.append(R,Y,S),t.append(s);let pe=Un,B=ln(pe),Pe="",X=(f.documentElement.lang||"").startsWith("zh"),M,j="",i;for(let n of[J,Q,T,D])Ue(n,()=>B.focus);function u(){let n=X?"\u5173\u95ED":"Close";D.parentElement===N?(D.textContent="\xD7",D.setAttribute("aria-label",n),_n(D,pe)):(D.textContent=n,D.removeAttribute("aria-label"),D.style.cssText=B.link+";margin-inline-start:auto")}function a(n){let r=n?.screen?.content.document.theme??pe,p=JSON.stringify([r.primary,r.background,r.text,r.radius,r.font,D.parentElement===N]);if(p===Pe)return;Pe=p,pe=r;let _=D.parentElement===N;B=ln(pe,_),s.style.cssText=B.root+";min-width:0"+(_?";display:flex;flex-direction:column;min-height:100%":""),S.style.cssText=B.bar+(_?";margin-top:auto":""),J.style.cssText=Q.style.cssText=B.secondary,T.style.cssText=B.primary,G.style.cssText=B.status,E.style.cssText=B.alert,u(),un(J)}function g(){S.hidden=J.hidden&&Q.hidden&&T.hidden&&E.hidden&&!G.textContent&&(D.hidden||D.parentElement!==S),M?.responsive&&i!==void 0&&M.setContentHeight(i+S.getBoundingClientRect().height)}a();let d=null,l=null,H=null,V="",O="",te=!1,Te="",Ee="",Me="",h=!1,le=0,$e=!1,pn="",en=null,nn=Promise.resolve(),fn=!e.client.view,z=C,Ne,_e,xe="",Ge,ue=!1,qe=null,he=!1,Qe=()=>e.client.pendingCommand?.operation==="close",de=null,Z=null,mn=Sn({document:f,run:async()=>{(!l?.observing||e.client.pendingCommand)&&await rn()},delay:()=>{if(!(h||!H||!["running","waiting"].includes(H.status)&&!e.client.pendingCommand)&&!(l?.observing&&!e.client.pendingCommand))return H.pendingRequest||e.client.pendingCommand?1500:cn},hiddenDelay:()=>!h&&e.client.pendingCommand?15e3:void 0}),K=null;function tn(){return Z&&e.client.hasDurableJournal===!0&&K?.acknowledged===!0&&K.operationId===Z.operationId&&e.client.view?.id===K.runId&&e.client.view?.status==="closed"&&e.client.view.revision===K.revision+1&&!(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0))&&!e.client.pendingPurchase?Z:null}function wn(n){let r=n.run.paywall;if(K&&n.settlement?.requestId===K.requestId&&n.settlement.state==="settled"&&n.settlement.operationId===null&&n.run.id===K.runId&&n.run.status==="closed"&&!n.run.pendingRequest&&n.run.revision===K.revision+1&&n.run.nodeId===K.nodeId&&n.run.visit===K.visit&&r?.receiptId===K.receiptId&&r.selectionGeneration===K.selectionGeneration&&(r.quote?.operationId??null)===K.operationId&&(r.operation?.operationId??r.quote?.operationId??null)===K.operationId){let p=K.operationId===null&&r.selectionGeneration===0&&!r.quote&&!r.operation&&!r.purchaseRequestId,_=Ve({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect});(p||r.canReselect===!0&&_.type==="native")&&(K.acknowledged=!0)}}let De=null,Je=new Set,we={},Fe=!1,fe=(n,r=null)=>{h||(De=r,Fe=!1,E.textContent=Mn(n,X),E.hidden=!1,T.hidden=e.client.pendingCommand===null,g(),Ce(e.onError,n))},yn=()=>{h||(De=null,E.textContent=$n(X),E.hidden=!1,T.hidden=!0,g())};function ke(){let n=e.client.view;if(!n)throw new m("INVALID_REQUEST","No current Run is available");return{requestId:crypto.randomUUID(),nodeId:n.nodeId,visit:n.visit,revision:n.revision}}let A=jn({client:e.client,doc:f,holder:R,reviewHolder:Y,mountScreenPreview:P,loadingOptions:e,get chrome(){return B},get stopped(){return h},get answers(){return we},suspend(n){l?.setSuspended(n)},resetScreen(){V="",O="",Te=""},enqueue:ye,fail:fe}),Le=zn({client:e.client,expected:ke,fail:fe,get stopped(){return h},get reviewing(){return A.active},get key(){return V},get busy(){return le},get staleRead(){return en}}),ze=Bn({client:e.client,expected:ke,perform:Oe,onIntent:e.onCustomerDataIntent,get stopped(){return h},get busy(){return le},get document(){return d?.document},get answers(){return we}}),Be=n=>`${n.id}:${n.nodeId}:${n.visit}`,Se=n=>n&&(n.screen||n.paywall)?Be(n):"";function Re(){let n=e.client.view;J.disabled=!A.active&&(le>0||!!e.client.pendingCommand||!n?.canBack||n.stopped||!["running","waiting"].includes(n.status)||!Se(n)||O!==Se(n)),J.hidden=!A.active&&!n?.canBack,un(J);let r=!!l&&!A.active;D.hidden=r&&!z?.active,Q.hidden=!e.client.review||r&&!n?.canBack,r&&(G.textContent=""),g()}async function gn(n){if(!n)return;let r=e.client.view;await n;let p=e.client.view;if(!r||!p||p.id!==r.id||p.nodeId!==r.nodeId||p.visit!==r.visit||p.stopped||!["running","waiting"].includes(p.status))throw new m("PRECONDITION_FAILED","The screen changed while its display was acknowledged")}async function Oe(n,r=!1,p){if(!((le||he||de||Z)&&!r||h||A.active&&!r)){le++,s.setAttribute("aria-busy","true"),E.hidden=!0,De=null,Fe=!1,Re();try{if(r||await gn(Le.inFlight),h)return;let _=await n();h||await ye(e.client.view??_.run)}catch(_){p?.(_)&&e.client.pendingCommand===null?yn():fe(_,e.client.pendingCommand?.requestId??null)}finally{le=Math.max(0,le-1),s.setAttribute("aria-busy",String(le>0)),h||(T.hidden=e.client.pendingCommand===null,Re())}}}function He(){mn.schedule()}async function rn(){if(!(h||$e||le)){if(A.active){await A.open(A.receipt);return}$e=!0;try{let n=e.client.pendingCommand;n&&e.client.settle&&await e.client.settle(n.requestId);let r=e.client.view,p=ze.queries,_=await e.client.get(r?.screen&&Object.keys(p).length?{nodeId:r.nodeId,visit:r.visit,revision:r.revision,components:p}:void 0);Fe&&!h&&(Fe=!1,E.hidden=!0,g()),!h&&p===ze.queries&&await ye(e.client.view??_.run)}catch(n){fe(n),Fe=!h}finally{$e=!1}}}function je(n,r,p){if(z?.active){let ae=z;return ae.setDismissHandler(()=>hn(ae)),ae}let _=Ze(t,e,"funnel",()=>hn(_),Vn);return z=_,_.start(n,r,p),_}function hn(n){h||ue||(ue=!0,n.finish("dismissed"),ve(),s.hidden=!0,e.client.view?Ie().finally(re):re())}function on(){clearTimeout(Ge?.timeout),Ge=void 0}function ve(){on(),Ne?.abort(),Ne=void 0,d?.destroy(),d=null,l?.destroy(),l=null,_e?.(),_e=void 0,N.open&&N.close(),R.replaceChildren(),R.style.cssText="",i=void 0,V="",O="",te=!1,Te="",Me=""}function vn(){let n=f.defaultView;M?.responsive&&n&&d?.resizeViewport?.(n.innerHeight,n.innerWidth)}function sn(){M?.destroy(),M=void 0,j=""}function We(n){let r=n.screen?.presentation;if(!r||r.type==="inline"){N.open&&N.close(),sn(),D.parentElement!==S&&S.append(D),s.parentElement!==t&&t.append(s);for(let ae of["flex","display","flex-direction","justify-content"])R.style.removeProperty(ae);a(n),g();return}s.parentElement!==N&&(N.append(D,s),t.append(N)),R.style.flex="1 0 auto",R.style.display="flex",R.style.flexDirection="column",R.style.justifyContent="center",a(n);let p=n.screen.content.document,_=JSON.stringify([r,Pe]);if(_!==j){sn(),j=_;let ae={sm:420,md:640,lg:900},ge="size"in r&&!r.backdrop?",0 0 0 100vmax #16142566":"";N.style.cssText=`box-sizing:border-box;padding:0;border:0;overflow:auto;background:${pe.background};color:${pe.text};`+(r.type==="fullscreen"?"width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;margin:0;border-radius:0":`width:${ae[r.size]}px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);box-shadow:0 24px 80px #0003${ge};`+(r.type==="sheet"?"margin:auto auto 0;border-radius:14px 14px 0 0":"border-radius:14px")),M=On(N,{presentation:r,theme:p.theme,pages:p.pages},vn),M.latch()}g(),N.setAttribute("aria-label",(ce?.screen===n.screen?.content.document.name?ce?.label:void 0)??d?.document?.name??n.screen?.content.document.name??"Funnel")}async function Wn(n){if(h||ue||he&&(Qe()||["running","waiting"].includes(n.status))||(H=n,De&&e.client.pendingCommand?.requestId!==De&&(E.hidden=!0,De=null),X=n.locale.startsWith("zh"),Q.textContent=X?"\u56DE\u770B":"History",J.textContent=A.active?X?"\u8FD4\u56DE\u5F53\u524D":"Return to current":X?"\u8FD4\u56DE":"Back",u(),T.textContent=X?"\u91CD\u8BD5":"Retry",T.hidden=e.client.pendingCommand===null,G.textContent=n.pendingRequest?X?"\u6B63\u5728\u5904\u7406":"Processing":n.instruction?.type==="wait"?X?"\u7B49\u5F85\u4E2D":"Waiting":"",Re(),pn!==`${n.revision}:${n.visit}:${n.status}:${n.stopped}`&&(pn=`${n.revision}:${n.visit}:${n.status}:${n.stopped}`,Ce(e.onState,structuredClone(n))),h||ue))return;if((!n.pendingRequest||he&&n.status==="closed")&&["closed","ineligible","failed"].includes(n.status)){re();return}if(n.stopped&&F()){re();return}if(n.stopped||e.client.configurationReady===!1){A.stop(),o(),ve(),z?.finish("skipped"),s.hidden=!0,He();return}if(s.hidden=!1,A.active){He();return}let r=Se(n),p=e.client.view;if(p&&p.revision>n.revision&&Se(p)!==r)return;let _=!n.instruction&&!n.pendingRequest&&n.nodeType==="screen"&&["running","waiting"].includes(n.status);r!==V&&(V&&z?.finish("dismissed"),ve(),V=r,we={...n.answers},ze.reset());let ae=Be(n);if(xe===ae){s.hidden=!0;return}if(_&&!r){s.hidden=!0;let $=e.prepared?.state==="shown"?null:je(!0,n.locale);!h&&!ue&&Ge?.key!==ae&&(on(),Ge={key:ae,timeout:setTimeout(()=>{let y=e.client.view;if(h||!$?.active&&e.prepared?.state!=="shown"||!y||Be(y)!==ae)return;xe=ae;let W=new Error("Funnel screen preparation timed out");$?.finish("error",W),o(),ve(),fe(W)},Ae)}),He();return}on();let ee=$=>{let y=e.client.view;return!h&&!ue&&!qe&&!$.aborted&&e.client.configurationReady!==!1&&!!y&&!y.stopped&&!["closed","ineligible","failed"].includes(y.status)&&Se(y)===r},ge=($,y)=>{ee(y)&&(xe=r,z?.finish("error",$),ve(),s.hidden=!0,fe($))};if(r||((n.instruction&&n.instruction.type!=="evaluate_segment"||!["running","waiting"].includes(n.status))&&o(),We(n),n.instruction?.type!=="event"&&n.instruction?.type!=="open_url"&&z?.finish("skipped")),n.screen){o();let $=n.screen.content;if(!d){let x=n.screen.presentation.type!=="inline",oe=je(x,n.locale);if(h||ue)return;let ie=(Ne=new AbortController).signal;We(n),_e=x?Hn(N):Ke(s,t),d=P(R,{mode:"live",rendererUrl:e.client.webViewUrl,title:$.document.name,...x?{hostPresentation:()=>M?.type??n.screen.presentation.type}:{},onResize:v=>{i=v,M?.responsive&&M.setContentHeight(v+S.getBoundingClientRect().height)},onAction(v,me={},et={}){if(A.active||!ee(ie)||O!==r)return;we={...we,...et};let an=n.screen?.inputs??[],bn=Object.fromEntries(an.filter(({variable:be})=>Object.hasOwn(we,be)).map(({variable:be})=>[be,we[be]]));if(xn(an,bn).length){yn();return}Oe(()=>e.client.submit({operation:"submit",...ke(),input:{type:"screen",output:v,answers:bn,selection:me}}),!1,be=>an.length>0&&be instanceof m&&be.code==="INVALID_REQUEST"&&be.status!==void 0&&be.status<500)},onAnswers:v=>{A.active||!ee(ie)||O!==r||(we={...we,...v})},onCustomerDataIntent:v=>{A.active||!ee(ie)||O!==r||ze.intent(v).catch(fe)},onEscape:()=>{!ee(ie)||O!==r||A.active||de||Z||Ie()},onError:v=>{let me=new Error(v);O===r?fe(me):ge(me,ie)},onRendered:v=>{if(!(!ee(ie)||O===r))try{oe.present(me=>{_e?.(),_e=void 0,v&&(ce={screen:$.document.name,label:v},N.setAttribute("aria-label",v)),x&&(N.showModal(),M?.responsive&&N.focus({preventScroll:!0}),!me&&e.loading!=="host"&&An(N,M?.type??n.screen.presentation.type,M?.responsive)),O=r,te=x,Re()}),ee(ie)&&Le.report(r)}catch(me){ge(me,ie)}}}),vn()}let y={capabilities:n.screen.capabilities,customerData:n.screen.customerData,parameters:n.parameters,serverInput:{bindings:n.screen.inputs,answers:we,values:n.screen.values}},W=JSON.stringify([$,n.locale,y.parameters,n.screen.inputs,n.screen.values]);if(W!==Te)d.update($.document,n.locale,y),Te=W,Ee=JSON.stringify(y.capabilities),Me=JSON.stringify(y.customerData);else{let x=JSON.stringify(y.capabilities);x!==Ee&&(d.updateCapabilities(y.capabilities),Ee=x),JSON.stringify(y.customerData)!==Me&&(d.updateCustomerData(y.customerData),Me=JSON.stringify(y.customerData))}let se=d;if(se)try{await(z?.wait(se.ready)??se.ready)}catch(x){Ne&&ge(x,Ne.signal)}}else if(n.paywall&&!l){let $=n.paywall.resolution,y="document"in $?$.document:null,W=w,se=null,x=(Ne=new AbortController).signal,oe={loading:"host",signal:x,canInteract:()=>ee(x)&&!A.active&&!de&&!Z,beforeAction:async()=>{le++;try{await gn(Le.settled()),E.hidden=!0,De=null,Fe=!1,g()}finally{le=Math.max(0,le-1)}},start:()=>dn(e.client),onObservationChange:He,onPurchase:e.onPurchase,onCheckoutUrl:e.onCheckoutUrl,resumeCheckout:e.resumeCheckout,allowNewPurchase:e.allowNewPurchase,checkoutNavigation:e.checkoutNavigation,terminateCheckout:e.terminateCheckout,confirmOnHostedCheckout:e.confirmOnHostedCheckout,resolveOfferId:e.resolveOfferId,onEvent:e.onEvent,onOpenUrl:v=>e.onOpenUrl?e.onOpenUrl({receiptId:n.paywall.receiptId,url:v,openIn:"same_window"}):f.defaultView?.location.assign(v),onAction:async v=>{if(A.active)return;let me=await e.client.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:n.nodeId,visit:n.visit,revision:e.client.view?.revision??n.revision,input:{type:"screen",output:v,answers:{}}});await ye(e.client.view??me.run)},onError:v=>{O===r?fe(v):ge(v,x)}},ie={quoteError:v=>Ce(e.onError,v),present(v){ee(x)&&(se?.present(()=>{v(),O=r,te=!!R.querySelector("dialog[open]"),Re()}),ee(x)&&Le.report(r))},async dismiss(){if(!(h||x.aborted||A.active||de||Z||!he&&!ee(x))){if(he=!0,(e.resumeCheckout||e.terminateCheckout)&&Kn()){H=e.client.view,re();return}await Ie()}}};if(W){let v=await W.adopt(n,{options:oe,handoff:ie,start:()=>dn(e.client)});v&&ee(x)&&!h?(We(n),l=v,z?.active&&z.present(()=>{}),O=r,te=W.modal,Re(),Le.report(r),A.active&&l.setSuspended(!0)):(v?.destroy(),o())}if(h||ue)return;if(!l){if(se=je(!0,n.locale,y),h||ue)return;We(n);let v=await U(R,oe,ie).catch(me=>(ge(me,x),null));!ee(x)&&!(he&&!h&&!x.aborted)?v?.host?.destroy():v&&(l=v.host,l?.setSuspended(A.active))}}if(h||ue)return;Re();let q=n.instruction;if(q&&(q.type==="open_url"||q.type==="event")&&!Je.has(q.receiptId)){let $=f.createElement("button");$.type="button",$.style.cssText=B.primary,Ue($,()=>B.focus),R.style.cssText=B.stage,$.textContent=q.type==="open_url"?`${X?"\u524D\u5F80":"Continue to"} ${new URL(q.url).host}`:X?"\u7EE7\u7EED":"Continue",$.onclick=()=>{let y=ke(),W=q.type==="open_url"&&!e.onOpenUrl&&q.openIn==="new_window"?Yn(q.url):null;Oe(async()=>{let se="success";if(q.type==="open_url")if(e.onOpenUrl)try{se=await e.onOpenUrl({receiptId:q.receiptId,url:q.url,openIn:q.openIn})===!1?"failed":"opened"}catch(oe){Ce(e.onError,oe),se="failed"}else se=q.openIn==="new_window"&&!W?"failed":"opened";if(q.type==="event"){if(!e.onEvent)throw new m("EVENT_HANDLER_REQUIRED","Provide the event handler");await e.onEvent(q.event)}if(h||e.client.view?.nodeId!==y.nodeId||e.client.view.visit!==y.visit)throw new m("PRECONDITION_FAILED","The client action visit changed");let x=await e.client.submit({operation:"submit",...y,input:{type:"client_action",receiptId:q.receiptId,outcome:se}});return Je.add(q.receiptId),q.type==="open_url"&&!e.onOpenUrl&&q.openIn==="same_window"&&f.defaultView?.location.assign(q.url),x})},z?.active?z.present(()=>R.replaceChildren($)):R.replaceChildren($)}!n.pendingRequest&&n.status==="completed"&&!Je.has(`complete:${n.id}`)&&(Je.add(`complete:${n.id}`),Ce(e.onComplete,structuredClone(n))),He()}function Yn(n){let r=f.defaultView?.open(n,"_blank")??null;return r&&(r.opener=null),r}function ye(n){return Re(),nn=nn.catch(()=>{}).then(async()=>{try{await Wn(n)}catch(r){throw z?.active&&(xe=Be(n),z.finish("error",r),ve(),s.hidden=!0),r}}),nn}let Xn=e.client.subscribe(n=>{if(!fn){if(n.stopped&&(te||F())&&!he){H=n,re();return}!he&&(n.stopped||e.client.configurationReady===!1||V&&O!==V&&(Se(n)!==V||["closed","ineligible","failed"].includes(n.status)))&&(ve(),z?.finish("dismissed"),s.hidden=!0),ye(n).catch(fe)}}),Zn=e.client.subscribeError?.(fe);function Kn(){let n=e.client.view,r=n?.paywall;return!!r?.operation&&!!n&&["running","waiting"].includes(n.status)&&qn(Ve({quote:r.quote,operation:r.operation,requestId:r.purchaseRequestId,pending:!1,destroyed:!1,canReselect:r.canReselect}))}function Ie(n){if(qe)return qe;if(h||!n&&(de||Z))return Promise.resolve();let r=!n&&Qe();return!r&&e.client.view&&!["running","waiting"].includes(e.client.view.status)?(H=e.client.view,re(),Promise.resolve()):(qe=Oe(async()=>{let p=r?await e.client.retry():await e.client.submit({operation:"close",...n??ke()});return n&&wn(p),p},!0).then(()=>{let p=e.client.view;p?.status==="closed"&&!Qe()&&(H=p,re())}).finally(()=>{qe=null}),qe)}function re(){ne?.destroy(),!h&&(h=!0,k(),o(),e.signal?.removeEventListener("abort",re),c?.removeEventListener("abort",re),z?.finish("dismissed"),mn.destroy(),Xn(),Zn?.(),ve(),sn(),A.stop(),N.remove(),s.remove(),L(),Ce(e.onDismiss,H?structuredClone(H):null))}J.onclick=()=>{if(!J.disabled){if(A.active){A.exit();return}Oe(()=>e.client.submit({operation:"back",...ke()}))}},Q.onclick=()=>{A.open()},D.onclick=()=>{z?.active?z.dismiss():de||Ie()},T.onclick=()=>{Qe()?Ie():Oe(()=>e.client.retry())},N.addEventListener("cancel",n=>{n.preventDefault(),z?.active?z.dismiss():de||Ie()}),e.signal?.addEventListener("abort",re,{once:!0}),c?.addEventListener("abort",re,{once:!0});let Ye=!1;w&&(k=w.onClose(()=>{h||ue||(ue=!0,z?.finish("dismissed"),ve(),s.hidden=!0,e.client.view?Ie().finally(re):Ye=!0)}));let In={destroy:re,refresh:rn,get recovery(){let n=tn();if(n)return n;if(!h&&!le&&!he&&!de&&l){let r=l.recovery;if(r.type!=="native")return r}return{type:"recover",operationId:e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??Z?.operationId??null,requestId:e.client.pendingCommand?.requestId??null}},prepareFallback(){if(de)return de;let n=tn();if(n)return Promise.resolve(n);let r=e.client.pendingPurchase?.operationId??e.client.view?.paywall?.quote?.operationId??Z?.operationId??null,p=()=>({type:"recover",operationId:r,requestId:e.client.pendingCommand?.requestId??null});if(e.client.hasDurableJournal!==!0){let q=l?.recovery;return Promise.resolve(q&&q.type!=="native"&&q.type!=="cancel"?q:p())}let _=(e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[])).some(q=>q.operation==="close");if(h&&!(_||Z&&e.client.view?.status==="closed")||le||$e||qe||A.active||!l&&!Z&&!_)return Promise.resolve(p());let ae=l,ee=(async()=>{try{if(!Z&&_){let y=await e.client.retry();return await ye(e.client.view??y.run),p()}if(!Z){let y=await ae.prepareFallback();if(y.type!=="native")return y;if(e.client.hasDurableJournal!==!0)return p();Z=y}let q=e.client.pendingCommands??(e.client.pendingCommand?[e.client.pendingCommand]:[]);if(q.length){let y=q.find(se=>se.operation==="close");if(!y||!K||y.requestId!==K.requestId)return p();let W=await e.client.retry();wn(W),await ye(e.client.view??W.run)}else{let y=e.client.view,W=y?.paywall;if(!y||!W||W.selectionGeneration===void 0||(W.quote?.operationId??null)!==Z.operationId||Z.operationId!==null&&W.canReselect!==!0)return p();let se=W.selectionGeneration,x=await e.client.get();await ye(e.client.view??x.run);let oe=e.client.view,ie=oe?.paywall;if(!oe||!ie||!["running","waiting"].includes(oe.status)||oe.stopped||oe.id!==y.id||oe.nodeId!==y.nodeId||oe.visit!==y.visit||ie.receiptId!==W.receiptId||ie.selectionGeneration!==se||(ie.quote?.operationId??null)!==Z.operationId||Z.operationId!==null&&ie.canReselect!==!0||e.client.pendingPurchase||(e.client.pendingCommands?.length??(e.client.pendingCommand?1:0)))return p();let v=ke();K={runId:oe.id,operationId:Z.operationId,revision:v.revision,requestId:v.requestId,nodeId:oe.nodeId,visit:oe.visit,receiptId:ie.receiptId,selectionGeneration:se,acknowledged:!1},await Ie(v)}let $=tn();return $?(re(),$):p()}catch(q){return fe(q),p()}})();de=ee;let ge=()=>{de===ee&&(de=null)};return ee.then(ge,ge),ee},review:A.open,exitReview:A.exit,get unappliedDrafts(){return A.drafts}};try{let n=e.client.view;if(n)((e.client.viewAgeMs??cn)>=cn||n.instruction?.type==="evaluate_segment")&&(en=rn().finally(()=>{en=null})),await ye(n);else{if(s.hidden=!0,h)throw new DOMException("Presentation cancelled","AbortError");let r=Ye||e.prepared?.state==="shown"?null:je(e.client.view?.screen?.presentation.type!=="inline",e.client.view?.locale);if(h||ue&&!Ye)throw new DOMException("Presentation cancelled","AbortError");let p=e.client.get(),_=await(r?r.wait(p,Ae):it(p,Ae));if(fn=!1,Ye)return h||await Ie().finally(re),In;await ye(e.client.view??_.run)}}catch(n){throw z?.finish("error",n),re(),n}return In}function it(t,b){let C;return Promise.race([t,new Promise((e,w)=>{C=setTimeout(()=>w(new Error("Presentation data timed out")),b)})]).finally(()=>clearTimeout(C))}function $t(t,b,C){return tt(t,b,C)}export{tt as a,$t as b};
|
package/dist/chunk-GZRRVHYK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as h}from"./chunk-44U3FOBB.js";import{c as N}from"./chunk-EUTWY7A2.js";import{b as J}from"./chunk-LF2UIJYD.js";import{v as Q}from"./chunk-CKKIB2HC.js";import{b as x}from"./chunk-W6OQTXLL.js";import{a as j}from"./chunk-3NCMYTNG.js";import{b as L}from"./chunk-VEX2FOFZ.js";import{c as H,d as K,e as B,f as F}from"./chunk-V7PFLFHE.js";import{b as U}from"./chunk-56BYGPQ6.js";import{a as M}from"./chunk-VYFSRHXM.js";import{da as G}from"./chunk-BQRS7Y4K.js";import{a as l}from"./chunk-OX7PA64E.js";import{a as W}from"./chunk-DSPLGTQI.js";async function ce(I,o){if(!M.test(o.customerToken))throw new l("INVALID_TOKEN","A verified Customer credential is required");if(I.session&&I.session.peek()!==o.customerToken)throw new l("SCOPE_MISMATCH","Paywall credential does not match the shared session");let u=h.resolvePaywall.request.parse({funnelId:o.funnelId,funnelVersionId:o.funnelVersionId,selector:o.paywallVersionId?{type:"version",versionId:o.paywallVersionId}:{type:"paywall",paywallId:o.paywallId},commerce:o.commerce,locale:o.locale,...o.requirement?{requirement:o.requirement}:{}}),S=U(I);I.session||S.identify(o.customerToken);let r=null,P=!1,D=new AbortController,s=null,c=null,v=null,w=null,R=null,d=null,f=null,A=0,O=null,_="",V=0,b=new Map,q=new Set;function g(){if(P)throw new l("IDENTITY_CHANGED","Paywall is closed")}function k(){let e=JSON.stringify([A,f!==null]);if(!O||e!==_){_=e;let t=Y(++V);O=t;let a=()=>{O===t&&(O=null)};t.then(a,a)}return O.then(t=>structuredClone(t))}async function Y(e){g();let t=h.resolvePaywall,a=await N(S.request,t,{...u,selector:r?{type:"version",versionId:r.id}:u.selector});J(u,a.paywall.check,a.scope);let i=await x(I,a.paywall);if(g(),o.paywallVersionId?i.id!==o.paywallVersionId:i.paywallId!==o.paywallId)throw new l("INVALID_RESPONSE","The requested Paywall changed");if(r&&(!H(i,r)||i.paywallId!==r.paywallId))throw new l("INVALID_RESPONSE","The pinned Paywall or Offering Version changed");if(e!==V)return structuredClone(r??i);r=i;for(let m of q)W(m,structuredClone(r));return structuredClone(r)}async function E(e){if(g(),w&&e!=="read")throw new l("COMMAND_PENDING","Wait for the original quote");if(!s)throw new l("INVALID_REQUEST","A quoted purchase is required");let t=s;if(e!=="read"){if(f){if(d===e)return f;throw new l("COMMAND_PENDING","Wait for the original purchase command")}if(d&&d!==e)throw new l("COMMAND_PENDING","Read the original purchase before changing an uncertain command");d=e,A++,V++}let a=d,i=A,m=e==="read"&&f===null,p=JSON.stringify([t.operationId,i,f!==null]);if(e==="read"&&b.has(p))return b.get(p).then(n=>structuredClone(n));let C=e==="read"?h.readSubscriptionOperation:h.attach,y=(async()=>{let n=await N(S.request,C,{operationId:t.operationId,...e==="read"?{}:{intent:e},...e==="confirm"&&t.merchantTerms?{merchantConfirmation:Q(t.merchantTerms)}:{}});return K(n.operation,{operationId:t.operationId,currency:u.commerce.currency},"The purchase operation changed"),g(),s?.operationId!==t.operationId?structuredClone(n.operation):(c=F(c,n.operation),(e!=="read"||m&&f===null)&&A===i&&d===a&&(d=null),structuredClone(c))})();if(e!=="read"){f=y;let n=()=>{f===y&&(f=null)};y.then(n,n)}else{b.set(p,y);let n=()=>{b.get(p)===y&&b.delete(p)};y.then(n,n)}return y.then(n=>structuredClone(n))}let T={signal:D.signal,get view(){return r?structuredClone(r):null},get quote(){return s?structuredClone(s):null},get operation(){return c?structuredClone(c):null},get webViewUrl(){return"bundled"},get recovery(){return j({quote:s,operation:c,requestId:R,pending:w!==null||d!==null,destroyed:P})},get pendingCancellation(){return!P&&d==="cancel"},refresh:k,subscribe(e){return P?()=>{}:(q.add(e),()=>q.delete(e))},async preview(e){if(g(),!r)throw new l("INVALID_REQUEST","Load the Paywall first");let t=r.document.buttons[e.actionId];if(t?.type!=="checkout")throw new l("INVALID_REQUEST","Choose an authored purchase action");let a=L(t.product,e.selection,r.capabilities);if(!a)throw new l("PRODUCT_UNAVAILABLE","Choose an available Product");let i=G(r.document.screen,a,e.selection,r.capabilities),m=h.previewAttach.request.parse({funnelId:u.funnelId,funnelVersionId:u.funnelVersionId,requestId:e.requestId,plans:[{productVersionId:a,...Object.keys(i).length?{featureQuantities:i}:{}}],provider:u.commerce.provider,currency:u.commerce.currency,...e.offerId?{offerId:e.offerId}:{},...e.nativeOffer?{nativeOffer:e.nativeOffer}:{}}),p=JSON.stringify(m);if(v&&v!==p&&(w||d||!c||c.status==="pending"))throw new l("COMMAND_PENDING","Finish or cancel the original purchase before changing it");if(v===p){if(w)return w;if(s)return structuredClone(s)}v!==p&&(s=null,c=null),v=p,R=m.requestId;let C=(async()=>{let y=h.previewAttach,n=await N(S.request,y,m);return g(),B(n.quote,{productVersionId:a,featureQuantities:i,currency:u.commerce.currency,provider:u.commerce.provider},"The purchase quote changed its selected Product or presentment"),s=n.quote,c=null,structuredClone(s)})();w=C;try{return await C}finally{w===C&&(w=null)}},confirm:()=>E("confirm"),cancel:()=>E("cancel"),read:()=>E("read"),destroy(){P||(P=!0,D.abort(),q.clear(),b.clear(),z?.(),S.dispose(),r=null,s=null,c=null,v=null,R=null)}},z=I.session?.subscribeIdentity(T.destroy);try{return await k(),T}catch(e){throw T.destroy(),e}}export{ce as a};
|
package/dist/chunk-RNEF4MZW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as Re}from"./chunk-KPDHY76A.js";import{a as G}from"./chunk-MSK3VZ3A.js";import{A as _e,E as W,G as ke,d as Pe,f as x,k as Se,v as Ee,w as be,y as Oe}from"./chunk-2FE4FTPH.js";import{a as we,b as ge,c as ye}from"./chunk-EUTWY7A2.js";import{$ as U}from"./chunk-TAFALMQN.js";import{a as X}from"./chunk-3NCMYTNG.js";import{f as Z}from"./chunk-V7PFLFHE.js";import{b as ve}from"./chunk-56BYGPQ6.js";import{b as $}from"./chunk-TJGIT5CU.js";import{a as l}from"./chunk-OX7PA64E.js";import{b as Ce}from"./chunk-EM3MGDPG.js";import{b as n}from"./chunk-VF6QMMEA.js";import{a as ue}from"./chunk-DSPLGTQI.js";var g=U.options,Ve=n.discriminatedUnion("operation",[g[1].omit({customerToken:!0}),g[2].omit({customerToken:!0}),g[3].omit({customerToken:!0}),g[4].omit({customerToken:!0}),g[5].omit({customerToken:!0}),g[6].omit({customerToken:!0}),g[7].omit({customerToken:!0}),g[8].omit({customerToken:!0}),Se.omit({customerToken:!0})]),ce=n.strictObject({receiptId:n.uuid(),operationId:n.uuid()}),We=n.discriminatedUnion("operation",[n.strictObject({operation:n.literal("find_purchase")}),n.strictObject({operation:n.literal("recover_start"),intent:n.enum(["lookup","resume"]),start:n.strictObject({requestId:g[0].shape.requestId,funnelId:g[0].shape.funnelId,locale:g[0].shape.locale,parameters:g[0].shape.parameters})}),n.strictObject({operation:n.literal("recover_run"),runId:n.uuid(),funnelId:n.uuid()}),n.strictObject({operation:n.literal("recover_purchase"),runId:n.uuid(),funnelId:n.uuid(),purchase:ce}),n.strictObject({operation:n.literal("terminate_checkout"),runId:n.uuid(),funnelId:n.uuid(),purchase:ce}),n.strictObject({operation:n.literal("settle_command"),runId:n.uuid(),funnelId:n.uuid(),requestId:n.uuid(),command:n.discriminatedUnion("operation",[g[3].omit({customerToken:!0}),g[4].omit({customerToken:!0}),g[5].omit({customerToken:!0}),g[6].omit({customerToken:!0}),g[7].omit({customerToken:!0})]).optional()}).refine(a=>!a.command||a.requestId===a.command.requestId),n.strictObject({operation:n.literal("run_command"),runId:n.uuid(),funnelId:n.uuid(),command:Ve})]),ee=n.strictObject({runId:n.uuid(),funnelId:n.uuid(),versionId:n.uuid(),startRequestId:n.uuid(),runExpiresAt:n.iso.datetime({offset:!0}),status:x.shape.run.shape.status}),N={scope:$,customerId:n.uuid()},Fe=n.discriminatedUnion("outcome",[n.strictObject({...N,outcome:n.literal("unknown"),target:n.null(),view:n.null(),access:n.null()}),n.strictObject({...N,outcome:n.literal("resolved"),target:ee,view:x.shape.run.nullable(),access:n.discriminatedUnion("type",[n.strictObject({type:n.literal("customer")}),n.strictObject({type:n.literal("operation_only"),cause:n.enum(["run_terminal","run_expired","run_revoked","issuer_unavailable"])})])})]).superRefine((a,d)=>{a.outcome==="resolved"&&(a.access.type==="customer"!=(a.view!==null)||a.view&&(a.view.id!==a.target.runId||a.view.source.id!==a.target.funnelId||a.view.source.versionId!==a.target.versionId||a.view.status!==a.target.status||a.view.runExpiresAt!==a.target.runExpiresAt||a.view.credentialExpiresAt!==null))&&d.addIssue({code:"custom",message:"Recovery view and original Run binding differ"})}),qe=n.strictObject({...N,target:ee,view:x.shape.run.nullable(),settlement:n.strictObject({requestId:n.uuid(),state:n.enum(["pending","unknown","settled"]),acceptance:n.enum(["accepted","not_accepted","unknown"]),receiptPhase:n.enum(["accepted","processing","done"]).nullable(),basis:n.enum(["receipt","run_terminal","position_advanced","none"]),receiptId:n.uuid().nullable(),operationId:n.uuid().nullable()}),purchase:x.shape.purchase.unwrap().nullable()}).superRefine((a,d)=>{let p=a.settlement;(p.acceptance==="accepted"!=(p.receiptPhase!==null)||p.acceptance==="accepted"&&p.basis!=="receipt"||p.acceptance==="unknown"&&(p.state!=="unknown"||p.basis!=="none")||p.acceptance!=="accepted"&&(p.operationId!==null||p.receiptId!==null)||p.acceptance==="not_accepted"&&(p.state!=="settled"||!["run_terminal","position_advanced"].includes(p.basis))||a.purchase&&(a.purchase.receiptId!==p.receiptId||a.purchase.operation&&a.purchase.operation.operationId!==p.operationId||a.purchase.quote&&a.purchase.quote.operationId!==p.operationId)||a.view&&(a.view.id!==a.target.runId||a.view.source.id!==a.target.funnelId||a.view.source.versionId!==a.target.versionId||a.view.status!==a.target.status||a.view.runExpiresAt!==a.target.runExpiresAt||a.view.credentialExpiresAt!==null))&&d.addIssue({code:"custom",message:"Original command settlement binding differs"})}),Ae=n.strictObject({...N,target:ee,purchase:x.shape.purchase.unwrap()}).superRefine((a,d)=>{(!a.purchase.operation||typeof a.purchase.canReselect!="boolean"||a.purchase.quote&&a.purchase.quote.operationId!==a.purchase.operation.operationId)&&d.addIssue({code:"custom",message:"Original purchase proof is incomplete"})}),Ne=n.discriminatedUnion("outcome",[n.strictObject({...N,outcome:n.literal("none")}),n.strictObject({...N,outcome:n.literal("blocked")}),n.strictObject({...N,outcome:n.literal("found"),target:ee,start:n.strictObject({locale:g[0].shape.locale,parameters:g[0].shape.parameters}),purchase:ce})]);var Ge=U.options[0].refine(a=>!a.customer&&!a.customerData),Me=n.strictObject({receiptId:n.uuid(),operationId:n.uuid(),terminal:n.enum(["complete","native"]).nullable()}),je=n.strictObject({schemaVersion:n.literal(1),baseUrl:n.url(),scope:$,customerId:n.uuid(),sessionId:n.uuid(),start:Ge,allowed:n.array(n.enum(["merchant","record_only","indiana","native"])),run:n.strictObject({id:n.uuid(),versionId:n.uuid(),status:Pe.shape.status,revision:n.number().int().nonnegative(),runExpiresAt:n.iso.datetime({offset:!0}).optional()}).optional(),purchases:n.array(Me).max(100),operationCommand:n.strictObject({operationId:n.uuid(),intent:n.literal("confirm")}).optional(),journal:n.strictObject({revision:n.number().int().nonnegative(),entry:Ee.nullable()})});function Te(a){return Oe({...a,namespace:"purchases",identity:[a.scope.projectId,a.scope.environment,a.customerId]})}function Ue(a){let d=new URL(a.baseUrl??Ce).href,p=()=>new l("PURCHASE_STORAGE_INVALID","Purchase recovery storage is unavailable or invalid; native fallback is not authorized");async function S(){a.assertCurrent();try{let C=await a.storage.read();if(a.assertCurrent(),!Number.isSafeInteger(C.revision)||C.revision<0)throw p();let u=C.entry===null?null:je.parse(C.entry);if(u&&(u.baseUrl!==d||u.customerId!==a.customerId||u.scope.projectId!==a.scope.projectId||u.scope.environment!==a.scope.environment))throw new l("SCOPE_MISMATCH","Purchase recovery belongs to another Customer or environment");if(u?.journal.entry&&(u.journal.entry.scope.projectId!==u.scope.projectId||u.journal.entry.scope.environment!==u.scope.environment||u.journal.entry.funnelId!==u.start.funnelId||u.journal.entry.runId!==u.run?.id||u.journal.entry.versionId!==u.run?.versionId)||u?.operationCommand&&!u.purchases.some(E=>E.operationId===u.operationCommand?.operationId))throw p();return{revision:C.revision,entry:u}}catch(C){throw C instanceof l?C:p()}}async function M(C){for(let u=0;u<8;u++){let E=await S(),O=C(structuredClone(E.entry));if(JSON.stringify(O)===JSON.stringify(E.entry))return O;O&&je.parse(O),a.assertCurrent();let R;try{R=await a.storage.write(E.revision,O)}catch{throw p()}if(a.assertCurrent(),R!==null){if(!Number.isSafeInteger(R)||R<=E.revision)throw p();return O}}throw new l("PURCHASE_STORAGE_CONFLICT","Another consumer changed this purchase; recover the original attempt")}return{read:S,update:M,baseUrl:d}}var ze=5*6e4;function Be(a,d){let p=a.purchases.find(S=>S.type==="checkout");if(!a.actions.includes("continue_checkout")||p?.type!=="checkout"||d!==void 0&&p.operationId!==d)throw new l("PURCHASE_PENDING","No single resumable Checkout is confirmed");return p.checkoutUrl}function Ct(a){let d={...a,scope:{...a.scope},executionPolicy:structuredClone(a.executionPolicy)},p=d.session.snapshot();if(!p)throw new l("CUSTOMER_SESSION_REQUIRED","Purchase recovery requires a verified Customer session");let{customerId:S,sessionId:M}=p,C=!1,u=null,E,O=null,R=!1,q,z,B,k={mode:"idle",status:"idle",actions:["start"],purchases:[]},y=new Map,j=new Map,le=new AbortController,Q=new Set,D=ve(d),de=Re(D.request);function H(e){return{code:e instanceof l?e.code:"PURCHASE_RECOVERY_BLOCKED",message:e instanceof Error?e.message:"The original purchase requires server confirmation",...e instanceof l&&e.status!==void 0?{status:e.status}:{}}}function w(){if(C||d.session.snapshot()?.customerId!==S)throw new l("IDENTITY_CHANGED","The original purchase Customer changed")}let f=Ue({...d,customerId:S,assertCurrent:w,storage:d.storage??Te({baseUrl:d.baseUrl,scope:d.scope,customerId:S})}),xe=d.session.subscribeIdentity(pe);function pe(){C||(C=!0,clearTimeout(B),le.abort(new l("IDENTITY_CHANGED","Purchase consumer was destroyed")),xe(),u?.reset(),u=null,O=null,D.dispose(),Q.clear(),y.clear(),j.clear())}function P(e){w();let t=JSON.stringify(e)!==JSON.stringify(k);k=e,clearTimeout(B),(e.mode==="operation"||e.mode==="run"&&!e.actions.includes("close"))&&["waiting_result","fulfillment","recording"].includes(e.status)&&(B=setTimeout(()=>{T().catch(()=>{})},5e3)),t&&ue(d.onRecovery,structuredClone(e));for(let r of t?Q:[]){if(C)break;ue(r,structuredClone(e))}return structuredClone(e)}function I(e){if(w(),!e||e.start.requestId!==E)throw new l("PURCHASE_STORAGE_CONFLICT","This purchase was superseded; the old consumer cannot dispatch")}function b(e){let t=[...e.purchases],r=e.journal.entry?.purchase;return r&&!t.some(o=>o.operationId===r.operationId)&&t.push({receiptId:r.receiptId,operationId:r.operationId,terminal:null}),t}function A(e){return e.run&&!["running","waiting"].includes(e.run.status)&&!e.journal.entry?.command&&!e.journal.entry?.closeCommand&&!e.operationCommand&&b(e).every(t=>t.terminal!==null)}function _(e,t){let r=e.journal.entry?.command??e.journal.entry?.closeCommand,o=b(e).map(v=>{let se=y.get(v.operationId);return v.terminal&&!se?{type:v.terminal,operationId:v.operationId}:X({quote:se?.quote??null,operation:se??null,requestId:r?.requestId??null,pending:!1,destroyed:!1,canReselect:j.get(v.operationId)===!0})}),c=o.filter(v=>!["complete","native"].includes(v.type)),i=c[0],s=c.length===1&&i?.operationId?y.get(i.operationId):void 0;if(s&&(i?.type==="checkout"||i?.type==="cancel"))try{W({allowed:e.allowed.filter(v=>d.executionPolicy.allowed.includes(v))},s.quote)}catch(v){return{mode:t,status:"blocked",actions:["refresh",...t==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[]],purchases:o,error:H(v)}}let m;if(t==="operation"&&!r&&i?.type==="cancel"&&s?.quote&&!s.problem&&!s.confirmedAt)try{W({allowed:e.allowed.filter(v=>d.executionPolicy.allowed.includes(v))},s.quote),Date.parse(s.quote.expiresAt)>Date.now()&&(m={operationId:s.operationId,quote:s.quote})}catch{}let h=o.length>0&&c.length===0,V=A(e)||t==="operation"&&h&&!r&&!e.operationCommand?"complete":i?.type==="checkout"?"checkout":i?.type==="fulfillment"?"fulfillment":i?.type==="recording"?"recording":r||e.operationCommand||i&&i.type!=="cancel"||t==="operation"&&!m?"waiting_result":"ready";return{mode:t,status:V,purchases:o,...m?{confirmation:structuredClone(m)}:{},actions:["refresh",...A(e)?["start"]:[],...t==="run"&&e.run&&["running","waiting"].includes(e.run.status)?["close"]:[],...e.operationCommand?["retry"]:m?["confirm"]:[],...c.length===1&&i?.type==="checkout"?["continue_checkout"]:[]]}}function te(e){let t=X({quote:e?.quote??null,operation:e??null,requestId:null,pending:!1,destroyed:!1,canReselect:e&&j.get(e.operationId)===!0});return t.type==="complete"||t.type==="native"?t.type:null}function ne(e){if(!e.operation)return;let t={...e.operation,...e.operation.quote?{}:e.quote?{quote:e.quote}:{}};if(t.merchantExecution&&t.merchantExecution.customerId!==S)throw new l("SCOPE_MISMATCH","Purchase execution belongs to another Customer");let r=Z(y.get(t.operationId)??null,t);y.set(t.operationId,r),r===t&&j.set(t.operationId,e.canReselect===!0)}async function De(e){w();for(let r of[e.purchase,e.run.paywall])r&&ne(r);let t=await f.update(r=>{if(I(r),r.run&&(r.run.id!==e.run.id||r.run.versionId!==e.run.source.versionId))throw new l("SCOPE_MISMATCH","The original purchase Run changed");let o=b(r);for(let c of[e.purchase,e.run.paywall]){let i=c?.operation?.operationId??c?.quote?.operationId;if(!c||!i)continue;let s=o.find(h=>h.operationId===i);if(s&&s.receiptId!==c.receiptId)throw new l("INVALID_RESPONSE","The original purchase Receipt changed");let m=te(y.get(i));s?s.terminal??=m:o.push({receiptId:c.receiptId,operationId:i,terminal:m})}return{...r,purchases:o,run:r.run&&(r.run.revision>e.run.revision||!["running","waiting"].includes(r.run.status)&&["running","waiting"].includes(e.run.status))?r.run:{id:e.run.id,versionId:e.run.source.versionId,status:e.run.status,revision:e.run.revision,runExpiresAt:e.run.runExpiresAt}}});I(t),t.run&&!["running","waiting"].includes(t.run.status)&&b(t).some(r=>!r.terminal)&&(t=await L(t,!t.journal.entry?.command&&!t.journal.entry?.closeCommand,new Set([e.purchase?.operation?.operationId,e.run.paywall?.operation?.operationId].filter(r=>!!r)))),I(t),P(_(t,"run"))}function He(){return{async read(){let{entry:e}=await f.read();return I(e),structuredClone(e.journal)},async write(e,t){let r=null;return await f.update(o=>{if(I(o),o.operationCommand&&t?.command&&t.command.operation!=="close")throw new l("PURCHASE_PENDING","Recover the original Operation command before dispatching a Run mutation");return r=null,o.journal.revision!==e?o:(r=e+1,{...o,journal:{revision:r,entry:t}})}),r}}}async function L(e,t=!1,r=new Set){I(e);let o=b(e);for(let i of o){if(i.terminal)continue;let s=r.has(i.operationId)?y.get(i.operationId):void 0;if(s??=await oe(e,i),w(),s.operationId!==i.operationId)throw new l("INVALID_RESPONSE","Original Operation changed");if(s.merchantExecution&&s.merchantExecution.customerId!==S)throw new l("SCOPE_MISMATCH","Purchase execution belongs to another Customer");if(t&&!e.operationCommand&&X({quote:s.quote??null,operation:s,requestId:null,pending:!1,destroyed:!1}).type==="cancel"){if({operation:s}=await de.attach({operationId:i.operationId,intent:"cancel"}),w(),s.operationId!==i.operationId)throw new l("INVALID_RESPONSE","Original cancellation Operation changed");s=await oe(e,i)}y.set(i.operationId,Z(y.get(i.operationId)??null,s))}let c=await f.update(i=>{I(i);let s=i.operationCommand&&y.get(i.operationCommand.operationId);return{...i,...s&&(s.confirmedAt||s.merchantExecution||s.status!=="pending")?{operationCommand:void 0}:{},purchases:b(i).map(m=>({...m,terminal:m.terminal??te(y.get(m.operationId))}))}});return I(c),c}async function Y(e){w();let t=await D.request("funnels",e);return w(),t}async function Le(){let e=G(Ne,await Y({operation:"find_purchase"}));if(e.customerId!==S||e.scope.projectId!==d.scope.projectId||e.scope.environment!==d.scope.environment)throw new l("SCOPE_MISMATCH","Recovery Customer or environment changed");if(e.outcome!=="found")return e.outcome;let{target:t,purchase:r}=e;return await f.update(o=>o&&!A(o)?o:{schemaVersion:1,baseUrl:f.baseUrl,scope:d.scope,customerId:S,sessionId:M,start:{operation:"start",requestId:t.startRequestId,funnelId:t.funnelId,...e.start},allowed:[...d.executionPolicy.allowed],run:{id:t.runId,versionId:t.versionId,status:t.status,revision:0,runExpiresAt:t.runExpiresAt},purchases:[{...r,terminal:null}],journal:{revision:0,entry:null}}),"found"}let J;function re(e){let t=J;if(t&&(!t.outcome||e&&t.outcome==="none"&&Date.now()-t.at<ze))return t.job;let r={at:Date.now(),job:Le().then(o=>(r.outcome=o,r.at=Date.now(),o),o=>{throw J===r&&(J=void 0),o})};return J=r,r.job}async function oe(e,t,r="recover_purchase"){let o=G(Ae,await Y({operation:r,runId:e.run.id,funnelId:e.start.funnelId,purchase:{receiptId:t.receiptId,operationId:t.operationId}}));if(ae(e,o),o.purchase.receiptId!==t.receiptId||o.purchase.operation?.operationId!==t.operationId)throw new l("INVALID_RESPONSE","Original purchase reference changed");return ne(o.purchase),y.get(t.operationId)}async function me(e){for(let t of[e.journal.entry?.command,e.journal.entry?.closeCommand]){if(!t)continue;let r=G(qe,await Y({operation:"settle_command",runId:e.run.id,funnelId:e.start.funnelId,requestId:t.requestId,...t.operation==="resume"?{}:{command:t}}));if(ae(e,r),r.settlement.requestId!==t.requestId)throw new l("INVALID_RESPONSE","Original command settlement changed");r.purchase&&ne(r.purchase);let o=await f.update(c=>{I(c);let i=b(c),{receiptId:s,operationId:m}=r.settlement;if(s&&m){let V=i.find(v=>v.operationId===m);if(V&&V.receiptId!==s)throw new l("INVALID_RESPONSE","Original Receipt changed");V||i.push({receiptId:s,operationId:m,terminal:te(y.get(m))})}let h=r.settlement.state==="settled"?be(c.journal.entry,t.requestId):c.journal.entry;return{...c,purchases:i,journal:h===c.journal.entry?c.journal:{revision:c.journal.revision+1,entry:h}}});I(o),e=o}return e}function ae(e,t){if(t.customerId!==S||t.scope.projectId!==d.scope.projectId||t.scope.environment!==d.scope.environment||t.target.funnelId!==e.start.funnelId||t.target.startRequestId!==e.start.requestId||e.run&&(t.target.runId!==e.run.id||t.target.versionId!==e.run.versionId))throw new l("SCOPE_MISMATCH","The original recovery binding changed")}async function ie(e,t){if(I(e),e.run&&(e=await me(e)),!b(e).length&&A(e))return P(_(e,"operation"));if(!b(e).length)return P({mode:"blocked",status:"blocked",actions:["refresh"],purchases:[],error:H(t)});R=!0;let r=await L(e);return P(_(r,"operation"))}async function K(e,t=!1,r=!0){if(E=e.start.requestId,O=structuredClone({requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}),!u){let o=e.run?{operation:"recover_run",runId:e.run.id,funnelId:e.start.funnelId}:{operation:"recover_start",intent:t?"resume":"lookup",start:{requestId:e.start.requestId,funnelId:e.start.funnelId,locale:e.start.locale,parameters:e.start.parameters}},c;try{c=await Y(o)}catch(h){if(!e.run&&h instanceof l&&(h.status===void 0||h.status>=500))return P({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:k.purchases,error:H(h)});throw h}let i=G(Fe,c);if(i.customerId!==S||i.scope.projectId!==d.scope.projectId||i.scope.environment!==d.scope.environment)throw new l("SCOPE_MISMATCH","Recovery Customer or environment changed");if(i.outcome==="unknown")return P({mode:"blocked",status:"blocked",actions:["refresh","retry"],purchases:k.purchases,error:{code:"RESULT_UNKNOWN",message:"The original Start outcome remains unknown; retry only its original input"}});ae(e,i);let s=await f.update(h=>(I(h),{...h,run:{id:i.target.runId,versionId:i.target.versionId,status:i.target.status,revision:i.view?.revision??h.run?.revision??0,runExpiresAt:i.target.runExpiresAt}}));if(I(s),e=s,i.access.type==="operation_only")return ie(e,new l("RUN_RECONCILIATION_REQUIRED","Only the original command and Operation can be recovered"));e=await me(e);let m=i.view;if(m.locale!==e.start.locale||!_e(m.parameters,e.start.parameters))throw new l("INVALID_RESPONSE","The original Start input changed");u=ke({...d,customerRun:{runId:i.target.runId,customerId:S,startRequestId:e.start.requestId},funnelId:e.start.funnelId,funnelExecutionPolicy:{allowed:e.allowed.filter(h=>d.executionPolicy.allowed.includes(h))},funnelCommandStorage:He(),onAcceptedResponse:De},{scope:i.scope,run:m})}try{await u.get(),u.view?.pendingRequest?.requestId===e.start.requestId&&!u.pendingCommands?.length&&await u.resume(u.view.pendingRequest.requestId);for(let c of u.pendingCommands??[])c.operation!=="close"&&await u.settle?.(c.requestId);u.pendingCommands?.length&&await u.retry(),w();let o=(await f.read()).entry;return I(o),P(_(o,"run"))}catch(o){if(w(),r&&o instanceof l&&(o.status===401||o.status===409&&o.reason==="STATE_CHANGED")){u.reset(),u=null;let c=(await f.read()).entry;return I(c),K(c,!1,!1)}throw o}}function F(e,t="read",r){if(w(),q)return t==="read"||t===z?q:q.then(()=>F(e,t,r),()=>F(e,t,r));clearTimeout(B);let o=e().catch(c=>{throw!C&&!r?.(c)&&P({mode:"blocked",status:"blocked",actions:["refresh"],purchases:k.purchases,error:H(c)}),c});return q=o,z=t,o.then(()=>{q===o&&(q=void 0,z=void 0)},()=>{q===o&&(q=void 0,z=void 0)}),o}function T(){return F(async()=>{let{entry:e}=await f.read();if(!e||A(e)){if(await re(!1)==="blocked")return fe();({entry:e}=await f.read())}return e?(E&&e.start.requestId!==E&&(u?.reset(),u=null,y.clear(),j.clear(),R=!1),R&&E===e.start.requestId?ie(e,k.error):K(e)):P({mode:"idle",status:"idle",actions:["start"],purchases:[]})})}function fe(){return P({mode:"blocked",status:"blocked",actions:["refresh"],purchases:[],error:H(new l("PURCHASE_PENDING","Check the outstanding purchases before starting another"))})}async function he(){let e=await T();return e.mode==="operation"&&!e.actions.includes("confirm")&&!e.actions.includes("retry")?e:F(async()=>{let t=(await f.read()).entry;if(I(t),!R){if(!u?.view?.paywall?.quote)throw new l("PURCHASE_PENDING","Read the original quote before confirming");let s=u.view.paywall.operation;if(s?.confirmedAt||s?.merchantExecution||s&&s.status!=="pending")return P(_(t,"run"));if(u.pendingCommands?.length)await u.retry();else{let h=u.view;await u.submit({operation:"submit",requestId:crypto.randomUUID(),nodeId:h.nodeId,visit:h.visit,revision:h.revision,input:{type:"paywall_confirm",operationId:h.paywall.quote.operationId}})}let m=(await f.read()).entry;return I(m),P(_(m,"run"))}let r=t.operationCommand?.operationId??k.confirmation?.operationId,o=r&&y.get(r);if(!r||!o||t.journal.entry?.command||t.journal.entry?.closeCommand)throw new l("PURCHASE_PENDING","The original Run command must be settled before Operation confirmation");W({allowed:t.allowed.filter(s=>d.executionPolicy.allowed.includes(s))},o.quote),await f.update(s=>{if(I(s),s.journal.entry?.command||s.journal.entry?.closeCommand||s.operationCommand&&s.operationCommand.operationId!==r)throw new l("PURCHASE_PENDING","Another original command is pending");return{...s,operationCommand:{operationId:r,intent:"confirm"}}});let c=await de.attach({operationId:r,intent:"confirm"});if(w(),c.operation.operationId!==r)throw new l("INVALID_RESPONSE","Original confirmation Operation changed");y.set(r,Z(o,c.operation));let i=(await f.read()).entry;return I(i),P(_(await L(i,!1,new Set([r])),"operation"))},"confirm")}async function Ie(){w();let{entry:e}=await f.read();return e?A(e)?"finished":"pending":"none"}return{get controller(){return u},get recovery(){return structuredClone(k)},get attempt(){return w(),structuredClone(O)},get identitySignal(){return le.signal},retained:Ie,async findPurchase(){let e=await Ie();if(e==="pending")return e;let t=await re(!0);return w(),t==="none"?e:t},async readPaywall(e){w();let t=we(e),[r,{readPaywallContent:o},{validateResourceCheck:c}]=await Promise.all([ge(D.request,"resolvePaywall"),import("./paywall-content-YQAVSO2T.js"),import("./check-response-GZZRWBEA.js")]);w();let i=r.request.parse({selector:t.paywallVersionId?{type:"version",versionId:t.paywallVersionId}:{type:"paywall",paywallId:t.paywallId},commerce:t.commerce,locale:t.locale}),s=await ye(D.request,r,i);c(i,s.paywall.check,s.scope);let m=await o(d,s.paywall);if(w(),t.paywallVersionId?m.id!==t.paywallVersionId:m.paywallId!==t.paywallId)throw new l("INVALID_RESPONSE","The requested Paywall changed");return m},start(e){let t=U.parse({...structuredClone(e),operation:"start",requestId:e.requestId??crypto.randomUUID()});if(t.operation!=="start"||t.customer||t.customerData)throw new l("INVALID_REQUEST","A Customer-owned Funnel start is required");return F(async()=>{let r=(await f.read()).entry;if((!r||A(r))&&await re(!0)==="blocked")return fe();let o=await f.update(c=>{if(c&&!A(c)){if(c.start.funnelId!==t.funnelId)throw new l("PURCHASE_PENDING","Recover the original Funnel before starting another purchase");return c}return{schemaVersion:1,baseUrl:f.baseUrl,scope:d.scope,customerId:S,sessionId:M,start:t,allowed:[...d.executionPolicy.allowed],purchases:[],journal:{revision:0,entry:null}}});if(!o)throw new l("PURCHASE_STORAGE_INVALID","Original start was not retained");return E!==o.start.requestId&&(u?.reset(),u=null,y.clear(),j.clear(),R=!1),R?ie(o,k.error):K(o,!0)},`start:${t.funnelId}`)},refresh:T,confirm:he,retry:()=>R?he():F(async()=>{let{entry:e}=await f.read();return e?K(e,!0):P({mode:"idle",status:"idle",actions:["start"],purchases:[]})},"retry"),async close(){return u?.view?F(async()=>{if(!u?.view)throw new l("PURCHASE_PENDING","Recover the original Run before closing");if(u.pendingCommands?.find(r=>r.operation==="close"))await u.retry();else if(["running","waiting"].includes(u.view.status)){let r=u.view;await u.submit({operation:"close",requestId:crypto.randomUUID(),nodeId:r.nodeId,visit:r.visit,revision:r.revision})}let t=(await f.read()).entry;return I(t),P(_(t,"run"))},"close"):T()},async continueCheckout(e,t){let r=t?await F(async()=>{let{entry:o}=await f.read();if(I(o),!o.run||!b(o).some(i=>i.operationId===t&&!i.terminal))throw new l("PURCHASE_PENDING","The original Checkout changed");let c=await L(o);return P(_(c,R?"operation":"run"))},`continue:${t}`,o=>o instanceof l&&o.code==="PURCHASE_PENDING"):await T();w(),await e(Be(r,t))},async terminateCheckout(e){let t=await T();if(!t.purchases.find(o=>o.type==="checkout"&&o.operationId===e)||!t.actions.includes("continue_checkout"))throw new l("PURCHASE_PENDING","The original Checkout has changed");return F(async()=>{let{entry:o}=await f.read();I(o);let c=b(o).find(s=>s.operationId===e&&!s.terminal);if(!c||!o.run)throw new l("PURCHASE_PENDING","The original Checkout has changed");await oe(o,c,"terminate_checkout");let i=await L(o,!1,new Set([e]));return P(_(i,R?"operation":"run"))},`terminate:${e}`,o=>o instanceof l&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(o.code))},subscribe(e){return Q.add(e),()=>{Q.delete(e)}},destroy:pe}}export{Te as a,Be as b,Ct as c};
|
package/dist/chunk-SFHIFCXG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as f}from"./chunk-XUGEOELU.js";import{a as x}from"./chunk-OX7PA64E.js";function P(e,t,o,a,n){let{presentation:i,screen:s}=o,b=Object.entries(o.buttons??{}).filter(([,p])=>p.type==="close").map(([p])=>p),c=e.ownerDocument.defaultView,l=s.pages.find(p=>p.id===s.initialPageId)?.theme??s.theme,w={background:s.theme.background,text:s.theme.text};t.inert=!0,t.style.cssText="width:100%;min-width:0;overflow:hidden;visibility:hidden";let u=!1,d,g=p=>{c&&d?.resizeViewport(Math.max(1,c.innerHeight-(p==="modal"?32:0)),c.innerWidth)},r=i.type==="inline"?void 0:f(e,{...s,presentation:i,theme:w},g);return r?.latch(),c&&r?.responsive&&r.setContentHeight(c.innerHeight-(r.type==="modal"?32:0)),e.style.background=l.background,e.style.color=l.text,r?(i.type==="fullscreen"||i.type==="sheet")&&(e.style.position="fixed"):e.style.position="relative",import("./screen-renderer-R5GH7XLV.js").then(({mountScreenPreview:p})=>{u||(d=p(t,{mode:"live",skeleton:!0,closeActions:b,hostPresentation:()=>r?.type??i.type,reportContentHeight:r?.responsive,onResize(k){if(!c||!r?.responsive)return;let $=r.type==="modal"?32:0,m=Math.min(k,Math.max(0,c.innerHeight-$));t.style.height=`${m}px`,r.setContentHeight(m)},onRendered:n,onError(){d&&(d.destroy(),d=void 0)}}),r?.responsive&&g(r.type),d.update({...s,presentation:i},a,{serverInput:{bindings:[],answers:{}}}))}).catch(()=>{d?.destroy(),d=void 0}),()=>{u=!0,d?.destroy(),r?.destroy()}}var T={none:0,sm:4,md:8,lg:14,full:9999},z={system:"system-ui,sans-serif",serif:"Georgia,serif",rounded:"ui-rounded,system-ui,sans-serif",mono:"ui-monospace,monospace"},E={primary:"#172033",background:"#FFFFFF",text:"#172033",radius:"md",font:"system"};function y(e){let[t,o,a]=[1,3,5].map(n=>{let i=Number.parseInt(e.slice(n,n+2),16)/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4});return .2126*t+.7152*o+.0722*a}function H(e,t=!0){let o=y(e.primary),a=(o+.05)/.05>1.05/(o+.05)?"#111318":"#FFFFFF",n=`color-mix(in srgb, ${e.text} 22%, ${e.background})`,i=`${T[e.radius]}px`,s=`appearance:none;margin:0;min-height:44px;padding:10px 18px;border:0;border-radius:${i};font:inherit;font-size:15px;font-weight:600;line-height:1.25;cursor:pointer;touch-action:manipulation`;return{root:`width:100%;box-sizing:border-box;${t?`background:${e.background};`:""}color:${e.text};font:14px/1.5 ${z[e.font]}`,controls:"display:flex;gap:12px;padding:0 20px 12px;align-items:center;flex-wrap:wrap",pinned:`position:sticky;bottom:0;z-index:1;box-sizing:border-box;padding-top:12px;background:${e.background};border-top:1px solid ${n}`,bar:`display:flex;gap:8px;padding:12px 16px;align-items:center;flex-wrap:wrap;border-top:1px solid ${n}`,message:"flex:1 1 200px;min-width:0;margin:0;font-size:13px",status:"margin:0;font-size:13px;opacity:.72",alert:`flex:1 1 200px;min-width:0;margin:0;font-size:13px;font-weight:500;color:${y(e.background)>.4?"#B42318":"#FDA29B"}`,panel:`flex:1 0 100%;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;padding:16px;border:1px solid ${n};border-radius:${i}`,summary:"margin:0;font-size:15px;font-weight:600",terms:"display:flex;flex-direction:column;gap:4px;font-size:13px;opacity:.72",actions:"display:flex;gap:8px;flex-wrap:wrap;margin-top:4px",primary:`${s};background:${e.primary};color:${a}`,secondary:`${s};background:transparent;color:${e.text};box-shadow:inset 0 0 0 1px ${n}`,link:`${s};background:transparent;color:${e.text};opacity:.72;font-weight:500`,stage:"display:flex;justify-content:center;padding:24px 20px",history:"display:flex;flex-direction:column;gap:12px;padding:20px",historyTitle:"margin:0;padding-inline-end:40px;font-size:17px;font-weight:600;line-height:1.3",historyNote:"margin:0;font-size:13px;opacity:.72",historyPages:"display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:0;list-style:none",historyPage:`border:1px solid ${n};border-radius:${i};overflow:hidden`,historyRecords:`display:flex;flex-direction:column;gap:4px;margin:0;padding:12px 0 0;list-style:none;font-size:13px;border-top:1px solid ${n}`,focus:e.text}}function S(e){e.style.opacity=e.disabled?".55":"",e.style.cursor=e.disabled?"not-allowed":"pointer"}function R(e,t){e.addEventListener("focus",()=>{let o=!0;try{o=e.matches(":focus-visible")}catch{}o&&(e.style.outline=`2px solid ${t()}`,e.style.outlineOffset="2px")}),e.addEventListener("blur",()=>{e.style.outline="",e.style.outlineOffset=""})}var h={en:{network:"Connection problem. Check your network and try again.",timeout:"This is taking longer than expected. Try again.",other:"Something went wrong. Try again.",required:"Answer the questions marked * to continue."},zh:{network:"\u7F51\u7EDC\u8FDE\u63A5\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002",timeout:"\u54CD\u5E94\u65F6\u95F4\u8FC7\u957F\uFF0C\u8BF7\u91CD\u8BD5\u3002",other:"\u51FA\u4E86\u70B9\u95EE\u9898\uFF0C\u8BF7\u91CD\u8BD5\u3002",required:"\u8BF7\u5148\u56DE\u7B54\u5E26 * \u7684\u95EE\u9898\u3002"}};function O(e,t){let o=h[t?"zh":"en"],a=e instanceof x?e.code:void 0;return a==="NETWORK_ERROR"?o.network:a==="TIMEOUT"?o.timeout:o.other}function A(e){return h[e?"zh":"en"].required}function C(e,t){return e.filter(({variable:o,required:a})=>{let n=t[o];return a&&(n==null||n===""||Array.isArray(n)&&n.length===0)})}var v={zh:{pending:"\u5904\u7406\u4E2D",complete:"\u5DF2\u5B8C\u6210",cancelled:"\u5DF2\u53D6\u6D88",failed:"\u5931\u8D25",unknown:"\u72B6\u6001\u5F85\u786E\u8BA4"},en:{pending:"Processing",complete:"Completed",cancelled:"Cancelled",failed:"Failed",unknown:"Status unconfirmed"}};function I(e,t){return v[t?"zh":"en"][e]}export{P as a,E as b,H as c,S as d,R as e,O as f,A as g,C as h,I as i};
|
package/dist/chunk-UVRT4MY6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as n,s as t}from"./chunk-2FE4FTPH.js";function u(o,e,a){return n(o,e,a,t)}export{u as a};
|
package/dist/chunk-XUGEOELU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as k}from"./chunk-BQRS7Y4K.js";import{a as M}from"./chunk-DSPLGTQI.js";var z={sm:420,md:640,lg:900},A=767;function pe(e,n,o=()=>!0,c="Close"){let r=e.ownerDocument.defaultView,i=e.ownerDocument.createElement("button");i.type="button",i.setAttribute("aria-label",c),i.style.cssText="position:absolute;inset:0 48px auto;z-index:2;height:24px;border:0;padding:0;background:transparent;touch-action:none;cursor:grab";let d=e.ownerDocument.createElement("span");d.style.cssText="display:block;width:36px;height:4px;border-radius:4px;margin:8px auto 12px;background:currentColor;opacity:.22;pointer-events:none",i.append(d),e.prepend(i);let l,s=0,a=!1,f=()=>{i.hidden=e.dataset.presentation!=="sheet",i.setAttribute("aria-disabled",String(!o()))},v=t=>{f(),!(i.hidden||!o()||t.button!==0)&&(l={y:t.clientY,time:Date.now(),id:t.pointerId},s=0,a=!1,i.setPointerCapture?.(t.pointerId))},y=t=>{!l||t.pointerId!==l.id||(s=Math.max(0,t.clientY-l.y),e.style.transform=`translateY(${s}px)`)},g=t=>{if(!l||t.pointerId!==l.id)return;let u=Math.max(1,Date.now()-l.time),x=t.type!=="pointercancel"&&o()&&(s>120||s>40&&s/u>.5);a=s>6,l=void 0,i.releasePointerCapture?.(t.pointerId),e.style.transform="",x?n():s&&typeof e.animate=="function"&&!r?.matchMedia?.("(prefers-reduced-motion: reduce)").matches&&e.animate([{transform:`translateY(${s}px)`},{transform:"none"}],{duration:200,easing:"cubic-bezier(.2,.8,.2,1)"}),s=0},m=()=>{if(a){a=!1;return}!l&&s===0&&o()&&n()};i.addEventListener("pointerdown",v),i.addEventListener("pointermove",y),i.addEventListener("pointerup",g),i.addEventListener("pointercancel",g),i.addEventListener("click",m);let p=typeof MutationObserver=="function"?new MutationObserver(f):void 0;return p?.observe(e,{attributes:!0,attributeFilter:["data-presentation"]}),r?.addEventListener("resize",f),f(),()=>{p?.disconnect(),r?.removeEventListener("resize",f),i.remove(),e.style.transform=""}}function O(e,n,o=!1){return(e.type==="modal"||e.type==="sheet")&&e.mobile&&o&&n<=A?e.mobile:e.type}function W(e,n,o){let c=e.ownerDocument.defaultView,r=n.presentation,i;if((r.type==="modal"||r.type==="sheet")&&r.backdrop){let t=`lp-backdrop-${crypto.randomUUID()}`,u={none:"transparent",scrim:"#f2f2f2cc",dim:"#0006","strong-dim":"#000000bf",blur:"#0006"};e.dataset.indianaBackdrop=t,i=e.ownerDocument.createElement("style"),i.textContent=`dialog[data-indiana-backdrop="${t}"]::backdrop{background:${u[r.backdrop]};backdrop-filter:${r.backdrop==="blur"?"blur(16px)":"none"}}`,e.append(i)}let d=n.pages?.[0]?.root.style?.shape,l=d?.type==="pill"?"9999px":d?.type==="rect"?typeof d.radius=="number"?`${d.radius}px`:[d.radius.topLeft,d.radius.topRight,d.radius.bottomRight,d.radius.bottomLeft].map(t=>`${t}px`).join(" "):void 0,s=(r.type==="modal"||r.type==="sheet")&&(r.desktopWidth!==void 0||r.mobile!==void 0),a=r.type,f,v,y=!1,g=t=>{y||!Number.isFinite(t)||t<0||(v=t,a!=="fullscreen"&&a!=="inline"&&(e.style.height=`min(${Math.max(t,40)}px, calc(100dvh - ${a==="sheet"?0:32}px))`))},m=()=>{if(!y&&(a=f??O(r,c?.innerWidth??1024,c?.matchMedia?.("(pointer: coarse)").matches===!0),e.dataset.presentation=a,!(!s||r.type!=="modal"&&r.type!=="sheet"))){if(e.style.boxSizing="border-box",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.outline="none",e.tabIndex=-1,e.style.background=n.theme.background,e.style.color=n.theme.text,a==="fullscreen")e.style.width="100vw",e.style.height="100dvh",e.style.maxWidth="100vw",e.style.maxHeight="100dvh",e.style.margin="0",e.style.borderRadius="0";else{let t=r.mobile==="sheet"&&a==="sheet",u=r.desktopWidth,x=c?.innerWidth??1024;e.style.width=t?`${x}px`:u?`${Math.min(u.max,Math.max(x*u.viewport/100,u.min))}px`:`${k[r.size]}px`,e.style.maxWidth=`${Math.max(0,x-(a==="sheet"?0:32))}px`,e.style.maxHeight=a==="sheet"?"100dvh":"calc(100dvh - 32px)",e.style.margin=a==="sheet"?"auto auto 0":"auto",e.style.borderRadius=l??(a==="sheet"?"16px 16px 0 0":"24px"),e.style.height="",v!==void 0&&g(v)}o?.(a)}},p=s?[c?.matchMedia?.(`(max-width: ${A}px)`),c?.matchMedia?.("(pointer: coarse)")].filter(t=>t!==void 0):[];if(s){c?.addEventListener("resize",m);for(let t of p)t.addEventListener?t.addEventListener("change",m):t.addListener?.(m)}return m(),{responsive:s,get type(){return a},latch(){y||f!==void 0||(m(),f=a)},setContentHeight:g,destroy(){if(!y){y=!0,i?.remove(),delete e.dataset.indianaBackdrop,c?.removeEventListener("resize",m);for(let t of p)t.removeEventListener?t.removeEventListener("change",m):t.removeListener?.(m)}}}}function ue(e,n,o){let{presentation:c}=n,r="size"in c?`${z[c.size]}px`:"100vw";return e.style.cssText=`padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;width:${r}`,W(e,n,o)}function me(e,n,o=!1){let c=e.ownerDocument.defaultView;if(typeof e.animate!="function"||c?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let r=o?{duration:300,easing:"cubic-bezier(0.23, 1, 0.32, 1)"}:{duration:240,easing:"cubic-bezier(0.2, 0.8, 0.2, 1)"};e.animate(n==="sheet"?[{transform:"translateY(100%)"},{transform:"none"}]:n==="modal"?[{opacity:0,transform:o?"translateY(12px) scale(0.96)":"translateY(8px) scale(0.98)"},{opacity:1,transform:"none"}]:[{opacity:0},{opacity:1}],r);try{e.animate([{opacity:0},{opacity:1}],{...r,pseudoElement:"::backdrop"})}catch{}}function $(e,n){e.style.cssText=["position:absolute","z-index:1","top:calc(4px + env(safe-area-inset-top, 0px))","inset-inline-end:calc(4px + env(safe-area-inset-right, 0px))","width:44px","height:44px","padding:0","border:0","border-radius:50%","font:400 20px/1 system-ui,sans-serif","cursor:pointer","touch-action:manipulation"].join(";"),e.style.background=`radial-gradient(circle, ${n.background} 0 15px, color-mix(in srgb, ${n.text} 22%, ${n.background}) 15px 16px, transparent 16.5px)`,e.style.color=n.text}var C=new WeakMap;function he(e,n){return C.set(e,n),()=>C.delete(e)}function xe(e){let n=e.defaultView?.HTMLElement,o=e.activeElement;for(let r=0;r<16&&o?.shadowRoot?.activeElement;r++)o=o.shadowRoot.activeElement;let c=o?C.get(o)?.():void 0;return()=>{!o?.isConnected||!n||!(o instanceof n)||(o.focus({preventScroll:!0}),c?.())}}var ge=15e3;function we(e,n,o,c,r){let i=e.ownerDocument,d=new AbortController,l=!1,s=!1,a,f;function v(){f?.(),f=void 0,a?.tagName==="DIALOG"&&a.close?.(),a?.remove(),a=void 0}function y(p,t){s||(s=!0,v(),(p==="dismissed"||p==="error")&&d.abort(t??new DOMException("Presentation cancelled","AbortError")),!(!l&&p!=="ready")&&M(n.onPresentationState,p==="error"?{surface:o,state:p,error:t}:{surface:o,state:p}))}let g=c,m=()=>{s||g()};return{setDismissHandler(p){g=p},get active(){return l&&!s},get cancelled(){return d.signal.aborted},start(p,t,u){if(!(l||s)){if(l=!0,n.loading!=="host"){let x=(t??i.documentElement.lang)||"en",b=p&&u?.presentation?.type!=="inline",S=u!==void 0,h=i.createElement(b?"dialog":"div");a=h,h.dataset.longplayLoading=o;let E=x.startsWith("zh"),I=S?E?"\u6B63\u5728\u52A0\u8F7D\u5957\u9910":"Loading plans":E?"\u6B63\u5728\u52A0\u8F7D":"Loading",R=u?.screen.theme??{background:"Canvas",text:"CanvasText"};h.setAttribute("aria-label",I);let P=i.createElement("div");P.setAttribute("role","status");let L=i.createElement("div");L.setAttribute("aria-hidden","true");let H=()=>{P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)"};S?P.style.cssText="padding:24px 60px 24px 24px;font:500 16px/1.5 system-ui,sans-serif":H(),P.textContent=I;let w=i.createElement("button");w.type="button",w.textContent="\xD7",w.setAttribute("aria-label",E?"\u53D6\u6D88\u52A0\u8F7D":"Cancel loading"),$(w,R),w.addEventListener("click",m),h.addEventListener("cancel",D=>{D.preventDefault(),m()}),h.append(P,L,w),e.append(h);let T=()=>{if(!s&&b){let D=h;D.showModal?D.showModal():D.open=!0,w.focus({preventScroll:!0})}};u&&r?(f=r(h,L,u,x,()=>{s||(L.style.visibility="",H())}),T()):S?(h.style.cssText=b?"padding:0;border:0;border-radius:24px;background:Canvas;color:CanvasText;width:min(420px,calc(100vw - 32px))":"position:relative;background:Canvas;color:CanvasText;width:100%",T()):(_(h,L,b,o),T())}M(n.onPresentationState,{surface:o,state:"loading",dismiss:m})}},present(p){if(s)return;let t=!!a;v(),p(t),y("ready")},dismiss:m,finish:y,async wait(p,t){let u=d.signal,x,b,S=new Promise((h,E)=>{b=()=>E(u.reason),u.aborted?b():u.addEventListener("abort",b,{once:!0}),t!==void 0&&(x=setTimeout(()=>E(new Error("Presentation data timed out")),t))});try{let h=await Promise.race([S,p]);return u.throwIfAborted(),h}finally{u.removeEventListener("abort",b),clearTimeout(x)}}}}function _(e,n,o,c){e.style.cssText="position:relative;box-sizing:border-box;background:Canvas;color:CanvasText;padding:24px 48px 24px 24px;"+(o?"position:fixed;width:min(480px,calc(100% - 32px));border:0;border-radius:16px;max-height:calc(100dvh - 32px)":"width:100%"),n.style.cssText="display:grid;gap:12px";let r=c==="banner"?[["72%",12],["44%",10]]:[["46%",20],["84%",12],["65%",12],["100%",64]];for(let[i,d]of r){let l=e.ownerDocument.createElement("div");l.style.cssText=`width:${i};height:${d}px;background:currentColor;opacity:.11;border-radius:6px`,n.append(l)}}function F(e){let n={display:"block",position:"fixed",top:"0",left:"0",opacity:"0",pointerEvents:"none",zIndex:"-1"},o=Object.keys(n).map(i=>{let d=i,l=e.style[d];return e.style[d]=n[d],[d,l]}),c=e.inert??!1,r=e.getAttribute("aria-hidden");return e.inert=!0,e.setAttribute("aria-hidden","true"),()=>{for(let[i,d]of o)e.style[i]=d;e.inert=c,r===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}}function Se(e,n){let o=e.style.width;e.style.width=`${n.getBoundingClientRect().width||n.ownerDocument.defaultView?.innerWidth||800}px`;let c=F(e);return()=>{c(),e.style.width=o}}export{pe as a,O as b,W as c,ue as d,me as e,$ as f,he as g,xe as h,ge as i,we as j,F as k,Se as l};
|
package/dist/chunk-ZGCKQWQ5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk-VF6QMMEA.js";var c=e.enum(["replace","stack_native"]);export{c as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-YVXLCQGM.js";import"./chunk-V7PFLFHE.js";import"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-VF6QMMEA.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{a as PRERENDER_MAX_AGE_MS,b as preparedInternals,c as prerenderFunnelPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-ETK6GC5P.js";import"./chunk-SFHIFCXG.js";import"./chunk-YVXLCQGM.js";import"./chunk-73NP72FV.js";import"./chunk-W32FI2A2.js";import"./chunk-XUGEOELU.js";import"./chunk-TAFALMQN.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-3NCMYTNG.js";import"./chunk-VEX2FOFZ.js";import"./chunk-V7PFLFHE.js";import"./chunk-56BYGPQ6.js";import"./chunk-VYFSRHXM.js";import"./chunk-BQRS7Y4K.js";import"./chunk-U4RSRFZY.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-SLUA7ABW.js";import"./chunk-TLZP7BW6.js";import"./chunk-EM3MGDPG.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{a as showFunnelRun,b as showObservedFunnelRun};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as r,O as m,h as e}from"./chunk-CKKIB2HC.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-VYFSRHXM.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-V7MMTILA.js";import"./chunk-VF6QMMEA.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{m as merchantBridgeCommerceSchema,r as merchantBridgeOperationSchema,e as merchantOperationLookupSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as o}from"./chunk-44U3FOBB.js";import"./chunk-WZR2XCSJ.js";import"./chunk-7MNJH5GB.js";import"./chunk-CIP5SQ5Y.js";import"./chunk-CKKIB2HC.js";import"./chunk-BOVN2BE3.js";import"./chunk-PUR5CYWX.js";import"./chunk-TAFALMQN.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-VEX2FOFZ.js";import"./chunk-5HJYR6Z4.js";import"./chunk-VYFSRHXM.js";import"./chunk-BQRS7Y4K.js";import"./chunk-U4RSRFZY.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-V7MMTILA.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{o as apiOperations};
|
package/dist/paywall-VYUBYBUI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as gt,c as vt,d as Fe,f as Ct,i as Pt}from"./chunk-SFHIFCXG.js";import{b as Be}from"./chunk-W32FI2A2.js";import{d as pt,e as mt,f as ht,h as je,i as Ae,j as yt,k as wt,l as bt}from"./chunk-XUGEOELU.js";import{a as ct,c as Ve,d as lt,e as ut}from"./chunk-3NCMYTNG.js";import{b as ne}from"./chunk-VEX2FOFZ.js";import{b as He,d as dt,g as ft}from"./chunk-V7PFLFHE.js";import"./chunk-56BYGPQ6.js";import"./chunk-VYFSRHXM.js";import{ba as ye,da as we}from"./chunk-BQRS7Y4K.js";import{c as ce,j as he}from"./chunk-U4RSRFZY.js";import{c as $e}from"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import{a as v}from"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-EM3MGDPG.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import{a as j}from"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";async function kt(T,a,A){if(a.status!=="complete")throw new v("INVALID_RESPONSE","A verified completed purchase is required");let g=T?he.parse(T):null;if(await A.onComplete?.(a),!g||!A.check)return;let D=he.parse(await A.check());if(D.internal_feature_id!==g.internal_feature_id||D.quantity!==g.quantity||g.observation!==void 0&&(D.observation===void 0||D.observation.requirementDigest!==g.observation.requirementDigest||D.observation.authority!==g.observation.authority||$e(D.observation.subject)!==$e(g.observation.subject)))throw new v("INVALID_RESPONSE","The access requirement changed");D.allowed&&await A.onAccessGranted?.(D)}function Qe(T){return Object.entries(T.document.buttons).filter(([,a])=>a.type==="checkout"&&a.product.type==="fixed"&&!ne(a.product,{},T.capabilities)).map(([a])=>a)}function Et(T,a){let A=a.lines[0];if(a.lines.length!==1||!A)return;let g=A.productVersionId,{screen:D,buttons:F}=T.document,E=new Map((A.prepaid??[]).map(d=>[d.internal_feature_id,d.quantity]));function Q(d,f){if(d.hidden)return!1;if(d.type==="plan_picker"&&T.capabilities.pickers[d.id]?.options.includes(g))return f[d.id]=g,!0;if(d.type==="quantity_picker"){let V=E.get(d.internalFeatureId);return V!==void 0&&(!d.bind?.plan||d.bind.plan===g)&&(f[d.id]=V),!1}if(d.type==="button"&&d.action){let V=F[d.action];return V?.type==="checkout"&&V.product.type==="fixed"&&V.product.productVersionId===g}if(d.type!=="stack")return!1;let $=d.interaction,r=d.bind?.plan===g;for(let[V,p]of d.children.entries()){let J={},R=Q(p,J);if($?.type==="toggle"||$?.type==="tabs"){if(!R)continue;return f[d.id]=$.type==="toggle"?V===0:p.id,Object.assign(f,J),!0}Object.assign(f,J),R&&(r=!0,$?.type==="select"&&$.purpose==="product"&&$.pickerId&&p.type==="stack"&&p.bind?.plan===g&&(f[d.id]=p.id,f[$.pickerId]=g))}return r}for(let d of D.pages){let f={__page:d.id};if(Q(d.root,f))return f}}async function dn(T,a,A){let g=a.focusAtReveal?()=>{}:je(T.ownerDocument),D=()=>{E.finish("dismissed"),g()},F=()=>D(),E=yt(T,a,"paywall",()=>{D(),j(a.onDismiss)},gt);a.signal?.throwIfAborted(),a.signal?.addEventListener("abort",F,{once:!0});let Q=null,d,f,$;try{if(E.start(!0,a.loadingDocument?.screen.strings.defaultLocale,a.loadingDocument??null),E.cancelled)throw new DOMException("Presentation cancelled","AbortError");if(Q=a.check?he.parse(await E.wait(a.check(),Ae)):null,Q?.allowed)return E.finish("skipped"),a.signal?.removeEventListener("abort",F),g(),await a.onAccessGranted?.(Q),{check:Q,host:null};let[e,t]=await Promise.allSettled([E.wait(import("./screen-renderer-R5GH7XLV.js")),E.wait(a.start().then(i=>(E.cancelled&&i.destroy(),i)),Ae)]);if(e.status==="rejected")throw t.status==="fulfilled"&&t.value.destroy(),e.reason;if(t.status==="rejected")throw t.reason;$=e.value,d=t.value,a.signal?.throwIfAborted(),d.signal?.throwIfAborted(),d.signal?.addEventListener("abort",F,{once:!0});let n=d.view??await E.wait(d.refresh(),Ae);if(!n)throw new v("INVALID_RESPONSE","Paywall presentation is missing");d.signal?.throwIfAborted(),f=n}catch(e){throw E.finish("error",e),a.signal?.removeEventListener("abort",F),d?.signal?.removeEventListener("abort",F),d?.destroy(),g(),e}let r=d,{mountScreenPreview:V}=$,p=T.ownerDocument,J=new AbortController,R=p.createElement("section"),re=p.createElement("div"),G=p.createElement("div"),l=p.createElement("p"),y=p.createElement("button"),C=p.createElement("button"),x=p.createElement("dialog"),s=f.document.screen.strings.defaultLocale.startsWith("zh"),xt=s?"\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026",It=s?"\u6B63\u5728\u51C6\u5907\u62A5\u4EF7\u2026":"Preparing your price\u2026",O=vt(f.document.screen.theme);R.dataset.indianaPaywall="",R.setAttribute("aria-label",f.document.name),R.style.cssText=O.root,G.style.cssText=O.controls,l.style.cssText=O.message,l.setAttribute("role","status"),C.style.cssText=O.link,C.textContent=s?"\u5173\u95ED":"Close",y.style.cssText=O.secondary,y.textContent=s?"\u91CD\u8BD5":"Retry",y.hidden=!0,G.append(l,y,C),R.append(re,G);let Ge=()=>{let e=K??G,t=[...e.children].every(i=>i===l?!l.textContent:i.hidden),n=[...e.children].some(i=>i===C?!1:i===l?!!l.textContent:!i.hidden);e.style.cssText=t?O.controls.replace(/padding:[^;]+/,"padding:0"):n?`${O.controls};${O.pinned}`:O.controls,Oe()},We=typeof MutationObserver>"u"?void 0:new MutationObserver(Ge);We?.observe(R,{attributes:!0,attributeFilter:["hidden"],characterData:!0,childList:!0,subtree:!0});let be=f.document.presentation,At=Object.entries(f.document.buttons).filter(([,e])=>e.type==="close").map(([e])=>e),U,ze,Re=!1,Ye=JSON.stringify(f.capabilities),Je=e=>Z&&!ue?Object.entries(e.document.buttons).filter(([,t])=>t.type==="checkout").map(([t])=>t):Qe(e);function Se(e){if(h)return;f=e;let t=JSON.stringify(e.capabilities);t!==Ye&&(U?.updateCapabilities(e.capabilities,Je(e)),Ye=t),Tt(e),de()}let P,Te=0;function Oe(){let e=p.defaultView;if(!P?.responsive||!e)return;let t=K??G,n=e.innerHeight-(P.type==="modal"?32:0);t.style.maxHeight=`${Math.max(1,n)}px`,t.style.overflowY="auto",t.style.flexShrink="0",Te=Math.max(1,n-t.getBoundingClientRect().height),U?.resizeViewport?.(Te,e.innerWidth)}let h=!1,Z=!1,k=null,ge=!1,Ke=!1,ee=!1,De,Ne=!1,W,K;function Rt(){return Z||h||W||Ne?{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null}:Ve(r)}let I=()=>!h&&!ge&&!W&&a.canInteract?.()!==!1,ie=!1,m=null,z=null,te=()=>a.checkoutNavigation==="after_confirmation"&&!!(a.terminateCheckout||a.resumeCheckout),le={},ue,H=null;function de(){if(!te()||!U?.updateCheckoutControls)return;let e=r.quote,t=!H&&!!e&&!!r.operation&&M(r.operation).type==="checkout",n=Object.entries(f.document.buttons).flatMap(([i,o])=>o.type==="checkout"?[{actionId:i,policy:o}]:[]);U.updateCheckoutControls({actions:n.map(({actionId:i})=>i),resume:t?n.filter(({policy:i})=>Pe(e,f,i.product,le)).map(({actionId:i})=>i):[],resumeLabel:s?"\u7EE7\u7EED\u4ED8\u6B3E":"Continue checkout",busy:ue})}function Xe(){z?.remove(),z=null}async function _e(){if(H)return;if(a.resumeCheckout&&r.operation){await a.resumeCheckout(r.operation.operationId);return}let e=await r.read();if(M(e).type!=="checkout")return N(e,!1);I()&&(ve.delete(e.operationId),await ke(e))}function Ze(){l.textContent=s?"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u4ED8\u6B3E\u9875\u9762\u3002\u8BF7\u91CD\u8BD5\u3002":"Couldn\u2019t open checkout. Try again.",y.hidden=!0}async function et(e=!1){let t=H;if(!t)return;y.hidden=!0;let n=Date.now()+2e4;for(;I();){let i=await r.read();if(i.operationId!==t.operationId)throw new v("PURCHASE_PENDING","The original Checkout changed");if(!I())break;let o=M(i);if(o.type==="native"){H=null,Xe(),k=t.selection,ie=!1,await pe();return}if(o.type==="complete"||o.type==="fulfillment"||o.type==="recording"){H=null,await N(i,!1);return}if(e&&o.type==="checkout"){e=!1;try{await a.terminateCheckout(t.operationId)}catch(u){j(a.onError,u)}}if(Date.now()>=n)break;await Be(1e3,p,J.signal)}h||Ze()}async function St(e,t){H={operationId:e,selection:t};let n=!1;try{await a.terminateCheckout(e)}catch(i){if(i instanceof v&&["CAPABILITY_UNAVAILABLE","NOT_CONFIGURED"].includes(i.code)){H=null,l.textContent=s?"\u8BF7\u7EE7\u7EED\u539F\u8BA2\u5355\uFF0C\u6216\u7B49\u5F85\u5B83\u8FC7\u671F\u540E\u518D\u66F4\u6362\u65B9\u6848\u3002":"Continue your original checkout, or wait for it to expire before changing plans.",j(a.onError,i);return}n=i instanceof v&&(i.status??0)>=500,j(a.onError,i)}I()&&await et(n)}function Tt(e){Z||k||r.quote||r.operation||(l.textContent=Object.values(e.capabilities.plans).some(t=>t.available)?"":s?"\u5F53\u524D\u8D26\u53F7\u6682\u65E0\u53EF\u8D2D\u4E70\u7684\u65B9\u6848\u3002":"No plans are currently available for this account.")}let ve=new Map,Ce=!1;function Pe(e,t,n,i){let o=e.lines.length===1?e.lines[0]:void 0,u=ne(n,i,t.capabilities);if(!o||!u||o.productVersionId!==u)return!1;let _;try{_=we(t.document.screen,u,i,t.capabilities)}catch{return!1}let b=Object.fromEntries((o.prepaid??[]).map(Y=>[Y.internal_feature_id,Y.quantity]));return[...new Set([...Object.keys(_),...Object.keys(b)])].every(Y=>(_[Y]??0)===(b[Y]??0))}let M=e=>ct({quote:r.quote,operation:e,requestId:null,pending:!1,destroyed:h,canReselect:r.canReselect});async function ke(e){let t=e.merchantExecution;if(!(!I()||!e.checkoutUrl||a.checkoutNavigation==="after_confirmation"&&M(e).type!=="checkout"||t?.type==="purchase"&&!["not_started","pending"].includes(t.paymentStatus)||ve.get(e.operationId)===e.checkoutUrl)){ve.set(e.operationId,e.checkoutUrl);try{a.onCheckoutUrl?await a.onCheckoutUrl(e.checkoutUrl):p.defaultView?.location.assign(e.checkoutUrl)}catch(n){throw ve.delete(e.operationId),n}}}let X=(e,t=!1)=>{if(e instanceof He)m=null,l.textContent=e.customerMessage(s);else if(t){let n=e instanceof v?e.code:void 0;n==="CAPABILITY_UNAVAILABLE"||n==="NOT_CONFIGURED"?(m=null,l.textContent=s?"\u6682\u65F6\u65E0\u6CD5\u4E3A\u6B64\u5957\u9910\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002":"Pricing for this plan is unavailable. Payment hasn\u2019t started."):r.canReselect===!0&&!k?l.textContent=s?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5957\u9910\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Choose a plan again.":n==="COMMAND_PENDING"?l.textContent=s?"\u4ECD\u5728\u51C6\u5907\u62A5\u4EF7\uFF0C\u8BF7\u91CD\u8BD5\u4EE5\u67E5\u770B\u7ED3\u679C\u3002":"Your price is still being prepared. Retry to check the result.":l.textContent=s?"\u672A\u80FD\u53D6\u5F97\u62A5\u4EF7\uFF0C\u4ED8\u6B3E\u5C1A\u672A\u5F00\u59CB\u3002\u8BF7\u91CD\u8BD5\u3002":"We couldn\u2019t prepare your price. Payment hasn\u2019t started. Try again."}else l.textContent=e instanceof v&&(e.code==="NETWORK_ERROR"||e.code==="TIMEOUT")?Ct(e,s):e instanceof v?e.message:s?"\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002":"This action couldn\u2019t be completed. Try again.";y.hidden=m===null,t&&!P?.responsive&&l.scrollIntoView?.({block:"nearest"}),j(t&&A?.quoteError?A.quoteError:a.onError,e)},Ee=new WeakMap;function xe(e){Z=e,y.disabled=e,U?.updateCapabilities?.(f.capabilities,Je(f));for(let t of z?.querySelectorAll("button")??[])e?(Ee.set(t,t.disabled),t.disabled=!0):Ee.has(t)&&(t.disabled=Ee.get(t),Ee.delete(t)),Fe(t)}function Le(){l.textContent=s?"\u6682\u65F6\u65E0\u6CD5\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"This action is unavailable right now. Try again in a moment."}async function Ot(e){if(a.beforeAction)try{await a.beforeAction()}catch(t){throw t instanceof He?(k=null,ie=!1,m=null):m=e,t}}async function L(e,t){if(Z||h)return;if(!I()){Le();return}let n=e===pe,i=n?It:xt,o=te()&&t!==void 0;ue=o?t:void 0,xe(!0),de(),y.hidden=!0,l.textContent=o?"":i;try{if((e!==_e||!a.resumeCheckout)&&await Ot(e),h)return;if(!I()){m=e,y.hidden=!1,Le();return}await e()}catch(u){h||X(u,n&&!o)}finally{ue=void 0,xe(!1),de(),l.textContent===i&&(l.textContent="")}}async function Dt(e){await kt(Q,e,a)}function tt(e){return Ve(r).type==="recording"||M(e).type==="recording"}function nt(e){let t=e.merchantTerms,n=t?.subscriptionTerms?.items??[],i=t?t.totalMinor:e.charge?.totalMinor??e.catalogAmountMinor-(e.discount?.amountMinor??0),o=t?n.length===1&&n[0]?.amountMinor===i&&n[0]:e.lines.length===1&&e.lines[0]?.catalogAmountMinor===i&&e.lines[0],u=i===null?ce(t.subtotalMinor-t.discountMinor,e.currency)+(s?" + \u5F85\u786E\u8BA4\u7A0E\u8D39":" + tax confirmed at checkout"):ce(i,e.currency)+(o?ye(o.interval,s?"zh-CN":"en",o.intervalCount??1):""),_=e.lines.map(b=>b.productName).join(", ");return{label:_?`${_} \xB7 ${u}`:u,recurring:o}}async function N(e,t=a.checkoutNavigation!=="after_confirmation"){if(h)return;if(!I()){m=async()=>N(await r.read()),y.hidden=!1;return}if(l.textContent=Pt(e.status,s),tt(e)){let o=e.merchantExecution?.type==="purchase"&&e.merchantExecution.recordingStatus==="failed";l.textContent=o?s?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u4F46\u4EA4\u6613\u8BB0\u5F55\u5931\u8D25\u3002\u8BF7\u8054\u7CFB\u5546\u6237\u4FEE\u590D\uFF0C\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and fulfillment succeeded, but recording failed. Contact the merchant to repair this purchase; do not buy again.":s?"\u4ED8\u6B3E\u548C\u5546\u6237\u5904\u7406\u5DF2\u5B8C\u6210\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u8BB0\u5F55\u3002\u8BF7\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"Payment and merchant fulfillment are complete. Recording is pending confirmation; do not purchase again.",y.textContent=s?"\u67E5\u8BE2\u8BB0\u5F55":"Check recording",m=async()=>N(await r.read()),y.hidden=!1;return}if(e.problem){let o=e.problem;m=fe,y.textContent=s?"\u68C0\u67E5\u5E76\u6062\u590D\u539F\u64CD\u4F5C":"Check and recover original purchase",X(new v(o.code,o.reason==="RESULT_UNKNOWN"?s?"\u4ED8\u6B3E\u7ED3\u679C\u5C1A\u672A\u786E\u5B9A\uFF0C\u8BF7\u6062\u590D\u539F\u64CD\u4F5C\uFF0C\u6682\u52FF\u91CD\u590D\u8D2D\u4E70\u3002":"The payment result is unknown. Recover the original purchase before buying again.":o.phase==="fulfillment"?s?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u5546\u6237\u6743\u76CA\u5904\u7406\u9700\u8981\u6838\u5BF9\u3002":"Payment was recorded. Access fulfillment needs attention.":o.code==="CAPABILITY_UNAVAILABLE"?s?"\u5546\u6237\u5C1A\u4E0D\u652F\u6301\u672C\u6B21\u8D2D\u4E70\u6240\u9700\u7684\u5B8C\u6574\u80FD\u529B\uFF0C\u8BF7\u5904\u7406\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The merchant does not currently support all actions required by this purchase. Recover the original purchase after this is resolved.":o.code==="NOT_CONFIGURED"?s?"\u4ED8\u6B3E\u670D\u52A1\u8FDE\u63A5\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u8054\u7CFB\u5546\u6237\u540E\u6062\u590D\u539F\u64CD\u4F5C\u3002":"The payment connection needs attention. Contact the merchant, then recover the original purchase.":s?"\u539F\u8D2D\u4E70\u64CD\u4F5C\u9700\u8981\u5904\u7406\uFF0C\u8BF7\u67E5\u8BE2\u6216\u6062\u590D\u6B64\u64CD\u4F5C\u3002":"The original purchase needs attention. Check or recover this operation.",void 0,void 0,o));return}if(e.merchantExecution?.type==="purchase"&&e.merchantExecution.paymentStatus==="succeeded"&&!["applied","not_applicable"].includes(e.merchantExecution.fulfillmentStatus)&&(l.textContent=s?"\u4ED8\u6B3E\u5DF2\u8BB0\u5F55\uFF0C\u6B63\u5728\u7B49\u5F85\u5546\u6237\u5B8C\u6210\u5904\u7406\u3002":"Payment was recorded. Waiting for merchant fulfillment."),e.status==="complete"){m=null,await Dt(e);return}if(e.status!=="pending"){if(r.canReselect===!1){l.textContent=s?"\u6B63\u5728\u6838\u5BF9\u539F\u8D2D\u4E70\u7ED3\u679C":"Checking the original purchase result",y.textContent=s?"\u67E5\u8BE2\u7ED3\u679C":"Check result",m=async()=>N(await r.read()),y.hidden=!1;return}e.status==="cancelled"?l.textContent=s?"\u8FD9\u7B14\u8D2D\u4E70\u5DF2\u53D6\u6D88\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase was cancelled. Choose a plan to start again.":e.status==="failed"&&(l.textContent=s?"\u8FD9\u7B14\u8D2D\u4E70\u672A\u80FD\u5B8C\u6210\uFF0C\u53EF\u4EE5\u91CD\u65B0\u9009\u62E9\u65B9\u6848\u3002":"This purchase didn\u2019t go through. Choose a plan to try again."),y.textContent=s?"\u91CD\u8BD5":"Retry",m=null,k=null;return}if(!t&&M(e).type==="checkout"){if(H){Ze();return}if(te()){l.textContent="",Ce=!1,m=null,de();return}let o=r.quote,u=o?.operationId===e.operationId?nt(o).label:"";l.textContent=Ce?u?s?`${u} \u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002`:`${u} is still unpaid. Choose it again to continue paying.`:s?"\u4E4B\u524D\u7684\u8D2D\u4E70\u5C1A\u672A\u4ED8\u6B3E\u3002\u518D\u6B21\u9009\u62E9\u8BE5\u65B9\u6848\u5373\u53EF\u7EE7\u7EED\u4ED8\u6B3E\u3002":"Your earlier purchase is still unpaid. Choose that plan again to continue paying.":"",Ce=!1,m=null;return}await ke(e);let n=Date.now()+6e5,i=2e3;Re=!0,j(a.onObservationChange,!0);try{for(;!h&&Date.now()<n;){if(await Be(i,p,J.signal),h)return;if(!I()){m=async()=>N(await r.read()),y.hidden=!1;return}let o=await r.read();if(!t&&M(o).type==="checkout"){await N(o,!1);return}if(!o.problem&&o.status==="pending"&&await ke(o),o.status!=="pending"||o.problem||tt(o)){await N(o);return}i=Math.min(i*1.5,3e4)}}finally{Re=!1,j(a.onObservationChange,!1)}m=async()=>N(await r.read()),y.hidden=!1}async function Ue(e=!1){let t=await r.read();if(h)return;if(!I()){m=()=>Ue(e),y.hidden=!1;return}let n=r.quote;if(n&&dt(t,{operationId:n.operationId,currency:n.currency},"The original purchase operation changed"),n&&t.status==="pending"&&t.quoteFinalized===!1&&!t.confirmedAt&&!t.checkoutUrl&&!t.nativePurchase&&!t.merchantExecution&&!t.problem&&!r.pendingCancellation){rt(n);return}await N(t,e||void 0)}async function fe(){Xe(),m=fe;let e=await r.confirm();if(!I()){m=fe,y.hidden=!1;return}if(e.problem){await N(e);return}if(e.status==="pending"){if(e.checkoutUrl)await ke(e);else if(e.execution&&e.execution.provider!=="merchant"||e.nativePurchase){if(!a.onPurchase)throw new v("PURCHASE_HANDLER_REQUIRED","Provide the merchant or native purchase handler");await a.onPurchase({operation:e,signal:J.signal})}}m=async()=>N(await r.read()),await N(e,!0)}function rt(e){z?.remove();let t=!(Date.parse(e.expiresAt)>Date.now());l.textContent=t?s?"\u6B64\u62A5\u4EF7\u5DF2\u8FC7\u671F\u3002\u8BF7\u5148\u53D6\u6D88\uFF0C\u518D\u91CD\u65B0\u9009\u62E9\u3002":"This quote has expired. Cancel it, then choose again.":"";let n=p.createElement("div"),i=p.createElement("button"),o=p.createElement("button"),u=p.createElement("div"),_=p.createElement("p"),b=e.merchantTerms,oe=s?"zh-CN":"en",Y=b?.subscriptionTerms?.items??[],me=b?b.subscriptionTerms?.trial?.days:e.lines.find(c=>c.trial)?.trial?.days,se=me===void 0?null:b?b.totalMinor:e.charge?e.charge.totalMinor:e.lines.every(c=>c.trial)?0:null,it=(c,w)=>s?`${w} \u5929\u8BD5\u7528\u7ED3\u675F\u540E ${c}`:`Then ${c} after the ${w}-day trial`,{label:Nt,recurring:at}=nt(e),_t=e.lines.map(c=>c.productName).join(", "),ot=se===null?"":`${s?"\u4ECA\u5929\u5E94\u4ED8":"Due today"} ${ce(se,e.currency)}`;_.textContent=ot?[_t,ot].filter(Boolean).join(" \xB7 "):Nt,i.textContent=s?"\u786E\u8BA4\u8D2D\u4E70":"Confirm purchase",i.disabled=t,o.textContent=s?"\u53D6\u6D88":"Cancel",n.style.cssText=O.panel,_.style.cssText=O.summary,u.style.cssText=O.actions,i.style.cssText=O.primary,o.style.cssText=O.secondary,Fe(i),i.onclick=()=>{L(fe)};let st=async()=>{let c=await r.cancel();h||(n.remove(),z=null,await N(c))};o.onclick=()=>{m=st,L(st)};let q=p.createElement("div");if(q.style.cssText=O.terms,b){for(let w of Y){if(se===null&&w===at)continue;let S=p.createElement("p"),B=ce(w.amountMinor,e.currency)+ye(w.interval,oe,w.intervalCount);S.textContent=se!==null&&me!==void 0?it(B,me):B,q.append(S)}let c=b.subscriptionTerms?.trial;if(c){let w=p.createElement("p");w.textContent=s?`\u8BD5\u7528 ${c.days} \u5929\uFF1B${c.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${c.days}; ${c.cardRequired?"a payment method is required":"no payment method is required"}`,q.append(w)}for(let w of[...b.expectedEffects.map(S=>S.description),...b.requiredConsents.map(S=>S.summary)]){let S=p.createElement("p");S.textContent=w,q.append(S)}}else{for(let c of e.lines){if(se!==null||c!==at){let w=p.createElement("p"),S=`${ce(c.catalogAmountMinor,e.currency)}${ye(c.interval,oe,c.intervalCount??1)}`;w.textContent=se!==null&&c.trial?(e.lines.length>1?`${c.productName} \xB7 `:"")+it(S,c.trial.days):`${c.productName} \xB7 ${S}`,q.append(w)}for(let w of c.prepaid??[]){let S=p.createElement("p"),B=r.view?.capabilities.plans[c.productVersionId]?.prepaid?.find(Lt=>Lt.internalFeatureId===w.internal_feature_id);S.textContent=`${B?.name??w.internal_feature_id} \xB7 ${w.quantity} ${s?"\u4EFD":"packs"} \xD7 ${w.terms.units}`,B&&(S.textContent+=ye(B.reset==="week"||B.reset==="month"||B.reset==="year"?B.reset:"one_time",oe,B.resetCount)),q.append(S)}if(c.trial){let w=p.createElement("p");w.textContent=s?`\u8BD5\u7528 ${c.trial.days} \u5929\uFF1B${c.trial.cardRequired?"\u9700\u8981\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F":"\u65E0\u9700\u63D0\u4F9B\u4ED8\u6B3E\u65B9\u5F0F"}`:`Trial days: ${c.trial.days}; ${c.trial.cardRequired?"a payment method is required":"no payment method is required"}`,q.append(w)}}if(!e.charge){let c=p.createElement("p");c.textContent=s?"\u76EE\u5F55\u4EF7\u683C\uFF1B\u6700\u7EC8\u91D1\u989D\u4EE5\u7ED3\u8D26\u65F6\u7A0E\u8D39\u548C\u8BD5\u7528\u89C4\u5219\u4E3A\u51C6\u3002":"Catalog price; the final charge depends on checkout taxes and trial terms.",q.append(c)}}for(let c of q.children)c.style.margin="0";u.append(i,o),n.append(_,...q.childElementCount?[q]:[],u),G.prepend(n),P?.responsive||n.scrollIntoView?.({block:"nearest"}),i.focus({preventScroll:!0}),z=n,m=null}async function pe(){if(!k)return;if(m=pe,!ie){let n=r.view,i=n?.document.buttons[k.actionId],o=n&&i?.type==="checkout"?ne(i.product,k.selection,n.capabilities):null;if(!n||!o)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");let u=await a.resolveOfferId?.({actionId:k.actionId,productVersionId:o,featureQuantities:we(n.document.screen,o,k.selection,n.capabilities)});if(h)return;u!==void 0&&(k.offerId=u),ie=!0}if(!I()){y.hidden=!1;return}let e;try{e=await r.preview(k)}catch(n){throw r.canReselect===!0&&(k=null,ie=!1,m=null),n}if(h)return;let t=e.merchantTerms;if(a.confirmOnHostedCheckout&&I()&&e.provider==="merchant"&&e.billingSubscriptionId===null&&t?.request.action==="purchase"&&t.request.mode==="subscription"&&t.subscriptionTerms?.trial===null&&t.requiredConsents.length===0&&Date.parse(e.expiresAt)>Date.now()){let n=ue?"":s?"\u6B63\u5728\u6253\u5F00\u6536\u94F6\u53F0\u2026":"Opening checkout\u2026";l.textContent=n;try{await fe()}catch(i){h||X(i)}finally{l.textContent===n&&(l.textContent="")}return}rt(e)}function ae(e="destroy"){h||(h=!0,a.signal?.removeEventListener("abort",F),r.signal?.removeEventListener("abort",F),E.finish("dismissed"),ze?.(),J.abort(),We?.disconnect(),P?.destroy(),U?.destroy(),r.destroy(),x.open&&x.close(),x.remove(),R.remove(),g(),e==="dismiss"&&j(a.onDismiss))}D=ae;async function Ie(){if(!ee||h||ge||W==="closing"||!W&&!I())return;if(!A){ae("dismiss");return}let e=p.createElement("p");e.setAttribute("role","status"),e.textContent=s?"\u6B63\u5728\u5173\u95ED\u2026":"Closing\u2026",K||(K=p.createElement("div"),K.style.cssText=G.style.cssText,G.replaceWith(K),re.inert=!0),C.hidden=!1,K.replaceChildren(e,C),W="closing",C.setAttribute("aria-disabled","true"),C.focus({preventScroll:!0});try{await A.dismiss()}catch(t){h||j(a.onError,t)}h||(W="retry",e.textContent=s?"\u672A\u80FD\u786E\u8BA4\u5173\u95ED\uFF0C\u8BF7\u91CD\u8BD5\u3002":"Could not confirm closure. Try again.",C.textContent=s?"\u91CD\u8BD5\u5173\u95ED":"Retry closing",C.removeAttribute("aria-label"),C.removeAttribute("aria-disabled"))}C.onclick=()=>{Ie()},x.addEventListener("cancel",e=>{e.preventDefault(),Ie()}),y.onclick=()=>{m&&L(m)};function Me(e){E.finish("error",e),ae()}function qe(){if(!(!Ke||ee||h||ge||P&&!I()))try{let e=t=>{a.focusAtReveal&&(g=je(p)),U?.setHidden?.(!1),De?.(),P&&(x.showModal(),P.responsive&&x.focus({preventScroll:!0}),!t&&a.loading!=="host"&&mt(x,P.type,P.responsive)),ee=!0};A?A.present(()=>E.present(()=>e(!0))):E.present(e)}catch(e){Me(e),X(e)}}try{be.type==="inline"?(Ge(),De=bt(R,T),T.append(R)):(x.setAttribute("aria-label",f.document.name),C.textContent="\xD7",C.setAttribute("aria-label",s?"\u5173\u95ED":"Close"),ht(C,f.document.screen.theme),C.hidden=ft(f.document),x.append(C,R),T.append(x),P=pt(x,{...f.document.screen,presentation:be},Oe),P.latch(),P.responsive&&(R.style.display="flex",R.style.flexDirection="column",R.style.maxHeight="100%",re.style.overflow="clip",re.style.minHeight="0"),De=wt(x)),U=V(re,{mode:"live",rendererUrl:r.webViewUrl,title:f.document.name,closeActions:At,onAuthoredClose(n){W||h||(C.hidden=n)},hostPresentation:()=>P?.type??be.type,reportContentHeight:P?.responsive,onResize:n=>{if(!P?.responsive)return;let i=Math.min(n,Te);re.style.height=`${i}px`,P.setContentHeight(i+(K??G).getBoundingClientRect().height)},onSelection(n){le=n,de()},onAction(n,i={}){if(!ee||h||W)return;let o=r.view,u=o?.document.buttons[n];if(!u)return;if(u.type==="close"&&A&&a.resumeCheckout&&r.operation&<(M(r.operation))){Ie();return}if(Z)return;if(!I()){Le();return}if(u.type==="close"){L(async()=>{await a.onAction?.(n),ae(a.onAction?"action":"dismiss")});return}if(u.type==="action"){m=async()=>{if(u.action.type==="event"){if(!a.onEvent)throw new v("EVENT_HANDLER_REQUIRED","Provide the event handler");await a.onEvent(u.action.event)}else a.onOpenUrl?await a.onOpenUrl(u.action.url):p.defaultView?.location.assign(u.action.url);await a.onAction?.(n),m=null},L(m);return}if(a.allowNewPurchase===!1){te()&&o&&r.quote&&r.operation&&M(r.operation).type==="checkout"&&Pe(r.quote,o,u.product,i)?L(_e,n):l.textContent=s?"\u5F53\u524D\u53EA\u80FD\u7EE7\u7EED\u539F\u8BA2\u5355\u3002":"Only your original checkout is available.";return}if(z&&r.canReselect===!1){l.textContent=s?"\u8BF7\u5148\u786E\u8BA4\u6216\u53D6\u6D88\u5F53\u524D\u8D2D\u4E70\u3002":"Confirm or cancel the current purchase first.",P?.responsive||z.scrollIntoView?.({block:"nearest"}),z.querySelector("button")?.focus({preventScroll:!0});return}if(te()&&H){H.selection.actionId===n&&L(()=>et(!0),n);return}if(te()&&a.terminateCheckout&&o&&r.quote&&r.operation&&r.canReselect===!1&&M(r.operation).type==="checkout"){if(Pe(r.quote,o,u.product,i)){L(_e,n);return}let b=ne(u.product,i,o.capabilities);try{if(!b)throw new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area");we(o.document.screen,b,i,o.capabilities)}catch(me){X(me);return}let oe=r.operation.operationId,Y={actionId:n,requestId:crypto.randomUUID(),selection:structuredClone(i)};L(()=>St(oe,Y),n);return}if((r.quote||k)&&r.canReselect===!1){let b=!!o&&!!r.quote&&Pe(r.quote,o,u.product,i);Ce=!!r.quote&&!b,m=r.quote?()=>Ue(b):pe,L(m);return}let _=o&&ne(u.product,i,o.capabilities);if(!o||!_){X(new v("PRODUCT_UNAVAILABLE","Choose an available Product in this purchase area"));return}if(a.onPurchaseIntent){m=null,L(async()=>{let b={actionId:n,productVersionId:_,selection:structuredClone(i),featureQuantities:we(o.document.screen,_,i,o.capabilities)};Ne=!0,await a.onPurchaseIntent(b)});return}if(k&&k.actionId!==n){X(new v("COMMAND_PENDING","Finish the current purchase"));return}k||(k={requestId:crypto.randomUUID(),actionId:n,selection:structuredClone(i)},ie=!1),L(pe,n)},onEscape:()=>{Ie()},onError:n=>{let i=new Error(n);!ee&&!h&&Me(i),X(i)},onRendered:n=>{n&&x.setAttribute("aria-label",n),Ke=!0,qe()}}),U.setHidden?.(!0),Oe();let e=te()&&!!r.quote&&!!r.operation&&M(r.operation).type==="checkout";le=e?Et(f,r.quote)??{}:{},U.update(f.document.screen,f.document.screen.strings.defaultLocale,{capabilities:f.capabilities,unavailableActions:Qe(f),serverInput:{bindings:[],answers:{}},...Object.keys(le).length?{selection:le}:{}}),ze=r.subscribe?.(Se),Se(r.view??f),await E.wait(U.ready);let t=r.operation;!e&&(r.quote||t&&(t.confirmedAt||t.checkoutUrl||t.status==="complete"))&&(m=()=>Ue(),L(m))}catch(e){throw Me(e),e}return{check:Q,host:{get observing(){return Re},get recovery(){return Rt()},async prepareFallback(){if(Z||h||W||Ne)return{type:"recover",operationId:r.operation?.operationId??r.quote?.operationId??null,requestId:null};xe(!0);try{let e=await ut(r);return e.type==="native"&&ae(),e}finally{xe(!1)}},setSuspended(e){ge=e,R.hidden=e,e&&x.open?x.close():!e&&!ee?qe():!e&&!h&&ee&&be.type!=="inline"&&!x.open&&x.showModal()},destroy:ae,refresh:async()=>{if(!I()){if(r.view)return r.view;throw new v("PRECONDITION_FAILED","Paywall presentation is suspended")}let e=await r.refresh();return Se(e),qe(),e}}}}export{dn as showPaywall};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a}from"./chunk-W6OQTXLL.js";import"./chunk-BOVN2BE3.js";import"./chunk-PUR5CYWX.js";import"./chunk-TAFALMQN.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-VEX2FOFZ.js";import"./chunk-56BYGPQ6.js";import"./chunk-VYFSRHXM.js";import"./chunk-BQRS7Y4K.js";import"./chunk-U4RSRFZY.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-3VUPVXAV.js";import"./chunk-EM3MGDPG.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-WOT6VMZA.js";export{a as readPaywallContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-GZRRVHYK.js";import"./chunk-44U3FOBB.js";import"./chunk-WZR2XCSJ.js";import"./chunk-EUTWY7A2.js";import"./chunk-7MNJH5GB.js";import"./chunk-CIP5SQ5Y.js";import"./chunk-LF2UIJYD.js";import"./chunk-CKKIB2HC.js";import"./chunk-W6OQTXLL.js";import"./chunk-BOVN2BE3.js";import"./chunk-PUR5CYWX.js";import"./chunk-TAFALMQN.js";import"./chunk-ZGCKQWQ5.js";import"./chunk-3NCMYTNG.js";import"./chunk-VEX2FOFZ.js";import"./chunk-V7PFLFHE.js";import"./chunk-5HJYR6Z4.js";import"./chunk-56BYGPQ6.js";import"./chunk-VYFSRHXM.js";import"./chunk-BQRS7Y4K.js";import"./chunk-U4RSRFZY.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-3VUPVXAV.js";import"./chunk-EM3MGDPG.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{a as createPaywallSession};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-TOTRALYQ.js";import"./chunk-XUGEOELU.js";import"./chunk-BQRS7Y4K.js";import"./chunk-U4RSRFZY.js";import"./chunk-KE26KWIU.js";import"./chunk-TJGIT5CU.js";import"./chunk-OX7PA64E.js";import"./chunk-V7MMTILA.js";import"./chunk-VF6QMMEA.js";import"./chunk-7QL4GF4C.js";import"./chunk-BID4UGWB.js";import"./chunk-DSPLGTQI.js";import"./chunk-WOT6VMZA.js";export{f as formatCustomerDecimal,b as hostedRendererScript,a as hostedRendererShell,d as inspectCustomHtml,i as mountScreenPreview,h as preparePopup,e as prepareScreen,c as sanitizeCustomHtml,g as showPopup};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|